diff options
author | David Kilroy <kilroyd@googlemail.com> | 2010-05-01 09:05:39 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2010-05-03 14:53:06 -0400 |
commit | 593ef09c9e70c92c0d76c67a1c03a5d44d3aec82 (patch) | |
tree | f15d00aa6ce35d3da828003b209cd4077cbadcec /drivers | |
parent | b42f2074dedef559ecf72dce61a6501f9f9b273a (diff) |
orinoco: allow driver to specify netdev_ops
Allow the main drivers to specify a custom version of the net_device_ops
structure. This is required by orinoco_usb to supply a separate transmit
function.
Export existing net_device_ops callbacks so that the drivers can reuse
some of the existing code.
Signed-off-by: David Kilroy <kilroyd@googlemail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/wireless/orinoco/airport.c | 2 | ||||
-rw-r--r-- | drivers/net/wireless/orinoco/main.c | 28 | ||||
-rw-r--r-- | drivers/net/wireless/orinoco/orinoco.h | 11 | ||||
-rw-r--r-- | drivers/net/wireless/orinoco/orinoco_cs.c | 2 | ||||
-rw-r--r-- | drivers/net/wireless/orinoco/orinoco_nortel.c | 2 | ||||
-rw-r--r-- | drivers/net/wireless/orinoco/orinoco_pci.c | 2 | ||||
-rw-r--r-- | drivers/net/wireless/orinoco/orinoco_plx.c | 2 | ||||
-rw-r--r-- | drivers/net/wireless/orinoco/orinoco_tmd.c | 2 | ||||
-rw-r--r-- | drivers/net/wireless/orinoco/spectrum_cs.c | 2 |
9 files changed, 37 insertions, 16 deletions
diff --git a/drivers/net/wireless/orinoco/airport.c b/drivers/net/wireless/orinoco/airport.c index ea23c4fdbf62..7dac5adb6c1c 100644 --- a/drivers/net/wireless/orinoco/airport.c +++ b/drivers/net/wireless/orinoco/airport.c | |||
@@ -210,7 +210,7 @@ airport_attach(struct macio_dev *mdev, const struct of_device_id *match) | |||
210 | } | 210 | } |
211 | 211 | ||
212 | /* Register an interface with the stack */ | 212 | /* Register an interface with the stack */ |
213 | if (orinoco_if_add(priv, phys_addr, card->irq) != 0) { | 213 | if (orinoco_if_add(priv, phys_addr, card->irq, NULL) != 0) { |
214 | printk(KERN_ERR PFX "orinoco_if_add() failed\n"); | 214 | printk(KERN_ERR PFX "orinoco_if_add() failed\n"); |
215 | goto failed; | 215 | goto failed; |
216 | } | 216 | } |
diff --git a/drivers/net/wireless/orinoco/main.c b/drivers/net/wireless/orinoco/main.c index d90951f731ef..7acb6bc3ebff 100644 --- a/drivers/net/wireless/orinoco/main.c +++ b/drivers/net/wireless/orinoco/main.c | |||
@@ -253,7 +253,7 @@ void set_port_type(struct orinoco_private *priv) | |||
253 | /* Device methods */ | 253 | /* Device methods */ |
254 | /********************************************************************/ | 254 | /********************************************************************/ |
255 | 255 | ||
256 | static int orinoco_open(struct net_device *dev) | 256 | int orinoco_open(struct net_device *dev) |
257 | { | 257 | { |
258 | struct orinoco_private *priv = ndev_priv(dev); | 258 | struct orinoco_private *priv = ndev_priv(dev); |
259 | unsigned long flags; | 259 | unsigned long flags; |
@@ -271,8 +271,9 @@ static int orinoco_open(struct net_device *dev) | |||
271 | 271 | ||
272 | return err; | 272 | return err; |
273 | } | 273 | } |
274 | EXPORT_SYMBOL(orinoco_open); | ||
274 | 275 | ||
275 | static int orinoco_stop(struct net_device *dev) | 276 | int orinoco_stop(struct net_device *dev) |
276 | { | 277 | { |
277 | struct orinoco_private *priv = ndev_priv(dev); | 278 | struct orinoco_private *priv = ndev_priv(dev); |
278 | int err = 0; | 279 | int err = 0; |
@@ -290,15 +291,17 @@ static int orinoco_stop(struct net_device *dev) | |||
290 | 291 | ||
291 | return err; | 292 | return err; |
292 | } | 293 | } |
294 | EXPORT_SYMBOL(orinoco_stop); | ||
293 | 295 | ||
294 | static struct net_device_stats *orinoco_get_stats(struct net_device *dev) | 296 | struct net_device_stats *orinoco_get_stats(struct net_device *dev) |
295 | { | 297 | { |
296 | struct orinoco_private *priv = ndev_priv(dev); | 298 | struct orinoco_private *priv = ndev_priv(dev); |
297 | 299 | ||
298 | return &priv->stats; | 300 | return &priv->stats; |
299 | } | 301 | } |
302 | EXPORT_SYMBOL(orinoco_get_stats); | ||
300 | 303 | ||
301 | static void orinoco_set_multicast_list(struct net_device *dev) | 304 | void orinoco_set_multicast_list(struct net_device *dev) |
302 | { | 305 | { |
303 | struct orinoco_private *priv = ndev_priv(dev); | 306 | struct orinoco_private *priv = ndev_priv(dev); |
304 | unsigned long flags; | 307 | unsigned long flags; |
@@ -312,8 +315,9 @@ static void orinoco_set_multicast_list(struct net_device *dev) | |||
312 | __orinoco_set_multicast_list(dev); | 315 | __orinoco_set_multicast_list(dev); |
313 | orinoco_unlock(priv, &flags); | 316 | orinoco_unlock(priv, &flags); |
314 | } | 317 | } |
318 | EXPORT_SYMBOL(orinoco_set_multicast_list); | ||
315 | 319 | ||
316 | static int orinoco_change_mtu(struct net_device *dev, int new_mtu) | 320 | int orinoco_change_mtu(struct net_device *dev, int new_mtu) |
317 | { | 321 | { |
318 | struct orinoco_private *priv = ndev_priv(dev); | 322 | struct orinoco_private *priv = ndev_priv(dev); |
319 | 323 | ||
@@ -329,6 +333,7 @@ static int orinoco_change_mtu(struct net_device *dev, int new_mtu) | |||
329 | 333 | ||
330 | return 0; | 334 | return 0; |
331 | } | 335 | } |
336 | EXPORT_SYMBOL(orinoco_change_mtu); | ||
332 | 337 | ||
333 | /********************************************************************/ | 338 | /********************************************************************/ |
334 | /* Tx path */ | 339 | /* Tx path */ |
@@ -614,7 +619,7 @@ static void __orinoco_ev_txexc(struct net_device *dev, hermes_t *hw) | |||
614 | netif_wake_queue(dev); | 619 | netif_wake_queue(dev); |
615 | } | 620 | } |
616 | 621 | ||
617 | static void orinoco_tx_timeout(struct net_device *dev) | 622 | void orinoco_tx_timeout(struct net_device *dev) |
618 | { | 623 | { |
619 | struct orinoco_private *priv = ndev_priv(dev); | 624 | struct orinoco_private *priv = ndev_priv(dev); |
620 | struct net_device_stats *stats = &priv->stats; | 625 | struct net_device_stats *stats = &priv->stats; |
@@ -629,6 +634,7 @@ static void orinoco_tx_timeout(struct net_device *dev) | |||
629 | 634 | ||
630 | schedule_work(&priv->reset_work); | 635 | schedule_work(&priv->reset_work); |
631 | } | 636 | } |
637 | EXPORT_SYMBOL(orinoco_tx_timeout); | ||
632 | 638 | ||
633 | /********************************************************************/ | 639 | /********************************************************************/ |
634 | /* Rx path (data frames) */ | 640 | /* Rx path (data frames) */ |
@@ -2192,7 +2198,8 @@ EXPORT_SYMBOL(alloc_orinocodev); | |||
2192 | */ | 2198 | */ |
2193 | int orinoco_if_add(struct orinoco_private *priv, | 2199 | int orinoco_if_add(struct orinoco_private *priv, |
2194 | unsigned long base_addr, | 2200 | unsigned long base_addr, |
2195 | unsigned int irq) | 2201 | unsigned int irq, |
2202 | const struct net_device_ops *ops) | ||
2196 | { | 2203 | { |
2197 | struct wiphy *wiphy = priv_to_wiphy(priv); | 2204 | struct wiphy *wiphy = priv_to_wiphy(priv); |
2198 | struct wireless_dev *wdev; | 2205 | struct wireless_dev *wdev; |
@@ -2211,12 +2218,17 @@ int orinoco_if_add(struct orinoco_private *priv, | |||
2211 | 2218 | ||
2212 | /* Setup / override net_device fields */ | 2219 | /* Setup / override net_device fields */ |
2213 | dev->ieee80211_ptr = wdev; | 2220 | dev->ieee80211_ptr = wdev; |
2214 | dev->netdev_ops = &orinoco_netdev_ops; | ||
2215 | dev->watchdog_timeo = HZ; /* 1 second timeout */ | 2221 | dev->watchdog_timeo = HZ; /* 1 second timeout */ |
2216 | dev->wireless_handlers = &orinoco_handler_def; | 2222 | dev->wireless_handlers = &orinoco_handler_def; |
2217 | #ifdef WIRELESS_SPY | 2223 | #ifdef WIRELESS_SPY |
2218 | dev->wireless_data = &priv->wireless_data; | 2224 | dev->wireless_data = &priv->wireless_data; |
2219 | #endif | 2225 | #endif |
2226 | /* Default to standard ops if not set */ | ||
2227 | if (ops) | ||
2228 | dev->netdev_ops = ops; | ||
2229 | else | ||
2230 | dev->netdev_ops = &orinoco_netdev_ops; | ||
2231 | |||
2220 | /* we use the default eth_mac_addr for setting the MAC addr */ | 2232 | /* we use the default eth_mac_addr for setting the MAC addr */ |
2221 | 2233 | ||
2222 | /* Reserve space in skb for the SNAP header */ | 2234 | /* Reserve space in skb for the SNAP header */ |
diff --git a/drivers/net/wireless/orinoco/orinoco.h b/drivers/net/wireless/orinoco/orinoco.h index ff6b7b1d421d..f1901d6e6af8 100644 --- a/drivers/net/wireless/orinoco/orinoco.h +++ b/drivers/net/wireless/orinoco/orinoco.h | |||
@@ -190,12 +190,21 @@ extern void free_orinocodev(struct orinoco_private *priv); | |||
190 | extern int orinoco_init(struct orinoco_private *priv); | 190 | extern int orinoco_init(struct orinoco_private *priv); |
191 | extern int orinoco_if_add(struct orinoco_private *priv, | 191 | extern int orinoco_if_add(struct orinoco_private *priv, |
192 | unsigned long base_addr, | 192 | unsigned long base_addr, |
193 | unsigned int irq); | 193 | unsigned int irq, |
194 | const struct net_device_ops *ops); | ||
194 | extern void orinoco_if_del(struct orinoco_private *priv); | 195 | extern void orinoco_if_del(struct orinoco_private *priv); |
195 | extern int orinoco_up(struct orinoco_private *priv); | 196 | extern int orinoco_up(struct orinoco_private *priv); |
196 | extern void orinoco_down(struct orinoco_private *priv); | 197 | extern void orinoco_down(struct orinoco_private *priv); |
197 | extern irqreturn_t orinoco_interrupt(int irq, void *dev_id); | 198 | extern irqreturn_t orinoco_interrupt(int irq, void *dev_id); |
198 | 199 | ||
200 | /* Common ndo functions exported for reuse by orinoco_usb */ | ||
201 | int orinoco_open(struct net_device *dev); | ||
202 | int orinoco_stop(struct net_device *dev); | ||
203 | struct net_device_stats *orinoco_get_stats(struct net_device *dev); | ||
204 | void orinoco_set_multicast_list(struct net_device *dev); | ||
205 | int orinoco_change_mtu(struct net_device *dev, int new_mtu); | ||
206 | void orinoco_tx_timeout(struct net_device *dev); | ||
207 | |||
199 | /********************************************************************/ | 208 | /********************************************************************/ |
200 | /* Locking and synchronization functions */ | 209 | /* Locking and synchronization functions */ |
201 | /********************************************************************/ | 210 | /********************************************************************/ |
diff --git a/drivers/net/wireless/orinoco/orinoco_cs.c b/drivers/net/wireless/orinoco/orinoco_cs.c index fdc961379170..525f74e68294 100644 --- a/drivers/net/wireless/orinoco/orinoco_cs.c +++ b/drivers/net/wireless/orinoco/orinoco_cs.c | |||
@@ -296,7 +296,7 @@ orinoco_cs_config(struct pcmcia_device *link) | |||
296 | 296 | ||
297 | /* Register an interface with the stack */ | 297 | /* Register an interface with the stack */ |
298 | if (orinoco_if_add(priv, link->io.BasePort1, | 298 | if (orinoco_if_add(priv, link->io.BasePort1, |
299 | link->irq.AssignedIRQ) != 0) { | 299 | link->irq.AssignedIRQ, NULL) != 0) { |
300 | printk(KERN_ERR PFX "orinoco_if_add() failed\n"); | 300 | printk(KERN_ERR PFX "orinoco_if_add() failed\n"); |
301 | goto failed; | 301 | goto failed; |
302 | } | 302 | } |
diff --git a/drivers/net/wireless/orinoco/orinoco_nortel.c b/drivers/net/wireless/orinoco/orinoco_nortel.c index 075f446b3139..bc3ea0b67a4f 100644 --- a/drivers/net/wireless/orinoco/orinoco_nortel.c +++ b/drivers/net/wireless/orinoco/orinoco_nortel.c | |||
@@ -220,7 +220,7 @@ static int orinoco_nortel_init_one(struct pci_dev *pdev, | |||
220 | goto fail; | 220 | goto fail; |
221 | } | 221 | } |
222 | 222 | ||
223 | err = orinoco_if_add(priv, 0, 0); | 223 | err = orinoco_if_add(priv, 0, 0, NULL); |
224 | if (err) { | 224 | if (err) { |
225 | printk(KERN_ERR PFX "orinoco_if_add() failed\n"); | 225 | printk(KERN_ERR PFX "orinoco_if_add() failed\n"); |
226 | goto fail; | 226 | goto fail; |
diff --git a/drivers/net/wireless/orinoco/orinoco_pci.c b/drivers/net/wireless/orinoco/orinoco_pci.c index bda5317cc596..468197f86673 100644 --- a/drivers/net/wireless/orinoco/orinoco_pci.c +++ b/drivers/net/wireless/orinoco/orinoco_pci.c | |||
@@ -170,7 +170,7 @@ static int orinoco_pci_init_one(struct pci_dev *pdev, | |||
170 | goto fail; | 170 | goto fail; |
171 | } | 171 | } |
172 | 172 | ||
173 | err = orinoco_if_add(priv, 0, 0); | 173 | err = orinoco_if_add(priv, 0, 0, NULL); |
174 | if (err) { | 174 | if (err) { |
175 | printk(KERN_ERR PFX "orinoco_if_add() failed\n"); | 175 | printk(KERN_ERR PFX "orinoco_if_add() failed\n"); |
176 | goto fail; | 176 | goto fail; |
diff --git a/drivers/net/wireless/orinoco/orinoco_plx.c b/drivers/net/wireless/orinoco/orinoco_plx.c index e0d5874ab42f..9358f4d2307b 100644 --- a/drivers/net/wireless/orinoco/orinoco_plx.c +++ b/drivers/net/wireless/orinoco/orinoco_plx.c | |||
@@ -259,7 +259,7 @@ static int orinoco_plx_init_one(struct pci_dev *pdev, | |||
259 | goto fail; | 259 | goto fail; |
260 | } | 260 | } |
261 | 261 | ||
262 | err = orinoco_if_add(priv, 0, 0); | 262 | err = orinoco_if_add(priv, 0, 0, NULL); |
263 | if (err) { | 263 | if (err) { |
264 | printk(KERN_ERR PFX "orinoco_if_add() failed\n"); | 264 | printk(KERN_ERR PFX "orinoco_if_add() failed\n"); |
265 | goto fail; | 265 | goto fail; |
diff --git a/drivers/net/wireless/orinoco/orinoco_tmd.c b/drivers/net/wireless/orinoco/orinoco_tmd.c index 88cbc7902aa0..784605f0af15 100644 --- a/drivers/net/wireless/orinoco/orinoco_tmd.c +++ b/drivers/net/wireless/orinoco/orinoco_tmd.c | |||
@@ -156,7 +156,7 @@ static int orinoco_tmd_init_one(struct pci_dev *pdev, | |||
156 | goto fail; | 156 | goto fail; |
157 | } | 157 | } |
158 | 158 | ||
159 | err = orinoco_if_add(priv, 0, 0); | 159 | err = orinoco_if_add(priv, 0, 0, NULL); |
160 | if (err) { | 160 | if (err) { |
161 | printk(KERN_ERR PFX "orinoco_if_add() failed\n"); | 161 | printk(KERN_ERR PFX "orinoco_if_add() failed\n"); |
162 | goto fail; | 162 | goto fail; |
diff --git a/drivers/net/wireless/orinoco/spectrum_cs.c b/drivers/net/wireless/orinoco/spectrum_cs.c index 59bda240fdc2..77b58717d185 100644 --- a/drivers/net/wireless/orinoco/spectrum_cs.c +++ b/drivers/net/wireless/orinoco/spectrum_cs.c | |||
@@ -374,7 +374,7 @@ spectrum_cs_config(struct pcmcia_device *link) | |||
374 | 374 | ||
375 | /* Register an interface with the stack */ | 375 | /* Register an interface with the stack */ |
376 | if (orinoco_if_add(priv, link->io.BasePort1, | 376 | if (orinoco_if_add(priv, link->io.BasePort1, |
377 | link->irq.AssignedIRQ) != 0) { | 377 | link->irq.AssignedIRQ, NULL) != 0) { |
378 | printk(KERN_ERR PFX "orinoco_if_add() failed\n"); | 378 | printk(KERN_ERR PFX "orinoco_if_add() failed\n"); |
379 | goto failed; | 379 | goto failed; |
380 | } | 380 | } |