mwl8k: get rid of mwl8k_start() workqueue use
[pandora-kernel.git] / drivers / net / cnic.c
index 44f77eb..4869d77 100644 (file)
@@ -25,8 +25,6 @@
 #include <linux/delay.h>
 #include <linux/ethtool.h>
 #include <linux/if_vlan.h>
-#include <linux/module.h>
-
 #if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
 #define BCM_VLAN 1
 #endif
@@ -229,7 +227,7 @@ static int cnic_send_nlmsg(struct cnic_local *cp, u32 type,
        }
 
        rcu_read_lock();
-       ulp_ops = rcu_dereference(cp->ulp_ops[CNIC_ULP_ISCSI]);
+       ulp_ops = rcu_dereference(cnic_ulp_tbl[CNIC_ULP_ISCSI]);
        if (ulp_ops)
                ulp_ops->iscsi_nl_send_msg(cp->dev, msg_type, buf, len);
        rcu_read_unlock();
@@ -321,6 +319,20 @@ static int cnic_abort_prep(struct cnic_sock *csk)
        return 0;
 }
 
+static void cnic_uio_stop(void)
+{
+       struct cnic_dev *dev;
+
+       read_lock(&cnic_dev_lock);
+       list_for_each_entry(dev, &cnic_dev_list, list) {
+               struct cnic_local *cp = dev->cnic_priv;
+
+               if (cp->cnic_uinfo)
+                       cnic_send_nlmsg(cp, ISCSI_KEVENT_IF_DOWN, NULL);
+       }
+       read_unlock(&cnic_dev_lock);
+}
+
 int cnic_register_driver(int ulp_type, struct cnic_ulp_ops *ulp_ops)
 {
        struct cnic_dev *dev;
@@ -392,6 +404,9 @@ int cnic_unregister_driver(int ulp_type)
        }
        read_unlock(&cnic_dev_lock);
 
+       if (ulp_type == CNIC_ULP_ISCSI)
+               cnic_uio_stop();
+
        rcu_assign_pointer(cnic_ulp_tbl[ulp_type], NULL);
 
        mutex_unlock(&cnic_lock);
@@ -634,7 +649,6 @@ static void cnic_free_resc(struct cnic_dev *dev)
        int i = 0;
 
        if (cp->cnic_uinfo) {
-               cnic_send_nlmsg(cp, ISCSI_KEVENT_IF_DOWN, NULL);
                while (cp->uio_dev != -1 && i < 15) {
                        msleep(100);
                        i++;
@@ -1059,6 +1073,9 @@ static void cnic_ulp_stop(struct cnic_dev *dev)
        struct cnic_local *cp = dev->cnic_priv;
        int if_type;
 
+       if (cp->cnic_uinfo)
+               cnic_send_nlmsg(cp, ISCSI_KEVENT_IF_DOWN, NULL);
+
        rcu_read_lock();
        for (if_type = 0; if_type < MAX_CNIC_ULP_TYPE; if_type++) {
                struct cnic_ulp_ops *ulp_ops;
@@ -2521,9 +2538,9 @@ static struct cnic_dev *init_bnx2_cnic(struct net_device *dev)
        struct cnic_dev *cdev;
        struct cnic_local *cp;
        struct cnic_eth_dev *ethdev = NULL;
-       struct cnic_eth_dev *(*probe)(void *) = NULL;
+       struct cnic_eth_dev *(*probe)(struct net_device *) = NULL;
 
-       probe = __symbol_get("bnx2_cnic_probe");
+       probe = symbol_get(bnx2_cnic_probe);
        if (probe) {
                ethdev = (*probe)(dev);
                symbol_put_addr(probe);