aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorHolger Schurig <hs4233@mail.mn-solutions.de>2007-05-25 12:04:31 -0400
committerJohn W. Linville <linville@tuxdriver.com>2007-06-11 14:28:38 -0400
commit32a74b7c8f7b883b532e0e4333b7c3014d3d8fe8 (patch)
treeef19ed4732bfd73818f6ddfc83b90e2b3eb4363d /drivers/net
parent3874d0fefd965eedfc7f8e0a5459ddf914eb4306 (diff)
[PATCH] libertas: split wlan_add_card()
Split wlan_add_card() into a part that just setups kernel parameters and into the function libertas_activate_card(), which will implizitly use hardware functions by the started thread. This allows us later to do something like this: priv = libertas_add_card(); priv->hw_command_to_host = if_usb_command_to_host; priv->hw_xxxx = if_usb_xxxx; priv->hw_yyyy = if_usb_yyyy; wlan_activate_card() and of course the CF driver can set it's own functions. Signed-off-by: Holger Schurig <hs4233@mail.mn-solutions.de> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/wireless/libertas/decl.h1
-rw-r--r--drivers/net/wireless/libertas/if_usb.c3
-rw-r--r--drivers/net/wireless/libertas/main.c26
3 files changed, 24 insertions, 6 deletions
diff --git a/drivers/net/wireless/libertas/decl.h b/drivers/net/wireless/libertas/decl.h
index b0694fe20f30..96d22b1f25d8 100644
--- a/drivers/net/wireless/libertas/decl.h
+++ b/drivers/net/wireless/libertas/decl.h
@@ -77,6 +77,7 @@ void libertas_send_iwevcustom_event(wlan_private * priv, s8 * str);
77extern struct chan_freq_power *libertas_get_region_cfp_table(u8 region, u8 band, 77extern struct chan_freq_power *libertas_get_region_cfp_table(u8 region, u8 band,
78 int *cfp_no); 78 int *cfp_no);
79wlan_private *wlan_add_card(void *card); 79wlan_private *wlan_add_card(void *card);
80int libertas_activate_card(wlan_private *priv);
80int wlan_remove_card(wlan_private *priv); 81int wlan_remove_card(wlan_private *priv);
81int wlan_add_mesh(wlan_private *priv); 82int wlan_add_mesh(wlan_private *priv);
82void wlan_remove_mesh(wlan_private *priv); 83void wlan_remove_mesh(wlan_private *priv);
diff --git a/drivers/net/wireless/libertas/if_usb.c b/drivers/net/wireless/libertas/if_usb.c
index 99f4ba35d6ef..e4caf3e4b352 100644
--- a/drivers/net/wireless/libertas/if_usb.c
+++ b/drivers/net/wireless/libertas/if_usb.c
@@ -195,6 +195,9 @@ static int if_usb_probe(struct usb_interface *intf,
195 if (!(priv = wlan_add_card(usb_cardp))) 195 if (!(priv = wlan_add_card(usb_cardp)))
196 goto dealloc; 196 goto dealloc;
197 197
198 if (libertas_activate_card(priv))
199 goto dealloc;
200
198 if (libertas_found < MAX_DEVS) { 201 if (libertas_found < MAX_DEVS) {
199 libertas_devs[libertas_found] = priv->wlan_dev.netdev; 202 libertas_devs[libertas_found] = priv->wlan_dev.netdev;
200 libertas_found++; 203 libertas_found++;
diff --git a/drivers/net/wireless/libertas/main.c b/drivers/net/wireless/libertas/main.c
index 417f92771375..44a632e4ce4e 100644
--- a/drivers/net/wireless/libertas/main.c
+++ b/drivers/net/wireless/libertas/main.c
@@ -812,6 +812,21 @@ wlan_private *wlan_add_card(void *card)
812 spin_lock_init(&priv->adapter->driver_lock); 812 spin_lock_init(&priv->adapter->driver_lock);
813 init_waitqueue_head(&priv->adapter->cmd_pending); 813 init_waitqueue_head(&priv->adapter->cmd_pending);
814 priv->adapter->nr_cmd_pending = 0; 814 priv->adapter->nr_cmd_pending = 0;
815 goto done;
816
817err_kzalloc:
818 free_netdev(dev);
819done:
820 lbs_deb_leave_args(LBS_DEB_NET, "priv %p", priv);
821 return priv;
822}
823
824int libertas_activate_card(wlan_private *priv)
825{
826 struct net_device *dev = priv->wlan_dev.netdev;
827 int ret = -1;
828
829 lbs_deb_enter(LBS_DEB_MAIN);
815 830
816 lbs_deb_thread("Starting kthread...\n"); 831 lbs_deb_thread("Starting kthread...\n");
817 priv->mainthread.priv = priv; 832 priv->mainthread.priv = priv;
@@ -847,8 +862,8 @@ wlan_private *wlan_add_card(void *card)
847 862
848 libertas_debugfs_init_one(priv, dev); 863 libertas_debugfs_init_one(priv, dev);
849 864
850 lbs_deb_leave_args(LBS_DEB_NET, "priv %p", priv); 865 ret = 0;
851 return priv; 866 goto done;
852 867
853err_init_fw: 868err_init_fw:
854 libertas_sbi_unregister_dev(priv); 869 libertas_sbi_unregister_dev(priv);
@@ -858,11 +873,10 @@ err_registerdev:
858 wake_up_interruptible(&priv->mainthread.waitq); 873 wake_up_interruptible(&priv->mainthread.waitq);
859 wlan_terminate_thread(&priv->mainthread); 874 wlan_terminate_thread(&priv->mainthread);
860 kfree(priv->adapter); 875 kfree(priv->adapter);
861err_kzalloc:
862 free_netdev(dev); 876 free_netdev(dev);
863 877done:
864 lbs_deb_leave_args(LBS_DEB_NET, "priv NULL"); 878 lbs_deb_leave_args(LBS_DEB_NET, "ret %d", ret);
865 return NULL; 879 return ret;
866} 880}
867 881
868/** 882/**