aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorDan Williams <dcbw@redhat.com>2007-05-25 13:13:25 -0400
committerJohn W. Linville <linville@tuxdriver.com>2007-06-11 14:28:40 -0400
commit7732ca45c68f893689a8c0d8c6e2eb2bfefbc087 (patch)
treeb894177055e35cd426cf36d923adfd8985e4e9ed /drivers/net
parent0681f989357416d7ef28ebaea4151ce70a6ae21c (diff)
[PATCH] libertas: call SET_NETDEV_DEV from common code
Move usage of SET_NETDEV_DEV into common code since it has nothing to do with bus-specific devices. Also fixes a bug where the mesh device was getting SET_NETDEV_DEV called after register_netdevice, resulting in no 'device' link in /sys/class/net/mshX/. Signed-off-by: Dan Williams <dcbw@redhat.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/wireless/libertas/decl.h6
-rw-r--r--drivers/net/wireless/libertas/if_usb.c12
-rw-r--r--drivers/net/wireless/libertas/main.c8
3 files changed, 12 insertions, 14 deletions
diff --git a/drivers/net/wireless/libertas/decl.h b/drivers/net/wireless/libertas/decl.h
index d6fcb339f5c2..40f56bb1eac8 100644
--- a/drivers/net/wireless/libertas/decl.h
+++ b/drivers/net/wireless/libertas/decl.h
@@ -6,6 +6,8 @@
6#ifndef _WLAN_DECL_H_ 6#ifndef _WLAN_DECL_H_
7#define _WLAN_DECL_H_ 7#define _WLAN_DECL_H_
8 8
9#include <linux/device.h>
10
9#include "defs.h" 11#include "defs.h"
10 12
11/** Function Prototype Declaration */ 13/** Function Prototype Declaration */
@@ -79,10 +81,10 @@ int libertas_init_fw(wlan_private * priv, char *fw_name);
79/* main.c */ 81/* main.c */
80struct chan_freq_power *libertas_get_region_cfp_table(u8 region, u8 band, 82struct chan_freq_power *libertas_get_region_cfp_table(u8 region, u8 band,
81 int *cfp_no); 83 int *cfp_no);
82wlan_private *libertas_add_card(void *card); 84wlan_private *libertas_add_card(void *card, struct device *dmdev);
83int libertas_activate_card(wlan_private *priv, char *fw_name); 85int libertas_activate_card(wlan_private *priv, char *fw_name);
84int libertas_remove_card(wlan_private *priv); 86int libertas_remove_card(wlan_private *priv);
85int libertas_add_mesh(wlan_private *priv); 87int libertas_add_mesh(wlan_private *priv, struct device *dev);
86void libertas_remove_mesh(wlan_private *priv); 88void libertas_remove_mesh(wlan_private *priv);
87 89
88 90
diff --git a/drivers/net/wireless/libertas/if_usb.c b/drivers/net/wireless/libertas/if_usb.c
index d25e3b58e96b..6433be63fb7f 100644
--- a/drivers/net/wireless/libertas/if_usb.c
+++ b/drivers/net/wireless/libertas/if_usb.c
@@ -207,15 +207,10 @@ static int if_usb_probe(struct usb_interface *intf,
207 } 207 }
208 } 208 }
209 209
210 210 if (!(priv = libertas_add_card(cardp, &udev->dev)))
211 /* At this point libertas_add_card() will be called. Don't worry
212 * about keeping pwlanpriv around since it will be set on our
213 * usb device data in -> add() -> hw_register_dev() -> if_usb_register_dev.
214 */
215 if (!(priv = libertas_add_card(cardp)))
216 goto dealloc; 211 goto dealloc;
217 212
218 if (libertas_add_mesh(priv)) 213 if (libertas_add_mesh(priv, &udev->dev))
219 goto err_add_mesh; 214 goto err_add_mesh;
220 215
221 priv->hw_register_dev = if_usb_register_dev; 216 priv->hw_register_dev = if_usb_register_dev;
@@ -806,9 +801,6 @@ static int if_usb_register_dev(wlan_private * priv)
806 cardp->eth_dev = priv->dev; 801 cardp->eth_dev = priv->dev;
807 priv->hotplug_device = &(cardp->udev->dev); 802 priv->hotplug_device = &(cardp->udev->dev);
808 803
809 SET_NETDEV_DEV(cardp->eth_dev, &(cardp->udev->dev));
810 SET_NETDEV_DEV(priv->mesh_dev, &(cardp->udev->dev));
811
812 lbs_deb_usbd(&cardp->udev->dev, "udev pointer is at %p\n", 804 lbs_deb_usbd(&cardp->udev->dev, "udev pointer is at %p\n",
813 cardp->udev); 805 cardp->udev);
814 806
diff --git a/drivers/net/wireless/libertas/main.c b/drivers/net/wireless/libertas/main.c
index 0c39bcdbd448..b05a6f99a1b2 100644
--- a/drivers/net/wireless/libertas/main.c
+++ b/drivers/net/wireless/libertas/main.c
@@ -763,7 +763,7 @@ static int wlan_service_main_thread(void *data)
763 * @param card A pointer to card 763 * @param card A pointer to card
764 * @return A pointer to wlan_private structure 764 * @return A pointer to wlan_private structure
765 */ 765 */
766wlan_private *libertas_add_card(void *card) 766wlan_private *libertas_add_card(void *card, struct device *dmdev)
767{ 767{
768 struct net_device *dev = NULL; 768 struct net_device *dev = NULL;
769 wlan_private *priv = NULL; 769 wlan_private *priv = NULL;
@@ -808,6 +808,8 @@ wlan_private *libertas_add_card(void *card)
808 dev->flags |= IFF_BROADCAST | IFF_MULTICAST; 808 dev->flags |= IFF_BROADCAST | IFF_MULTICAST;
809 dev->set_multicast_list = wlan_set_multicast_list; 809 dev->set_multicast_list = wlan_set_multicast_list;
810 810
811 SET_NETDEV_DEV(dev, dmdev);
812
811 INIT_LIST_HEAD(&priv->adapter->cmdfreeq); 813 INIT_LIST_HEAD(&priv->adapter->cmdfreeq);
812 INIT_LIST_HEAD(&priv->adapter->cmdpendingq); 814 INIT_LIST_HEAD(&priv->adapter->cmdpendingq);
813 815
@@ -891,7 +893,7 @@ EXPORT_SYMBOL_GPL(libertas_activate_card);
891 * @param priv A pointer to the wlan_private structure 893 * @param priv A pointer to the wlan_private structure
892 * @return 0 if successful, -X otherwise 894 * @return 0 if successful, -X otherwise
893 */ 895 */
894int libertas_add_mesh(wlan_private *priv) 896int libertas_add_mesh(wlan_private *priv, struct device *dev)
895{ 897{
896 struct net_device *mesh_dev = NULL; 898 struct net_device *mesh_dev = NULL;
897 int ret = 0; 899 int ret = 0;
@@ -918,6 +920,8 @@ int libertas_add_mesh(wlan_private *priv)
918 memcpy(mesh_dev->dev_addr, priv->dev->dev_addr, 920 memcpy(mesh_dev->dev_addr, priv->dev->dev_addr,
919 sizeof(priv->dev->dev_addr)); 921 sizeof(priv->dev->dev_addr));
920 922
923 SET_NETDEV_DEV(priv->mesh_dev, dev);
924
921#ifdef WIRELESS_EXT 925#ifdef WIRELESS_EXT
922 mesh_dev->wireless_handlers = (struct iw_handler_def *)&libertas_handler_def; 926 mesh_dev->wireless_handlers = (struct iw_handler_def *)&libertas_handler_def;
923#endif 927#endif