initial changes for handling compat.diff
authorLuis R. Rodriguez <lrodriguez@atheros.com>
Tue, 4 Aug 2009 18:00:32 +0000 (11:00 -0700)
committerLuis R. Rodriguez <lrodriguez@atheros.com>
Tue, 4 Aug 2009 18:00:32 +0000 (11:00 -0700)
We change the way we deal with backport patches.
We used to just apply compat/compat.diff but this
can grow in size as we move on through kernels and
maintaining can be painful. To ease with its
maintenance and review of patches we add add
the patches onto their own directory and separate
them based on the functional nature of the patch.

We add 3 files for now:

01-netdev-ops.patch
02-ksize.patch
03-rfkill.patch

This reflects better what each patch addresses.

While at it update the hunks necessary to apply
cleanly as of wirless-testing master-2009-08-04.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
compat/compat.diff
compat/diffs/01-netdev-ops.patch [new file with mode: 0644]
compat/diffs/02-ksize.patch [new file with mode: 0644]
compat/diffs/03-rfkill.patch [new file with mode: 0644]
scripts/admin-update.sh

index 6081970d47db89c00b03b8d6ed1a4b6e05d324a9..82cb8f65e6244b71181eaceda17f66ee804593dd 100644 (file)
 -obj-$(CONFIG_USB_NET_INT51X1) += int51x1.o
 -obj-$(CONFIG_USB_CDC_PHONET)  += cdc-phonet.o
  
---- a/drivers/net/usb/rndis_host.c
-+++ b/drivers/net/usb/rndis_host.c
-@@ -266,6 +266,7 @@ response_error:
-       return -EDOM;
- }
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29))
- /* same as usbnet_netdev_ops but MTU change not allowed */
- static const struct net_device_ops rndis_netdev_ops = {
-       .ndo_open               = usbnet_open,
-@@ -275,6 +276,7 @@ static const struct net_device_ops rndis_netdev_ops = {
-       .ndo_set_mac_address    = eth_mac_addr,
-       .ndo_validate_addr      = eth_validate_addr,
- };
-+#endif
- int
- generic_rndis_bind(struct usbnet *dev, struct usb_interface *intf, int flags)
-@@ -337,7 +339,11 @@ generic_rndis_bind(struct usbnet *dev, struct usb_interface *intf, int flags)
-       dev->rx_urb_size &= ~(dev->maxpacket - 1);
-       u.init->max_transfer_size = cpu_to_le32(dev->rx_urb_size);
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29))
-       net->netdev_ops = &rndis_netdev_ops;
-+#else
-+      net->change_mtu = NULL;
-+#endif
-       retval = rndis_command(dev, u.header, CONTROL_BUFFER_SIZE);
-       if (unlikely(retval < 0)) {
---- a/drivers/net/usb/usbnet.c 2009-07-02 00:16:46.300294574 -0700
-+++ b/drivers/net/usb/usbnet.c 2009-07-02 00:20:34.717101235 -0700
-@@ -1151,6 +1151,7 @@
- }
- EXPORT_SYMBOL_GPL(usbnet_disconnect);
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29))
- static const struct net_device_ops usbnet_netdev_ops = {
-       .ndo_open               = usbnet_open,
-       .ndo_stop               = usbnet_stop,
-@@ -1160,6 +1161,7 @@
-       .ndo_set_mac_address    = eth_mac_addr,
-       .ndo_validate_addr      = eth_validate_addr,
- };
-+#endif
- /*-------------------------------------------------------------------------*/
-@@ -1229,7 +1231,15 @@
-               net->features |= NETIF_F_HIGHDMA;
- #endif
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29))
-       net->netdev_ops = &usbnet_netdev_ops;
-+#else
-+      net->change_mtu = usbnet_change_mtu;
-+      net->hard_start_xmit = usbnet_start_xmit;
-+      net->open = usbnet_open;
-+      net->stop = usbnet_stop;
-+      net->tx_timeout = usbnet_tx_timeout;
-+#endif
-       net->watchdog_timeo = TX_TIMEOUT_JIFFIES;
-       net->ethtool_ops = &usbnet_ethtool_ops;
 --- a/net/wireless/Makefile
 +++ b/net/wireless/Makefile
 @@ -10,3 +10,11 @@ cfg80211-$(CONFIG_CFG80211_DEBUGFS) += debugfs.o
        dev->destructor = free_netdev;
        ether_setup(dev);
        dev->tx_queue_len = 0;
