Commit 32a74b7c authored by Holger Schurig's avatar Holger Schurig Committed by John W. Linville

[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: default avatarHolger Schurig <hs4233@mail.mn-solutions.de>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 3874d0fe
...@@ -77,6 +77,7 @@ void libertas_send_iwevcustom_event(wlan_private * priv, s8 * str); ...@@ -77,6 +77,7 @@ void libertas_send_iwevcustom_event(wlan_private * priv, s8 * str);
extern struct chan_freq_power *libertas_get_region_cfp_table(u8 region, u8 band, extern struct chan_freq_power *libertas_get_region_cfp_table(u8 region, u8 band,
int *cfp_no); int *cfp_no);
wlan_private *wlan_add_card(void *card); wlan_private *wlan_add_card(void *card);
int libertas_activate_card(wlan_private *priv);
int wlan_remove_card(wlan_private *priv); int wlan_remove_card(wlan_private *priv);
int wlan_add_mesh(wlan_private *priv); int wlan_add_mesh(wlan_private *priv);
void wlan_remove_mesh(wlan_private *priv); void wlan_remove_mesh(wlan_private *priv);
......
...@@ -195,6 +195,9 @@ static int if_usb_probe(struct usb_interface *intf, ...@@ -195,6 +195,9 @@ static int if_usb_probe(struct usb_interface *intf,
if (!(priv = wlan_add_card(usb_cardp))) if (!(priv = wlan_add_card(usb_cardp)))
goto dealloc; goto dealloc;
if (libertas_activate_card(priv))
goto dealloc;
if (libertas_found < MAX_DEVS) { if (libertas_found < MAX_DEVS) {
libertas_devs[libertas_found] = priv->wlan_dev.netdev; libertas_devs[libertas_found] = priv->wlan_dev.netdev;
libertas_found++; libertas_found++;
......
...@@ -812,6 +812,21 @@ wlan_private *wlan_add_card(void *card) ...@@ -812,6 +812,21 @@ wlan_private *wlan_add_card(void *card)
spin_lock_init(&priv->adapter->driver_lock); spin_lock_init(&priv->adapter->driver_lock);
init_waitqueue_head(&priv->adapter->cmd_pending); init_waitqueue_head(&priv->adapter->cmd_pending);
priv->adapter->nr_cmd_pending = 0; priv->adapter->nr_cmd_pending = 0;
goto done;
err_kzalloc:
free_netdev(dev);
done:
lbs_deb_leave_args(LBS_DEB_NET, "priv %p", priv);
return priv;
}
int libertas_activate_card(wlan_private *priv)
{
struct net_device *dev = priv->wlan_dev.netdev;
int ret = -1;
lbs_deb_enter(LBS_DEB_MAIN);
lbs_deb_thread("Starting kthread...\n"); lbs_deb_thread("Starting kthread...\n");
priv->mainthread.priv = priv; priv->mainthread.priv = priv;
...@@ -847,8 +862,8 @@ wlan_private *wlan_add_card(void *card) ...@@ -847,8 +862,8 @@ wlan_private *wlan_add_card(void *card)
libertas_debugfs_init_one(priv, dev); libertas_debugfs_init_one(priv, dev);
lbs_deb_leave_args(LBS_DEB_NET, "priv %p", priv); ret = 0;
return priv; goto done;
err_init_fw: err_init_fw:
libertas_sbi_unregister_dev(priv); libertas_sbi_unregister_dev(priv);
...@@ -858,11 +873,10 @@ wlan_private *wlan_add_card(void *card) ...@@ -858,11 +873,10 @@ wlan_private *wlan_add_card(void *card)
wake_up_interruptible(&priv->mainthread.waitq); wake_up_interruptible(&priv->mainthread.waitq);
wlan_terminate_thread(&priv->mainthread); wlan_terminate_thread(&priv->mainthread);
kfree(priv->adapter); kfree(priv->adapter);
err_kzalloc:
free_netdev(dev); free_netdev(dev);
done:
lbs_deb_leave_args(LBS_DEB_NET, "priv NULL"); lbs_deb_leave_args(LBS_DEB_NET, "ret %d", ret);
return NULL; return ret;
} }
/** /**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment