aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/orinoco/main.c
diff options
context:
space:
mode:
authorDavid Kilroy <kilroyd@googlemail.com>2010-05-01 09:05:39 -0400
committerJohn W. Linville <linville@tuxdriver.com>2010-05-03 14:53:06 -0400
commit593ef09c9e70c92c0d76c67a1c03a5d44d3aec82 (patch)
treef15d00aa6ce35d3da828003b209cd4077cbadcec /drivers/net/wireless/orinoco/main.c
parentb42f2074dedef559ecf72dce61a6501f9f9b273a (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/net/wireless/orinoco/main.c')
-rw-r--r--drivers/net/wireless/orinoco/main.c28
1 files changed, 20 insertions, 8 deletions
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
256static int orinoco_open(struct net_device *dev) 256int 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}
274EXPORT_SYMBOL(orinoco_open);
274 275
275static int orinoco_stop(struct net_device *dev) 276int 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}
294EXPORT_SYMBOL(orinoco_stop);
293 295
294static struct net_device_stats *orinoco_get_stats(struct net_device *dev) 296struct 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}
302EXPORT_SYMBOL(orinoco_get_stats);
300 303
301static void orinoco_set_multicast_list(struct net_device *dev) 304void 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}
318EXPORT_SYMBOL(orinoco_set_multicast_list);
315 319
316static int orinoco_change_mtu(struct net_device *dev, int new_mtu) 320int 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}
336EXPORT_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
617static void orinoco_tx_timeout(struct net_device *dev) 622void 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}
637EXPORT_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 */
2193int orinoco_if_add(struct orinoco_private *priv, 2199int 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 */