]> bbs.cooldavid.org Git - net-next-2.6.git/commitdiff
orinoco: allow driver to specify netdev_ops
authorDavid Kilroy <kilroyd@googlemail.com>
Sat, 1 May 2010 13:05:39 +0000 (14:05 +0100)
committerJohn W. Linville <linville@tuxdriver.com>
Mon, 3 May 2010 18:53:06 +0000 (14:53 -0400)
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>
drivers/net/wireless/orinoco/airport.c
drivers/net/wireless/orinoco/main.c
drivers/net/wireless/orinoco/orinoco.h
drivers/net/wireless/orinoco/orinoco_cs.c
drivers/net/wireless/orinoco/orinoco_nortel.c
drivers/net/wireless/orinoco/orinoco_pci.c
drivers/net/wireless/orinoco/orinoco_plx.c
drivers/net/wireless/orinoco/orinoco_tmd.c
drivers/net/wireless/orinoco/spectrum_cs.c

index ea23c4fdbf62374e1c92eded04ec9ffa93c0773a..7dac5adb6c1c9e73689d817b6739d3ce8956ae86 100644 (file)
@@ -210,7 +210,7 @@ airport_attach(struct macio_dev *mdev, const struct of_device_id *match)
        }
 
        /* Register an interface with the stack */
-       if (orinoco_if_add(priv, phys_addr, card->irq) != 0) {
+       if (orinoco_if_add(priv, phys_addr, card->irq, NULL) != 0) {
                printk(KERN_ERR PFX "orinoco_if_add() failed\n");
                goto failed;
        }
index d90951f731ef1f04b4000faeb2260203f558c106..7acb6bc3ebffec31d4fba242d7a4ef2f5488014c 100644 (file)
@@ -253,7 +253,7 @@ void set_port_type(struct orinoco_private *priv)
 /* Device methods                                                   */
 /********************************************************************/
 
-static int orinoco_open(struct net_device *dev)
+int orinoco_open(struct net_device *dev)
 {
        struct orinoco_private *priv = ndev_priv(dev);
        unsigned long flags;
@@ -271,8 +271,9 @@ static int orinoco_open(struct net_device *dev)
 
        return err;
 }
+EXPORT_SYMBOL(orinoco_open);
 
-static int orinoco_stop(struct net_device *dev)
+int orinoco_stop(struct net_device *dev)
 {
        struct orinoco_private *priv = ndev_priv(dev);
        int err = 0;
@@ -290,15 +291,17 @@ static int orinoco_stop(struct net_device *dev)
 
        return err;
 }
+EXPORT_SYMBOL(orinoco_stop);
 
-static struct net_device_stats *orinoco_get_stats(struct net_device *dev)
+struct net_device_stats *orinoco_get_stats(struct net_device *dev)
 {
        struct orinoco_private *priv = ndev_priv(dev);
 
        return &priv->stats;
 }
+EXPORT_SYMBOL(orinoco_get_stats);
 
-static void orinoco_set_multicast_list(struct net_device *dev)
+void orinoco_set_multicast_list(struct net_device *dev)
 {
        struct orinoco_private *priv = ndev_priv(dev);
        unsigned long flags;
@@ -312,8 +315,9 @@ static void orinoco_set_multicast_list(struct net_device *dev)
        __orinoco_set_multicast_list(dev);
        orinoco_unlock(priv, &flags);
 }
+EXPORT_SYMBOL(orinoco_set_multicast_list);
 
-static int orinoco_change_mtu(struct net_device *dev, int new_mtu)
+int orinoco_change_mtu(struct net_device *dev, int new_mtu)
 {
        struct orinoco_private *priv = ndev_priv(dev);
 
@@ -329,6 +333,7 @@ static int orinoco_change_mtu(struct net_device *dev, int new_mtu)
 
        return 0;
 }
+EXPORT_SYMBOL(orinoco_change_mtu);
 
 /********************************************************************/
 /* Tx path                                                          */
@@ -614,7 +619,7 @@ static void __orinoco_ev_txexc(struct net_device *dev, hermes_t *hw)
        netif_wake_queue(dev);
 }
 
-static void orinoco_tx_timeout(struct net_device *dev)
+void orinoco_tx_timeout(struct net_device *dev)
 {
        struct orinoco_private *priv = ndev_priv(dev);
        struct net_device_stats *stats = &priv->stats;
@@ -629,6 +634,7 @@ static void orinoco_tx_timeout(struct net_device *dev)
 
        schedule_work(&priv->reset_work);
 }
+EXPORT_SYMBOL(orinoco_tx_timeout);
 
 /********************************************************************/
 /* Rx path (data frames)                                            */
