Commit 11de8e62 authored by David S. Miller's avatar David S. Miller

Merge branch 'bna-next'

Ivan Vecera says:

====================
bna: remove useless global variables

The set removes useless global bnad_list as well as bnad->entry that track
a list of driver instances but it is not used anywhere. The associated
bnad_list_mutex is removed as well but as it is also used to protect
bna_id increment it is necessary to convert bna_id to atomic_t.
====================
Signed-off-by: default avatarIvan Vecera <ivecera@redhat.com>
parents 9f3377ef 09e36360
...@@ -54,9 +54,7 @@ MODULE_PARM_DESC(bna_debugfs_enable, "Enables debugfs feature, default=1," ...@@ -54,9 +54,7 @@ MODULE_PARM_DESC(bna_debugfs_enable, "Enables debugfs feature, default=1,"
* Global variables * Global variables
*/ */
static u32 bnad_rxqs_per_cq = 2; static u32 bnad_rxqs_per_cq = 2;
static u32 bna_id; static atomic_t bna_id;
static struct mutex bnad_list_mutex;
static LIST_HEAD(bnad_list);
static const u8 bnad_bcast_addr[] __aligned(2) = static const u8 bnad_bcast_addr[] __aligned(2) =
{ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
...@@ -76,23 +74,6 @@ do { \ ...@@ -76,23 +74,6 @@ do { \
(_res_info)->res_u.mem_info.len = (_size); \ (_res_info)->res_u.mem_info.len = (_size); \
} while (0) } while (0)
static void
bnad_add_to_list(struct bnad *bnad)
{
mutex_lock(&bnad_list_mutex);
list_add_tail(&bnad->list_entry, &bnad_list);
bnad->id = bna_id++;
mutex_unlock(&bnad_list_mutex);
}
static void
bnad_remove_from_list(struct bnad *bnad)
{
mutex_lock(&bnad_list_mutex);
list_del(&bnad->list_entry);
mutex_unlock(&bnad_list_mutex);
}
/* /*
* Reinitialize completions in CQ, once Rx is taken down * Reinitialize completions in CQ, once Rx is taken down
*/ */
...@@ -3573,14 +3554,12 @@ bnad_lock_init(struct bnad *bnad) ...@@ -3573,14 +3554,12 @@ bnad_lock_init(struct bnad *bnad)
{ {
spin_lock_init(&bnad->bna_lock); spin_lock_init(&bnad->bna_lock);
mutex_init(&bnad->conf_mutex); mutex_init(&bnad->conf_mutex);
mutex_init(&bnad_list_mutex);
} }
static void static void
bnad_lock_uninit(struct bnad *bnad) bnad_lock_uninit(struct bnad *bnad)
{ {
mutex_destroy(&bnad->conf_mutex); mutex_destroy(&bnad->conf_mutex);
mutex_destroy(&bnad_list_mutex);
} }
/* PCI Initialization */ /* PCI Initialization */
...@@ -3653,7 +3632,7 @@ bnad_pci_probe(struct pci_dev *pdev, ...@@ -3653,7 +3632,7 @@ bnad_pci_probe(struct pci_dev *pdev,
} }
bnad = netdev_priv(netdev); bnad = netdev_priv(netdev);
bnad_lock_init(bnad); bnad_lock_init(bnad);
bnad_add_to_list(bnad); bnad->id = atomic_inc_return(&bna_id) - 1;
mutex_lock(&bnad->conf_mutex); mutex_lock(&bnad->conf_mutex);
/* /*
...@@ -3807,7 +3786,6 @@ bnad_pci_probe(struct pci_dev *pdev, ...@@ -3807,7 +3786,6 @@ bnad_pci_probe(struct pci_dev *pdev,
bnad_pci_uninit(pdev); bnad_pci_uninit(pdev);
unlock_mutex: unlock_mutex:
mutex_unlock(&bnad->conf_mutex); mutex_unlock(&bnad->conf_mutex);
bnad_remove_from_list(bnad);
bnad_lock_uninit(bnad); bnad_lock_uninit(bnad);
free_netdev(netdev); free_netdev(netdev);
return err; return err;
...@@ -3845,7 +3823,6 @@ bnad_pci_remove(struct pci_dev *pdev) ...@@ -3845,7 +3823,6 @@ bnad_pci_remove(struct pci_dev *pdev)
bnad_disable_msix(bnad); bnad_disable_msix(bnad);
bnad_pci_uninit(pdev); bnad_pci_uninit(pdev);
mutex_unlock(&bnad->conf_mutex); mutex_unlock(&bnad->conf_mutex);
bnad_remove_from_list(bnad);
bnad_lock_uninit(bnad); bnad_lock_uninit(bnad);
/* Remove the debugfs node for this bnad */ /* Remove the debugfs node for this bnad */
kfree(bnad->regdata); kfree(bnad->regdata);
......
...@@ -288,7 +288,6 @@ struct bnad_rx_unmap_q { ...@@ -288,7 +288,6 @@ struct bnad_rx_unmap_q {
struct bnad { struct bnad {
struct net_device *netdev; struct net_device *netdev;
u32 id; u32 id;
struct list_head list_entry;
/* Data path */ /* Data path */
struct bnad_tx_info tx_info[BNAD_MAX_TX]; struct bnad_tx_info tx_info[BNAD_MAX_TX];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment