Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

beceem: remove bogus network device notifier

Network device should not be messing with refcounts directly.
See Documentation/networking/netdevices.txt

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>

+1 -67
+1 -1
drivers/staging/bcm/Adapter.h
··· 600 600 601 601 struct semaphore NVMRdmWrmLock; 602 602 BOOLEAN bNetworkInterfaceRegistered; 603 - BOOLEAN bNetdeviceNotifierRegistered; 603 + 604 604 struct device *pstCreatedClassDevice; 605 605 BOOLEAN bUsbClassDriverRegistered; 606 606 // BOOLEAN InterfaceUpStatus;
-64
drivers/staging/bcm/Bcmnet.c
··· 4 4 #define DRV_VERSION "5.2.7.3P1" 5 5 #define DRV_COPYRIGHT "Copyright 2010. Beceem Communications Inc" 6 6 7 - static INT bcm_notify_event(struct notifier_block *nb, ULONG event, PVOID dev) 8 - { 9 - struct net_device *ndev = (struct net_device*)dev; 10 - PMINI_ADAPTER Adapter = GET_BCM_ADAPTER(gblpnetdev); 11 - //PMINI_ADAPTER Adapter = (PMINI_ADAPTER)ndev->priv; 12 - if(strncmp(ndev->name,gblpnetdev->name,5)==0) 13 - { 14 - switch(event) 15 - { 16 - case NETDEV_CHANGEADDR: 17 - case NETDEV_GOING_DOWN: 18 - /*ignore this */ 19 - break; 20 - case NETDEV_DOWN: 21 - break; 22 - 23 - case NETDEV_UP: 24 - break; 25 - 26 - case NETDEV_REGISTER: 27 - /* Increment the Reference Count for "veth0" */ 28 - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_INITEXIT, DRV_ENTRY, DBG_LVL_ALL, "Register RefCount: %x\n", 29 - netdev_refcnt_read(ndev)); 30 - dev_hold(ndev); 31 - break; 32 - 33 - case NETDEV_UNREGISTER: 34 - /* Decrement the Reference Count for "veth0" */ 35 - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_INITEXIT, DRV_ENTRY, DBG_LVL_ALL, "Unregister RefCnt: %x\n", 36 - netdev_refcnt_read(ndev)); 37 - dev_put(ndev); 38 - break; 39 - }; 40 - } 41 - return NOTIFY_DONE; 42 - } 43 - 44 - /* Notifier block to receive netdevice events */ 45 - static struct notifier_block bcm_notifier_block = 46 - { 47 - .notifier_call = bcm_notify_event, 48 - }; 49 7 50 8 struct net_device *gblpnetdev; 51 9 /***************************************************************************************/ ··· 114 156 /* Read the MAC Address from EEPROM */ 115 157 ReadMacAddressFromNVM(Adapter); 116 158 117 - 118 - /* Register the notifier block for getting netdevice events */ 119 - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_INITEXIT, DRV_ENTRY, DBG_LVL_ALL, "Registering netdevice notifier\n"); 120 - result = register_netdevice_notifier(&bcm_notifier_block); 121 - if(result) 122 - { 123 - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_INITEXIT, DRV_ENTRY, DBG_LVL_ALL, "BCM Notifier Block did not get registered"); 124 - Adapter->bNetdeviceNotifierRegistered = FALSE; 125 - return result; 126 - } 127 - else 128 - { 129 - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_INITEXIT, DRV_ENTRY, DBG_LVL_ALL, "BCM Notifier got Registered"); 130 - Adapter->bNetdeviceNotifierRegistered = TRUE; 131 - } 132 - 133 - 134 159 result = register_netdev(Adapter->dev); 135 160 if (!result) 136 161 { ··· 150 209 if(Adapter->dev && !IS_ERR(Adapter->dev) && Adapter->bNetworkInterfaceRegistered) 151 210 unregister_netdev(Adapter->dev); 152 211 /* Unregister the notifier block */ 153 - if(Adapter->bNetdeviceNotifierRegistered == TRUE) 154 - { 155 - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_INITEXIT, DRV_ENTRY, DBG_LVL_ALL, "Unregistering netdevice notifier\n"); 156 - unregister_netdevice_notifier(&bcm_notifier_block); 157 - } 158 212 } 159 213 160 214 static int bcm_init(void)
-1
drivers/staging/bcm/Debug.c
··· 37 37 printk("\n"); 38 38 } 39 39 } 40 -
-1
drivers/staging/bcm/headers.h
··· 22 22 #include <linux/etherdevice.h> 23 23 #include <net/ip.h> 24 24 #include <linux/wait.h> 25 - #include <linux/notifier.h> 26 25 #include <linux/proc_fs.h> 27 26 #include <linux/interrupt.h> 28 27