From d7200a17cf787767dfe91ffba47a463301bc1ebf Mon Sep 17 00:00:00 2001 From: "Luis R. Rodriguez" Date: Tue, 4 May 2010 16:46:11 -0700 Subject: [PATCH] compat-wireless: make use of new netdev_attach_ops() for orinoco This is an example of how to use this stuff and how much code it can save when backporting the net_device_ops. Signed-off-by: Luis R. Rodriguez --- patches/01-netdev.patch | 43 ++++++++++------------------------------- patches/24-pcmcia.patch | 10 +++++----- 2 files changed, 15 insertions(+), 38 deletions(-) diff --git a/patches/01-netdev.patch b/patches/01-netdev.patch index 01dbbceca26e..91fb7022c029 100644 --- a/patches/01-netdev.patch +++ b/patches/01-netdev.patch @@ -575,41 +575,18 @@ without creating a headache on maintenance of the pathes. dev->tx_queue_len = 0; --- a/drivers/net/wireless/orinoco/main.c +++ b/drivers/net/wireless/orinoco/main.c -@@ -2078,6 +2078,7 @@ int orinoco_init(struct orinoco_private - } - EXPORT_SYMBOL(orinoco_init); - -+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29)) - static const struct net_device_ops orinoco_netdev_ops = { - .ndo_open = orinoco_open, - .ndo_stop = orinoco_stop, -@@ -2089,6 +2090,7 @@ static const struct net_device_ops orino - .ndo_tx_timeout = orinoco_tx_timeout, - .ndo_get_stats = orinoco_get_stats, - }; -+#endif +@@ -2228,9 +2228,9 @@ + #endif + /* Default to standard ops if not set */ + if (ops) +- dev->netdev_ops = ops; ++ netdev_attach_ops(dev, ops); + else +- dev->netdev_ops = &orinoco_netdev_ops; ++ netdev_attach_ops(dev, &orinoco_netdev_ops); - /* Allocate private data. - * -@@ -2211,7 +2213,18 @@ int orinoco_if_add(struct orinoco_privat + /* we use the default eth_mac_addr for setting the MAC addr */ - /* Setup / override net_device fields */ - dev->ieee80211_ptr = wdev; -+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29)) - dev->netdev_ops = &orinoco_netdev_ops; -+#else -+ dev->open = orinoco_open; -+ dev->stop = orinoco_stop; -+ dev->hard_start_xmit = orinoco_xmit; -+ dev->set_multicast_list = orinoco_set_multicast_list; -+ dev->change_mtu = orinoco_change_mtu; -+ dev->set_mac_address = eth_mac_addr; -+ dev->tx_timeout = orinoco_tx_timeout; -+ dev->get_stats = orinoco_get_stats; -+#endif - dev->watchdog_timeo = HZ; /* 1 second timeout */ - dev->wireless_handlers = &orinoco_handler_def; - #ifdef WIRELESS_SPY --- a/net/bluetooth/bnep/netdev.c +++ b/net/bluetooth/bnep/netdev.c @@ -168,8 +168,12 @@ static inline int bnep_net_proto_filter( diff --git a/patches/24-pcmcia.patch b/patches/24-pcmcia.patch index 283b30d61da3..3bc395d0e94f 100644 --- a/patches/24-pcmcia.patch +++ b/patches/24-pcmcia.patch @@ -251,9 +251,9 @@ /* Register an interface with the stack */ if (orinoco_if_add(priv, link->io.BasePort1, +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35)) - link->irq) != 0) { + link->irq, NULL) != 0) { +#else -+ link->irq.AssignedIRQ) != 0) { ++ link->irq.AssignedIRQ, NULL) != 0) { +#endif printk(KERN_ERR PFX "orinoco_if_add() failed\n"); goto failed; @@ -285,14 +285,14 @@ if (ret) goto failed; -@@ -359,7 +369,11 @@ spectrum_cs_config(struct pcmcia_device +@@ -360,7 +370,11 @@ spectrum_cs_config(struct pcmcia_device /* Register an interface with the stack */ if (orinoco_if_add(priv, link->io.BasePort1, +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35)) - link->irq) != 0) { + link->irq, NULL) != 0) { +#else -+ link->irq.AssignedIRQ) != 0) { ++ link->irq.AssignedIRQ, NULL) != 0) { +#endif printk(KERN_ERR PFX "orinoco_if_add() failed\n"); goto failed; -- 2.30.2