@@ -2192,7 +2198,8 @@ EXPORT_SYMBOL(alloc_orinocodev);
  */
 int orinoco_if_add(struct orinoco_private *priv,
                   unsigned long base_addr,
-                  unsigned int irq)
+                  unsigned int irq,
+                  const struct net_device_ops *ops)
 {
        struct wiphy *wiphy = priv_to_wiphy(priv);
        struct wireless_dev *wdev;
@@ -2211,12 +2218,17 @@ int orinoco_if_add(struct orinoco_private *priv,
 
        /* Setup / override net_device fields */
        dev->ieee80211_ptr = wdev;
-       dev->netdev_ops = &orinoco_netdev_ops;
        dev->watchdog_timeo = HZ; /* 1 second timeout */
        dev->wireless_handlers = &orinoco_handler_def;
 #ifdef WIRELESS_SPY
        dev->wireless_data = &priv->wireless_data;
 #endif
+       /* Default to standard ops if not set */
+       if (ops)
+               dev->netdev_ops = ops;
+       else
+               dev->netdev_ops = &orinoco_netdev_ops;
+
        /* we use the default eth_mac_addr for setting the MAC addr */
 
        /* Reserve space in skb for the SNAP header */
index ff6b7b1d421d10fe72c758a812e09d1e67ebbfbd..f1901d6e6af8e71c3f1dfa8633ea35005c9d9760 100644 (file)
@@ -190,12 +190,21 @@ extern void free_orinocodev(struct orinoco_private *priv);
 extern int orinoco_init(struct orinoco_private *priv);
 extern int orinoco_if_add(struct orinoco_private *priv,
                          unsigned long base_addr,
-                         unsigned int irq);
+                         unsigned int irq,
+                         const struct net_device_ops *ops);
 extern void orinoco_if_del(struct orinoco_private *priv);
 extern int orinoco_up(struct orinoco_private *priv);
 extern void orinoco_down(struct orinoco_private *priv);
 extern irqreturn_t orinoco_interrupt(int irq, void *dev_id);
 
+/* Common ndo functions exported for reuse by orinoco_usb */
+int orinoco_open(struct net_device *dev);
+int orinoco_stop(struct net_device *dev);
+struct net_device_stats *orinoco_get_stats(struct net_device *dev);
+void orinoco_set_multicast_list(struct net_device *dev);
+int orinoco_change_mtu(struct net_device *dev, int new_mtu);
+void orinoco_tx_timeout(struct net_device *dev);
+
 /********************************************************************/
 /* Locking and synchronization functions                            */
 /********************************************************************/
index fdc961379170b30b4a5571ee422a16b00cf9c74b..525f74e68294785af20e3d88c936e0c2c3a99738 100644 (file)
@@ -296,7 +296,7 @@ orinoco_cs_config(struct pcmcia_device *link)
 
        /* Register an interface with the stack */
        if (orinoco_if_add(priv, link->io.BasePort1,
-                          link->irq.AssignedIRQ) != 0) {
+                          link->irq.AssignedIRQ, NULL) != 0) {
                printk(KERN_ERR PFX "orinoco_if_add() failed\n");
                goto failed;
        }
index 075f446b3139269cd0e492dd17fcba6c65fe19c8..bc3ea0b67a4f8ec83eb62f283455bdf4b05034af 100644 (file)
@@ -220,7 +220,7 @@ static int orinoco_nortel_init_one(struct pci_dev *pdev,
                goto fail;
        }
 
-       err = orinoco_if_add(priv, 0, 0);
+       err = orinoco_if_add(priv, 0, 0, NULL);
        if (err) {
                printk(KERN_ERR PFX "orinoco_if_add() failed\n");
                goto fail;
index bda5317cc596038c91f2e966c94c69185c9a1ac6..468197f86673e3b0569e993218d96ac257f44c04 100644 (file)
@@ -170,7 +170,7 @@ static int orinoco_pci_init_one(struct pci_dev *pdev,
                goto fail;
        }
 
-       err = orinoco_if_add(priv, 0, 0);
+       err = orinoco_if_add(priv, 0, 0, NULL);
        if (err) {
                printk(KERN_ERR PFX "orinoco_if_add() failed\n");
                goto fail;
index e0d5874ab42fb9090ccaad1fa3e39e882ce4acef..9358f4d2307bb19265f462227bc3c8dd81ace14e 100644 (file)
@@ -259,7 +259,7 @@ static int orinoco_plx_init_one(struct pci_dev *pdev,
                goto fail;
        }
 
-       err = orinoco_if_add(priv, 0, 0);
+       err = orinoco_if_add(priv, 0, 0, NULL);
        if (err) {
                printk(KERN_ERR PFX "orinoco_if_add() failed\n");
                goto fail;
index 88cbc7902aa0a1e5c31de5a6b66534babbed8561..784605f0af157e193c6f99e5eab5d0ce2afa3d29 100644 (file)
@@ -156,7 +156,7 @@ static int orinoco_tmd_init_one(struct pci_dev *pdev,
                goto fail;
        }
 
-       err = orinoco_if_add(priv, 0, 0);
+       err = orinoco_if_add(priv, 0, 0, NULL);
        if (err) {
                printk(KERN_ERR PFX "orinoco_if_add() failed\n");
                goto fail;
index 59bda240fdc228712490e6dfe7a0bea1d0b4c3f4..77b58717d18589053c0dd4e5a437bfaaa1d7eaf7 100644 (file)
@@ -374,7 +374,7 @@ spectrum_cs_config(struct pcmcia_device *link)
 
        /* Register an interface with the stack */
        if (orinoco_if_add(priv, link->io.BasePort1,
-                          link->irq.AssignedIRQ) != 0) {
+                          link->irq.AssignedIRQ, NULL) != 0) {
                printk(KERN_ERR PFX "orinoco_if_add() failed\n");
                goto failed;
        }