diff options
author | Dhananjay Phadke <dhananjay@netxen.com> | 2008-07-21 22:44:00 -0400 |
---|---|---|
committer | Jeff Garzik <jgarzik@redhat.com> | 2008-07-22 17:50:55 -0400 |
commit | 7830b22cbc5f5e804469b74a3fe0d3a8ed88ca31 (patch) | |
tree | e7779997b1a62f7a4e0003d51132ec710981c258 /drivers/net/netxen/netxen_nic_main.c | |
parent | f0084a36d4d799c024a5211555334d56c91d236d (diff) |
netxen: cleanup unused variables/functions
o Reduce access to global arrays in data path.
o Remove duplicate/unused variables, unecessary alignment constraints.
o Use correct pci_dev instead of fallback device for consistent
allocations.
o Disable ethtool set_eeprom functionality for now, it was only used
for flashing firmware.
Signed-off-by: Dhananjay Phadke <dhananjay@netxen.com>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Diffstat (limited to 'drivers/net/netxen/netxen_nic_main.c')
-rw-r--r-- | drivers/net/netxen/netxen_nic_main.c | 74 |
1 files changed, 17 insertions, 57 deletions
diff --git a/drivers/net/netxen/netxen_nic_main.c b/drivers/net/netxen/netxen_nic_main.c index 63cd67b931e7..91b02ebc9a10 100644 --- a/drivers/net/netxen/netxen_nic_main.c +++ b/drivers/net/netxen/netxen_nic_main.c | |||
@@ -108,66 +108,30 @@ static struct workqueue_struct *netxen_workq; | |||
108 | 108 | ||
109 | static void netxen_watchdog(unsigned long); | 109 | static void netxen_watchdog(unsigned long); |
110 | 110 | ||
111 | static uint32_t crb_cmd_producer[4] = { | ||
112 | CRB_CMD_PRODUCER_OFFSET, CRB_CMD_PRODUCER_OFFSET_1, | ||
113 | CRB_CMD_PRODUCER_OFFSET_2, CRB_CMD_PRODUCER_OFFSET_3 | ||
114 | }; | ||
115 | |||
111 | static void netxen_nic_update_cmd_producer(struct netxen_adapter *adapter, | 116 | static void netxen_nic_update_cmd_producer(struct netxen_adapter *adapter, |
112 | uint32_t crb_producer) | 117 | uint32_t crb_producer) |
113 | { | 118 | { |
114 | switch (adapter->portnum) { | 119 | writel(crb_producer, NETXEN_CRB_NORMALIZE(adapter, |
115 | case 0: | 120 | adapter->crb_addr_cmd_producer)); |
116 | writel(crb_producer, NETXEN_CRB_NORMALIZE | ||
117 | (adapter, CRB_CMD_PRODUCER_OFFSET)); | ||
118 | return; | ||
119 | case 1: | ||
120 | writel(crb_producer, NETXEN_CRB_NORMALIZE | ||
121 | (adapter, CRB_CMD_PRODUCER_OFFSET_1)); | ||
122 | return; | ||
123 | case 2: | ||
124 | writel(crb_producer, NETXEN_CRB_NORMALIZE | ||
125 | (adapter, CRB_CMD_PRODUCER_OFFSET_2)); | ||
126 | return; | ||
127 | case 3: | ||
128 | writel(crb_producer, NETXEN_CRB_NORMALIZE | ||
129 | (adapter, CRB_CMD_PRODUCER_OFFSET_3)); | ||
130 | return; | ||
131 | default: | ||
132 | printk(KERN_WARNING "We tried to update " | ||
133 | "CRB_CMD_PRODUCER_OFFSET for invalid " | ||
134 | "PCI function id %d\n", | ||
135 | adapter->portnum); | ||
136 | return; | ||
137 | } | ||
138 | } | 121 | } |
139 | 122 | ||
123 | static uint32_t crb_cmd_consumer[4] = { | ||
124 | CRB_CMD_CONSUMER_OFFSET, CRB_CMD_CONSUMER_OFFSET_1, | ||
125 | CRB_CMD_CONSUMER_OFFSET_2, CRB_CMD_CONSUMER_OFFSET_3 | ||
126 | }; | ||
127 | |||
140 | static void netxen_nic_update_cmd_consumer(struct netxen_adapter *adapter, | 128 | static void netxen_nic_update_cmd_consumer(struct netxen_adapter *adapter, |
141 | u32 crb_consumer) | 129 | u32 crb_consumer) |
142 | { | 130 | { |
143 | switch (adapter->portnum) { | 131 | writel(crb_consumer, NETXEN_CRB_NORMALIZE(adapter, |
144 | case 0: | 132 | adapter->crb_addr_cmd_consumer)); |
145 | writel(crb_consumer, NETXEN_CRB_NORMALIZE | ||
146 | (adapter, CRB_CMD_CONSUMER_OFFSET)); | ||
147 | return; | ||
148 | case 1: | ||
149 | writel(crb_consumer, NETXEN_CRB_NORMALIZE | ||
150 | (adapter, CRB_CMD_CONSUMER_OFFSET_1)); | ||
151 | return; | ||
152 | case 2: | ||
153 | writel(crb_consumer, NETXEN_CRB_NORMALIZE | ||
154 | (adapter, CRB_CMD_CONSUMER_OFFSET_2)); | ||
155 | return; | ||
156 | case 3: | ||
157 | writel(crb_consumer, NETXEN_CRB_NORMALIZE | ||
158 | (adapter, CRB_CMD_CONSUMER_OFFSET_3)); | ||
159 | return; | ||
160 | default: | ||
161 | printk(KERN_WARNING "We tried to update " | ||
162 | "CRB_CMD_PRODUCER_OFFSET for invalid " | ||
163 | "PCI function id %d\n", | ||
164 | adapter->portnum); | ||
165 | return; | ||
166 | } | ||
167 | } | 133 | } |
168 | 134 | ||
169 | #define ADAPTER_LIST_SIZE 12 | ||
170 | |||
171 | static uint32_t msi_tgt_status[4] = { | 135 | static uint32_t msi_tgt_status[4] = { |
172 | ISR_INT_TARGET_STATUS, ISR_INT_TARGET_STATUS_F1, | 136 | ISR_INT_TARGET_STATUS, ISR_INT_TARGET_STATUS_F1, |
173 | ISR_INT_TARGET_STATUS_F2, ISR_INT_TARGET_STATUS_F3 | 137 | ISR_INT_TARGET_STATUS_F2, ISR_INT_TARGET_STATUS_F3 |
@@ -334,7 +298,6 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
334 | 298 | ||
335 | adapter = netdev->priv; | 299 | adapter = netdev->priv; |
336 | 300 | ||
337 | adapter->ahw.pdev = pdev; | ||
338 | adapter->ahw.pci_func = pci_func_id; | 301 | adapter->ahw.pci_func = pci_func_id; |
339 | 302 | ||
340 | /* remap phys address */ | 303 | /* remap phys address */ |
@@ -552,12 +515,13 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
552 | adapter->watchdog_timer.function = &netxen_watchdog; | 515 | adapter->watchdog_timer.function = &netxen_watchdog; |
553 | adapter->watchdog_timer.data = (unsigned long)adapter; | 516 | adapter->watchdog_timer.data = (unsigned long)adapter; |
554 | INIT_WORK(&adapter->watchdog_task, netxen_watchdog_task); | 517 | INIT_WORK(&adapter->watchdog_task, netxen_watchdog_task); |
555 | adapter->ahw.pdev = pdev; | ||
556 | adapter->ahw.revision_id = pdev->revision; | 518 | adapter->ahw.revision_id = pdev->revision; |
557 | 519 | ||
558 | /* make sure Window == 1 */ | 520 | /* make sure Window == 1 */ |
559 | netxen_nic_pci_change_crbwindow(adapter, 1); | 521 | netxen_nic_pci_change_crbwindow(adapter, 1); |
560 | 522 | ||
523 | adapter->crb_addr_cmd_producer = crb_cmd_producer[adapter->portnum]; | ||
524 | adapter->crb_addr_cmd_consumer = crb_cmd_consumer[adapter->portnum]; | ||
561 | netxen_nic_update_cmd_producer(adapter, 0); | 525 | netxen_nic_update_cmd_producer(adapter, 0); |
562 | netxen_nic_update_cmd_consumer(adapter, 0); | 526 | netxen_nic_update_cmd_consumer(adapter, 0); |
563 | writel(0, NETXEN_CRB_NORMALIZE(adapter, CRB_HOST_CMD_ADDR_LO)); | 527 | writel(0, NETXEN_CRB_NORMALIZE(adapter, CRB_HOST_CMD_ADDR_LO)); |
@@ -816,7 +780,7 @@ static int netxen_nic_open(struct net_device *netdev) | |||
816 | for (ring = 0; ring < NUM_RCV_DESC_RINGS; ring++) | 780 | for (ring = 0; ring < NUM_RCV_DESC_RINGS; ring++) |
817 | netxen_post_rx_buffers(adapter, ctx, ring); | 781 | netxen_post_rx_buffers(adapter, ctx, ring); |
818 | } | 782 | } |
819 | adapter->irq = adapter->ahw.pdev->irq; | 783 | adapter->irq = adapter->pdev->irq; |
820 | if (adapter->flags & NETXEN_NIC_MSI_ENABLED) | 784 | if (adapter->flags & NETXEN_NIC_MSI_ENABLED) |
821 | handler = netxen_msi_intr; | 785 | handler = netxen_msi_intr; |
822 | else { | 786 | else { |
@@ -1220,10 +1184,6 @@ module_init(netxen_init_module); | |||
1220 | 1184 | ||
1221 | static void __exit netxen_exit_module(void) | 1185 | static void __exit netxen_exit_module(void) |
1222 | { | 1186 | { |
1223 | /* | ||
1224 | * Wait for some time to allow the dma to drain, if any. | ||
1225 | */ | ||
1226 | msleep(100); | ||
1227 | pci_unregister_driver(&netxen_driver); | 1187 | pci_unregister_driver(&netxen_driver); |
1228 | destroy_workqueue(netxen_workq); | 1188 | destroy_workqueue(netxen_workq); |
1229 | } | 1189 | } |