]> err.no Git - linux-2.6/blobdiff - drivers/net/wireless/orinoco.c
Merge branch 'for-2.6.27' of git://linux-nfs.org/~bfields/linux
[linux-2.6] / drivers / net / wireless / orinoco.c
index 100ae333df4d3eb6868012544014a0f7516ac009..b047306bf38681da30132a061c44b82de4efb029 100644 (file)
@@ -1194,7 +1194,7 @@ static int orinoco_process_scan_results(struct net_device *dev,
        /* Read the entries one by one */
        for (; offset + atom_len <= len; offset += atom_len) {
                int found = 0;
-               bss_element *bss;
+               bss_element *bss = NULL;
 
                /* Get next atom */
                atom = (union hermes_scan_info *) (buf + offset);
@@ -1209,7 +1209,6 @@ static int orinoco_process_scan_results(struct net_device *dev,
                        if (memcmp(bss->bss.a.essid, atom->a.essid,
                              le16_to_cpu(atom->a.essid_len)))
                                continue;
-                       bss->last_scanned = jiffies;
                        found = 1;
                        break;
                }
@@ -1220,10 +1219,14 @@ static int orinoco_process_scan_results(struct net_device *dev,
                                         bss_element, list);
                        list_del(priv->bss_free_list.next);
 
-                       memcpy(bss, atom, sizeof(bss->bss));
-                       bss->last_scanned = jiffies;
                        list_add_tail(&bss->list, &priv->bss_list);
                }
+
+               if (bss) {
+                       /* Always update the BSS to get latest beacon info */
+                       memcpy(&bss->bss, atom, sizeof(bss->bss));
+                       bss->last_scanned = jiffies;
+               }
        }
 
        return 0;
@@ -4043,6 +4046,7 @@ static int orinoco_ioctl_setscan(struct net_device *dev,
  * format that the Wireless Tools will understand - Jean II
  * Return message length or -errno for fatal errors */
 static inline char *orinoco_translate_scan(struct net_device *dev,
+                                          struct iw_request_info *info,
                                           char *current_ev,
                                           char *end_buf,
                                           union hermes_scan_info *bss,
@@ -4059,7 +4063,8 @@ static inline char *orinoco_translate_scan(struct net_device *dev,
        iwe.cmd = SIOCGIWAP;
        iwe.u.ap_addr.sa_family = ARPHRD_ETHER;
        memcpy(iwe.u.ap_addr.sa_data, bss->a.bssid, ETH_ALEN);
-       current_ev = iwe_stream_add_event(current_ev, end_buf, &iwe, IW_EV_ADDR_LEN);
+       current_ev = iwe_stream_add_event(info, current_ev, end_buf,
+                                         &iwe, IW_EV_ADDR_LEN);
 
        /* Other entries will be displayed in the order we give them */
 
@@ -4069,7 +4074,8 @@ static inline char *orinoco_translate_scan(struct net_device *dev,
                iwe.u.data.length = 32;
        iwe.cmd = SIOCGIWESSID;
        iwe.u.data.flags = 1;
-       current_ev = iwe_stream_add_point(current_ev, end_buf, &iwe, bss->a.essid);
+       current_ev = iwe_stream_add_point(info, current_ev, end_buf,
+                                         &iwe, bss->a.essid);
 
        /* Add mode */
        iwe.cmd = SIOCGIWMODE;
@@ -4079,7 +4085,8 @@ static inline char *orinoco_translate_scan(struct net_device *dev,
                        iwe.u.mode = IW_MODE_MASTER;
                else
                        iwe.u.mode = IW_MODE_ADHOC;
-               current_ev = iwe_stream_add_event(current_ev, end_buf, &iwe, IW_EV_UINT_LEN);
+               current_ev = iwe_stream_add_event(info, current_ev, end_buf,
+                                                 &iwe, IW_EV_UINT_LEN);
        }
 
        channel = bss->s.channel;
@@ -4088,7 +4095,7 @@ static inline char *orinoco_translate_scan(struct net_device *dev,
                iwe.cmd = SIOCGIWFREQ;
                iwe.u.freq.m = channel_frequency[channel-1] * 100000;
                iwe.u.freq.e = 1;
-               current_ev = iwe_stream_add_event(current_ev, end_buf,
+               current_ev = iwe_stream_add_event(info, current_ev, end_buf,
                                                  &iwe, IW_EV_FREQ_LEN);
        }
 
@@ -4103,7 +4110,8 @@ static inline char *orinoco_translate_scan(struct net_device *dev,
                iwe.u.qual.qual = iwe.u.qual.level - iwe.u.qual.noise;
        else
                iwe.u.qual.qual = 0;
-       current_ev = iwe_stream_add_event(current_ev, end_buf, &iwe, IW_EV_QUAL_LEN);
+       current_ev = iwe_stream_add_event(info, current_ev, end_buf,
+                                         &iwe, IW_EV_QUAL_LEN);
 
        /* Add encryption capability */
        iwe.cmd = SIOCGIWENCODE;
@@ -4112,7 +4120,8 @@ static inline char *orinoco_translate_scan(struct net_device *dev,
        else
                iwe.u.data.flags = IW_ENCODE_DISABLED;
        iwe.u.data.length = 0;
-       current_ev = iwe_stream_add_point(current_ev, end_buf, &iwe, bss->a.essid);
+       current_ev = iwe_stream_add_point(info, current_ev, end_buf,
+                                         &iwe, bss->a.essid);
 
        /* Add EXTRA: Age to display seconds since last beacon/probe response
         * for given network. */
@@ -4123,11 +4132,12 @@ static inline char *orinoco_translate_scan(struct net_device *dev,
                      jiffies_to_msecs(jiffies - last_scanned));
        iwe.u.data.length = p - custom;
        if (iwe.u.data.length)
-               current_ev = iwe_stream_add_point(current_ev, end_buf, &iwe, custom);
+               current_ev = iwe_stream_add_point(info, current_ev, end_buf,
+                                                 &iwe, custom);
 
        /* Bit rate is not available in Lucent/Agere firmwares */
        if (priv->firmware_type != FIRMWARE_TYPE_AGERE) {
-               char *current_val = current_ev + IW_EV_LCP_LEN;
+               char *current_val = current_ev + iwe_stream_lcp_len(info);
                int i;
                int step;
 
@@ -4146,12 +4156,13 @@ static inline char *orinoco_translate_scan(struct net_device *dev,
                                break;
                        /* Bit rate given in 500 kb/s units (+ 0x80) */
                        iwe.u.bitrate.value = ((bss->p.rates[i] & 0x7f) * 500000);
-                       current_val = iwe_stream_add_value(current_ev, current_val,
+                       current_val = iwe_stream_add_value(info, current_ev,
+                                                          current_val,
                                                           end_buf, &iwe,
                                                           IW_EV_PARAM_LEN);
                }
                /* Check if we added any event */
-               if ((current_val - current_ev) > IW_EV_LCP_LEN)
+               if ((current_val - current_ev) > iwe_stream_lcp_len(info))
                        current_ev = current_val;
        }
 
@@ -4187,7 +4198,7 @@ static int orinoco_ioctl_getscan(struct net_device *dev,
 
        list_for_each_entry(bss, &priv->bss_list, list) {
                /* Translate to WE format this entry */
-               current_ev = orinoco_translate_scan(dev, current_ev,
+               current_ev = orinoco_translate_scan(dev, info, current_ev,
                                                    extra + srq->length,
                                                    &bss->bss,
                                                    bss->last_scanned);