Merge branch 'upstream-fixes' of git://lost.foo-projects.org/~ahkok/git/netdev-2...
[pandora-kernel.git] / drivers / net / wireless / hostap / hostap_hw.c
index abfae7f..d500012 100644 (file)
@@ -30,7 +30,6 @@
  */
 
 
-#include <linux/config.h>
 
 #include <asm/delay.h>
 #include <asm/uaccess.h>
@@ -253,7 +252,7 @@ static void prism2_clear_cmd_queue(local_info_t *local)
  * @dev: pointer to net_device
  * @entry: Prism2 command queue entry to be issued
  */
-static inline int hfa384x_cmd_issue(struct net_device *dev,
+static int hfa384x_cmd_issue(struct net_device *dev,
                                    struct hostap_cmd_queue *entry)
 {
        struct hostap_interface *iface;
@@ -743,7 +742,7 @@ static void prism2_cmd_ev(struct net_device *dev)
 }
 
 
-static inline int hfa384x_wait_offset(struct net_device *dev, u16 o_off)
+static int hfa384x_wait_offset(struct net_device *dev, u16 o_off)
 {
        int tries = HFA384X_BAP_BUSY_TIMEOUT;
        int res = HFA384X_INW(o_off) & HFA384X_OFFSET_BUSY;
@@ -928,15 +927,15 @@ static int hfa384x_set_rid(struct net_device *dev, u16 rid, void *buf, int len)
 
        res = hfa384x_cmd(dev, HFA384X_CMDCODE_ACCESS_WRITE, rid, NULL, NULL);
        up(&local->rid_bap_sem);
+
        if (res) {
                printk(KERN_DEBUG "%s: hfa384x_set_rid: CMDCODE_ACCESS_WRITE "
                       "failed (res=%d, rid=%04x, len=%d)\n",
                       dev->name, res, rid, len);
-               return res;
-       }
 
-       if (res == -ETIMEDOUT)
-               prism2_hw_reset(dev);
+               if (res == -ETIMEDOUT)
+                       prism2_hw_reset(dev);
+       }
 
        return res;
 }
@@ -1043,6 +1042,9 @@ static int prism2_reset_port(struct net_device *dev)
                       dev->name, local->fragm_threshold);
        }
 
+       /* Some firmwares lose antenna selection settings on reset */
+       (void) hostap_set_antsel(local);
+
        return res;
 }
 
@@ -1904,7 +1906,7 @@ fail:
  * and will try to get the correct fid eventually. */
 #define EXTRA_FID_READ_TESTS
 
-static inline u16 prism2_read_fid_reg(struct net_device *dev, u16 reg)
+static u16 prism2_read_fid_reg(struct net_device *dev, u16 reg)
 {
 #ifdef EXTRA_FID_READ_TESTS
        u16 val, val2, val3;
@@ -2581,7 +2583,7 @@ static void prism2_ev_tick(struct net_device *dev)
 
 
 /* Called only from hardware IRQ */
-static inline void prism2_check_magic(local_info_t *local)
+static void prism2_check_magic(local_info_t *local)
 {
        /* at least PCI Prism2.5 with bus mastering seems to sometimes
         * return 0x0000 in SWSUPPORT0 for unknown reason, but re-reading the
@@ -3096,6 +3098,14 @@ static void prism2_clear_set_tim_queue(local_info_t *local)
 }
 
 
+/*
+ * HostAP uses two layers of net devices, where the inner
+ * layer gets called all the time from the outer layer.
+ * This is a natural nesting, which needs a split lock type.
+ */
+static struct lock_class_key hostap_netdev_xmit_lock_key;
+
+
 static struct net_device *
 prism2_init_local_data(struct prism2_helper_functions *funcs, int card_idx,
                       struct device *sdev)
@@ -3260,6 +3270,8 @@ while (0)
        SET_NETDEV_DEV(dev, sdev);
        if (ret >= 0)
                ret = register_netdevice(dev);
+
+       lockdep_set_class(&dev->_xmit_lock, &hostap_netdev_xmit_lock_key);
        rtnl_unlock();
        if (ret < 0) {
                printk(KERN_WARNING "%s: register netdevice failed!\n",