libiwinfo: Fix frequency-to-MHz coversion
authorVasilis Tsiligiannis <b_tsiligiannis@silverton.gr>
Sat, 26 Feb 2011 22:30:52 +0000 (22:30 +0000)
committerVasilis Tsiligiannis <b_tsiligiannis@silverton.gr>
Sat, 26 Feb 2011 22:30:52 +0000 (22:30 +0000)
contrib/package/iwinfo/src/iwinfo_wext.c

index 518551f7d59e39f926c169c9086a12fcee8cb434..5b942ea33a99d4baf85264abe35bc84acbcb37fd 100644 (file)
@@ -32,7 +32,7 @@ static double wext_freq2float(const struct iw_freq *in)
 
 static inline int wext_freq2mhz(const struct iw_freq *in)
 {
-       int i, mhz;
+       int i;
 
        if( in->e == 6 )
        {
@@ -40,11 +40,7 @@ static inline int wext_freq2mhz(const struct iw_freq *in)
        }
        else
        {
-               mhz = in->m;
-               for(i = 0; i < in->e; i++)
-                       mhz *= 10;
-
-               return (int)(mhz / 100000);
+               return (int)(wext_freq2float(in) / 1000000);
        }
 }