diff options
-rw-r--r-- | drivers/staging/bcm/Bcmnet.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/drivers/staging/bcm/Bcmnet.c b/drivers/staging/bcm/Bcmnet.c index bb9260c6845e..bc2969821421 100644 --- a/drivers/staging/bcm/Bcmnet.c +++ b/drivers/staging/bcm/Bcmnet.c | |||
@@ -22,17 +22,15 @@ static INT bcm_notify_event(struct notifier_block *nb, ULONG event, PVOID dev) | |||
22 | case NETDEV_REGISTER: | 22 | case NETDEV_REGISTER: |
23 | /* Increment the Reference Count for "veth0" */ | 23 | /* Increment the Reference Count for "veth0" */ |
24 | BCM_DEBUG_PRINT(Adapter,DBG_TYPE_INITEXIT, DRV_ENTRY, DBG_LVL_ALL, "Register RefCount: %x\n", | 24 | BCM_DEBUG_PRINT(Adapter,DBG_TYPE_INITEXIT, DRV_ENTRY, DBG_LVL_ALL, "Register RefCount: %x\n", |
25 | atomic_read(&ndev->refcnt)); | 25 | netdev_refcnt_read(ndev)); |
26 | atomic_inc(&ndev->refcnt); | 26 | dev_hold(ndev); |
27 | break; | 27 | break; |
28 | 28 | ||
29 | case NETDEV_UNREGISTER: | 29 | case NETDEV_UNREGISTER: |
30 | /* Decrement the Reference Count for "veth0" */ | 30 | /* Decrement the Reference Count for "veth0" */ |
31 | BCM_DEBUG_PRINT(Adapter,DBG_TYPE_INITEXIT, DRV_ENTRY, DBG_LVL_ALL, "Unregister RefCnt: %x\n", | 31 | BCM_DEBUG_PRINT(Adapter,DBG_TYPE_INITEXIT, DRV_ENTRY, DBG_LVL_ALL, "Unregister RefCnt: %x\n", |
32 | atomic_read(&ndev->refcnt)); | 32 | netdev_refcnt_read(ndev)); |
33 | atomic_dec(&ndev->refcnt); | 33 | dev_put(ndev); |
34 | if((int)atomic_read(&ndev->refcnt) < 0) | ||
35 | atomic_set(&ndev->refcnt, 0); | ||
36 | break; | 34 | break; |
37 | }; | 35 | }; |
38 | } | 36 | } |