net: wireless: bcm4329: set reference to physical device
Eric Brower [Fri, 20 Jan 2012 00:44:25 +0000 (16:44 -0800)]
Set the parent field of the netdevice, which causes sysfs
to create a device subdirectory under the netdevice.  Without
this subdirectory the user-space NetworkManager cannot manage
the network device.

Implemented using void * to maintain current driver implementation
of segregated OS-specific implementation.

Bug 929960

Signed-off-by: Eric Brower <ebrower@nvidia.com>
Reviewed-on: http://git-master/r/77889
(cherry picked from commit 5055320be16c36557e1ab9966ff7537500ca6d4d)

Change-Id: Ia5ea298c32823f896428905a779a734140306861
Signed-off-by: Pritesh Raithatha <praithatha@nvidia.com>
Reviewed-on: http://git-master/r/82720
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Varun Wadekar <vwadekar@nvidia.com>
Tested-by: Varun Wadekar <vwadekar@nvidia.com>

drivers/net/wireless/bcm4329/bcmsdh_linux.c
drivers/net/wireless/bcm4329/dhd.h
drivers/net/wireless/bcm4329/dhd_linux.c
drivers/net/wireless/bcm4329/dhd_sdio.c
drivers/net/wireless/bcm4329/include/bcmsdh.h

index 6d6097b..22e1e9c 100644 (file)
@@ -249,7 +249,7 @@ int bcmsdh_probe(struct device *dev)
        /* try to attach to the target device */
        if (!(sdhc->ch = drvinfo.attach((vendevid >> 16),
                                         (vendevid & 0xFFFF), 0, 0, 0, 0,
-                                       (void *)regs, NULL, sdh))) {
+                                       (void *)regs, NULL, sdh, dev))) {
                SDLX_MSG(("%s: device attach failed\n", __FUNCTION__));
                goto err;
        }
@@ -468,7 +468,7 @@ bcmsdh_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
        /* try to attach to the target device */
        if (!(sdhc->ch = drvinfo.attach(VENDOR_BROADCOM, /* pdev->vendor, */
                                        bcmsdh_query_device(sdh) & 0xFFFF, 0, 0, 0, 0,
-                                       (void *)regs, NULL, sdh))) {
+                                       (void *)regs, NULL, sdh, pdev->dev))) {
                SDLX_MSG(("%s: device attach failed\n", __FUNCTION__));
                goto err;
        }
index 9b75ae6..8f0910c 100644 (file)
@@ -268,7 +268,7 @@ void dhd_osl_detach(osl_t *osh);
  * Returned structure should have bus and prot pointers filled in.
  * bus_hdrlen specifies required headroom for bus module header.
  */
-extern dhd_pub_t *dhd_attach(osl_t *osh, struct dhd_bus *bus, uint bus_hdrlen);
+extern dhd_pub_t *dhd_attach(osl_t *osh, struct dhd_bus *bus, uint bus_hdrlen, void *dev);
 extern int dhd_net_attach(dhd_pub_t *dhdp, int idx);
 
 /* Indication from bus module regarding removal/absence of dongle */
index 26bbb74..2327ad5 100644 (file)
@@ -42,6 +42,7 @@
 #include <linux/fs.h>
 #include <linux/inetdevice.h>
 #include <linux/mutex.h>
+#include <linux/device.h>
 
 #include <asm/uaccess.h>
 #include <asm/unaligned.h>
@@ -2054,7 +2055,7 @@ dhd_del_if(dhd_info_t *dhd, int ifidx)
 
 
 dhd_pub_t *
-dhd_attach(osl_t *osh, struct dhd_bus *bus, uint bus_hdrlen)
+dhd_attach(osl_t *osh, struct dhd_bus *bus, uint bus_hdrlen, void *dev)
 {
        dhd_info_t *dhd = NULL;
        struct net_device *net;
@@ -2071,7 +2072,7 @@ dhd_attach(osl_t *osh, struct dhd_bus *bus, uint bus_hdrlen)
                DHD_ERROR(("%s: OOM - alloc_etherdev\n", __FUNCTION__));
                goto fail;
        }
-
+       SET_NETDEV_DEV(net, (struct device *)dev);
        /* Allocate primary dhd_info */
        if (!(dhd = MALLOC(osh, sizeof(dhd_info_t)))) {
                DHD_ERROR(("%s: OOM - alloc dhd_info\n", __FUNCTION__));
index 5b08f79..446eb4a 100644 (file)
@@ -4771,7 +4771,8 @@ dhdsdio_chipmatch(uint16 chipid)
 
 static void *
 dhdsdio_probe(uint16 venid, uint16 devid, uint16 bus_no, uint16 slot,
-       uint16 func, uint bustype, void *regsva, osl_t * osh, void *sdh)
+       uint16 func, uint bustype, void *regsva, osl_t * osh, void *sdh,
+       void *dev)
 {
        int ret;
        dhd_bus_t *bus;
@@ -4879,7 +4880,7 @@ dhdsdio_probe(uint16 venid, uint16 devid, uint16 bus_no, uint16 slot,
        }
 
        /* Attach to the dhd/OS/network interface */
-       if (!(bus->dhd = dhd_attach(osh, bus, SDPCM_RESERVE))) {
+       if (!(bus->dhd = dhd_attach(osh, bus, SDPCM_RESERVE, dev))) {
                DHD_ERROR(("%s: dhd_attach failed\n", __FUNCTION__));
                goto fail;
        }
index f5dee5c..caf0b99 100644 (file)
@@ -179,7 +179,7 @@ typedef struct {
        /* attach to device */
        void *(*attach)(uint16 vend_id, uint16 dev_id, uint16 bus, uint16 slot,
                        uint16 func, uint bustype, void * regsva, osl_t * osh,
-                       void * param);
+                       void * param, void *dev);
        /* detach from device */
        void (*detach)(void *ch);
 } bcmsdh_driver_t;