---- a/drivers/net/wireless/rndis_wlan.c
-+++ b/drivers/net/wireless/rndis_wlan.c
-@@ -2335,6 +2335,7 @@ static int bcm4320b_early_init(struct usbnet *usbdev)
-       return 0;
- }
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29))
- /* same as rndis_netdev_ops but with local multicast handler */
- static const struct net_device_ops rndis_wlan_netdev_ops = {
-       .ndo_open               = usbnet_open,
-@@ -2345,6 +2346,7 @@ static const struct net_device_ops rndis_wlan_netdev_ops = {
-       .ndo_validate_addr      = eth_validate_addr,
-       .ndo_set_multicast_list = rndis_wlan_set_multicast_list,
- };
-+#endif
- static int rndis_wlan_bind(struct usbnet *usbdev, struct usb_interface *intf)
-@@ -2395,7 +2397,11 @@ static int rndis_wlan_bind(struct usbnet *usbdev, struct usb_interface *intf)
-        * rndis_host wants to avoid all OID as much as possible
-        * so do promisc/multicast handling in rndis_wlan.
-        */
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29))
-       usbdev->net->netdev_ops = &rndis_wlan_netdev_ops;
-+#else
-+      usbdev->net->set_multicast_list = rndis_wlan_set_multicast_list;
-+#endif
-       tmp = RNDIS_PACKET_TYPE_DIRECTED | RNDIS_PACKET_TYPE_BROADCAST;
-       retval = rndis_set_oid(usbdev, OID_GEN_CURRENT_PACKET_FILTER, &tmp,
 --- a/drivers/net/wireless/wl12xx/wl1251_main.c
 +++ b/drivers/net/wireless/wl12xx/wl1251_main.c
 @@ -26,6 +26,9 @@
  #include <linux/spi/spi.h>
  
  #include "wl1251.h"
---- a/include/linux/rfkill_backport.h  2009-07-08 19:34:26.145290692 -0700
-+++ b/include/linux/rfkill_backport.h  2009-07-08 23:33:04.501218904 -0700
-@@ -23,6 +23,7 @@
-  */
- #include <linux/types.h>
-+#include <net/compat.h>
- /* define userspace visible states */
- #define RFKILL_STATE_SOFT_BLOCKED     0
-@@ -147,7 +148,7 @@ struct rfkill_ops {
-       int     (*set_block)(void *data, bool blocked);
- };
--#if defined(CONFIG_RFKILL) || defined(CONFIG_RFKILL_MODULE)
-+#if defined(CONFIG_RFKILL_BACKPORT) || defined(CONFIG_RFKILL_MODULE_BACKPORT)
- /**
-  * rfkill_alloc - allocate rfkill structure
-  * @name: name of the struct -- the string is not copied internally
 --- a/include/net/cfg80211.h
 +++ b/include/net/cfg80211.h
 @@ -23,6 +23,7 @@
 +#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,30))
  #include <trace/define_trace.h>
 +#endif /* (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,30)) */
---- a/net/mac80211/iface.c     2009-07-27 13:03:30.589047026 -0700
-+++ b/net/mac80211/iface.c     2009-07-27 14:39:46.521397084 -0700
-@@ -660,6 +660,7 @@ static void ieee80211_teardown_sdata(str
-       WARN_ON(flushed);
- }
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29))
- static const struct net_device_ops ieee80211_dataif_ops = {
-       .ndo_open               = ieee80211_open,
-       .ndo_stop               = ieee80211_stop,
-@@ -679,11 +680,22 @@ static const struct net_device_ops ieee8
-       .ndo_change_mtu         = ieee80211_change_mtu,
-       .ndo_set_mac_address    = eth_mac_addr,
- };
-+#endif
- static void ieee80211_if_setup(struct net_device *dev)
- {
-       ether_setup(dev);
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29))
-       dev->netdev_ops = &ieee80211_dataif_ops;
-+#else
-+      dev->hard_start_xmit = ieee80211_subif_start_xmit;
-+      dev->set_multicast_list = ieee80211_set_multicast_list;
-+      dev->change_mtu = ieee80211_change_mtu;
-+      dev->open = ieee80211_open;
-+      dev->stop = ieee80211_stop;
-+      /* we will validate the address ourselves in ->open */
-+      dev->validate_addr = NULL;
-+#endif
-       dev->destructor = free_netdev;
- }
-@@ -698,7 +710,11 @@ static void ieee80211_setup_sdata(struct
-       /* and set some type-dependent values */
-       sdata->vif.type = type;
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29))
-       sdata->dev->netdev_ops = &ieee80211_dataif_ops;
-+#else
-+      sdata->dev->hard_start_xmit = ieee80211_subif_start_xmit;
-+#endif
-       sdata->wdev.iftype = type;
-       /* only monitor differs */
-@@ -721,7 +737,11 @@ static void ieee80211_setup_sdata(struct
-               break;
-       case NL80211_IFTYPE_MONITOR:
-               sdata->dev->type = ARPHRD_IEEE80211_RADIOTAP;
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29))
-               sdata->dev->netdev_ops = &ieee80211_monitorif_ops;
-+#else
-+              sdata->dev->hard_start_xmit = ieee80211_monitor_start_xmit;
-+#endif
-               sdata->u.mntr_flags = MONITOR_FLAG_CONTROL |
-                                     MONITOR_FLAG_OTHER_BSS;
-               break;
-@@ -788,6 +808,8 @@ int ieee80211_if_add(struct ieee80211_lo
-               return -ENOMEM;
-       dev_net_set(ndev, wiphy_net(local->hw.wiphy));
-+/* This is an optimization, just ignore for older kernels */
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,26))
-       ndev->needed_headroom = local->tx_headroom +
-                               4*6 /* four MAC addresses */
-                               + 2 + 2 + 2 + 2 /* ctl, dur, seq, qos */
-@@ -796,6 +818,7 @@ int ieee80211_if_add(struct ieee80211_lo
-                               - ETH_HLEN /* ethernet hard_header_len */
-                               + IEEE80211_ENCRYPT_HEADROOM;
-       ndev->needed_tailroom = IEEE80211_ENCRYPT_TAILROOM;
-+#endif
-       ret = dev_alloc_name(ndev, ndev->name);
-       if (ret < 0)
-@@ -828,6 +851,10 @@ int ieee80211_if_add(struct ieee80211_lo
-       if (ret)
-               goto fail;
-+#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,28))
-+      ndev->uninit = ieee80211_teardown_sdata;
-+#endif
-+
-       if (ieee80211_vif_is_mesh(&sdata->vif) &&
-           params && params->mesh_id_len)
-               ieee80211_sdata_set_mesh_id(sdata,
 --- a/net/mac80211/key.c
 +++ b/net/mac80211/key.c
 @@ -21,6 +21,9 @@
 +rfkill_backport-y                     += core.o
 +rfkill_backport-$(CONFIG_RFKILL_BACKPORT_INPUT)       += input.o
 +obj-$(CONFIG_RFKILL_BACKPORT)         += rfkill_backport.o
---- a/net/rfkill/core.c        2009-07-21 13:20:20.385938726 -0700
-+++ b/net/rfkill/core.c        2009-07-21 13:20:20.869936904 -0700
-@@ -26,7 +26,7 @@
- #include <linux/capability.h>
- #include <linux/list.h>
- #include <linux/mutex.h>
--#include <linux/rfkill.h>
-+#include <linux/rfkill_backport.h>
- #include <linux/spinlock.h>
- #include <linux/miscdevice.h>
- #include <linux/wait.h>
-@@ -61,7 +61,7 @@
-       const struct rfkill_ops *ops;
-       void                    *data;
--#ifdef CONFIG_RFKILL_LEDS
-+#ifdef CONFIG_RFKILL_BACKPORT_LEDS
-       struct led_trigger      led_trigger;
-       const char              *ledtrigname;
- #endif
-@@ -122,7 +122,7 @@
- static bool rfkill_epo_lock_active;
--#ifdef CONFIG_RFKILL_LEDS
-+#ifdef CONFIG_RFKILL_BACKPORT_LEDS
- static void rfkill_led_trigger_event(struct rfkill *rfkill)
- {
-       struct led_trigger *trigger;
-@@ -316,7 +316,7 @@
-       rfkill_event(rfkill);
- }
--#ifdef CONFIG_RFKILL_INPUT
-+#ifdef CONFIG_RFKILL_BACKPORT_INPUT
- static atomic_t rfkill_input_disabled = ATOMIC_INIT(0);
- /**
-@@ -774,7 +774,7 @@
- }
- static struct class rfkill_class = {
--      .name           = "rfkill",
-+      .name           = "rfkill_backport",
-       .dev_release    = rfkill_release,
-       .dev_attrs      = rfkill_dev_attrs,
-       .dev_uevent     = rfkill_dev_uevent,
-@@ -920,7 +920,7 @@
-       if (!rfkill->persistent || rfkill_epo_lock_active) {
-               schedule_work(&rfkill->sync_work);
-       } else {
--#ifdef CONFIG_RFKILL_INPUT
-+#ifdef CONFIG_RFKILL_BACKPORT_INPUT
-               bool soft_blocked = !!(rfkill->state & RFKILL_BLOCK_SW);
-               if (!atomic_read(&rfkill_input_disabled))
-@@ -1148,7 +1148,7 @@
-       list_for_each_entry_safe(ev, tmp, &data->events, list)
-               kfree(ev);
--#ifdef CONFIG_RFKILL_INPUT
-+#ifdef CONFIG_RFKILL_BACKPORT_INPUT
-       if (data->input_handler)
-               if (atomic_dec_return(&rfkill_input_disabled) == 0)
-                       printk(KERN_DEBUG "rfkill: input handler enabled\n");
-@@ -1159,7 +1159,7 @@
-       return 0;
- }
--#ifdef CONFIG_RFKILL_INPUT
-+#ifdef CONFIG_RFKILL_BACKPORT_INPUT
- static long rfkill_fop_ioctl(struct file *file, unsigned int cmd,
-                            unsigned long arg)
- {
-@@ -1191,14 +1191,14 @@
-       .write          = rfkill_fop_write,
-       .poll           = rfkill_fop_poll,
-       .release        = rfkill_fop_release,
--#ifdef CONFIG_RFKILL_INPUT
-+#ifdef CONFIG_RFKILL_BACKPORT_INPUT
-       .unlocked_ioctl = rfkill_fop_ioctl,
-       .compat_ioctl   = rfkill_fop_ioctl,
- #endif
- };
- static struct miscdevice rfkill_miscdev = {
--      .name   = "rfkill",
-+      .name   = "rfkill_backport",
-       .fops   = &rfkill_fops,
-       .minor  = MISC_DYNAMIC_MINOR,
- };
-@@ -1221,7 +1221,7 @@
-               goto out;
-       }
--#ifdef CONFIG_RFKILL_INPUT
-+#ifdef CONFIG_RFKILL_BACKPORT_INPUT
-       error = rfkill_handler_init();
-       if (error) {
-               misc_deregister(&rfkill_miscdev);
-@@ -1237,7 +1237,7 @@
- static void __exit rfkill_exit(void)
- {
--#ifdef CONFIG_RFKILL_INPUT
-+#ifdef CONFIG_RFKILL_BACKPORT_INPUT
-       rfkill_handler_exit();
- #endif
-       misc_deregister(&rfkill_miscdev);
 --- a/net/rfkill/input.c       2009-07-07 17:27:09.290706860 -0700
 +++ b/net/rfkill/input.c       2009-07-07 17:26:57.195684653 -0700
 @@ -17,7 +17,11 @@
  #include <linux/workqueue.h>
  #include <net/genetlink.h>
  #include <net/cfg80211.h>
---- a/net/wireless/scan.c      2009-07-27 14:42:47.558049856 -0700
-+++ b/net/wireless/scan.c      2009-07-27 14:42:48.118044849 -0700
-@@ -399,7 +399,11 @@ cfg80211_bss_update(struct cfg80211_regi
-                       size_t used = dev->wiphy.bss_priv_size + sizeof(*res);
-                       size_t ielen = res->pub.len_information_elements;
-+#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,28)
-+                      if (0) {
-+#else
-                       if (!found->ies_allocated && ksize(found) >= used + ielen) {
-+#endif
-                               memcpy(found->pub.information_elements,
-                                      res->pub.information_elements, ielen);
-                               found->pub.len_information_elements = ielen;
 --- a/drivers/net/wireless/Makefile    2009-07-06 12:53:07.479194884 -0700
 +++ b/drivers/net/wireless/Makefile    2009-07-06 12:54:42.026195576 -0700
 @@ -5,43 +5,16 @@
  
  #define LBS_DEB_ENTER 0x00000001
  #define LBS_DEB_LEAVE 0x00000002
---- a/net/wireless/wext.c      2009-07-27 15:38:09.989056661 -0700
-+++ b/net/wireless/wext.c      2009-07-27 16:05:06.681045663 -0700
-@@ -1118,8 +1118,13 @@
-                       return private(dev, iwr, cmd, info, handler);
-       }
-       /* Old driver API : call driver ioctl handler */
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29))
-       if (dev->netdev_ops->ndo_do_ioctl)
-               return dev->netdev_ops->ndo_do_ioctl(dev, ifr, cmd);
-+#else
-+      if (dev->do_ioctl)
-+              return dev->do_ioctl(dev, ifr, cmd);
-+#endif
-       return -EOPNOTSUPP;
- }
-@@ -1272,6 +1277,7 @@
- }
- #endif
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32))
- static int __net_init wext_pernet_init(struct net *net)
- {
-       skb_queue_head_init(&net->wext_nlevents);
-@@ -1315,6 +1321,29 @@
- static DECLARE_WORK(wireless_nlevent_work, wireless_nlevent_process);
-+#else
-+/* Older kernels get the old way of doing stuff*/
-+static struct sk_buff_head wireless_nlevent_queue;
-+
-+static int __init wireless_nlevent_init(void)
-+{
-+      skb_queue_head_init(&wireless_nlevent_queue);
-+      return 0;
-+}
-+
-+subsys_initcall(wireless_nlevent_init);
-+
-+static void wireless_nlevent_process(unsigned long data)
-+{
-+      struct sk_buff *skb;
-+      while ((skb = skb_dequeue(&wireless_nlevent_queue)))
-+              rtnl_notify(skb, &init_net, 0, RTNLGRP_LINK, NULL, GFP_ATOMIC);
-+}
-+
-+static DECLARE_TASKLET(wireless_nlevent_tasklet, wireless_nlevent_process, 0);
-+
-+#endif
-+
- static struct nlmsghdr *rtnetlink_ifinfo_prep(struct net_device *dev,
-                                             struct sk_buff *skb)
- {
-@@ -1525,8 +1554,13 @@
-       skb_shinfo(skb)->frag_list = compskb;
- #endif
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32))
-       skb_queue_tail(&dev_net(dev)->wext_nlevents, skb);
-       schedule_work(&wireless_nlevent_work);
-+#else
-+      skb_queue_tail(&wireless_nlevent_queue, skb);
-+      tasklet_schedule(&wireless_nlevent_tasklet);
-+#endif
- }
- EXPORT_SYMBOL(wireless_send_event);
 --- a/net/wireless/nl80211.c   2009-07-27 16:22:30.301045695 -0700
 +++ b/net/wireless/nl80211.c   2009-07-27 18:17:28.445046102 -0700
 @@ -29,7 +29,9 @@
