diff options
author | Rasesh Mody <rmody@brocade.com> | 2010-10-05 11:46:05 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-10-05 23:39:39 -0400 |
commit | b7ee31c5af7f04b67d8b8e4f3b2bcb8bcfced8a3 (patch) | |
tree | a50e868a3a0d6dcc9c86ca488db91f77eaa3ab56 /drivers/net/bna/bnad.c | |
parent | e2fa6f2ef6e48666b78d4b0f00914b06bb19d298 (diff) |
bna: scope and dead code cleanup
As suggested by Stephen Hemminger:
1) Made functions and data structures static wherever possible.
2) Removed unused code.
Signed-off-by: Debashis Dutt <ddutt@brocade.com>
Signed-off-by: Rasesh Mody <rmody@brocade.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/bna/bnad.c')
-rw-r--r-- | drivers/net/bna/bnad.c | 29 |
1 files changed, 10 insertions, 19 deletions
diff --git a/drivers/net/bna/bnad.c b/drivers/net/bna/bnad.c index 7210c34d2d5b..74c64d6c8801 100644 --- a/drivers/net/bna/bnad.c +++ b/drivers/net/bna/bnad.c | |||
@@ -28,7 +28,7 @@ | |||
28 | #include "bna.h" | 28 | #include "bna.h" |
29 | #include "cna.h" | 29 | #include "cna.h" |
30 | 30 | ||
31 | DEFINE_MUTEX(bnad_fwimg_mutex); | 31 | static DEFINE_MUTEX(bnad_fwimg_mutex); |
32 | 32 | ||
33 | /* | 33 | /* |
34 | * Module params | 34 | * Module params |
@@ -46,7 +46,7 @@ MODULE_PARM_DESC(bnad_ioc_auto_recover, "Enable / Disable auto recovery"); | |||
46 | */ | 46 | */ |
47 | u32 bnad_rxqs_per_cq = 2; | 47 | u32 bnad_rxqs_per_cq = 2; |
48 | 48 | ||
49 | const u8 bnad_bcast_addr[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; | 49 | static const u8 bnad_bcast_addr[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; |
50 | 50 | ||
51 | /* | 51 | /* |
52 | * Local MACROS | 52 | * Local MACROS |
@@ -687,7 +687,7 @@ bnad_enable_mbox_irq(struct bnad *bnad) | |||
687 | * Called with bnad->bna_lock held b'cos of | 687 | * Called with bnad->bna_lock held b'cos of |
688 | * bnad->cfg_flags access. | 688 | * bnad->cfg_flags access. |
689 | */ | 689 | */ |
690 | void | 690 | static void |
691 | bnad_disable_mbox_irq(struct bnad *bnad) | 691 | bnad_disable_mbox_irq(struct bnad *bnad) |
692 | { | 692 | { |
693 | int irq = BNAD_GET_MBOX_IRQ(bnad); | 693 | int irq = BNAD_GET_MBOX_IRQ(bnad); |
@@ -956,11 +956,6 @@ bnad_cb_stats_get(struct bnad *bnad, enum bna_cb_status status, | |||
956 | jiffies + msecs_to_jiffies(BNAD_STATS_TIMER_FREQ)); | 956 | jiffies + msecs_to_jiffies(BNAD_STATS_TIMER_FREQ)); |
957 | } | 957 | } |
958 | 958 | ||
959 | void | ||
960 | bnad_cb_stats_clr(struct bnad *bnad) | ||
961 | { | ||
962 | } | ||
963 | |||
964 | /* Resource allocation, free functions */ | 959 | /* Resource allocation, free functions */ |
965 | 960 | ||
966 | static void | 961 | static void |
@@ -1111,8 +1106,10 @@ bnad_mbox_irq_alloc(struct bnad *bnad, | |||
1111 | } | 1106 | } |
1112 | 1107 | ||
1113 | spin_lock_irqsave(&bnad->bna_lock, flags); | 1108 | spin_lock_irqsave(&bnad->bna_lock, flags); |
1109 | |||
1114 | if (bnad->cfg_flags & BNAD_CF_MSIX) | 1110 | if (bnad->cfg_flags & BNAD_CF_MSIX) |
1115 | disable_irq_nosync(irq); | 1111 | disable_irq_nosync(irq); |
1112 | |||
1116 | spin_unlock_irqrestore(&bnad->bna_lock, flags); | 1113 | spin_unlock_irqrestore(&bnad->bna_lock, flags); |
1117 | return 0; | 1114 | return 0; |
1118 | } | 1115 | } |
@@ -2243,7 +2240,6 @@ static void | |||
2243 | bnad_enable_msix(struct bnad *bnad) | 2240 | bnad_enable_msix(struct bnad *bnad) |
2244 | { | 2241 | { |
2245 | int i, ret; | 2242 | int i, ret; |
2246 | u32 tot_msix_num; | ||
2247 | unsigned long flags; | 2243 | unsigned long flags; |
2248 | 2244 | ||
2249 | spin_lock_irqsave(&bnad->bna_lock, flags); | 2245 | spin_lock_irqsave(&bnad->bna_lock, flags); |
@@ -2256,18 +2252,16 @@ bnad_enable_msix(struct bnad *bnad) | |||
2256 | if (bnad->msix_table) | 2252 | if (bnad->msix_table) |
2257 | return; | 2253 | return; |
2258 | 2254 | ||
2259 | tot_msix_num = bnad->msix_num + bnad->msix_diag_num; | ||
2260 | |||
2261 | bnad->msix_table = | 2255 | bnad->msix_table = |
2262 | kcalloc(tot_msix_num, sizeof(struct msix_entry), GFP_KERNEL); | 2256 | kcalloc(bnad->msix_num, sizeof(struct msix_entry), GFP_KERNEL); |
2263 | 2257 | ||
2264 | if (!bnad->msix_table) | 2258 | if (!bnad->msix_table) |
2265 | goto intx_mode; | 2259 | goto intx_mode; |
2266 | 2260 | ||
2267 | for (i = 0; i < tot_msix_num; i++) | 2261 | for (i = 0; i < bnad->msix_num; i++) |
2268 | bnad->msix_table[i].entry = i; | 2262 | bnad->msix_table[i].entry = i; |
2269 | 2263 | ||
2270 | ret = pci_enable_msix(bnad->pcidev, bnad->msix_table, tot_msix_num); | 2264 | ret = pci_enable_msix(bnad->pcidev, bnad->msix_table, bnad->msix_num); |
2271 | if (ret > 0) { | 2265 | if (ret > 0) { |
2272 | /* Not enough MSI-X vectors. */ | 2266 | /* Not enough MSI-X vectors. */ |
2273 | 2267 | ||
@@ -2280,12 +2274,11 @@ bnad_enable_msix(struct bnad *bnad) | |||
2280 | + (bnad->num_rx | 2274 | + (bnad->num_rx |
2281 | * bnad->num_rxp_per_rx) + | 2275 | * bnad->num_rxp_per_rx) + |
2282 | BNAD_MAILBOX_MSIX_VECTORS; | 2276 | BNAD_MAILBOX_MSIX_VECTORS; |
2283 | tot_msix_num = bnad->msix_num + bnad->msix_diag_num; | ||
2284 | 2277 | ||
2285 | /* Try once more with adjusted numbers */ | 2278 | /* Try once more with adjusted numbers */ |
2286 | /* If this fails, fall back to INTx */ | 2279 | /* If this fails, fall back to INTx */ |
2287 | ret = pci_enable_msix(bnad->pcidev, bnad->msix_table, | 2280 | ret = pci_enable_msix(bnad->pcidev, bnad->msix_table, |
2288 | tot_msix_num); | 2281 | bnad->msix_num); |
2289 | if (ret) | 2282 | if (ret) |
2290 | goto intx_mode; | 2283 | goto intx_mode; |
2291 | 2284 | ||
@@ -2298,7 +2291,6 @@ intx_mode: | |||
2298 | kfree(bnad->msix_table); | 2291 | kfree(bnad->msix_table); |
2299 | bnad->msix_table = NULL; | 2292 | bnad->msix_table = NULL; |
2300 | bnad->msix_num = 0; | 2293 | bnad->msix_num = 0; |
2301 | bnad->msix_diag_num = 0; | ||
2302 | spin_lock_irqsave(&bnad->bna_lock, flags); | 2294 | spin_lock_irqsave(&bnad->bna_lock, flags); |
2303 | bnad->cfg_flags &= ~BNAD_CF_MSIX; | 2295 | bnad->cfg_flags &= ~BNAD_CF_MSIX; |
2304 | bnad_q_num_init(bnad); | 2296 | bnad_q_num_init(bnad); |
@@ -2946,7 +2938,6 @@ bnad_init(struct bnad *bnad, | |||
2946 | bnad->msix_num = (bnad->num_tx * bnad->num_txq_per_tx) + | 2938 | bnad->msix_num = (bnad->num_tx * bnad->num_txq_per_tx) + |
2947 | (bnad->num_rx * bnad->num_rxp_per_rx) + | 2939 | (bnad->num_rx * bnad->num_rxp_per_rx) + |
2948 | BNAD_MAILBOX_MSIX_VECTORS; | 2940 | BNAD_MAILBOX_MSIX_VECTORS; |
2949 | bnad->msix_diag_num = 2; /* 1 for Tx, 1 for Rx */ | ||
2950 | 2941 | ||
2951 | bnad->txq_depth = BNAD_TXQ_DEPTH; | 2942 | bnad->txq_depth = BNAD_TXQ_DEPTH; |
2952 | bnad->rxq_depth = BNAD_RXQ_DEPTH; | 2943 | bnad->rxq_depth = BNAD_RXQ_DEPTH; |
@@ -3217,7 +3208,7 @@ bnad_pci_remove(struct pci_dev *pdev) | |||
3217 | free_netdev(netdev); | 3208 | free_netdev(netdev); |
3218 | } | 3209 | } |
3219 | 3210 | ||
3220 | const struct pci_device_id bnad_pci_id_table[] = { | 3211 | static const struct pci_device_id bnad_pci_id_table[] = { |
3221 | { | 3212 | { |
3222 | PCI_DEVICE(PCI_VENDOR_ID_BROCADE, | 3213 | PCI_DEVICE(PCI_VENDOR_ID_BROCADE, |
3223 | PCI_DEVICE_ID_BROCADE_CT), | 3214 | PCI_DEVICE_ID_BROCADE_CT), |