diff --git a/compat/diffs/01-netdev-ops.patch b/compat/diffs/01-netdev-ops.patch
new file mode 100644 (file)
index 0000000..1d90a36
--- /dev/null
@@ -0,0 +1,247 @@
+--- a/drivers/net/usb/rndis_host.c     2009-08-04 10:15:14.237993105 -0700
++++ b/drivers/net/usb/rndis_host.c     2009-08-04 10:15:14.614020995 -0700
+@@ -274,6 +274,7 @@ response_error:
+       return -EDOM;
+ }
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29))
+ /* same as usbnet_netdev_ops but MTU change not allowed */
+ static const struct net_device_ops rndis_netdev_ops = {
+       .ndo_open               = usbnet_open,
+@@ -283,6 +284,7 @@ static const struct net_device_ops rndis
+       .ndo_set_mac_address    = eth_mac_addr,
+       .ndo_validate_addr      = eth_validate_addr,
+ };
++#endif
+ int
+ generic_rndis_bind(struct usbnet *dev, struct usb_interface *intf, int flags)
+@@ -345,7 +347,11 @@ generic_rndis_bind(struct usbnet *dev, s
+       dev->rx_urb_size &= ~(dev->maxpacket - 1);
+       u.init->max_transfer_size = cpu_to_le32(dev->rx_urb_size);
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29))
+       net->netdev_ops = &rndis_netdev_ops;
++#else
++      net->change_mtu = NULL;
++#endif
+       retval = rndis_command(dev, u.header, CONTROL_BUFFER_SIZE);
+       if (unlikely(retval < 0)) {
+--- a/drivers/net/usb/usbnet.c 2009-08-04 10:28:16.310023000 -0700
++++ b/drivers/net/usb/usbnet.c 2009-08-04 10:28:16.410010646 -0700
+@@ -1155,6 +1155,7 @@
+ }
+ EXPORT_SYMBOL_GPL(usbnet_disconnect);
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29))
+ static const struct net_device_ops usbnet_netdev_ops = {
+       .ndo_open               = usbnet_open,
+       .ndo_stop               = usbnet_stop,
+@@ -1164,6 +1165,7 @@
+       .ndo_set_mac_address    = eth_mac_addr,
+       .ndo_validate_addr      = eth_validate_addr,
+ };
++#endif
+ /*-------------------------------------------------------------------------*/
+@@ -1233,7 +1235,15 @@
+               net->features |= NETIF_F_HIGHDMA;
+ #endif
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29))
+       net->netdev_ops = &usbnet_netdev_ops;
++#else
++      net->change_mtu = usbnet_change_mtu;
++      net->hard_start_xmit = usbnet_start_xmit;
++      net->open = usbnet_open;
++      net->stop = usbnet_stop;
++      net->tx_timeout = usbnet_tx_timeout;
++#endif
+       net->watchdog_timeo = TX_TIMEOUT_JIFFIES;
+       net->ethtool_ops = &usbnet_ethtool_ops;
+--- a/drivers/net/wireless/rndis_wlan.c        2009-08-04 10:34:57.006001381 -0700
++++ b/drivers/net/wireless/rndis_wlan.c        2009-08-04 10:34:57.065996441 -0700
+@@ -2789,6 +2789,7 @@
+       return 0;
+ }
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29))
+ /* same as rndis_netdev_ops but with local multicast handler */
+ static const struct net_device_ops rndis_wlan_netdev_ops = {
+       .ndo_open               = usbnet_open,
+@@ -2799,6 +2800,7 @@
+       .ndo_validate_addr      = eth_validate_addr,
+       .ndo_set_multicast_list = rndis_wlan_set_multicast_list,
+ };
++#endif
+ static int rndis_wlan_bind(struct usbnet *usbdev, struct usb_interface *intf)
+@@ -2849,7 +2851,11 @@
+        * rndis_host wants to avoid all OID as much as possible
+        * so do promisc/multicast handling in rndis_wlan.
+        */
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29))
+       usbdev->net->netdev_ops = &rndis_wlan_netdev_ops;
++#else
++      usbdev->net->set_multicast_list = rndis_wlan_set_multicast_list;
++#endif
+       tmp = RNDIS_PACKET_TYPE_DIRECTED | RNDIS_PACKET_TYPE_BROADCAST;
+       retval = rndis_set_oid(usbdev, OID_GEN_CURRENT_PACKET_FILTER, &tmp,
+--- a/net/mac80211/iface.c     2009-08-04 10:36:02.971020795 -0700
++++ b/net/mac80211/iface.c     2009-08-04 10:36:03.459024595 -0700
+@@ -684,6 +684,7 @@
+       WARN_ON(flushed);
+ }
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29))
+ static const struct net_device_ops ieee80211_dataif_ops = {
+       .ndo_open               = ieee80211_open,
+       .ndo_stop               = ieee80211_stop,
+@@ -703,11 +704,22 @@
+       .ndo_change_mtu         = ieee80211_change_mtu,
+       .ndo_set_mac_address    = eth_mac_addr,
+ };
++#endif
+ static void ieee80211_if_setup(struct net_device *dev)
+ {
+       ether_setup(dev);
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29))
+       dev->netdev_ops = &ieee80211_dataif_ops;
++#else
++      dev->hard_start_xmit = ieee80211_subif_start_xmit;
++      dev->set_multicast_list = ieee80211_set_multicast_list;
++      dev->change_mtu = ieee80211_change_mtu;
++      dev->open = ieee80211_open;
++      dev->stop = ieee80211_stop;
++      /* we will validate the address ourselves in ->open */
++      dev->validate_addr = NULL;
++#endif
+       dev->destructor = free_netdev;
+ }
+@@ -722,7 +734,11 @@
+       /* and set some type-dependent values */
+       sdata->vif.type = type;
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29))
+       sdata->dev->netdev_ops = &ieee80211_dataif_ops;
++#else
++      sdata->dev->hard_start_xmit = ieee80211_subif_start_xmit;
++#endif
+       sdata->wdev.iftype = type;
+       /* only monitor differs */
+@@ -745,7 +761,11 @@
+               break;
+       case NL80211_IFTYPE_MONITOR:
+               sdata->dev->type = ARPHRD_IEEE80211_RADIOTAP;
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29))
+               sdata->dev->netdev_ops = &ieee80211_monitorif_ops;
++#else
++              sdata->dev->hard_start_xmit = ieee80211_monitor_start_xmit;
++#endif
+               sdata->u.mntr_flags = MONITOR_FLAG_CONTROL |
+                                     MONITOR_FLAG_OTHER_BSS;
+               break;
+@@ -812,6 +832,8 @@
+               return -ENOMEM;
+       dev_net_set(ndev, wiphy_net(local->hw.wiphy));
++/* This is an optimization, just ignore for older kernels */
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,26))
+       ndev->needed_headroom = local->tx_headroom +
+                               4*6 /* four MAC addresses */
+                               + 2 + 2 + 2 + 2 /* ctl, dur, seq, qos */
+@@ -820,6 +842,7 @@
+                               - ETH_HLEN /* ethernet hard_header_len */
+                               + IEEE80211_ENCRYPT_HEADROOM;
+       ndev->needed_tailroom = IEEE80211_ENCRYPT_TAILROOM;
++#endif
+       ret = dev_alloc_name(ndev, ndev->name);
+       if (ret < 0)
+@@ -852,6 +875,10 @@
+       if (ret)
+               goto fail;
++#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,28))
++      ndev->uninit = ieee80211_teardown_sdata;
++#endif
++
+       if (ieee80211_vif_is_mesh(&sdata->vif) &&
+           params && params->mesh_id_len)
+               ieee80211_sdata_set_mesh_id(sdata,
+--- a/net/wireless/wext.c      2009-08-04 10:50:33.634995059 -0700
++++ b/net/wireless/wext.c      2009-08-04 10:50:34.175014901 -0700
+@@ -1118,8 +1118,13 @@
+                       return private(dev, iwr, cmd, info, handler);
+       }
+       /* Old driver API : call driver ioctl handler */
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29))
+       if (dev->netdev_ops->ndo_do_ioctl)
+               return dev->netdev_ops->ndo_do_ioctl(dev, ifr, cmd);
++#else
++      if (dev->do_ioctl)
++              return dev->do_ioctl(dev, ifr, cmd);
++#endif
+       return -EOPNOTSUPP;
+ }
+@@ -1272,6 +1277,7 @@
+ }
+ #endif
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32))
+ static int __net_init wext_pernet_init(struct net *net)
+ {
+       skb_queue_head_init(&net->wext_nlevents);
+@@ -1314,6 +1320,29 @@
+ static DECLARE_WORK(wireless_nlevent_work, wireless_nlevent_process);
++#else
++/* Older kernels get the old way of doing stuff*/
++static struct sk_buff_head wireless_nlevent_queue;
++
++static int __init wireless_nlevent_init(void)
++{
++      skb_queue_head_init(&wireless_nlevent_queue);
++      return 0;
++}
++
++subsys_initcall(wireless_nlevent_init);
++
++static void wireless_nlevent_process(unsigned long data)
++{
++      struct sk_buff *skb;
++      while ((skb = skb_dequeue(&wireless_nlevent_queue)))
++              rtnl_notify(skb, &init_net, 0, RTNLGRP_LINK, NULL, GFP_ATOMIC);
++}
++
++static DECLARE_TASKLET(wireless_nlevent_tasklet, wireless_nlevent_process, 0);
++
++#endif
++
+ static struct nlmsghdr *rtnetlink_ifinfo_prep(struct net_device *dev,
+                                             struct sk_buff *skb)
+ {
+@@ -1524,8 +1553,13 @@
+       skb_shinfo(skb)->frag_list = compskb;
+ #endif
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32))
+       skb_queue_tail(&dev_net(dev)->wext_nlevents, skb);
+       schedule_work(&wireless_nlevent_work);
++#else
++      skb_queue_tail(&wireless_nlevent_queue, skb);
++      tasklet_schedule(&wireless_nlevent_tasklet);
++#endif
+ }
+ EXPORT_SYMBOL(wireless_send_event);
diff --git a/compat/diffs/02-ksize.patch b/compat/diffs/02-ksize.patch
new file mode 100644 (file)
index 0000000..0f384cd
--- /dev/null
@@ -0,0 +1,14 @@
+--- a/net/wireless/scan.c      2009-08-04 10:39:49.110993204 -0700
++++ b/net/wireless/scan.c      2009-08-04 10:39:49.619023920 -0700
+@@ -401,7 +401,11 @@
+                       size_t used = dev->wiphy.bss_priv_size + sizeof(*res);
+                       size_t ielen = res->pub.len_information_elements;
++#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,28)
++                      if (0) {
++#else
+                       if (!found->ies_allocated && ksize(found) >= used + ielen) {
++#endif
+                               memcpy(found->pub.information_elements,
+                                      res->pub.information_elements, ielen);
+                               found->pub.len_information_elements = ielen;
diff --git a/compat/diffs/03-rfkill.patch b/compat/diffs/03-rfkill.patch
new file mode 100644 (file)
index 0000000..b81f202
--- /dev/null
@@ -0,0 +1,128 @@
+--- a/net/rfkill/core.c        2009-08-04 10:54:43.078999821 -0700
++++ b/net/rfkill/core.c        2009-08-04 10:54:43.555024585 -0700
+@@ -26,7 +26,7 @@
+ #include <linux/capability.h>
+ #include <linux/list.h>
+ #include <linux/mutex.h>
+-#include <linux/rfkill.h>
++#include <linux/rfkill_backport.h>
+ #include <linux/spinlock.h>
+ #include <linux/miscdevice.h>
+ #include <linux/wait.h>
+@@ -61,7 +61,7 @@
+       const struct rfkill_ops *ops;
+       void                    *data;
+-#ifdef CONFIG_RFKILL_LEDS
++#ifdef CONFIG_RFKILL_BACKPORT_LEDS
+       struct led_trigger      led_trigger;
+       const char              *ledtrigname;
+ #endif
+@@ -122,7 +122,7 @@
+ static bool rfkill_epo_lock_active;
+-#ifdef CONFIG_RFKILL_LEDS
++#ifdef CONFIG_RFKILL_BACKPORT_LEDS
+ static void rfkill_led_trigger_event(struct rfkill *rfkill)
+ {
+       struct led_trigger *trigger;
+@@ -316,7 +316,7 @@
+       rfkill_event(rfkill);
+ }
+-#ifdef CONFIG_RFKILL_INPUT
++#ifdef CONFIG_RFKILL_BACKPORT_INPUT
+ static atomic_t rfkill_input_disabled = ATOMIC_INIT(0);
+ /**
+@@ -776,7 +776,7 @@
+ }
+ static struct class rfkill_class = {
+-      .name           = "rfkill",
++      .name           = "rfkill_backport",
+       .dev_release    = rfkill_release,
+       .dev_attrs      = rfkill_dev_attrs,
+       .dev_uevent     = rfkill_dev_uevent,
+@@ -922,7 +922,7 @@
+       if (!rfkill->persistent || rfkill_epo_lock_active) {
+               schedule_work(&rfkill->sync_work);
+       } else {
+-#ifdef CONFIG_RFKILL_INPUT
++#ifdef CONFIG_RFKILL_BACKPORT_INPUT
+               bool soft_blocked = !!(rfkill->state & RFKILL_BLOCK_SW);
+               if (!atomic_read(&rfkill_input_disabled))
+@@ -1150,7 +1150,7 @@
+       list_for_each_entry_safe(ev, tmp, &data->events, list)
+               kfree(ev);
+-#ifdef CONFIG_RFKILL_INPUT
++#ifdef CONFIG_RFKILL_BACKPORT_INPUT
+       if (data->input_handler)
+               if (atomic_dec_return(&rfkill_input_disabled) == 0)
+                       printk(KERN_DEBUG "rfkill: input handler enabled\n");
+@@ -1161,7 +1161,7 @@
+       return 0;
+ }
+-#ifdef CONFIG_RFKILL_INPUT
++#ifdef CONFIG_RFKILL_BACKPORT_INPUT
+ static long rfkill_fop_ioctl(struct file *file, unsigned int cmd,
+                            unsigned long arg)
+ {
+@@ -1193,14 +1193,14 @@
+       .write          = rfkill_fop_write,
+       .poll           = rfkill_fop_poll,
+       .release        = rfkill_fop_release,
+-#ifdef CONFIG_RFKILL_INPUT
++#ifdef CONFIG_RFKILL_BACKPORT_INPUT
+       .unlocked_ioctl = rfkill_fop_ioctl,
+       .compat_ioctl   = rfkill_fop_ioctl,
+ #endif
+ };
+ static struct miscdevice rfkill_miscdev = {
+-      .name   = "rfkill",
++      .name   = "rfkill_backport",
+       .fops   = &rfkill_fops,
+       .minor  = MISC_DYNAMIC_MINOR,
+ };
+@@ -1223,7 +1223,7 @@
+               goto out;
+       }
+-#ifdef CONFIG_RFKILL_INPUT
++#ifdef CONFIG_RFKILL_BACKPORT_INPUT
+       error = rfkill_handler_init();
+       if (error) {
+               misc_deregister(&rfkill_miscdev);
+@@ -1239,7 +1239,7 @@
+ static void __exit rfkill_exit(void)
+ {
+-#ifdef CONFIG_RFKILL_INPUT
++#ifdef CONFIG_RFKILL_BACKPORT_INPUT
+       rfkill_handler_exit();
+ #endif
+       misc_deregister(&rfkill_miscdev);
+--- a/include/linux/rfkill_backport.h  2009-08-04 10:07:03.242018265 -0700
++++ b/include/linux/rfkill_backport.h  2009-08-04 10:58:40.933996836 -0700
+@@ -23,6 +23,7 @@
+  */
+ #include <linux/types.h>
++#include <net/compat.h>
+ /* define userspace visible states */
+ #define RFKILL_STATE_SOFT_BLOCKED     0
+@@ -148,7 +149,7 @@
+       int     (*set_block)(void *data, bool blocked);
+ };
+-#if defined(CONFIG_RFKILL) || defined(CONFIG_RFKILL_MODULE)
++#if defined(CONFIG_RFKILL_BACKPORT) || defined(CONFIG_RFKILL_MODULE_BACKPORT)
+ /**
+  * rfkill_alloc - allocate rfkill structure
+  * @name: name of the struct -- the string is not copied internally
index acf3d968422a51ff74d369ec98b25868186bb17f..2719affde3dcb8b751e94d17cec53afd49533b8c 100755 (executable)
@@ -164,12 +164,24 @@ cp compat/compat-2.6.*.c net/wireless/
 cp compat/compat-2.6.*.h include/net/
 cp compat/compat.h include/net/
 
+# We'll remove this soon
 patch -p1 -N -t < compat/compat.diff
 RET=$?
 if [[ $RET -ne 0 ]]; then
        echo "Patching compat.diff failed, update it"
        exit $RET
 fi
+
+# This is the new way
+for i in compat/diffs/*.patch; do
+       patch -p1 -N -t < $i
+       RET=$?
+       if [[ $RET -ne 0 ]]; then
+               echo "Patching $i failed, update it"
+               exit $RET
+       fi
+done
+
 DIR="$PWD"
 cd $GIT_TREE
 GIT_DESCRIBE=$(git describe)