From: Luis R. Rodriguez Date: Fri, 11 Dec 2009 00:33:59 +0000 (-0800) Subject: Re-order patch location and compat code X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=1a8c0d67ff56b62d132267fafdd881d69a38ba30;p=openwrt%2Fstaging%2Fblogic.git Re-order patch location and compat code The patches can now go on the top level dir as that is all we ship with. The top level compat/ dir now exists as the home of the copied compat module and we build the compat module there. Signed-off-by: Luis R. Rodriguez --- diff --git a/Makefile b/Makefile index 1658ac88d4f2..c76ec029d03a 100644 --- a/Makefile +++ b/Makefile @@ -19,7 +19,12 @@ include $(M)/$(COMPAT_CONFIG) NOSTDINC_FLAGS := -I$(M)/include/ -include $(M)/include/net/compat.h $(CFLAGS) -obj-y := net/bluetooth/ net/compat/ net/wireless/ net/mac80211/ net/rfkill/ +obj-y := \ + compat/ \ + net/rfkill/ + net/bluetooth/ \ + net/wireless/ net/mac80211/ + ifeq ($(ONLY_CORE),) obj-m += \ drivers/ssb/ \ diff --git a/compat/patches/01-netdev.patch b/compat/patches/01-netdev.patch deleted file mode 100644 index 40a265821f7a..000000000000 --- a/compat/patches/01-netdev.patch +++ /dev/null @@ -1,613 +0,0 @@ - -This patch backports the struct net_device_ops changes added -on 2.6.29. It also backports the namespace changes added -through net/wireless/wext.c. Note that there is another -patch file which also addresses netns changes, we leave -them separate as there is no easy way to split the stuff -without creating a headache on maintenance of the pathes. - ---- 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-12-10 08:40:23.000000000 -0800 -+++ b/drivers/net/usb/usbnet.c 2009-12-10 08:40:24.000000000 -0800 -@@ -1260,6 +1260,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, -@@ -1269,6 +1270,7 @@ - .ndo_set_mac_address = eth_mac_addr, - .ndo_validate_addr = eth_validate_addr, - }; -+#endif - - /*-------------------------------------------------------------------------*/ - -@@ -1348,7 +1350,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-09-02 14:08:52.418110490 -0700 -+++ b/drivers/net/wireless/rndis_wlan.c 2009-09-02 14:08:52.930092180 -0700 -@@ -2670,6 +2670,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, -@@ -2680,6 +2681,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) - { -@@ -2727,7 +2729,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-12-10 08:41:38.000000000 -0800 -+++ b/net/mac80211/iface.c 2009-12-10 08:41:39.000000000 -0800 -@@ -644,6 +644,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, -@@ -663,11 +664,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; - } - -@@ -682,7 +694,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 */ -@@ -705,7 +721,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; -@@ -774,6 +794,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 */ -@@ -782,6 +804,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) -@@ -821,6 +844,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/drivers/net/b44.c 2009-12-10 08:42:34.000000000 -0800 -+++ b/drivers/net/b44.c 2009-12-10 08:42:34.000000000 -0800 -@@ -2116,6 +2116,7 @@ - return err; - } - -+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29)) - static const struct net_device_ops b44_netdev_ops = { - .ndo_open = b44_open, - .ndo_stop = b44_close, -@@ -2131,6 +2132,7 @@ - .ndo_poll_controller = b44_poll_controller, - #endif - }; -+#endif - - static int __devinit b44_init_one(struct ssb_device *sdev, - const struct ssb_device_id *ent) -@@ -2170,9 +2172,26 @@ - bp->rx_pending = B44_DEF_RX_RING_PENDING; - bp->tx_pending = B44_DEF_TX_RING_PENDING; - -+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29)) -+ dev->open = b44_open; -+ dev->stop = b44_close; -+ dev->hard_start_xmit = b44_start_xmit; -+ dev->get_stats = b44_get_stats; -+ dev->set_multicast_list = b44_set_rx_mode; -+ dev->set_mac_address = b44_set_mac_addr; -+ dev->do_ioctl = b44_ioctl; -+ dev->tx_timeout = b44_tx_timeout; -+ netif_napi_add(dev, &bp->napi, b44_poll, 64); -+ dev->watchdog_timeo = B44_TX_TIMEOUT; -+#ifdef CONFIG_NET_POLL_CONTROLLER -+ dev->poll_controller = b44_poll_controller; -+#endif -+ dev->change_mtu = b44_change_mtu; -+#else - dev->netdev_ops = &b44_netdev_ops; - netif_napi_add(dev, &bp->napi, b44_poll, 64); - dev->watchdog_timeo = B44_TX_TIMEOUT; -+#endif - dev->irq = sdev->irq; - SET_ETHTOOL_OPS(dev, &b44_ethtool_ops); - ---- a/net/wireless/wext-core.c -+++ b/net/wireless/wext-core.c -@@ -340,6 +340,7 @@ - - /* IW event code */ - -+#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); -@@ -382,6 +383,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) - { -@@ -592,8 +616,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); - -@@ -902,8 +931,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; - } - ---- a/drivers/net/wireless/ipw2x00/ipw2100.c 2009-09-02 14:12:00.958117808 -0700 -+++ b/drivers/net/wireless/ipw2x00/ipw2100.c 2009-09-02 14:12:01.382115761 -0700 -@@ -6091,6 +6091,7 @@ - - static void ipw2100_irq_tasklet(struct ipw2100_priv *priv); - -+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29)) - static const struct net_device_ops ipw2100_netdev_ops = { - .ndo_open = ipw2100_open, - .ndo_stop = ipw2100_close, -@@ -6101,6 +6102,7 @@ - .ndo_set_mac_address = ipw2100_set_address, - .ndo_validate_addr = eth_validate_addr, - }; -+#endif - - /* Look into using netdev destructor to shutdown ieee80211? */ - -@@ -6126,7 +6128,16 @@ - priv->ieee->perfect_rssi = -20; - priv->ieee->worst_rssi = -85; - -+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29)) - dev->netdev_ops = &ipw2100_netdev_ops; -+#else -+ dev->open = ipw2100_open; -+ dev->stop = ipw2100_close; -+ dev->init = ipw2100_net_init; -+ dev->tx_timeout = ipw2100_tx_timeout; -+ dev->set_mac_address = ipw2100_set_address; -+#endif -+ - dev->ethtool_ops = &ipw2100_ethtool_ops; - dev->wireless_handlers = &ipw2100_wx_handler_def; - priv->wireless_data.libipw = priv->ieee; ---- a/drivers/net/wireless/ipw2x00/ipw2200.c 2009-11-13 11:37:43.000000000 -0800 -+++ b/drivers/net/wireless/ipw2x00/ipw2200.c 2009-11-13 11:37:43.000000000 -0800 -@@ -11635,6 +11635,7 @@ - return NETDEV_TX_OK; - } - -+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29)) - static const struct net_device_ops ipw_prom_netdev_ops = { - .ndo_open = ipw_prom_open, - .ndo_stop = ipw_prom_stop, -@@ -11643,6 +11644,7 @@ - .ndo_set_mac_address = eth_mac_addr, - .ndo_validate_addr = eth_validate_addr, - }; -+#endif - - static int ipw_prom_alloc(struct ipw_priv *priv) - { -@@ -11663,7 +11665,13 @@ - memcpy(priv->prom_net_dev->dev_addr, priv->mac_addr, ETH_ALEN); - - priv->prom_net_dev->type = ARPHRD_IEEE80211_RADIOTAP; -+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29)) - priv->prom_net_dev->netdev_ops = &ipw_prom_netdev_ops; -+#else -+ priv->prom_net_dev->open = ipw_prom_open; -+ priv->prom_net_dev->stop = ipw_prom_stop; -+ priv->prom_net_dev->hard_start_xmit = ipw_prom_hard_start_xmit; -+#endif - - priv->prom_priv->ieee->iw_mode = IW_MODE_MONITOR; - SET_NETDEV_DEV(priv->prom_net_dev, &priv->pci_dev->dev); -@@ -11691,6 +11699,7 @@ - - #endif - -+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29)) - static const struct net_device_ops ipw_netdev_ops = { - .ndo_init = ipw_net_init, - .ndo_open = ipw_net_open, -@@ -11701,6 +11710,7 @@ - .ndo_change_mtu = libipw_change_mtu, - .ndo_validate_addr = eth_validate_addr, - }; -+#endif - - static int __devinit ipw_pci_probe(struct pci_dev *pdev, - const struct pci_device_id *ent) -@@ -11802,7 +11812,15 @@ - priv->ieee->perfect_rssi = -20; - priv->ieee->worst_rssi = -85; - -+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29)) - net_dev->netdev_ops = &ipw_netdev_ops; -+#else -+ net_dev->open = ipw_net_open; -+ net_dev->stop = ipw_net_stop; -+ net_dev->init = ipw_net_init; -+ net_dev->set_multicast_list = ipw_net_set_multicast_list; -+ net_dev->set_mac_address = ipw_net_set_mac_address; -+#endif - priv->wireless_data.spy_data = &priv->ieee->spy_data; - net_dev->wireless_data = &priv->wireless_data; - net_dev->wireless_handlers = &ipw_wx_handler_def; ---- a/drivers/net/wireless/ipw2x00/libipw_module.c -+++ b/drivers/net/wireless/ipw2x00/libipw_module.c -@@ -157,6 +157,10 @@ - goto failed; - } - ieee = netdev_priv(dev); -+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29)) -+ dev->hard_start_xmit = libipw_xmit; -+ dev->change_mtu = libipw_change_mtu; -+#endif - - ieee->dev = dev; - ---- a/drivers/net/wireless/libertas/main.c 2009-11-02 08:04:43.000000000 -0800 -+++ b/drivers/net/wireless/libertas/main.c 2009-11-02 08:04:44.000000000 -0800 -@@ -911,6 +911,7 @@ - lbs_deb_leave(LBS_DEB_MAIN); - } - -+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29)) - static const struct net_device_ops lbs_netdev_ops = { - .ndo_open = lbs_dev_open, - .ndo_stop = lbs_eth_stop, -@@ -921,6 +922,7 @@ - .ndo_change_mtu = eth_change_mtu, - .ndo_validate_addr = eth_validate_addr, - }; -+#endif - - /** - * @brief This function adds the card. it will probe the -@@ -966,7 +968,16 @@ - wdev->netdev = dev; - priv->dev = dev; - -+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29)) - dev->netdev_ops = &lbs_netdev_ops; -+#else -+ dev->open = lbs_dev_open; -+ dev->hard_start_xmit = lbs_hard_start_xmit; -+ dev->stop = lbs_eth_stop; -+ dev->set_mac_address = lbs_set_mac_address; -+ dev->tx_timeout = lbs_tx_timeout; -+ dev->set_multicast_list = lbs_set_multicast_list; -+#endif - dev->watchdog_timeo = 5 * HZ; - dev->ethtool_ops = &lbs_ethtool_ops; - #ifdef WIRELESS_EXT -@@ -1262,11 +1273,13 @@ - lbs_deb_leave(LBS_DEB_MAIN); - } - -+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29)) - static const struct net_device_ops rtap_netdev_ops = { - .ndo_open = lbs_rtap_open, - .ndo_stop = lbs_rtap_stop, - .ndo_start_xmit = lbs_rtap_hard_start_xmit, - }; -+#endif - - static int lbs_add_rtap(struct lbs_private *priv) - { -@@ -1287,7 +1300,13 @@ - - memcpy(rtap_dev->dev_addr, priv->current_addr, ETH_ALEN); - rtap_dev->type = ARPHRD_IEEE80211_RADIOTAP; -+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29)) - rtap_dev->netdev_ops = &rtap_netdev_ops; -+#else -+ rtap_dev->open = lbs_rtap_open; -+ rtap_dev->stop = lbs_rtap_stop; -+ rtap_dev->hard_start_xmit = lbs_rtap_hard_start_xmit; -+#endif - rtap_dev->ml_priv = priv; - SET_NETDEV_DEV(rtap_dev, priv->dev->dev.parent); - ---- a/drivers/net/wireless/libertas/mesh.c -+++ b/drivers/net/wireless/libertas/mesh.c -@@ -318,6 +318,7 @@ - return ret; - } - -+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29)) - static const struct net_device_ops mesh_netdev_ops = { - .ndo_open = lbs_mesh_dev_open, - .ndo_stop = lbs_mesh_stop, -@@ -325,6 +326,7 @@ - .ndo_set_mac_address = lbs_set_mac_address, - .ndo_set_multicast_list = lbs_set_multicast_list, - }; -+#endif - - /** - * @brief This function adds mshX interface -@@ -349,7 +351,15 @@ - mesh_dev->ml_priv = priv; - priv->mesh_dev = mesh_dev; - -+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29)) - mesh_dev->netdev_ops = &mesh_netdev_ops; -+#else -+ mesh_dev->open = lbs_mesh_dev_open; -+ mesh_dev->hard_start_xmit = lbs_hard_start_xmit; -+ mesh_dev->stop = lbs_mesh_stop; -+ mesh_dev->set_mac_address = lbs_set_mac_address; -+ mesh_dev->set_multicast_list = lbs_set_multicast_list; -+#endif - mesh_dev->ethtool_ops = &lbs_ethtool_ops; - memcpy(mesh_dev->dev_addr, priv->dev->dev_addr, - sizeof(priv->dev->dev_addr)); ---- a/drivers/net/wireless/libertas/defs.h 2009-07-08 14:04:29.692256519 -0700 -+++ b/drivers/net/wireless/libertas/defs.h 2009-07-08 14:03:26.712279246 -0700 -@@ -16,6 +16,14 @@ - #define DRV_NAME "libertas" - #endif - -+/* -+ * Really nasty hack to avoid stuffing compat.diff with tons of ifdefs, -+ * we could add this to a compat header file but too lazy to check ml_priv -+ * is not used anywhere else -+ */ -+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,26)) -+#define ml_priv priv -+#endif - - #define LBS_DEB_ENTER 0x00000001 - #define LBS_DEB_LEAVE 0x00000002 ---- a/drivers/net/wireless/mac80211_hwsim.c 2009-08-18 16:18:52.829350750 -0700 -+++ b/drivers/net/wireless/mac80211_hwsim.c 2009-08-18 16:18:52.977352457 -0700 -@@ -872,16 +872,22 @@ - .name = "mac80211_hwsim" - }; - -+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29)) - static const struct net_device_ops hwsim_netdev_ops = { - .ndo_start_xmit = hwsim_mon_xmit, - .ndo_change_mtu = eth_change_mtu, - .ndo_set_mac_address = eth_mac_addr, - .ndo_validate_addr = eth_validate_addr, - }; -+#endif - - static void hwsim_mon_setup(struct net_device *dev) - { -+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29)) - dev->netdev_ops = &hwsim_netdev_ops; -+#else -+ dev->hard_start_xmit = hwsim_mon_xmit; -+#endif - dev->destructor = free_netdev; - ether_setup(dev); - dev->tx_queue_len = 0; -diff -Nur a/net/bluetooth/bnep/netdev.c b/net/bluetooth/bnep/netdev.c ---- a/net/bluetooth/bnep/netdev.c 2009-11-25 11:24:43.000000000 +0530 -+++ b/net/bluetooth/bnep/netdev.c 2009-11-27 19:35:33.000000000 +0530 -@@ -165,8 +165,12 @@ - } - #endif - --static netdev_tx_t bnep_net_xmit(struct sk_buff *skb, -- struct net_device *dev) -+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,31)) -+static netdev_tx_t bnep_net_xmit(struct sk_buff *skb, struct net_device *dev) -+#else -+static int bnep_net_xmit(struct sk_buff *skb, struct net_device *dev) -+#endif -+ - { - struct bnep_session *s = netdev_priv(dev); - struct sock *sk = s->sock->sk; -@@ -207,6 +211,7 @@ - return NETDEV_TX_OK; - } - -+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,28)) - static const struct net_device_ops bnep_netdev_ops = { - .ndo_open = bnep_net_open, - .ndo_stop = bnep_net_close, -@@ -218,6 +223,16 @@ - .ndo_change_mtu = eth_change_mtu, - - }; -+#else -+static struct net_device_stats *bnep_net_get_stats(struct net_device *dev) -+{ -+ return &dev->stats; -+} -+static int bnep_net_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) -+{ -+ return -EINVAL; -+} -+#endif - - void bnep_net_setup(struct net_device *dev) - { -@@ -226,7 +241,18 @@ - dev->addr_len = ETH_ALEN; - - ether_setup(dev); -+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,28)) - dev->netdev_ops = &bnep_netdev_ops; -+#else -+ dev->open = bnep_net_open; -+ dev->stop = bnep_net_close; -+ dev->hard_start_xmit = bnep_net_xmit; -+ dev->get_stats = bnep_net_get_stats; -+ dev->do_ioctl = bnep_net_ioctl; -+ dev->set_mac_address = bnep_net_set_mac_addr; -+ dev->set_multicast_list = bnep_net_set_mc_list; -+ dev->tx_timeout = bnep_net_timeout; -+#endif - - dev->watchdog_timeo = HZ * 2; - } diff --git a/compat/patches/02-ksize.patch b/compat/patches/02-ksize.patch deleted file mode 100644 index 48964e29ed9b..000000000000 --- a/compat/patches/02-ksize.patch +++ /dev/null @@ -1,27 +0,0 @@ -ksize() was added as of 2.6.29, it gives you the actual -size of the allocated data. Since we have no support for -this we simply do not optimize for it and deal with -large alloocations for the IEs. - -We technically could backport this as - -define ksize(bleh) SOME_LARGE_NUMBER - -but doing it this way emphasis careful review -of the situation. - ---- a/net/wireless/scan.c 2009-09-02 14:13:33.769092519 -0700 -+++ b/net/wireless/scan.c 2009-09-02 14:13:34.925094548 -0700 -@@ -423,7 +423,12 @@ - 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) { -+ used = 0; /* just to shut up the compiler */ -+#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/patches/03-rfkill.patch b/compat/patches/03-rfkill.patch deleted file mode 100644 index a221dff8c46a..000000000000 --- a/compat/patches/03-rfkill.patch +++ /dev/null @@ -1,233 +0,0 @@ -rfkill was re-implemented on 2.6.31. We port it to -older kernels with a simple hack, just rename the -module as a new one rfkill_backport, and every -exported symbol gets redefined with a _backport -postfix through compat-2.6.31.h. The changes below -are the ones we could not do through compat-2.6.31.h - -Do older kernels have /dev/rfkill ? I not then we can -just keep /dev/rfkill and not /dev/rfkill_backport. - -Note that 2.6.31 added netdevice notifier upon interface -dev_open() which on cfg80211 will check if checks to see -if rfkill is enabled (or if the mode of operation is not -supported) on the cfg80211_netdev_notifier_call() and if -so deny bringing the interface up. This was added via -commit: - -3b8bcfd5d31ea0fec58681d035544ace707d2536 - -Since older kernels will not have the notifier call -on dev_open() if we *really want* to port this we could have -mac80211's subif_open() call : - - ret = call_netdevice_notifiers(NETDEV_PRE_UP, dev); - ret = notifier_to_errno(ret); - if (ret) - return ret; - -This would do the policing from within mac80211. - ---- a/net/rfkill/Makefile -+++ b/net/rfkill/Makefile -@@ -2,6 +2,6 @@ - # Makefile for the RF switch subsystem. - # - --rfkill-y += core.o --rfkill-$(CONFIG_RFKILL_INPUT) += input.o --obj-$(CONFIG_RFKILL) += rfkill.o -+rfkill_backport-y += core.o -+rfkill_backport-$(CONFIG_RFKILL_BACKPORT_INPUT) += input.o -+obj-$(CONFIG_RFKILL_BACKPORT) += rfkill_backport.o ---- 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 - #include - #include -+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,31)) - #include -+#else -+#include -+#endif - #include - - #include "rfkill.h" -@@ -229,7 +233,7 @@ static int rfkill_connect(struct input_h - - handle->dev = dev; - handle->handler = handler; -- handle->name = "rfkill"; -+ handle->name = "rfkill_backport"; - - /* causes rfkill_start() to be called */ - error = input_register_handle(handle); ---- a/net/rfkill/core.c 2009-10-06 12:53:52.000000000 -0400 -+++ b/net/rfkill/core.c 2009-10-06 12:53:53.000000000 -0400 -@@ -26,7 +26,7 @@ - #include - #include - #include --#include -+#include - #include - #include - #include -@@ -62,7 +62,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 -@@ -123,7 +123,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; -@@ -317,7 +317,7 @@ - rfkill_event(rfkill); - } - --#ifdef CONFIG_RFKILL_INPUT -+#ifdef CONFIG_RFKILL_BACKPORT_INPUT - static atomic_t rfkill_input_disabled = ATOMIC_INIT(0); - - /** -@@ -779,7 +779,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, -@@ -925,7 +925,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)) -@@ -1153,7 +1153,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"); -@@ -1164,7 +1164,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) - { -@@ -1197,7 +1197,7 @@ - .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 -@@ -1227,7 +1227,7 @@ - goto out; - } - --#ifdef CONFIG_RFKILL_INPUT -+#ifdef CONFIG_RFKILL_BACKPORT_INPUT - error = rfkill_handler_init(); - if (error) { - misc_deregister(&rfkill_miscdev); -@@ -1243,7 +1243,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-09-13 13:28:21.286436755 -0700 -+++ b/include/linux/rfkill_backport.h 2009-09-13 13:28:54.665495610 -0700 -@@ -20,6 +20,7 @@ - */ - - #include -+#include - - /* 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 -@@ -355,7 +356,7 @@ - #endif /* RFKILL || RFKILL_MODULE */ - - --#ifdef CONFIG_RFKILL_LEDS -+#ifdef CONFIG_RFKILL_BACKPORT_LEDS - /** - * rfkill_get_led_trigger_name - Get the LED trigger name for the button's LED. - * This function might return a NULL pointer if registering of the ---- a/net/wireless/core.h 2009-07-07 13:32:53.367707921 -0700 -+++ b/net/wireless/core.h 2009-07-07 13:32:53.943703622 -0700 -@@ -11,7 +11,11 @@ - #include - #include - #include -+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,31)) - #include -+#else -+#include -+#endif - #include - #include - #include ---- a/drivers/net/wireless/ath/ath9k/hw.c 2009-12-10 08:43:21.000000000 -0800 -+++ b/drivers/net/wireless/ath/ath9k/hw.c 2009-12-10 08:43:22.000000000 -0800 -@@ -3260,7 +3260,7 @@ - - pCap->hw_caps |= ATH9K_HW_CAP_ENHANCEDPM; - --#if defined(CONFIG_RFKILL) || defined(CONFIG_RFKILL_MODULE) -+#if ((LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,31)) && defined(CONFIG_RFKILL) || defined(CONFIG_RFKILL_MODULE)) || ((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,31)) && defined(CONFIG_RFKILL_BACKPORT) || defined(CONFIG_RFKILL_BACKPORT_MODULE)) - ah->rfsilent = ah->eep_ops->get_eeprom(ah, EEP_RF_SILENT); - if (ah->rfsilent & EEP_RFSILENT_ENABLED) { - ah->rfkill_gpio = ---- a/drivers/net/wireless/ath/ath5k/base.h -+++ b/drivers/net/wireless/ath/ath5k/base.h -@@ -46,7 +46,11 @@ - #include - #include - #include -+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,31)) - #include -+#else -+#include -+#endif - - #include "ath5k.h" - #include "debug.h" diff --git a/compat/patches/04-netns.patch b/compat/patches/04-netns.patch deleted file mode 100644 index 76833a41b0b1..000000000000 --- a/compat/patches/04-netns.patch +++ /dev/null @@ -1,18 +0,0 @@ -The only other namespace change. Note that pach 01-netdev.patch -also has some other namespace changes there, look at that file -for the other changes. It'd be nice to figure out a way to -bring thise here cleanly and seprately but they touch the same -files... - ---- 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 @@ - .hdrsize = 0, /* no private header */ - .version = 1, /* no particular meaning now */ - .maxattr = NL80211_ATTR_MAX, -+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32)) - .netnsok = true, -+#endif - }; - - /* internal helper: get rdev and dev */ diff --git a/compat/patches/05-usb.patch b/compat/patches/05-usb.patch deleted file mode 100644 index 9d13a1330a0e..000000000000 --- a/compat/patches/05-usb.patch +++ /dev/null @@ -1,14 +0,0 @@ -USB opt soft_unbid was added as of 2.6.27. - ---- a/drivers/net/wireless/p54/p54usb.c 2009-09-23 10:28:04.963708264 -0700 -+++ b/drivers/net/wireless/p54/p54usb.c 2009-09-23 10:28:05.199734839 -0700 -@@ -1052,7 +1052,9 @@ - .resume = p54u_resume, - .reset_resume = p54u_resume, - #endif /* CONFIG_PM */ -+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)) - .soft_unbind = 1, -+#endif - }; - - static int __init p54u_init(void) diff --git a/compat/patches/06-header-changes.patch b/compat/patches/06-header-changes.patch deleted file mode 100644 index 44f43cf4f34a..000000000000 --- a/compat/patches/06-header-changes.patch +++ /dev/null @@ -1,66 +0,0 @@ - -Every kernel release there are a few changes to headers -made. Some code gets shifted around between headers or -new headers are defined. This patch deals with such -cases. - ---- a/drivers/net/wireless/b43/phy_common.h -+++ b/drivers/net/wireless/b43/phy_common.h -@@ -2,6 +2,9 @@ - #define LINUX_B43_PHY_COMMON_H_ - - #include -+#if (LINUX_VERSION_CODE == KERNEL_VERSION(2,6,28)) -+#include -+#endif - - struct b43_wldev; - ---- a/drivers/net/wireless/libertas/assoc.c -+++ b/drivers/net/wireless/libertas/assoc.c -@@ -5,6 +5,9 @@ - #include - #include - #include -+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29)) -+#include -+#endif - - #include "assoc.h" - #include "decl.h" ---- a/drivers/net/wireless/wl12xx/wl1251_main.c 2009-08-07 11:42:12.532495607 -0700 -+++ b/drivers/net/wireless/wl12xx/wl1251_main.c 2009-08-07 12:08:31.167548696 -0700 -@@ -26,6 +26,9 @@ - #include - #include - #include -+#if (LINUX_VERSION_CODE == KERNEL_VERSION(2,6,28)) -+#include -+#endif - #include - #include - #include ---- a/drivers/net/wireless/wl12xx/wl1251_spi.c 2009-08-07 12:24:58.907526225 -0700 -+++ b/drivers/net/wireless/wl12xx/wl1251_spi.c 2009-08-07 12:24:59.199494403 -0700 -@@ -24,6 +24,9 @@ - #include - #include - #include -+#if (LINUX_VERSION_CODE == KERNEL_VERSION(2,6,28)) -+#include -+#endif - #include - #include - ---- a/net/mac80211/key.c -+++ b/net/mac80211/key.c -@@ -21,6 +21,9 @@ - #include "aes_ccm.h" - #include "aes_cmac.h" - -+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29)) -+#include -+#endif - - /** - * DOC: Key handling basics diff --git a/compat/patches/07-change-default-rate-alg.patch b/compat/patches/07-change-default-rate-alg.patch deleted file mode 100644 index 159b9317a971..000000000000 --- a/compat/patches/07-change-default-rate-alg.patch +++ /dev/null @@ -1,34 +0,0 @@ - -Your current kernels configuration (.config and linux/autoconf.h) -are always respected when compiling external modules. Because -of this if you are using an old kernel which preferred the -PID rate control algorithm we cannot force it to use minstrel -instead. Minstrel is now the default rate control algorithm -and we want you to use it. To let you use it we redefine here -the CONFIG_MAC80211_RC_DEFAULT to CONFIG_COMPAT_MAC80211_RC_DEFAULT -and define CONFIG_COMPAT_MAC80211_RC_DEFAULT on config.mk. -Through the compat autoconf we then get it also defined there -at compilation time. - ---- a/net/mac80211/rate.c 2009-12-10 08:44:19.000000000 -0800 -+++ b/net/mac80211/rate.c 2009-12-10 08:46:38.000000000 -0800 -@@ -22,7 +22,7 @@ struct rate_control_alg { - static LIST_HEAD(rate_ctrl_algs); - static DEFINE_MUTEX(rate_ctrl_mutex); - --static char *ieee80211_default_rc_algo = CONFIG_MAC80211_RC_DEFAULT; -+static char *ieee80211_default_rc_algo = CONFIG_COMPAT_MAC80211_RC_DEFAULT; - module_param(ieee80211_default_rc_algo, charp, 0644); - MODULE_PARM_DESC(ieee80211_default_rc_algo, - "Default rate control algorithm for mac80211 to use"); -@@ -118,8 +118,8 @@ ieee80211_rate_control_ops_get(const cha - ops = ieee80211_try_rate_control_ops_get(ieee80211_default_rc_algo); - - /* try built-in one if specific alg requested but not found */ -- if (!ops && strlen(CONFIG_MAC80211_RC_DEFAULT)) -- ops = ieee80211_try_rate_control_ops_get(CONFIG_MAC80211_RC_DEFAULT); -+ if (!ops && strlen(CONFIG_COMPAT_MAC80211_RC_DEFAULT)) -+ ops = ieee80211_try_rate_control_ops_get(CONFIG_COMPAT_MAC80211_RC_DEFAULT); - kparam_unblock_sysfs_write(ieee80211_default_rc_algo); - - return ops; diff --git a/compat/patches/08-rename-iwl4965-config.patch b/compat/patches/08-rename-iwl4965-config.patch deleted file mode 100644 index 7e5cf752a8c2..000000000000 --- a/compat/patches/08-rename-iwl4965-config.patch +++ /dev/null @@ -1,31 +0,0 @@ -In kernel 2.6.26 and older CONFIG_IWL4965 was build as an extra -module, but now it is directly included in the iwlagn. - -CONFIG_IWL4965 has to be set to y, to build correctly. - ---- a/drivers/net/wireless/iwlwifi/Makefile 2009-10-06 12:57:49.000000000 -0400 -+++ b/drivers/net/wireless/iwlwifi/Makefile 2009-10-06 12:57:50.000000000 -0400 -@@ -12,7 +12,7 @@ - obj-$(CONFIG_IWLAGN) += iwlagn.o - iwlagn-objs := iwl-agn.o iwl-agn-rs.o iwl-agn-led.o - --iwlagn-$(CONFIG_IWL4965) += iwl-4965.o -+iwlagn-$(CONFIG_COMPAT_IWL4965) += iwl-4965.o - iwlagn-$(CONFIG_IWL5000) += iwl-5000.o - iwlagn-$(CONFIG_IWL5000) += iwl-6000.o - iwlagn-$(CONFIG_IWL5000) += iwl-1000.o ---- a/drivers/net/wireless/iwlwifi/iwl-agn.c 2009-12-10 08:47:49.000000000 -0800 -+++ b/drivers/net/wireless/iwlwifi/iwl-agn.c 2009-12-10 08:47:51.000000000 -0800 -@@ -3590,10 +3590,10 @@ static void __devexit iwl_pci_remove(str - - /* Hardware specific file defines the PCI IDs table for that hardware module */ - static struct pci_device_id iwl_hw_card_ids[] = { --#ifdef CONFIG_IWL4965 -+#ifdef CONFIG_COMPAT_IWL4965 - {IWL_PCI_DEVICE(0x4229, PCI_ANY_ID, iwl4965_agn_cfg)}, - {IWL_PCI_DEVICE(0x4230, PCI_ANY_ID, iwl4965_agn_cfg)}, --#endif /* CONFIG_IWL4965 */ -+#endif /* CONFIG_COMPAT_IWL4965 */ - #ifdef CONFIG_IWL5000 - /* 5100 Series WiFi */ - {IWL_PCI_DEVICE(0x4232, 0x1201, iwl5100_agn_cfg)}, /* Mini Card */ diff --git a/compat/patches/09-threaded-irq.patch b/compat/patches/09-threaded-irq.patch deleted file mode 100644 index 6731ee8d1370..000000000000 --- a/compat/patches/09-threaded-irq.patch +++ /dev/null @@ -1,63 +0,0 @@ -The 2.6.31 kernel has threaded IRQ support and b43 is the first -wireless driver that makes use of it. To support threaded IRSs -on older kernels we built our own struct compat_threaded_irq -to queue_work() onto it as the kernel thread be running the -thread in process context as well. - ---- a/drivers/net/wireless/b43/main.c 2009-11-13 11:39:32.000000000 -0800 -+++ b/drivers/net/wireless/b43/main.c 2009-11-13 11:39:33.000000000 -0800 -@@ -3909,8 +3909,13 @@ - if (dev->dev->bus->bustype == SSB_BUSTYPE_SDIO) { - b43_sdio_free_irq(dev); - } else { -+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,31) -+ compat_synchronize_threaded_irq(&dev->irq_compat); -+ compat_free_threaded_irq(&dev->irq_compat); -+#else - synchronize_irq(dev->dev->irq); - free_irq(dev->dev->irq, dev); -+#endif - } - mutex_lock(&wl->mutex); - dev = wl->current_dev; -@@ -3950,9 +3955,17 @@ - goto out; - } - } else { -+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,31) -+ err = compat_request_threaded_irq(&dev->irq_compat, -+ dev->dev->irq, -+ b43_interrupt_handler, -+ b43_interrupt_thread_handler, -+ IRQF_SHARED, KBUILD_MODNAME, dev); -+#else - err = request_threaded_irq(dev->dev->irq, b43_interrupt_handler, - b43_interrupt_thread_handler, - IRQF_SHARED, KBUILD_MODNAME, dev); -+#endif - if (err) { - b43err(dev->wl, "Cannot request IRQ-%d\n", dev->dev->irq); - goto out; -@@ -4659,6 +4672,10 @@ - - static void b43_wireless_core_detach(struct b43_wldev *dev) - { -+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,31) -+ if (dev->dev->bus->bustype != SSB_BUSTYPE_SDIO) -+ compat_destroy_threaded_irq(&dev->irq_compat); -+#endif - /* We release firmware that late to not be required to re-request - * is all the time when we reinit the core. */ - b43_release_firmware(dev); ---- a/drivers/net/wireless/b43/b43.h 2009-10-19 11:36:44.000000000 +0900 -+++ b/drivers/net/wireless/b43/b43.h 2009-10-19 11:36:45.000000000 +0900 -@@ -745,6 +745,9 @@ - unsigned int tx_count; - unsigned int rx_count; - #endif -+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,31) -+ struct compat_threaded_irq irq_compat; -+#endif - }; - - /* Data structure for the WLAN parts (802.11 cores) of the b43 chip. */ diff --git a/compat/patches/10-add-wext-handlers-to-netdev.patch b/compat/patches/10-add-wext-handlers-to-netdev.patch deleted file mode 100644 index e5ab4f11f6ef..000000000000 --- a/compat/patches/10-add-wext-handlers-to-netdev.patch +++ /dev/null @@ -1,26 +0,0 @@ -The patch "wext: refactor" by Johannes Berg refactored -wext code so that new kernels no longer get the wext -handlers through struct netdevice, instead they get -it through the struct wiphy which is cfg80211 specific. - -For old kernels this means you get not wext handlers -anymore when backporting code, this adds the wext handler -back to the netdevice wireless_handlers to let compat -users use wext again. - -We only do this for kernels <= 2.6.32 as 2.6.33 will use -the struct wiphy wireless handler. - ---- a/net/wireless/core.c 2009-12-10 09:02:05.000000000 -0800 -+++ b/net/wireless/core.c 2009-12-10 09:02:08.000000000 -0800 -@@ -683,6 +683,10 @@ - wdev->sme_state = CFG80211_SME_IDLE; - mutex_unlock(&rdev->devlist_mtx); - #ifdef CONFIG_CFG80211_WEXT -+#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,32)) -+ if (!dev->wireless_handlers) -+ dev->wireless_handlers = &cfg80211_wext_handler; -+#endif - wdev->wext.default_key = -1; - wdev->wext.default_mgmt_key = -1; - wdev->wext.connect.auth_type = NL80211_AUTHTYPE_AUTOMATIC; diff --git a/compat/patches/11-dev-pm-ops.patch b/compat/patches/11-dev-pm-ops.patch deleted file mode 100644 index fc4de8f64777..000000000000 --- a/compat/patches/11-dev-pm-ops.patch +++ /dev/null @@ -1,58 +0,0 @@ -The 2.6.29 kernel has new struct dev_pm_ops [1] which are used -on the pci device to distinguish power management hooks for suspend -to RAM and hibernation. Older kernels don't have these so we need -to resort back to the good ol' suspend/resume. Fortunately the calls -are not so different so it should be possible to resuse the same -calls on compat code with only slight modifications. - -[1] http://lxr.linux.no/#linux+v2.6.29/include/linux/pm.h#L170 - ---- a/drivers/net/wireless/ath/ath5k/base.c 2009-10-07 01:58:19.000000000 -0400 -+++ b/drivers/net/wireless/ath/ath5k/base.c 2009-10-07 02:19:58.000000000 -0400 -@@ -197,6 +197,33 @@ - #ifdef CONFIG_PM - static int ath5k_pci_suspend(struct device *dev); - static int ath5k_pci_resume(struct device *dev); -+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29)) -+static int ath5k_pci_suspend_compat(struct pci_dev *pdev, pm_message_t state) -+{ -+ int r; -+ -+ r = ath5k_pci_suspend(&pdev->dev); -+ if (r) -+ return r; -+ -+ pci_save_state(pdev); -+ pci_disable_device(pdev); -+ pci_set_power_state(pdev, PCI_D3hot); -+ return 0; -+} -+ -+static int ath5k_pci_resume_compat(struct pci_dev *pdev) -+{ -+ int r; -+ -+ pci_restore_state(pdev); -+ r = pci_enable_device(pdev); -+ if (r) -+ return r; -+ -+ return ath5k_pci_resume(&pdev->dev); -+} -+#endif - - SIMPLE_DEV_PM_OPS(ath5k_pm_ops, ath5k_pci_suspend, ath5k_pci_resume); - #define ATH5K_PM_OPS (&ath5k_pm_ops) -@@ -209,7 +235,12 @@ - .id_table = ath5k_pci_id_table, - .probe = ath5k_pci_probe, - .remove = __devexit_p(ath5k_pci_remove), -+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29)) - .driver.pm = ATH5K_PM_OPS, -+#elif defined(CONFIG_PM) -+ .suspend = ath5k_pci_suspend_compat, -+ .resume = ath5k_pci_resume_compat, -+#endif - }; - - diff --git a/compat/patches/12-iw_handler-changes.patch b/compat/patches/12-iw_handler-changes.patch deleted file mode 100644 index fb97af5aac4a..000000000000 --- a/compat/patches/12-iw_handler-changes.patch +++ /dev/null @@ -1,14 +0,0 @@ ---- a/drivers/net/wireless/ipw2x00/ipw2100.c 2009-10-08 11:01:52.000000000 -0400 -+++ b/drivers/net/wireless/ipw2x00/ipw2100.c 2009-10-08 11:01:43.000000000 -0400 -@@ -6140,7 +6140,11 @@ - - dev->ethtool_ops = &ipw2100_ethtool_ops; - dev->wireless_handlers = &ipw2100_wx_handler_def; -+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,31)) - priv->wireless_data.libipw = priv->ieee; -+#else -+ priv->wireless_data.ieee80211 = (struct ieee80211_device *) priv->ieee; -+#endif - dev->wireless_data = &priv->wireless_data; - dev->watchdog_timeo = 3 * HZ; - dev->irq = 0; diff --git a/compat/patches/13-trace.patch b/compat/patches/13-trace.patch deleted file mode 100644 index 7668d50db05a..000000000000 --- a/compat/patches/13-trace.patch +++ /dev/null @@ -1,44 +0,0 @@ -Older kernels do not have trace/define_trace.h [1] and if there -is something there that we can backport we will define it -in or compat headers. - -[1] http://lxr.linux.no/#linux+v2.6.31/include/trace/define_trace.h - ---- a/drivers/net/wireless/iwlwifi/iwl-devtrace.h -+++ b/drivers/net/wireless/iwlwifi/iwl-devtrace.h -@@ -1,7 +1,9 @@ - #if !defined(__IWLWIFI_DEVICE_TRACE) || defined(TRACE_HEADER_MULTI_READ) - #define __IWLWIFI_DEVICE_TRACE - -+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,27)) - #include -+#endif /* (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,27)) */ - #include "iwl-dev.h" - - #if !defined(CONFIG_IWLWIFI_DEVICE_TRACING) || defined(__CHECKER__) -@@ -194,4 +196,6 @@ TRACE_EVENT(iwlwifi_dev_ucode_event, - #define TRACE_INCLUDE_PATH . - #undef TRACE_INCLUDE_FILE - #define TRACE_INCLUDE_FILE iwl-devtrace -+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,30)) - #include -+#endif ---- a/net/mac80211/driver-trace.h 2009-08-18 16:19:34.574352433 -0700 -+++ b/net/mac80211/driver-trace.h 2009-08-18 16:19:35.694367614 -0700 -@@ -1,7 +1,9 @@ - #if !defined(__MAC80211_DRIVER_TRACE) || defined(TRACE_HEADER_MULTI_READ) - #define __MAC80211_DRIVER_TRACE - -+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,27)) - #include -+#endif /* (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,27)) */ - #include - #include "ieee80211_i.h" - -@@ -694,4 +696,6 @@ TRACE_EVENT(drv_ampdu_action, - #define TRACE_INCLUDE_PATH . - #undef TRACE_INCLUDE_FILE - #define TRACE_INCLUDE_FILE driver-trace -+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,30)) - #include -+#endif /* (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,30)) */ diff --git a/compat/patches/14-device-type.patch b/compat/patches/14-device-type.patch deleted file mode 100644 index 9f2f433b59f2..000000000000 --- a/compat/patches/14-device-type.patch +++ /dev/null @@ -1,36 +0,0 @@ -Kernels >= 2.6.32 can identify the type of device netdevice -so that sysfs can be used to get this. We never really had a -systematic way of doing this -- now we do through the -SET_NETDEV_DEVTYPE() macro. For older kernels we make the -SET_NETDEV_DEVTYPE() be a no-op this means the wireless type -we define is unused so we ucomment it simply to avoid a -compile warning. - ---- a/net/wireless/core.c 2009-12-10 09:17:21.000000000 -0800 -+++ b/net/wireless/core.c 2009-12-10 09:17:28.000000000 -0800 -@@ -635,9 +635,11 @@ - dev_put(wdev->netdev); - } - -+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32)) - static struct device_type wiphy_type = { - .name = "wlan", - }; -+#endif - - static int cfg80211_netdev_notifier_call(struct notifier_block * nb, - unsigned long state, ---- a/net/bluetooth/bnep/core.c 2009-12-10 09:22:58.000000000 -0800 -+++ b/net/bluetooth/bnep/core.c 2009-12-10 09:22:59.000000000 -0800 -@@ -536,9 +536,11 @@ static struct device *bnep_get_device(st - return conn ? &conn->dev : NULL; - } - -+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32)) - static struct device_type bnep_type = { - .name = "bluetooth", - }; -+#endif - - int bnep_add_connection(struct bnep_connadd_req *req, struct socket *sock) - { diff --git a/compat/patches/15-symbol-export-conflicts.patch b/compat/patches/15-symbol-export-conflicts.patch deleted file mode 100644 index 053867136582..000000000000 --- a/compat/patches/15-symbol-export-conflicts.patch +++ /dev/null @@ -1,18 +0,0 @@ -In kernel < 2.6.32 libipw also exports ieee80211_rx. -To avoid conflicts with the other export we rename our. - ---- a/net/mac80211/rx.c 2009-11-13 11:41:29.000000000 -0800 -+++ b/net/mac80211/rx.c 2009-11-13 11:41:30.000000000 -0800 -@@ -2537,7 +2537,12 @@ - drop: - kfree_skb(skb); - } -+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32)) - EXPORT_SYMBOL(ieee80211_rx); -+#else -+EXPORT_SYMBOL(mac80211_ieee80211_rx); -+#endif -+ - - /* This is a version of the rx handler that can be called from hard irq - * context. Post the skb on the queue and schedule the tasklet */ diff --git a/compat/patches/16-bluetooth.patch b/compat/patches/16-bluetooth.patch deleted file mode 100644 index 32529a0b611d..000000000000 --- a/compat/patches/16-bluetooth.patch +++ /dev/null @@ -1,448 +0,0 @@ -These changes are required to backport blueooth. A lot can be optimized -here still, but for now we keep this here. - -diff -Nur a/drivers/bluetooth/hci_ldisc.c b/drivers/bluetooth/hci_ldisc.c ---- a/drivers/bluetooth/hci_ldisc.c 2009-11-25 11:24:32.000000000 +0530 -+++ b/drivers/bluetooth/hci_ldisc.c 2009-11-28 10:56:22.000000000 +0530 -@@ -277,8 +277,13 @@ - /* FIXME: why is this needed. Note don't use ldisc_ref here as the - open path is before the ldisc is referencable */ - -+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,30)) - if (tty->ldisc->ops->flush_buffer) - tty->ldisc->ops->flush_buffer(tty); -+#else -+ if (tty->ldisc.ops->flush_buffer) -+ tty->ldisc.ops->flush_buffer(tty); -+#endif - tty_driver_flush_buffer(tty); - - return 0; -@@ -478,7 +483,11 @@ - return -EUNATCH; - - default: -+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,27)) - err = n_tty_ioctl_helper(tty, file, cmd, arg); -+#else -+ err = n_tty_ioctl(tty, file, cmd, arg); -+#endif - break; - }; - ---- a/net/bluetooth/af_bluetooth.c 2009-12-10 09:20:31.000000000 -0800 -+++ b/net/bluetooth/af_bluetooth.c 2009-12-10 09:20:33.000000000 -0800 -@@ -338,7 +338,11 @@ int bt_sock_ioctl(struct socket *sock, u - if (sk->sk_state == BT_LISTEN) - return -EINVAL; - -+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,31)) - amount = sk->sk_sndbuf - sk_wmem_alloc_get(sk); -+#else -+ amount = sk->sk_sndbuf - atomic_read(&sk->sk_wmem_alloc); -+#endif - if (amount < 0) - amount = 0; - err = put_user(amount, (int __user *) arg); -diff -Nur a/net/bluetooth/cmtp/capi.c b/net/bluetooth/cmtp/capi.c ---- a/net/bluetooth/cmtp/capi.c 2009-11-25 11:24:43.000000000 +0530 -+++ b/net/bluetooth/cmtp/capi.c 2009-11-26 16:43:42.000000000 +0530 -@@ -382,7 +382,11 @@ - - BT_DBG("ctrl %p", ctrl); - -+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,30)) - capi_ctr_down(ctrl); -+#else -+ capi_ctr_reseted(ctrl); -+#endif - - atomic_inc(&session->terminate); - cmtp_schedule(session); -diff -Nur a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c ---- a/net/bluetooth/hci_core.c 2009-11-25 11:24:43.000000000 +0530 -+++ b/net/bluetooth/hci_core.c 2009-11-26 16:01:35.000000000 +0530 -@@ -39,7 +39,12 @@ - #include - #include - #include -+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,31)) - #include -+#else -+#include -+#endif -+ - #include - - #include ---- a/net/bluetooth/hci_sock.c 2009-12-10 09:40:08.000000000 -0800 -+++ b/net/bluetooth/hci_sock.c 2009-12-10 09:40:59.000000000 -0800 -@@ -471,7 +471,11 @@ - goto done; - } - -+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,31)) - static int hci_sock_setsockopt(struct socket *sock, int level, int optname, char __user *optval, unsigned int len) -+#else -+static int hci_sock_setsockopt(struct socket *sock, int level, int optname, char __user *optval, int len) -+#endif - { - struct hci_ufilter uf = { .opcode = 0 }; - struct sock *sk = sock->sk; -diff -Nur a/net/bluetooth/hci_sysfs.c b/net/bluetooth/hci_sysfs.c ---- a/net/bluetooth/hci_sysfs.c 2009-11-25 11:24:43.000000000 +0530 -+++ b/net/bluetooth/hci_sysfs.c 2009-11-27 15:19:26.000000000 +0530 -@@ -68,7 +68,11 @@ - .attrs = bt_link_attrs, - }; - -+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,31)) - static const struct attribute_group *bt_link_groups[] = { -+#else -+static struct attribute_group *bt_link_groups[] = { -+#endif - &bt_link_group, - NULL - }; -@@ -126,7 +130,11 @@ - dev = device_find_child(&conn->dev, NULL, __match_tty); - if (!dev) - break; -+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,29)) - device_move(dev, NULL, DPM_ORDER_DEV_LAST); -+#else -+ device_move(dev, NULL); -+#endif - put_device(dev); - } - -@@ -392,7 +400,11 @@ - .attrs = bt_host_attrs, - }; - -+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,31)) - static const struct attribute_group *bt_host_groups[] = { -+#else -+static struct attribute_group *bt_host_groups[] = { -+#endif - &bt_host_group, - NULL - }; ---- a/net/bluetooth/hidp/core.c 2009-12-10 09:43:25.000000000 -0800 -+++ b/net/bluetooth/hidp/core.c 2009-12-10 09:45:09.000000000 -0800 -@@ -583,10 +583,16 @@ static int hidp_session(void *arg) - session->input = NULL; - } - -- if (session->hid) { -- hid_destroy_device(session->hid); -- session->hid = NULL; -- } -+ if (session->hid) { -+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,27)) -+ hid_destroy_device(session->hid); -+ session->hid = NULL; -+#else -+ if (session->hid->claimed & HID_CLAIMED_INPUT) -+ hidinput_disconnect(session->hid); -+ hid_free_device(session->hid); -+#endif -+ } - - /* Wakeup user-space polling for socket errors */ - session->intr_sock->sk->sk_err = EUNATCH; -@@ -698,6 +704,7 @@ static void hidp_close(struct hid_device - { - } - -+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,27)) - static int hidp_parse(struct hid_device *hid) - { - struct hidp_session *session = hid->driver_data; -@@ -762,15 +769,44 @@ static struct hid_ll_driver hidp_hid_dri - }; - - static int hidp_setup_hid(struct hidp_session *session, -+#else -+static const struct { -+ __u16 idVendor; -+ __u16 idProduct; -+ unsigned quirks; -+} hidp_blacklist[] = { -+ /* Apple wireless Mighty Mouse */ -+ { 0x05ac, 0x030c, HID_QUIRK_MIGHTYMOUSE | HID_QUIRK_INVERT_HWHEEL }, -+ -+ { } /* Terminating entry */ -+}; -+static void hidp_setup_quirks(struct hid_device *hid) -+{ -+ unsigned int n; -+ -+ for (n = 0; hidp_blacklist[n].idVendor; n++) -+ if (hidp_blacklist[n].idVendor == le16_to_cpu(hid->vendor) && -+ hidp_blacklist[n].idProduct == le16_to_cpu(hid->product)) -+ hid->quirks = hidp_blacklist[n].quirks; -+} -+static void hidp_setup_hid(struct hidp_session *session, -+#endif - struct hidp_connadd_req *req) - { -+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,27)) - struct hid_device *hid; -- bdaddr_t src, dst; - int err; -+#else -+ struct hid_device *hid = session->hid; -+ struct hid_report *report; -+#endif -+ bdaddr_t src, dst; - -+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,27)) - hid = hid_allocate_device(); - if (IS_ERR(hid)) - return PTR_ERR(session->hid); -+#endif - - session->hid = hid; - session->req = req; -@@ -789,6 +825,8 @@ static int hidp_setup_hid(struct hidp_se - strncpy(hid->phys, batostr(&src), 64); - strncpy(hid->uniq, batostr(&dst), 64); - -+ -+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,27)) - hid->dev.parent = hidp_get_device(session); - hid->ll_driver = &hidp_hid_driver; - -@@ -805,6 +843,24 @@ failed: - session->hid = NULL; - - return err; -+#else -+ hid->dev = hidp_get_device(session); -+ hid->hid_open = hidp_open; -+ hid->hid_close = hidp_close; -+ -+ hid->hidinput_input_event = hidp_hidinput_event; -+ -+ hidp_setup_quirks(hid); -+ -+ list_for_each_entry(report, &hid->report_enum[HID_INPUT_REPORT].report_list, list) -+ hidp_send_report(session, report); -+ -+ list_for_each_entry(report, &hid->report_enum[HID_FEATURE_REPORT].report_list, list) -+ hidp_send_report(session, report); -+ -+ if (hidinput_connect(hid) == 0) -+ hid->claimed |= HID_CLAIMED_INPUT; -+#endif - } - - int hidp_add_connection(struct hidp_connadd_req *req, struct socket *ctrl_sock, struct socket *intr_sock) -@@ -824,6 +880,39 @@ int hidp_add_connection(struct hidp_conn - - BT_DBG("rd_data %p rd_size %d", req->rd_data, req->rd_size); - -+#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,27)) -+ if (req->rd_size > 0) { -+ unsigned char *buf = kmalloc(req->rd_size, GFP_KERNEL); -+ -+ if (!buf) { -+ kfree(session); -+ return -ENOMEM; -+ } -+ -+ if (copy_from_user(buf, req->rd_data, req->rd_size)) { -+ kfree(buf); -+ kfree(session); -+ return -EFAULT; -+ } -+ -+ session->hid = hid_parse_report(buf, req->rd_size); -+ -+ kfree(buf); -+ -+ if (!session->hid) { -+ kfree(session); -+ return -EINVAL; -+ } -+ } -+ -+ if (!session->hid) { -+ session->input = input_allocate_device(); -+ if (!session->input) { -+ kfree(session); -+ return -ENOMEM; -+ } -+ } -+#endif - down_write(&hidp_session_sem); - - s = __hidp_get_session(&bt_sk(ctrl_sock->sk)->dst); -@@ -851,6 +940,7 @@ int hidp_add_connection(struct hidp_conn - session->flags = req->flags & (1 << HIDP_BLUETOOTH_VENDOR_ID); - session->idle_to = req->idle_to; - -+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,27)) - if (req->rd_size > 0) { - err = hidp_setup_hid(session, req); - if (err && err != -ENODEV) -@@ -862,6 +952,16 @@ int hidp_add_connection(struct hidp_conn - if (err < 0) - goto purge; - } -+#else -+ if (session->input) { -+ err = hidp_setup_input(session, req); -+ if (err < 0) -+ goto failed; -+ } -+ -+ if (session->hid) -+ hidp_setup_hid(session, req); -+#endif - - __hidp_link_session(session); - -@@ -893,6 +993,7 @@ unlink: - session->input = NULL; - } - -+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,27)) - if (session->hid) { - hid_destroy_device(session->hid); - session->hid = NULL; -@@ -901,10 +1002,15 @@ unlink: - purge: - skb_queue_purge(&session->ctrl_transmit); - skb_queue_purge(&session->intr_transmit); -+#endif - - failed: - up_write(&hidp_session_sem); - -+#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,27)) -+ if (session->hid) -+ hid_free_device(session->hid); -+#endif - input_free_device(session->input); - kfree(session); - return err; -@@ -994,6 +1100,7 @@ int hidp_get_conninfo(struct hidp_connin - return err; - } - -+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,27)) - static const struct hid_device_id hidp_table[] = { - { HID_BLUETOOTH_DEVICE(HID_ANY_ID, HID_ANY_ID) }, - { } -@@ -1003,6 +1110,7 @@ static struct hid_driver hidp_driver = { - .name = "generic-bluetooth", - .id_table = hidp_table, - }; -+#endif - - static int __init hidp_init(void) - { -@@ -1012,11 +1120,14 @@ static int __init hidp_init(void) - - BT_INFO("HIDP (Human Interface Emulation) ver %s", VERSION); - -+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,27)) - ret = hid_register_driver(&hidp_driver); - if (ret) - goto err; -+#endif - - ret = hidp_init_sockets(); -+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,27)) - if (ret) - goto err_drv; - -@@ -1024,13 +1135,16 @@ static int __init hidp_init(void) - err_drv: - hid_unregister_driver(&hidp_driver); - err: -+#endif - return ret; - } - - static void __exit hidp_exit(void) - { - hidp_cleanup_sockets(); -+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,27)) - hid_unregister_driver(&hidp_driver); -+#endif - } - - module_init(hidp_init); ---- a/net/bluetooth/l2cap.c 2009-12-10 09:47:08.000000000 -0800 -+++ b/net/bluetooth/l2cap.c 2009-12-10 09:47:10.000000000 -0800 -@@ -1762,7 +1762,11 @@ static int l2cap_sock_setsockopt_old(str - return err; - } - -+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,31)) - static int l2cap_sock_setsockopt(struct socket *sock, int level, int optname, char __user *optval, unsigned int optlen) -+#else -+static int l2cap_sock_setsockopt(struct socket *sock, int level, int optname, char __user *optval, int optlen) -+#endif - { - struct sock *sk = sock->sk; - struct bt_security sec; ---- a/net/bluetooth/rfcomm/sock.c 2009-12-10 09:48:33.000000000 -0800 -+++ b/net/bluetooth/rfcomm/sock.c 2009-12-10 09:48:37.000000000 -0800 -@@ -767,7 +767,11 @@ static int rfcomm_sock_setsockopt_old(st - return err; - } - -+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,31)) - static int rfcomm_sock_setsockopt(struct socket *sock, int level, int optname, char __user *optval, unsigned int optlen) -+#else -+static int rfcomm_sock_setsockopt(struct socket *sock, int level, int optname, char __user *optval, int optlen) -+#endif - { - struct sock *sk = sock->sk; - struct bt_security sec; -diff -Nur a/net/bluetooth/rfcomm/tty.c b/net/bluetooth/rfcomm/tty.c ---- a/net/bluetooth/rfcomm/tty.c 2009-11-25 11:24:43.000000000 +0530 -+++ b/net/bluetooth/rfcomm/tty.c 2009-11-27 15:25:36.000000000 +0530 -@@ -731,8 +731,12 @@ - remove_wait_queue(&dev->wait, &wait); - - if (err == 0) -+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,29)) - device_move(dev->tty_dev, rfcomm_get_device(dev), - DPM_ORDER_DEV_AFTER_PARENT); -+#else -+ device_move(dev->tty_dev, rfcomm_get_device(dev)); -+#endif - - rfcomm_tty_copy_pending(dev); - -@@ -752,7 +756,11 @@ - - if (atomic_dec_and_test(&dev->opened)) { - if (dev->tty_dev->parent) -+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,29)) - device_move(dev->tty_dev, NULL, DPM_ORDER_DEV_LAST); -+#else -+ device_move(dev->tty_dev, NULL); -+#endif - - /* Close DLC and dettach TTY */ - rfcomm_dlc_close(dev->dlc, 0); ---- a/net/bluetooth/sco.c 2009-12-10 09:49:34.000000000 -0800 -+++ b/net/bluetooth/sco.c 2009-12-10 09:49:36.000000000 -0800 -@@ -645,7 +645,11 @@ static int sco_sock_sendmsg(struct kiocb - return err; - } - -+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,31)) - static int sco_sock_setsockopt(struct socket *sock, int level, int optname, char __user *optval, unsigned int optlen) -+#else -+static int sco_sock_setsockopt(struct socket *sock, int level, int optname, char __user *optval, int optlen) -+#endif - { - struct sock *sk = sock->sk; - int err = 0; diff --git a/compat/patches/98-add-compat-wireless.patch b/compat/patches/98-add-compat-wireless.patch deleted file mode 100644 index 84f75d1d0695..000000000000 --- a/compat/patches/98-add-compat-wireless.patch +++ /dev/null @@ -1,30 +0,0 @@ - -This patch file includes the changes required to add -compat-wireless support. Besides all the patches in this -directory we have our own compat-2.6.*.[ch] files which -help backport more. These the respective compat-2.6.2x.c -files get compiled and enabled if you are on older kernels -to bring in support for new features when possible. - -Lastly, the cfg80211.h change is what allows us to -get all compat-2.6.*.h files included. Its our only -point of entry through compat code. It works because -all drivers we are supporting through there one way -or another depend on cfg80211. New wireless drivers -are either mac80211 drivers or cfg80211 drivers, and -all mac80211 drivesr are cfg80211 drivers. - -If your driver is not a cfg80211 driver you must -ensure you include compat.h then. I think we -added compat.h also for ssb, I forget. - ---- a/include/net/cfg80211.h -+++ b/include/net/cfg80211.h -@@ -23,6 +23,7 @@ - /* remove once we remove the wext stuff */ - #include - #include -+#include - - - /* diff --git a/compat/patches/99-change-makefiles.patch b/compat/patches/99-change-makefiles.patch deleted file mode 100644 index bdd9282a58c8..000000000000 --- a/compat/patches/99-change-makefiles.patch +++ /dev/null @@ -1,90 +0,0 @@ - -This patch removes all drivers we do not support -or do not want to support. This lets us build -only the wireless stuff. - ---- a/drivers/misc/eeprom/Makefile -+++ b/drivers/misc/eeprom/Makefile -@@ -1,5 +1 @@ --obj-$(CONFIG_EEPROM_AT24) += at24.o --obj-$(CONFIG_EEPROM_AT25) += at25.o --obj-$(CONFIG_EEPROM_LEGACY) += eeprom.o --obj-$(CONFIG_EEPROM_MAX6875) += max6875.o - obj-$(CONFIG_EEPROM_93CX6) += eeprom_93cx6.o ---- a/drivers/net/usb/Makefile 2009-07-27 08:03:34.770077174 -0700 -+++ b/drivers/net/usb/Makefile 2009-07-27 08:04:22.594143560 -0700 -@@ -2,24 +2,7 @@ - # Makefile for USB Network drivers - # - --obj-$(CONFIG_USB_CATC) += catc.o --obj-$(CONFIG_USB_KAWETH) += kaweth.o --obj-$(CONFIG_USB_PEGASUS) += pegasus.o --obj-$(CONFIG_USB_RTL8150) += rtl8150.o --obj-$(CONFIG_USB_HSO) += hso.o --obj-$(CONFIG_USB_NET_AX8817X) += asix.o - obj-$(CONFIG_USB_NET_CDCETHER) += cdc_ether.o --obj-$(CONFIG_USB_NET_CDC_EEM) += cdc_eem.o --obj-$(CONFIG_USB_NET_DM9601) += dm9601.o --obj-$(CONFIG_USB_NET_SMSC95XX) += smsc95xx.o --obj-$(CONFIG_USB_NET_GL620A) += gl620a.o --obj-$(CONFIG_USB_NET_NET1080) += net1080.o --obj-$(CONFIG_USB_NET_PLUSB) += plusb.o - obj-$(CONFIG_USB_NET_RNDIS_HOST) += rndis_host.o --obj-$(CONFIG_USB_NET_CDC_SUBSET) += cdc_subset.o --obj-$(CONFIG_USB_NET_ZAURUS) += zaurus.o --obj-$(CONFIG_USB_NET_MCS7830) += mcs7830.o - obj-$(CONFIG_USB_USBNET) += usbnet.o --obj-$(CONFIG_USB_NET_INT51X1) += int51x1.o --obj-$(CONFIG_USB_CDC_PHONET) += cdc-phonet.o - ---- a/drivers/net/wireless/Makefile 2009-11-01 12:53:07.479194884 -0700 -+++ b/drivers/net/wireless/Makefile 2009-11-01 12:54:42.026195576 -0700 -@@ -5,33 +5,16 @@ - obj-$(CONFIG_IPW2100) += ipw2x00/ - obj-$(CONFIG_IPW2200) += ipw2x00/ - --obj-$(CONFIG_HERMES) += orinoco/ -- --obj-$(CONFIG_AIRO) += airo.o --obj-$(CONFIG_AIRO_CS) += airo_cs.o airo.o -- --obj-$(CONFIG_ATMEL) += atmel.o --obj-$(CONFIG_PCI_ATMEL) += atmel_pci.o --obj-$(CONFIG_PCMCIA_ATMEL) += atmel_cs.o -- - obj-$(CONFIG_AT76C50X_USB) += at76c50x-usb.o - --obj-$(CONFIG_PRISM54) += prism54/ -- --obj-$(CONFIG_HOSTAP) += hostap/ - obj-$(CONFIG_B43) += b43/ - obj-$(CONFIG_B43LEGACY) += b43legacy/ - obj-$(CONFIG_ZD1211RW) += zd1211rw/ - obj-$(CONFIG_RTL8180) += rtl818x/ - obj-$(CONFIG_RTL8187) += rtl818x/ - --# 16-bit wireless PCMCIA client drivers --obj-$(CONFIG_PCMCIA_RAYCS) += ray_cs.o --obj-$(CONFIG_PCMCIA_WL3501) += wl3501_cs.o -- - obj-$(CONFIG_USB_NET_RNDIS_WLAN) += rndis_wlan.o - --obj-$(CONFIG_USB_ZD1201) += zd1201.o - obj-$(CONFIG_LIBERTAS) += libertas/ - - obj-$(CONFIG_LIBERTAS_THINFIRM) += libertas_tf/ ---- a/net/wireless/Makefile 2009-10-06 13:00:59.000000000 -0400 -+++ b/net/wireless/Makefile 2009-10-06 13:00:59.000000000 -0400 -@@ -4,11 +4,6 @@ - obj-$(CONFIG_LIB80211_CRYPT_CCMP) += lib80211_crypt_ccmp.o - obj-$(CONFIG_LIB80211_CRYPT_TKIP) += lib80211_crypt_tkip.o - --obj-$(CONFIG_WEXT_CORE) += wext-core.o --obj-$(CONFIG_WEXT_PROC) += wext-proc.o --obj-$(CONFIG_WEXT_SPY) += wext-spy.o --obj-$(CONFIG_WEXT_PRIV) += wext-priv.o -- - cfg80211-y += core.o sysfs.o radiotap.o util.o reg.o scan.o nl80211.o - cfg80211-y += mlme.o ibss.o sme.o chan.o ethtool.o - cfg80211-$(CONFIG_CFG80211_DEBUGFS) += debugfs.o diff --git a/compat/patches/README b/compat/patches/README deleted file mode 100644 index e048cb4eab5b..000000000000 --- a/compat/patches/README +++ /dev/null @@ -1,16 +0,0 @@ - -compat-wireless patches -======================= - -You must have a really good reason to be adding files -in this directory. Your reasoning should either match the -explanation already present on the top of each patch file -or you should add your own. - -We try to avoid having patch files because: - - * Its a pain in the ass to maintain them. - - * Most backport changes can be pulled off through - some macro magic or new files which implement - the new functionality on the old kernels. diff --git a/patches/01-netdev.patch b/patches/01-netdev.patch new file mode 100644 index 000000000000..40a265821f7a --- /dev/null +++ b/patches/01-netdev.patch @@ -0,0 +1,613 @@ + +This patch backports the struct net_device_ops changes added +on 2.6.29. It also backports the namespace changes added +through net/wireless/wext.c. Note that there is another +patch file which also addresses netns changes, we leave +them separate as there is no easy way to split the stuff +without creating a headache on maintenance of the pathes. + +--- 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-12-10 08:40:23.000000000 -0800 ++++ b/drivers/net/usb/usbnet.c 2009-12-10 08:40:24.000000000 -0800 +@@ -1260,6 +1260,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, +@@ -1269,6 +1270,7 @@ + .ndo_set_mac_address = eth_mac_addr, + .ndo_validate_addr = eth_validate_addr, + }; ++#endif + + /*-------------------------------------------------------------------------*/ + +@@ -1348,7 +1350,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-09-02 14:08:52.418110490 -0700 ++++ b/drivers/net/wireless/rndis_wlan.c 2009-09-02 14:08:52.930092180 -0700 +@@ -2670,6 +2670,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, +@@ -2680,6 +2681,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) + { +@@ -2727,7 +2729,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-12-10 08:41:38.000000000 -0800 ++++ b/net/mac80211/iface.c 2009-12-10 08:41:39.000000000 -0800 +@@ -644,6 +644,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, +@@ -663,11 +664,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; + } + +@@ -682,7 +694,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 */ +@@ -705,7 +721,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; +@@ -774,6 +794,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 */ +@@ -782,6 +804,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) +@@ -821,6 +844,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/drivers/net/b44.c 2009-12-10 08:42:34.000000000 -0800 ++++ b/drivers/net/b44.c 2009-12-10 08:42:34.000000000 -0800 +@@ -2116,6 +2116,7 @@ + return err; + } + ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29)) + static const struct net_device_ops b44_netdev_ops = { + .ndo_open = b44_open, + .ndo_stop = b44_close, +@@ -2131,6 +2132,7 @@ + .ndo_poll_controller = b44_poll_controller, + #endif + }; ++#endif + + static int __devinit b44_init_one(struct ssb_device *sdev, + const struct ssb_device_id *ent) +@@ -2170,9 +2172,26 @@ + bp->rx_pending = B44_DEF_RX_RING_PENDING; + bp->tx_pending = B44_DEF_TX_RING_PENDING; + ++#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29)) ++ dev->open = b44_open; ++ dev->stop = b44_close; ++ dev->hard_start_xmit = b44_start_xmit; ++ dev->get_stats = b44_get_stats; ++ dev->set_multicast_list = b44_set_rx_mode; ++ dev->set_mac_address = b44_set_mac_addr; ++ dev->do_ioctl = b44_ioctl; ++ dev->tx_timeout = b44_tx_timeout; ++ netif_napi_add(dev, &bp->napi, b44_poll, 64); ++ dev->watchdog_timeo = B44_TX_TIMEOUT; ++#ifdef CONFIG_NET_POLL_CONTROLLER ++ dev->poll_controller = b44_poll_controller; ++#endif ++ dev->change_mtu = b44_change_mtu; ++#else + dev->netdev_ops = &b44_netdev_ops; + netif_napi_add(dev, &bp->napi, b44_poll, 64); + dev->watchdog_timeo = B44_TX_TIMEOUT; ++#endif + dev->irq = sdev->irq; + SET_ETHTOOL_OPS(dev, &b44_ethtool_ops); + +--- a/net/wireless/wext-core.c ++++ b/net/wireless/wext-core.c +@@ -340,6 +340,7 @@ + + /* IW event code */ + ++#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); +@@ -382,6 +383,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) + { +@@ -592,8 +616,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); + +@@ -902,8 +931,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; + } + +--- a/drivers/net/wireless/ipw2x00/ipw2100.c 2009-09-02 14:12:00.958117808 -0700 ++++ b/drivers/net/wireless/ipw2x00/ipw2100.c 2009-09-02 14:12:01.382115761 -0700 +@@ -6091,6 +6091,7 @@ + + static void ipw2100_irq_tasklet(struct ipw2100_priv *priv); + ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29)) + static const struct net_device_ops ipw2100_netdev_ops = { + .ndo_open = ipw2100_open, + .ndo_stop = ipw2100_close, +@@ -6101,6 +6102,7 @@ + .ndo_set_mac_address = ipw2100_set_address, + .ndo_validate_addr = eth_validate_addr, + }; ++#endif + + /* Look into using netdev destructor to shutdown ieee80211? */ + +@@ -6126,7 +6128,16 @@ + priv->ieee->perfect_rssi = -20; + priv->ieee->worst_rssi = -85; + ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29)) + dev->netdev_ops = &ipw2100_netdev_ops; ++#else ++ dev->open = ipw2100_open; ++ dev->stop = ipw2100_close; ++ dev->init = ipw2100_net_init; ++ dev->tx_timeout = ipw2100_tx_timeout; ++ dev->set_mac_address = ipw2100_set_address; ++#endif ++ + dev->ethtool_ops = &ipw2100_ethtool_ops; + dev->wireless_handlers = &ipw2100_wx_handler_def; + priv->wireless_data.libipw = priv->ieee; +--- a/drivers/net/wireless/ipw2x00/ipw2200.c 2009-11-13 11:37:43.000000000 -0800 ++++ b/drivers/net/wireless/ipw2x00/ipw2200.c 2009-11-13 11:37:43.000000000 -0800 +@@ -11635,6 +11635,7 @@ + return NETDEV_TX_OK; + } + ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29)) + static const struct net_device_ops ipw_prom_netdev_ops = { + .ndo_open = ipw_prom_open, + .ndo_stop = ipw_prom_stop, +@@ -11643,6 +11644,7 @@ + .ndo_set_mac_address = eth_mac_addr, + .ndo_validate_addr = eth_validate_addr, + }; ++#endif + + static int ipw_prom_alloc(struct ipw_priv *priv) + { +@@ -11663,7 +11665,13 @@ + memcpy(priv->prom_net_dev->dev_addr, priv->mac_addr, ETH_ALEN); + + priv->prom_net_dev->type = ARPHRD_IEEE80211_RADIOTAP; ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29)) + priv->prom_net_dev->netdev_ops = &ipw_prom_netdev_ops; ++#else ++ priv->prom_net_dev->open = ipw_prom_open; ++ priv->prom_net_dev->stop = ipw_prom_stop; ++ priv->prom_net_dev->hard_start_xmit = ipw_prom_hard_start_xmit; ++#endif + + priv->prom_priv->ieee->iw_mode = IW_MODE_MONITOR; + SET_NETDEV_DEV(priv->prom_net_dev, &priv->pci_dev->dev); +@@ -11691,6 +11699,7 @@ + + #endif + ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29)) + static const struct net_device_ops ipw_netdev_ops = { + .ndo_init = ipw_net_init, + .ndo_open = ipw_net_open, +@@ -11701,6 +11710,7 @@ + .ndo_change_mtu = libipw_change_mtu, + .ndo_validate_addr = eth_validate_addr, + }; ++#endif + + static int __devinit ipw_pci_probe(struct pci_dev *pdev, + const struct pci_device_id *ent) +@@ -11802,7 +11812,15 @@ + priv->ieee->perfect_rssi = -20; + priv->ieee->worst_rssi = -85; + ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29)) + net_dev->netdev_ops = &ipw_netdev_ops; ++#else ++ net_dev->open = ipw_net_open; ++ net_dev->stop = ipw_net_stop; ++ net_dev->init = ipw_net_init; ++ net_dev->set_multicast_list = ipw_net_set_multicast_list; ++ net_dev->set_mac_address = ipw_net_set_mac_address; ++#endif + priv->wireless_data.spy_data = &priv->ieee->spy_data; + net_dev->wireless_data = &priv->wireless_data; + net_dev->wireless_handlers = &ipw_wx_handler_def; +--- a/drivers/net/wireless/ipw2x00/libipw_module.c ++++ b/drivers/net/wireless/ipw2x00/libipw_module.c +@@ -157,6 +157,10 @@ + goto failed; + } + ieee = netdev_priv(dev); ++#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29)) ++ dev->hard_start_xmit = libipw_xmit; ++ dev->change_mtu = libipw_change_mtu; ++#endif + + ieee->dev = dev; + +--- a/drivers/net/wireless/libertas/main.c 2009-11-02 08:04:43.000000000 -0800 ++++ b/drivers/net/wireless/libertas/main.c 2009-11-02 08:04:44.000000000 -0800 +@@ -911,6 +911,7 @@ + lbs_deb_leave(LBS_DEB_MAIN); + } + ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29)) + static const struct net_device_ops lbs_netdev_ops = { + .ndo_open = lbs_dev_open, + .ndo_stop = lbs_eth_stop, +@@ -921,6 +922,7 @@ + .ndo_change_mtu = eth_change_mtu, + .ndo_validate_addr = eth_validate_addr, + }; ++#endif + + /** + * @brief This function adds the card. it will probe the +@@ -966,7 +968,16 @@ + wdev->netdev = dev; + priv->dev = dev; + ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29)) + dev->netdev_ops = &lbs_netdev_ops; ++#else ++ dev->open = lbs_dev_open; ++ dev->hard_start_xmit = lbs_hard_start_xmit; ++ dev->stop = lbs_eth_stop; ++ dev->set_mac_address = lbs_set_mac_address; ++ dev->tx_timeout = lbs_tx_timeout; ++ dev->set_multicast_list = lbs_set_multicast_list; ++#endif + dev->watchdog_timeo = 5 * HZ; + dev->ethtool_ops = &lbs_ethtool_ops; + #ifdef WIRELESS_EXT +@@ -1262,11 +1273,13 @@ + lbs_deb_leave(LBS_DEB_MAIN); + } + ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29)) + static const struct net_device_ops rtap_netdev_ops = { + .ndo_open = lbs_rtap_open, + .ndo_stop = lbs_rtap_stop, + .ndo_start_xmit = lbs_rtap_hard_start_xmit, + }; ++#endif + + static int lbs_add_rtap(struct lbs_private *priv) + { +@@ -1287,7 +1300,13 @@ + + memcpy(rtap_dev->dev_addr, priv->current_addr, ETH_ALEN); + rtap_dev->type = ARPHRD_IEEE80211_RADIOTAP; ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29)) + rtap_dev->netdev_ops = &rtap_netdev_ops; ++#else ++ rtap_dev->open = lbs_rtap_open; ++ rtap_dev->stop = lbs_rtap_stop; ++ rtap_dev->hard_start_xmit = lbs_rtap_hard_start_xmit; ++#endif + rtap_dev->ml_priv = priv; + SET_NETDEV_DEV(rtap_dev, priv->dev->dev.parent); + +--- a/drivers/net/wireless/libertas/mesh.c ++++ b/drivers/net/wireless/libertas/mesh.c +@@ -318,6 +318,7 @@ + return ret; + } + ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29)) + static const struct net_device_ops mesh_netdev_ops = { + .ndo_open = lbs_mesh_dev_open, + .ndo_stop = lbs_mesh_stop, +@@ -325,6 +326,7 @@ + .ndo_set_mac_address = lbs_set_mac_address, + .ndo_set_multicast_list = lbs_set_multicast_list, + }; ++#endif + + /** + * @brief This function adds mshX interface +@@ -349,7 +351,15 @@ + mesh_dev->ml_priv = priv; + priv->mesh_dev = mesh_dev; + ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29)) + mesh_dev->netdev_ops = &mesh_netdev_ops; ++#else ++ mesh_dev->open = lbs_mesh_dev_open; ++ mesh_dev->hard_start_xmit = lbs_hard_start_xmit; ++ mesh_dev->stop = lbs_mesh_stop; ++ mesh_dev->set_mac_address = lbs_set_mac_address; ++ mesh_dev->set_multicast_list = lbs_set_multicast_list; ++#endif + mesh_dev->ethtool_ops = &lbs_ethtool_ops; + memcpy(mesh_dev->dev_addr, priv->dev->dev_addr, + sizeof(priv->dev->dev_addr)); +--- a/drivers/net/wireless/libertas/defs.h 2009-07-08 14:04:29.692256519 -0700 ++++ b/drivers/net/wireless/libertas/defs.h 2009-07-08 14:03:26.712279246 -0700 +@@ -16,6 +16,14 @@ + #define DRV_NAME "libertas" + #endif + ++/* ++ * Really nasty hack to avoid stuffing compat.diff with tons of ifdefs, ++ * we could add this to a compat header file but too lazy to check ml_priv ++ * is not used anywhere else ++ */ ++#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,26)) ++#define ml_priv priv ++#endif + + #define LBS_DEB_ENTER 0x00000001 + #define LBS_DEB_LEAVE 0x00000002 +--- a/drivers/net/wireless/mac80211_hwsim.c 2009-08-18 16:18:52.829350750 -0700 ++++ b/drivers/net/wireless/mac80211_hwsim.c 2009-08-18 16:18:52.977352457 -0700 +@@ -872,16 +872,22 @@ + .name = "mac80211_hwsim" + }; + ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29)) + static const struct net_device_ops hwsim_netdev_ops = { + .ndo_start_xmit = hwsim_mon_xmit, + .ndo_change_mtu = eth_change_mtu, + .ndo_set_mac_address = eth_mac_addr, + .ndo_validate_addr = eth_validate_addr, + }; ++#endif + + static void hwsim_mon_setup(struct net_device *dev) + { ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29)) + dev->netdev_ops = &hwsim_netdev_ops; ++#else ++ dev->hard_start_xmit = hwsim_mon_xmit; ++#endif + dev->destructor = free_netdev; + ether_setup(dev); + dev->tx_queue_len = 0; +diff -Nur a/net/bluetooth/bnep/netdev.c b/net/bluetooth/bnep/netdev.c +--- a/net/bluetooth/bnep/netdev.c 2009-11-25 11:24:43.000000000 +0530 ++++ b/net/bluetooth/bnep/netdev.c 2009-11-27 19:35:33.000000000 +0530 +@@ -165,8 +165,12 @@ + } + #endif + +-static netdev_tx_t bnep_net_xmit(struct sk_buff *skb, +- struct net_device *dev) ++#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,31)) ++static netdev_tx_t bnep_net_xmit(struct sk_buff *skb, struct net_device *dev) ++#else ++static int bnep_net_xmit(struct sk_buff *skb, struct net_device *dev) ++#endif ++ + { + struct bnep_session *s = netdev_priv(dev); + struct sock *sk = s->sock->sk; +@@ -207,6 +211,7 @@ + return NETDEV_TX_OK; + } + ++#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,28)) + static const struct net_device_ops bnep_netdev_ops = { + .ndo_open = bnep_net_open, + .ndo_stop = bnep_net_close, +@@ -218,6 +223,16 @@ + .ndo_change_mtu = eth_change_mtu, + + }; ++#else ++static struct net_device_stats *bnep_net_get_stats(struct net_device *dev) ++{ ++ return &dev->stats; ++} ++static int bnep_net_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) ++{ ++ return -EINVAL; ++} ++#endif + + void bnep_net_setup(struct net_device *dev) + { +@@ -226,7 +241,18 @@ + dev->addr_len = ETH_ALEN; + + ether_setup(dev); ++#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,28)) + dev->netdev_ops = &bnep_netdev_ops; ++#else ++ dev->open = bnep_net_open; ++ dev->stop = bnep_net_close; ++ dev->hard_start_xmit = bnep_net_xmit; ++ dev->get_stats = bnep_net_get_stats; ++ dev->do_ioctl = bnep_net_ioctl; ++ dev->set_mac_address = bnep_net_set_mac_addr; ++ dev->set_multicast_list = bnep_net_set_mc_list; ++ dev->tx_timeout = bnep_net_timeout; ++#endif + + dev->watchdog_timeo = HZ * 2; + } diff --git a/patches/02-ksize.patch b/patches/02-ksize.patch new file mode 100644 index 000000000000..48964e29ed9b --- /dev/null +++ b/patches/02-ksize.patch @@ -0,0 +1,27 @@ +ksize() was added as of 2.6.29, it gives you the actual +size of the allocated data. Since we have no support for +this we simply do not optimize for it and deal with +large alloocations for the IEs. + +We technically could backport this as + +define ksize(bleh) SOME_LARGE_NUMBER + +but doing it this way emphasis careful review +of the situation. + +--- a/net/wireless/scan.c 2009-09-02 14:13:33.769092519 -0700 ++++ b/net/wireless/scan.c 2009-09-02 14:13:34.925094548 -0700 +@@ -423,7 +423,12 @@ + 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) { ++ used = 0; /* just to shut up the compiler */ ++#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/patches/03-rfkill.patch b/patches/03-rfkill.patch new file mode 100644 index 000000000000..a221dff8c46a --- /dev/null +++ b/patches/03-rfkill.patch @@ -0,0 +1,233 @@ +rfkill was re-implemented on 2.6.31. We port it to +older kernels with a simple hack, just rename the +module as a new one rfkill_backport, and every +exported symbol gets redefined with a _backport +postfix through compat-2.6.31.h. The changes below +are the ones we could not do through compat-2.6.31.h + +Do older kernels have /dev/rfkill ? I not then we can +just keep /dev/rfkill and not /dev/rfkill_backport. + +Note that 2.6.31 added netdevice notifier upon interface +dev_open() which on cfg80211 will check if checks to see +if rfkill is enabled (or if the mode of operation is not +supported) on the cfg80211_netdev_notifier_call() and if +so deny bringing the interface up. This was added via +commit: + +3b8bcfd5d31ea0fec58681d035544ace707d2536 + +Since older kernels will not have the notifier call +on dev_open() if we *really want* to port this we could have +mac80211's subif_open() call : + + ret = call_netdevice_notifiers(NETDEV_PRE_UP, dev); + ret = notifier_to_errno(ret); + if (ret) + return ret; + +This would do the policing from within mac80211. + +--- a/net/rfkill/Makefile ++++ b/net/rfkill/Makefile +@@ -2,6 +2,6 @@ + # Makefile for the RF switch subsystem. + # + +-rfkill-y += core.o +-rfkill-$(CONFIG_RFKILL_INPUT) += input.o +-obj-$(CONFIG_RFKILL) += rfkill.o ++rfkill_backport-y += core.o ++rfkill_backport-$(CONFIG_RFKILL_BACKPORT_INPUT) += input.o ++obj-$(CONFIG_RFKILL_BACKPORT) += rfkill_backport.o +--- 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 + #include + #include ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,31)) + #include ++#else ++#include ++#endif + #include + + #include "rfkill.h" +@@ -229,7 +233,7 @@ static int rfkill_connect(struct input_h + + handle->dev = dev; + handle->handler = handler; +- handle->name = "rfkill"; ++ handle->name = "rfkill_backport"; + + /* causes rfkill_start() to be called */ + error = input_register_handle(handle); +--- a/net/rfkill/core.c 2009-10-06 12:53:52.000000000 -0400 ++++ b/net/rfkill/core.c 2009-10-06 12:53:53.000000000 -0400 +@@ -26,7 +26,7 @@ + #include + #include + #include +-#include ++#include + #include + #include + #include +@@ -62,7 +62,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 +@@ -123,7 +123,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; +@@ -317,7 +317,7 @@ + rfkill_event(rfkill); + } + +-#ifdef CONFIG_RFKILL_INPUT ++#ifdef CONFIG_RFKILL_BACKPORT_INPUT + static atomic_t rfkill_input_disabled = ATOMIC_INIT(0); + + /** +@@ -779,7 +779,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, +@@ -925,7 +925,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)) +@@ -1153,7 +1153,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"); +@@ -1164,7 +1164,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) + { +@@ -1197,7 +1197,7 @@ + .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 +@@ -1227,7 +1227,7 @@ + goto out; + } + +-#ifdef CONFIG_RFKILL_INPUT ++#ifdef CONFIG_RFKILL_BACKPORT_INPUT + error = rfkill_handler_init(); + if (error) { + misc_deregister(&rfkill_miscdev); +@@ -1243,7 +1243,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-09-13 13:28:21.286436755 -0700 ++++ b/include/linux/rfkill_backport.h 2009-09-13 13:28:54.665495610 -0700 +@@ -20,6 +20,7 @@ + */ + + #include ++#include + + /* 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 +@@ -355,7 +356,7 @@ + #endif /* RFKILL || RFKILL_MODULE */ + + +-#ifdef CONFIG_RFKILL_LEDS ++#ifdef CONFIG_RFKILL_BACKPORT_LEDS + /** + * rfkill_get_led_trigger_name - Get the LED trigger name for the button's LED. + * This function might return a NULL pointer if registering of the +--- a/net/wireless/core.h 2009-07-07 13:32:53.367707921 -0700 ++++ b/net/wireless/core.h 2009-07-07 13:32:53.943703622 -0700 +@@ -11,7 +11,11 @@ + #include + #include + #include ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,31)) + #include ++#else ++#include ++#endif + #include + #include + #include +--- a/drivers/net/wireless/ath/ath9k/hw.c 2009-12-10 08:43:21.000000000 -0800 ++++ b/drivers/net/wireless/ath/ath9k/hw.c 2009-12-10 08:43:22.000000000 -0800 +@@ -3260,7 +3260,7 @@ + + pCap->hw_caps |= ATH9K_HW_CAP_ENHANCEDPM; + +-#if defined(CONFIG_RFKILL) || defined(CONFIG_RFKILL_MODULE) ++#if ((LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,31)) && defined(CONFIG_RFKILL) || defined(CONFIG_RFKILL_MODULE)) || ((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,31)) && defined(CONFIG_RFKILL_BACKPORT) || defined(CONFIG_RFKILL_BACKPORT_MODULE)) + ah->rfsilent = ah->eep_ops->get_eeprom(ah, EEP_RF_SILENT); + if (ah->rfsilent & EEP_RFSILENT_ENABLED) { + ah->rfkill_gpio = +--- a/drivers/net/wireless/ath/ath5k/base.h ++++ b/drivers/net/wireless/ath/ath5k/base.h +@@ -46,7 +46,11 @@ + #include + #include + #include ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,31)) + #include ++#else ++#include ++#endif + + #include "ath5k.h" + #include "debug.h" diff --git a/patches/04-netns.patch b/patches/04-netns.patch new file mode 100644 index 000000000000..76833a41b0b1 --- /dev/null +++ b/patches/04-netns.patch @@ -0,0 +1,18 @@ +The only other namespace change. Note that pach 01-netdev.patch +also has some other namespace changes there, look at that file +for the other changes. It'd be nice to figure out a way to +bring thise here cleanly and seprately but they touch the same +files... + +--- 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 @@ + .hdrsize = 0, /* no private header */ + .version = 1, /* no particular meaning now */ + .maxattr = NL80211_ATTR_MAX, ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32)) + .netnsok = true, ++#endif + }; + + /* internal helper: get rdev and dev */ diff --git a/patches/05-usb.patch b/patches/05-usb.patch new file mode 100644 index 000000000000..9d13a1330a0e --- /dev/null +++ b/patches/05-usb.patch @@ -0,0 +1,14 @@ +USB opt soft_unbid was added as of 2.6.27. + +--- a/drivers/net/wireless/p54/p54usb.c 2009-09-23 10:28:04.963708264 -0700 ++++ b/drivers/net/wireless/p54/p54usb.c 2009-09-23 10:28:05.199734839 -0700 +@@ -1052,7 +1052,9 @@ + .resume = p54u_resume, + .reset_resume = p54u_resume, + #endif /* CONFIG_PM */ ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)) + .soft_unbind = 1, ++#endif + }; + + static int __init p54u_init(void) diff --git a/patches/06-header-changes.patch b/patches/06-header-changes.patch new file mode 100644 index 000000000000..44f43cf4f34a --- /dev/null +++ b/patches/06-header-changes.patch @@ -0,0 +1,66 @@ + +Every kernel release there are a few changes to headers +made. Some code gets shifted around between headers or +new headers are defined. This patch deals with such +cases. + +--- a/drivers/net/wireless/b43/phy_common.h ++++ b/drivers/net/wireless/b43/phy_common.h +@@ -2,6 +2,9 @@ + #define LINUX_B43_PHY_COMMON_H_ + + #include ++#if (LINUX_VERSION_CODE == KERNEL_VERSION(2,6,28)) ++#include ++#endif + + struct b43_wldev; + +--- a/drivers/net/wireless/libertas/assoc.c ++++ b/drivers/net/wireless/libertas/assoc.c +@@ -5,6 +5,9 @@ + #include + #include + #include ++#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29)) ++#include ++#endif + + #include "assoc.h" + #include "decl.h" +--- a/drivers/net/wireless/wl12xx/wl1251_main.c 2009-08-07 11:42:12.532495607 -0700 ++++ b/drivers/net/wireless/wl12xx/wl1251_main.c 2009-08-07 12:08:31.167548696 -0700 +@@ -26,6 +26,9 @@ + #include + #include + #include ++#if (LINUX_VERSION_CODE == KERNEL_VERSION(2,6,28)) ++#include ++#endif + #include + #include + #include +--- a/drivers/net/wireless/wl12xx/wl1251_spi.c 2009-08-07 12:24:58.907526225 -0700 ++++ b/drivers/net/wireless/wl12xx/wl1251_spi.c 2009-08-07 12:24:59.199494403 -0700 +@@ -24,6 +24,9 @@ + #include + #include + #include ++#if (LINUX_VERSION_CODE == KERNEL_VERSION(2,6,28)) ++#include ++#endif + #include + #include + +--- a/net/mac80211/key.c ++++ b/net/mac80211/key.c +@@ -21,6 +21,9 @@ + #include "aes_ccm.h" + #include "aes_cmac.h" + ++#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29)) ++#include ++#endif + + /** + * DOC: Key handling basics diff --git a/patches/07-change-default-rate-alg.patch b/patches/07-change-default-rate-alg.patch new file mode 100644 index 000000000000..159b9317a971 --- /dev/null +++ b/patches/07-change-default-rate-alg.patch @@ -0,0 +1,34 @@ + +Your current kernels configuration (.config and linux/autoconf.h) +are always respected when compiling external modules. Because +of this if you are using an old kernel which preferred the +PID rate control algorithm we cannot force it to use minstrel +instead. Minstrel is now the default rate control algorithm +and we want you to use it. To let you use it we redefine here +the CONFIG_MAC80211_RC_DEFAULT to CONFIG_COMPAT_MAC80211_RC_DEFAULT +and define CONFIG_COMPAT_MAC80211_RC_DEFAULT on config.mk. +Through the compat autoconf we then get it also defined there +at compilation time. + +--- a/net/mac80211/rate.c 2009-12-10 08:44:19.000000000 -0800 ++++ b/net/mac80211/rate.c 2009-12-10 08:46:38.000000000 -0800 +@@ -22,7 +22,7 @@ struct rate_control_alg { + static LIST_HEAD(rate_ctrl_algs); + static DEFINE_MUTEX(rate_ctrl_mutex); + +-static char *ieee80211_default_rc_algo = CONFIG_MAC80211_RC_DEFAULT; ++static char *ieee80211_default_rc_algo = CONFIG_COMPAT_MAC80211_RC_DEFAULT; + module_param(ieee80211_default_rc_algo, charp, 0644); + MODULE_PARM_DESC(ieee80211_default_rc_algo, + "Default rate control algorithm for mac80211 to use"); +@@ -118,8 +118,8 @@ ieee80211_rate_control_ops_get(const cha + ops = ieee80211_try_rate_control_ops_get(ieee80211_default_rc_algo); + + /* try built-in one if specific alg requested but not found */ +- if (!ops && strlen(CONFIG_MAC80211_RC_DEFAULT)) +- ops = ieee80211_try_rate_control_ops_get(CONFIG_MAC80211_RC_DEFAULT); ++ if (!ops && strlen(CONFIG_COMPAT_MAC80211_RC_DEFAULT)) ++ ops = ieee80211_try_rate_control_ops_get(CONFIG_COMPAT_MAC80211_RC_DEFAULT); + kparam_unblock_sysfs_write(ieee80211_default_rc_algo); + + return ops; diff --git a/patches/08-rename-iwl4965-config.patch b/patches/08-rename-iwl4965-config.patch new file mode 100644 index 000000000000..7e5cf752a8c2 --- /dev/null +++ b/patches/08-rename-iwl4965-config.patch @@ -0,0 +1,31 @@ +In kernel 2.6.26 and older CONFIG_IWL4965 was build as an extra +module, but now it is directly included in the iwlagn. + +CONFIG_IWL4965 has to be set to y, to build correctly. + +--- a/drivers/net/wireless/iwlwifi/Makefile 2009-10-06 12:57:49.000000000 -0400 ++++ b/drivers/net/wireless/iwlwifi/Makefile 2009-10-06 12:57:50.000000000 -0400 +@@ -12,7 +12,7 @@ + obj-$(CONFIG_IWLAGN) += iwlagn.o + iwlagn-objs := iwl-agn.o iwl-agn-rs.o iwl-agn-led.o + +-iwlagn-$(CONFIG_IWL4965) += iwl-4965.o ++iwlagn-$(CONFIG_COMPAT_IWL4965) += iwl-4965.o + iwlagn-$(CONFIG_IWL5000) += iwl-5000.o + iwlagn-$(CONFIG_IWL5000) += iwl-6000.o + iwlagn-$(CONFIG_IWL5000) += iwl-1000.o +--- a/drivers/net/wireless/iwlwifi/iwl-agn.c 2009-12-10 08:47:49.000000000 -0800 ++++ b/drivers/net/wireless/iwlwifi/iwl-agn.c 2009-12-10 08:47:51.000000000 -0800 +@@ -3590,10 +3590,10 @@ static void __devexit iwl_pci_remove(str + + /* Hardware specific file defines the PCI IDs table for that hardware module */ + static struct pci_device_id iwl_hw_card_ids[] = { +-#ifdef CONFIG_IWL4965 ++#ifdef CONFIG_COMPAT_IWL4965 + {IWL_PCI_DEVICE(0x4229, PCI_ANY_ID, iwl4965_agn_cfg)}, + {IWL_PCI_DEVICE(0x4230, PCI_ANY_ID, iwl4965_agn_cfg)}, +-#endif /* CONFIG_IWL4965 */ ++#endif /* CONFIG_COMPAT_IWL4965 */ + #ifdef CONFIG_IWL5000 + /* 5100 Series WiFi */ + {IWL_PCI_DEVICE(0x4232, 0x1201, iwl5100_agn_cfg)}, /* Mini Card */ diff --git a/patches/09-threaded-irq.patch b/patches/09-threaded-irq.patch new file mode 100644 index 000000000000..6731ee8d1370 --- /dev/null +++ b/patches/09-threaded-irq.patch @@ -0,0 +1,63 @@ +The 2.6.31 kernel has threaded IRQ support and b43 is the first +wireless driver that makes use of it. To support threaded IRSs +on older kernels we built our own struct compat_threaded_irq +to queue_work() onto it as the kernel thread be running the +thread in process context as well. + +--- a/drivers/net/wireless/b43/main.c 2009-11-13 11:39:32.000000000 -0800 ++++ b/drivers/net/wireless/b43/main.c 2009-11-13 11:39:33.000000000 -0800 +@@ -3909,8 +3909,13 @@ + if (dev->dev->bus->bustype == SSB_BUSTYPE_SDIO) { + b43_sdio_free_irq(dev); + } else { ++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,31) ++ compat_synchronize_threaded_irq(&dev->irq_compat); ++ compat_free_threaded_irq(&dev->irq_compat); ++#else + synchronize_irq(dev->dev->irq); + free_irq(dev->dev->irq, dev); ++#endif + } + mutex_lock(&wl->mutex); + dev = wl->current_dev; +@@ -3950,9 +3955,17 @@ + goto out; + } + } else { ++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,31) ++ err = compat_request_threaded_irq(&dev->irq_compat, ++ dev->dev->irq, ++ b43_interrupt_handler, ++ b43_interrupt_thread_handler, ++ IRQF_SHARED, KBUILD_MODNAME, dev); ++#else + err = request_threaded_irq(dev->dev->irq, b43_interrupt_handler, + b43_interrupt_thread_handler, + IRQF_SHARED, KBUILD_MODNAME, dev); ++#endif + if (err) { + b43err(dev->wl, "Cannot request IRQ-%d\n", dev->dev->irq); + goto out; +@@ -4659,6 +4672,10 @@ + + static void b43_wireless_core_detach(struct b43_wldev *dev) + { ++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,31) ++ if (dev->dev->bus->bustype != SSB_BUSTYPE_SDIO) ++ compat_destroy_threaded_irq(&dev->irq_compat); ++#endif + /* We release firmware that late to not be required to re-request + * is all the time when we reinit the core. */ + b43_release_firmware(dev); +--- a/drivers/net/wireless/b43/b43.h 2009-10-19 11:36:44.000000000 +0900 ++++ b/drivers/net/wireless/b43/b43.h 2009-10-19 11:36:45.000000000 +0900 +@@ -745,6 +745,9 @@ + unsigned int tx_count; + unsigned int rx_count; + #endif ++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,31) ++ struct compat_threaded_irq irq_compat; ++#endif + }; + + /* Data structure for the WLAN parts (802.11 cores) of the b43 chip. */ diff --git a/patches/10-add-wext-handlers-to-netdev.patch b/patches/10-add-wext-handlers-to-netdev.patch new file mode 100644 index 000000000000..e5ab4f11f6ef --- /dev/null +++ b/patches/10-add-wext-handlers-to-netdev.patch @@ -0,0 +1,26 @@ +The patch "wext: refactor" by Johannes Berg refactored +wext code so that new kernels no longer get the wext +handlers through struct netdevice, instead they get +it through the struct wiphy which is cfg80211 specific. + +For old kernels this means you get not wext handlers +anymore when backporting code, this adds the wext handler +back to the netdevice wireless_handlers to let compat +users use wext again. + +We only do this for kernels <= 2.6.32 as 2.6.33 will use +the struct wiphy wireless handler. + +--- a/net/wireless/core.c 2009-12-10 09:02:05.000000000 -0800 ++++ b/net/wireless/core.c 2009-12-10 09:02:08.000000000 -0800 +@@ -683,6 +683,10 @@ + wdev->sme_state = CFG80211_SME_IDLE; + mutex_unlock(&rdev->devlist_mtx); + #ifdef CONFIG_CFG80211_WEXT ++#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,32)) ++ if (!dev->wireless_handlers) ++ dev->wireless_handlers = &cfg80211_wext_handler; ++#endif + wdev->wext.default_key = -1; + wdev->wext.default_mgmt_key = -1; + wdev->wext.connect.auth_type = NL80211_AUTHTYPE_AUTOMATIC; diff --git a/patches/11-dev-pm-ops.patch b/patches/11-dev-pm-ops.patch new file mode 100644 index 000000000000..fc4de8f64777 --- /dev/null +++ b/patches/11-dev-pm-ops.patch @@ -0,0 +1,58 @@ +The 2.6.29 kernel has new struct dev_pm_ops [1] which are used +on the pci device to distinguish power management hooks for suspend +to RAM and hibernation. Older kernels don't have these so we need +to resort back to the good ol' suspend/resume. Fortunately the calls +are not so different so it should be possible to resuse the same +calls on compat code with only slight modifications. + +[1] http://lxr.linux.no/#linux+v2.6.29/include/linux/pm.h#L170 + +--- a/drivers/net/wireless/ath/ath5k/base.c 2009-10-07 01:58:19.000000000 -0400 ++++ b/drivers/net/wireless/ath/ath5k/base.c 2009-10-07 02:19:58.000000000 -0400 +@@ -197,6 +197,33 @@ + #ifdef CONFIG_PM + static int ath5k_pci_suspend(struct device *dev); + static int ath5k_pci_resume(struct device *dev); ++#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29)) ++static int ath5k_pci_suspend_compat(struct pci_dev *pdev, pm_message_t state) ++{ ++ int r; ++ ++ r = ath5k_pci_suspend(&pdev->dev); ++ if (r) ++ return r; ++ ++ pci_save_state(pdev); ++ pci_disable_device(pdev); ++ pci_set_power_state(pdev, PCI_D3hot); ++ return 0; ++} ++ ++static int ath5k_pci_resume_compat(struct pci_dev *pdev) ++{ ++ int r; ++ ++ pci_restore_state(pdev); ++ r = pci_enable_device(pdev); ++ if (r) ++ return r; ++ ++ return ath5k_pci_resume(&pdev->dev); ++} ++#endif + + SIMPLE_DEV_PM_OPS(ath5k_pm_ops, ath5k_pci_suspend, ath5k_pci_resume); + #define ATH5K_PM_OPS (&ath5k_pm_ops) +@@ -209,7 +235,12 @@ + .id_table = ath5k_pci_id_table, + .probe = ath5k_pci_probe, + .remove = __devexit_p(ath5k_pci_remove), ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29)) + .driver.pm = ATH5K_PM_OPS, ++#elif defined(CONFIG_PM) ++ .suspend = ath5k_pci_suspend_compat, ++ .resume = ath5k_pci_resume_compat, ++#endif + }; + + diff --git a/patches/12-iw_handler-changes.patch b/patches/12-iw_handler-changes.patch new file mode 100644 index 000000000000..fb97af5aac4a --- /dev/null +++ b/patches/12-iw_handler-changes.patch @@ -0,0 +1,14 @@ +--- a/drivers/net/wireless/ipw2x00/ipw2100.c 2009-10-08 11:01:52.000000000 -0400 ++++ b/drivers/net/wireless/ipw2x00/ipw2100.c 2009-10-08 11:01:43.000000000 -0400 +@@ -6140,7 +6140,11 @@ + + dev->ethtool_ops = &ipw2100_ethtool_ops; + dev->wireless_handlers = &ipw2100_wx_handler_def; ++#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,31)) + priv->wireless_data.libipw = priv->ieee; ++#else ++ priv->wireless_data.ieee80211 = (struct ieee80211_device *) priv->ieee; ++#endif + dev->wireless_data = &priv->wireless_data; + dev->watchdog_timeo = 3 * HZ; + dev->irq = 0; diff --git a/patches/13-trace.patch b/patches/13-trace.patch new file mode 100644 index 000000000000..7668d50db05a --- /dev/null +++ b/patches/13-trace.patch @@ -0,0 +1,44 @@ +Older kernels do not have trace/define_trace.h [1] and if there +is something there that we can backport we will define it +in or compat headers. + +[1] http://lxr.linux.no/#linux+v2.6.31/include/trace/define_trace.h + +--- a/drivers/net/wireless/iwlwifi/iwl-devtrace.h ++++ b/drivers/net/wireless/iwlwifi/iwl-devtrace.h +@@ -1,7 +1,9 @@ + #if !defined(__IWLWIFI_DEVICE_TRACE) || defined(TRACE_HEADER_MULTI_READ) + #define __IWLWIFI_DEVICE_TRACE + ++#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,27)) + #include ++#endif /* (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,27)) */ + #include "iwl-dev.h" + + #if !defined(CONFIG_IWLWIFI_DEVICE_TRACING) || defined(__CHECKER__) +@@ -194,4 +196,6 @@ TRACE_EVENT(iwlwifi_dev_ucode_event, + #define TRACE_INCLUDE_PATH . + #undef TRACE_INCLUDE_FILE + #define TRACE_INCLUDE_FILE iwl-devtrace ++#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,30)) + #include ++#endif +--- a/net/mac80211/driver-trace.h 2009-08-18 16:19:34.574352433 -0700 ++++ b/net/mac80211/driver-trace.h 2009-08-18 16:19:35.694367614 -0700 +@@ -1,7 +1,9 @@ + #if !defined(__MAC80211_DRIVER_TRACE) || defined(TRACE_HEADER_MULTI_READ) + #define __MAC80211_DRIVER_TRACE + ++#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,27)) + #include ++#endif /* (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,27)) */ + #include + #include "ieee80211_i.h" + +@@ -694,4 +696,6 @@ TRACE_EVENT(drv_ampdu_action, + #define TRACE_INCLUDE_PATH . + #undef TRACE_INCLUDE_FILE + #define TRACE_INCLUDE_FILE driver-trace ++#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,30)) + #include ++#endif /* (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,30)) */ diff --git a/patches/14-device-type.patch b/patches/14-device-type.patch new file mode 100644 index 000000000000..9f2f433b59f2 --- /dev/null +++ b/patches/14-device-type.patch @@ -0,0 +1,36 @@ +Kernels >= 2.6.32 can identify the type of device netdevice +so that sysfs can be used to get this. We never really had a +systematic way of doing this -- now we do through the +SET_NETDEV_DEVTYPE() macro. For older kernels we make the +SET_NETDEV_DEVTYPE() be a no-op this means the wireless type +we define is unused so we ucomment it simply to avoid a +compile warning. + +--- a/net/wireless/core.c 2009-12-10 09:17:21.000000000 -0800 ++++ b/net/wireless/core.c 2009-12-10 09:17:28.000000000 -0800 +@@ -635,9 +635,11 @@ + dev_put(wdev->netdev); + } + ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32)) + static struct device_type wiphy_type = { + .name = "wlan", + }; ++#endif + + static int cfg80211_netdev_notifier_call(struct notifier_block * nb, + unsigned long state, +--- a/net/bluetooth/bnep/core.c 2009-12-10 09:22:58.000000000 -0800 ++++ b/net/bluetooth/bnep/core.c 2009-12-10 09:22:59.000000000 -0800 +@@ -536,9 +536,11 @@ static struct device *bnep_get_device(st + return conn ? &conn->dev : NULL; + } + ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32)) + static struct device_type bnep_type = { + .name = "bluetooth", + }; ++#endif + + int bnep_add_connection(struct bnep_connadd_req *req, struct socket *sock) + { diff --git a/patches/15-symbol-export-conflicts.patch b/patches/15-symbol-export-conflicts.patch new file mode 100644 index 000000000000..053867136582 --- /dev/null +++ b/patches/15-symbol-export-conflicts.patch @@ -0,0 +1,18 @@ +In kernel < 2.6.32 libipw also exports ieee80211_rx. +To avoid conflicts with the other export we rename our. + +--- a/net/mac80211/rx.c 2009-11-13 11:41:29.000000000 -0800 ++++ b/net/mac80211/rx.c 2009-11-13 11:41:30.000000000 -0800 +@@ -2537,7 +2537,12 @@ + drop: + kfree_skb(skb); + } ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32)) + EXPORT_SYMBOL(ieee80211_rx); ++#else ++EXPORT_SYMBOL(mac80211_ieee80211_rx); ++#endif ++ + + /* This is a version of the rx handler that can be called from hard irq + * context. Post the skb on the queue and schedule the tasklet */ diff --git a/patches/16-bluetooth.patch b/patches/16-bluetooth.patch new file mode 100644 index 000000000000..32529a0b611d --- /dev/null +++ b/patches/16-bluetooth.patch @@ -0,0 +1,448 @@ +These changes are required to backport blueooth. A lot can be optimized +here still, but for now we keep this here. + +diff -Nur a/drivers/bluetooth/hci_ldisc.c b/drivers/bluetooth/hci_ldisc.c +--- a/drivers/bluetooth/hci_ldisc.c 2009-11-25 11:24:32.000000000 +0530 ++++ b/drivers/bluetooth/hci_ldisc.c 2009-11-28 10:56:22.000000000 +0530 +@@ -277,8 +277,13 @@ + /* FIXME: why is this needed. Note don't use ldisc_ref here as the + open path is before the ldisc is referencable */ + ++#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,30)) + if (tty->ldisc->ops->flush_buffer) + tty->ldisc->ops->flush_buffer(tty); ++#else ++ if (tty->ldisc.ops->flush_buffer) ++ tty->ldisc.ops->flush_buffer(tty); ++#endif + tty_driver_flush_buffer(tty); + + return 0; +@@ -478,7 +483,11 @@ + return -EUNATCH; + + default: ++#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,27)) + err = n_tty_ioctl_helper(tty, file, cmd, arg); ++#else ++ err = n_tty_ioctl(tty, file, cmd, arg); ++#endif + break; + }; + +--- a/net/bluetooth/af_bluetooth.c 2009-12-10 09:20:31.000000000 -0800 ++++ b/net/bluetooth/af_bluetooth.c 2009-12-10 09:20:33.000000000 -0800 +@@ -338,7 +338,11 @@ int bt_sock_ioctl(struct socket *sock, u + if (sk->sk_state == BT_LISTEN) + return -EINVAL; + ++#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,31)) + amount = sk->sk_sndbuf - sk_wmem_alloc_get(sk); ++#else ++ amount = sk->sk_sndbuf - atomic_read(&sk->sk_wmem_alloc); ++#endif + if (amount < 0) + amount = 0; + err = put_user(amount, (int __user *) arg); +diff -Nur a/net/bluetooth/cmtp/capi.c b/net/bluetooth/cmtp/capi.c +--- a/net/bluetooth/cmtp/capi.c 2009-11-25 11:24:43.000000000 +0530 ++++ b/net/bluetooth/cmtp/capi.c 2009-11-26 16:43:42.000000000 +0530 +@@ -382,7 +382,11 @@ + + BT_DBG("ctrl %p", ctrl); + ++#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,30)) + capi_ctr_down(ctrl); ++#else ++ capi_ctr_reseted(ctrl); ++#endif + + atomic_inc(&session->terminate); + cmtp_schedule(session); +diff -Nur a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c +--- a/net/bluetooth/hci_core.c 2009-11-25 11:24:43.000000000 +0530 ++++ b/net/bluetooth/hci_core.c 2009-11-26 16:01:35.000000000 +0530 +@@ -39,7 +39,12 @@ + #include + #include + #include ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,31)) + #include ++#else ++#include ++#endif ++ + #include + + #include +--- a/net/bluetooth/hci_sock.c 2009-12-10 09:40:08.000000000 -0800 ++++ b/net/bluetooth/hci_sock.c 2009-12-10 09:40:59.000000000 -0800 +@@ -471,7 +471,11 @@ + goto done; + } + ++#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,31)) + static int hci_sock_setsockopt(struct socket *sock, int level, int optname, char __user *optval, unsigned int len) ++#else ++static int hci_sock_setsockopt(struct socket *sock, int level, int optname, char __user *optval, int len) ++#endif + { + struct hci_ufilter uf = { .opcode = 0 }; + struct sock *sk = sock->sk; +diff -Nur a/net/bluetooth/hci_sysfs.c b/net/bluetooth/hci_sysfs.c +--- a/net/bluetooth/hci_sysfs.c 2009-11-25 11:24:43.000000000 +0530 ++++ b/net/bluetooth/hci_sysfs.c 2009-11-27 15:19:26.000000000 +0530 +@@ -68,7 +68,11 @@ + .attrs = bt_link_attrs, + }; + ++#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,31)) + static const struct attribute_group *bt_link_groups[] = { ++#else ++static struct attribute_group *bt_link_groups[] = { ++#endif + &bt_link_group, + NULL + }; +@@ -126,7 +130,11 @@ + dev = device_find_child(&conn->dev, NULL, __match_tty); + if (!dev) + break; ++#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,29)) + device_move(dev, NULL, DPM_ORDER_DEV_LAST); ++#else ++ device_move(dev, NULL); ++#endif + put_device(dev); + } + +@@ -392,7 +400,11 @@ + .attrs = bt_host_attrs, + }; + ++#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,31)) + static const struct attribute_group *bt_host_groups[] = { ++#else ++static struct attribute_group *bt_host_groups[] = { ++#endif + &bt_host_group, + NULL + }; +--- a/net/bluetooth/hidp/core.c 2009-12-10 09:43:25.000000000 -0800 ++++ b/net/bluetooth/hidp/core.c 2009-12-10 09:45:09.000000000 -0800 +@@ -583,10 +583,16 @@ static int hidp_session(void *arg) + session->input = NULL; + } + +- if (session->hid) { +- hid_destroy_device(session->hid); +- session->hid = NULL; +- } ++ if (session->hid) { ++#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,27)) ++ hid_destroy_device(session->hid); ++ session->hid = NULL; ++#else ++ if (session->hid->claimed & HID_CLAIMED_INPUT) ++ hidinput_disconnect(session->hid); ++ hid_free_device(session->hid); ++#endif ++ } + + /* Wakeup user-space polling for socket errors */ + session->intr_sock->sk->sk_err = EUNATCH; +@@ -698,6 +704,7 @@ static void hidp_close(struct hid_device + { + } + ++#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,27)) + static int hidp_parse(struct hid_device *hid) + { + struct hidp_session *session = hid->driver_data; +@@ -762,15 +769,44 @@ static struct hid_ll_driver hidp_hid_dri + }; + + static int hidp_setup_hid(struct hidp_session *session, ++#else ++static const struct { ++ __u16 idVendor; ++ __u16 idProduct; ++ unsigned quirks; ++} hidp_blacklist[] = { ++ /* Apple wireless Mighty Mouse */ ++ { 0x05ac, 0x030c, HID_QUIRK_MIGHTYMOUSE | HID_QUIRK_INVERT_HWHEEL }, ++ ++ { } /* Terminating entry */ ++}; ++static void hidp_setup_quirks(struct hid_device *hid) ++{ ++ unsigned int n; ++ ++ for (n = 0; hidp_blacklist[n].idVendor; n++) ++ if (hidp_blacklist[n].idVendor == le16_to_cpu(hid->vendor) && ++ hidp_blacklist[n].idProduct == le16_to_cpu(hid->product)) ++ hid->quirks = hidp_blacklist[n].quirks; ++} ++static void hidp_setup_hid(struct hidp_session *session, ++#endif + struct hidp_connadd_req *req) + { ++#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,27)) + struct hid_device *hid; +- bdaddr_t src, dst; + int err; ++#else ++ struct hid_device *hid = session->hid; ++ struct hid_report *report; ++#endif ++ bdaddr_t src, dst; + ++#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,27)) + hid = hid_allocate_device(); + if (IS_ERR(hid)) + return PTR_ERR(session->hid); ++#endif + + session->hid = hid; + session->req = req; +@@ -789,6 +825,8 @@ static int hidp_setup_hid(struct hidp_se + strncpy(hid->phys, batostr(&src), 64); + strncpy(hid->uniq, batostr(&dst), 64); + ++ ++#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,27)) + hid->dev.parent = hidp_get_device(session); + hid->ll_driver = &hidp_hid_driver; + +@@ -805,6 +843,24 @@ failed: + session->hid = NULL; + + return err; ++#else ++ hid->dev = hidp_get_device(session); ++ hid->hid_open = hidp_open; ++ hid->hid_close = hidp_close; ++ ++ hid->hidinput_input_event = hidp_hidinput_event; ++ ++ hidp_setup_quirks(hid); ++ ++ list_for_each_entry(report, &hid->report_enum[HID_INPUT_REPORT].report_list, list) ++ hidp_send_report(session, report); ++ ++ list_for_each_entry(report, &hid->report_enum[HID_FEATURE_REPORT].report_list, list) ++ hidp_send_report(session, report); ++ ++ if (hidinput_connect(hid) == 0) ++ hid->claimed |= HID_CLAIMED_INPUT; ++#endif + } + + int hidp_add_connection(struct hidp_connadd_req *req, struct socket *ctrl_sock, struct socket *intr_sock) +@@ -824,6 +880,39 @@ int hidp_add_connection(struct hidp_conn + + BT_DBG("rd_data %p rd_size %d", req->rd_data, req->rd_size); + ++#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,27)) ++ if (req->rd_size > 0) { ++ unsigned char *buf = kmalloc(req->rd_size, GFP_KERNEL); ++ ++ if (!buf) { ++ kfree(session); ++ return -ENOMEM; ++ } ++ ++ if (copy_from_user(buf, req->rd_data, req->rd_size)) { ++ kfree(buf); ++ kfree(session); ++ return -EFAULT; ++ } ++ ++ session->hid = hid_parse_report(buf, req->rd_size); ++ ++ kfree(buf); ++ ++ if (!session->hid) { ++ kfree(session); ++ return -EINVAL; ++ } ++ } ++ ++ if (!session->hid) { ++ session->input = input_allocate_device(); ++ if (!session->input) { ++ kfree(session); ++ return -ENOMEM; ++ } ++ } ++#endif + down_write(&hidp_session_sem); + + s = __hidp_get_session(&bt_sk(ctrl_sock->sk)->dst); +@@ -851,6 +940,7 @@ int hidp_add_connection(struct hidp_conn + session->flags = req->flags & (1 << HIDP_BLUETOOTH_VENDOR_ID); + session->idle_to = req->idle_to; + ++#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,27)) + if (req->rd_size > 0) { + err = hidp_setup_hid(session, req); + if (err && err != -ENODEV) +@@ -862,6 +952,16 @@ int hidp_add_connection(struct hidp_conn + if (err < 0) + goto purge; + } ++#else ++ if (session->input) { ++ err = hidp_setup_input(session, req); ++ if (err < 0) ++ goto failed; ++ } ++ ++ if (session->hid) ++ hidp_setup_hid(session, req); ++#endif + + __hidp_link_session(session); + +@@ -893,6 +993,7 @@ unlink: + session->input = NULL; + } + ++#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,27)) + if (session->hid) { + hid_destroy_device(session->hid); + session->hid = NULL; +@@ -901,10 +1002,15 @@ unlink: + purge: + skb_queue_purge(&session->ctrl_transmit); + skb_queue_purge(&session->intr_transmit); ++#endif + + failed: + up_write(&hidp_session_sem); + ++#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,27)) ++ if (session->hid) ++ hid_free_device(session->hid); ++#endif + input_free_device(session->input); + kfree(session); + return err; +@@ -994,6 +1100,7 @@ int hidp_get_conninfo(struct hidp_connin + return err; + } + ++#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,27)) + static const struct hid_device_id hidp_table[] = { + { HID_BLUETOOTH_DEVICE(HID_ANY_ID, HID_ANY_ID) }, + { } +@@ -1003,6 +1110,7 @@ static struct hid_driver hidp_driver = { + .name = "generic-bluetooth", + .id_table = hidp_table, + }; ++#endif + + static int __init hidp_init(void) + { +@@ -1012,11 +1120,14 @@ static int __init hidp_init(void) + + BT_INFO("HIDP (Human Interface Emulation) ver %s", VERSION); + ++#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,27)) + ret = hid_register_driver(&hidp_driver); + if (ret) + goto err; ++#endif + + ret = hidp_init_sockets(); ++#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,27)) + if (ret) + goto err_drv; + +@@ -1024,13 +1135,16 @@ static int __init hidp_init(void) + err_drv: + hid_unregister_driver(&hidp_driver); + err: ++#endif + return ret; + } + + static void __exit hidp_exit(void) + { + hidp_cleanup_sockets(); ++#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,27)) + hid_unregister_driver(&hidp_driver); ++#endif + } + + module_init(hidp_init); +--- a/net/bluetooth/l2cap.c 2009-12-10 09:47:08.000000000 -0800 ++++ b/net/bluetooth/l2cap.c 2009-12-10 09:47:10.000000000 -0800 +@@ -1762,7 +1762,11 @@ static int l2cap_sock_setsockopt_old(str + return err; + } + ++#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,31)) + static int l2cap_sock_setsockopt(struct socket *sock, int level, int optname, char __user *optval, unsigned int optlen) ++#else ++static int l2cap_sock_setsockopt(struct socket *sock, int level, int optname, char __user *optval, int optlen) ++#endif + { + struct sock *sk = sock->sk; + struct bt_security sec; +--- a/net/bluetooth/rfcomm/sock.c 2009-12-10 09:48:33.000000000 -0800 ++++ b/net/bluetooth/rfcomm/sock.c 2009-12-10 09:48:37.000000000 -0800 +@@ -767,7 +767,11 @@ static int rfcomm_sock_setsockopt_old(st + return err; + } + ++#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,31)) + static int rfcomm_sock_setsockopt(struct socket *sock, int level, int optname, char __user *optval, unsigned int optlen) ++#else ++static int rfcomm_sock_setsockopt(struct socket *sock, int level, int optname, char __user *optval, int optlen) ++#endif + { + struct sock *sk = sock->sk; + struct bt_security sec; +diff -Nur a/net/bluetooth/rfcomm/tty.c b/net/bluetooth/rfcomm/tty.c +--- a/net/bluetooth/rfcomm/tty.c 2009-11-25 11:24:43.000000000 +0530 ++++ b/net/bluetooth/rfcomm/tty.c 2009-11-27 15:25:36.000000000 +0530 +@@ -731,8 +731,12 @@ + remove_wait_queue(&dev->wait, &wait); + + if (err == 0) ++#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,29)) + device_move(dev->tty_dev, rfcomm_get_device(dev), + DPM_ORDER_DEV_AFTER_PARENT); ++#else ++ device_move(dev->tty_dev, rfcomm_get_device(dev)); ++#endif + + rfcomm_tty_copy_pending(dev); + +@@ -752,7 +756,11 @@ + + if (atomic_dec_and_test(&dev->opened)) { + if (dev->tty_dev->parent) ++#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,29)) + device_move(dev->tty_dev, NULL, DPM_ORDER_DEV_LAST); ++#else ++ device_move(dev->tty_dev, NULL); ++#endif + + /* Close DLC and dettach TTY */ + rfcomm_dlc_close(dev->dlc, 0); +--- a/net/bluetooth/sco.c 2009-12-10 09:49:34.000000000 -0800 ++++ b/net/bluetooth/sco.c 2009-12-10 09:49:36.000000000 -0800 +@@ -645,7 +645,11 @@ static int sco_sock_sendmsg(struct kiocb + return err; + } + ++#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,31)) + static int sco_sock_setsockopt(struct socket *sock, int level, int optname, char __user *optval, unsigned int optlen) ++#else ++static int sco_sock_setsockopt(struct socket *sock, int level, int optname, char __user *optval, int optlen) ++#endif + { + struct sock *sk = sock->sk; + int err = 0; diff --git a/patches/98-add-compat-wireless.patch b/patches/98-add-compat-wireless.patch new file mode 100644 index 000000000000..84f75d1d0695 --- /dev/null +++ b/patches/98-add-compat-wireless.patch @@ -0,0 +1,30 @@ + +This patch file includes the changes required to add +compat-wireless support. Besides all the patches in this +directory we have our own compat-2.6.*.[ch] files which +help backport more. These the respective compat-2.6.2x.c +files get compiled and enabled if you are on older kernels +to bring in support for new features when possible. + +Lastly, the cfg80211.h change is what allows us to +get all compat-2.6.*.h files included. Its our only +point of entry through compat code. It works because +all drivers we are supporting through there one way +or another depend on cfg80211. New wireless drivers +are either mac80211 drivers or cfg80211 drivers, and +all mac80211 drivesr are cfg80211 drivers. + +If your driver is not a cfg80211 driver you must +ensure you include compat.h then. I think we +added compat.h also for ssb, I forget. + +--- a/include/net/cfg80211.h ++++ b/include/net/cfg80211.h +@@ -23,6 +23,7 @@ + /* remove once we remove the wext stuff */ + #include + #include ++#include + + + /* diff --git a/patches/99-change-makefiles.patch b/patches/99-change-makefiles.patch new file mode 100644 index 000000000000..bdd9282a58c8 --- /dev/null +++ b/patches/99-change-makefiles.patch @@ -0,0 +1,90 @@ + +This patch removes all drivers we do not support +or do not want to support. This lets us build +only the wireless stuff. + +--- a/drivers/misc/eeprom/Makefile ++++ b/drivers/misc/eeprom/Makefile +@@ -1,5 +1 @@ +-obj-$(CONFIG_EEPROM_AT24) += at24.o +-obj-$(CONFIG_EEPROM_AT25) += at25.o +-obj-$(CONFIG_EEPROM_LEGACY) += eeprom.o +-obj-$(CONFIG_EEPROM_MAX6875) += max6875.o + obj-$(CONFIG_EEPROM_93CX6) += eeprom_93cx6.o +--- a/drivers/net/usb/Makefile 2009-07-27 08:03:34.770077174 -0700 ++++ b/drivers/net/usb/Makefile 2009-07-27 08:04:22.594143560 -0700 +@@ -2,24 +2,7 @@ + # Makefile for USB Network drivers + # + +-obj-$(CONFIG_USB_CATC) += catc.o +-obj-$(CONFIG_USB_KAWETH) += kaweth.o +-obj-$(CONFIG_USB_PEGASUS) += pegasus.o +-obj-$(CONFIG_USB_RTL8150) += rtl8150.o +-obj-$(CONFIG_USB_HSO) += hso.o +-obj-$(CONFIG_USB_NET_AX8817X) += asix.o + obj-$(CONFIG_USB_NET_CDCETHER) += cdc_ether.o +-obj-$(CONFIG_USB_NET_CDC_EEM) += cdc_eem.o +-obj-$(CONFIG_USB_NET_DM9601) += dm9601.o +-obj-$(CONFIG_USB_NET_SMSC95XX) += smsc95xx.o +-obj-$(CONFIG_USB_NET_GL620A) += gl620a.o +-obj-$(CONFIG_USB_NET_NET1080) += net1080.o +-obj-$(CONFIG_USB_NET_PLUSB) += plusb.o + obj-$(CONFIG_USB_NET_RNDIS_HOST) += rndis_host.o +-obj-$(CONFIG_USB_NET_CDC_SUBSET) += cdc_subset.o +-obj-$(CONFIG_USB_NET_ZAURUS) += zaurus.o +-obj-$(CONFIG_USB_NET_MCS7830) += mcs7830.o + obj-$(CONFIG_USB_USBNET) += usbnet.o +-obj-$(CONFIG_USB_NET_INT51X1) += int51x1.o +-obj-$(CONFIG_USB_CDC_PHONET) += cdc-phonet.o + +--- a/drivers/net/wireless/Makefile 2009-11-01 12:53:07.479194884 -0700 ++++ b/drivers/net/wireless/Makefile 2009-11-01 12:54:42.026195576 -0700 +@@ -5,33 +5,16 @@ + obj-$(CONFIG_IPW2100) += ipw2x00/ + obj-$(CONFIG_IPW2200) += ipw2x00/ + +-obj-$(CONFIG_HERMES) += orinoco/ +- +-obj-$(CONFIG_AIRO) += airo.o +-obj-$(CONFIG_AIRO_CS) += airo_cs.o airo.o +- +-obj-$(CONFIG_ATMEL) += atmel.o +-obj-$(CONFIG_PCI_ATMEL) += atmel_pci.o +-obj-$(CONFIG_PCMCIA_ATMEL) += atmel_cs.o +- + obj-$(CONFIG_AT76C50X_USB) += at76c50x-usb.o + +-obj-$(CONFIG_PRISM54) += prism54/ +- +-obj-$(CONFIG_HOSTAP) += hostap/ + obj-$(CONFIG_B43) += b43/ + obj-$(CONFIG_B43LEGACY) += b43legacy/ + obj-$(CONFIG_ZD1211RW) += zd1211rw/ + obj-$(CONFIG_RTL8180) += rtl818x/ + obj-$(CONFIG_RTL8187) += rtl818x/ + +-# 16-bit wireless PCMCIA client drivers +-obj-$(CONFIG_PCMCIA_RAYCS) += ray_cs.o +-obj-$(CONFIG_PCMCIA_WL3501) += wl3501_cs.o +- + obj-$(CONFIG_USB_NET_RNDIS_WLAN) += rndis_wlan.o + +-obj-$(CONFIG_USB_ZD1201) += zd1201.o + obj-$(CONFIG_LIBERTAS) += libertas/ + + obj-$(CONFIG_LIBERTAS_THINFIRM) += libertas_tf/ +--- a/net/wireless/Makefile 2009-10-06 13:00:59.000000000 -0400 ++++ b/net/wireless/Makefile 2009-10-06 13:00:59.000000000 -0400 +@@ -4,11 +4,6 @@ + obj-$(CONFIG_LIB80211_CRYPT_CCMP) += lib80211_crypt_ccmp.o + obj-$(CONFIG_LIB80211_CRYPT_TKIP) += lib80211_crypt_tkip.o + +-obj-$(CONFIG_WEXT_CORE) += wext-core.o +-obj-$(CONFIG_WEXT_PROC) += wext-proc.o +-obj-$(CONFIG_WEXT_SPY) += wext-spy.o +-obj-$(CONFIG_WEXT_PRIV) += wext-priv.o +- + cfg80211-y += core.o sysfs.o radiotap.o util.o reg.o scan.o nl80211.o + cfg80211-y += mlme.o ibss.o sme.o chan.o ethtool.o + cfg80211-$(CONFIG_CFG80211_DEBUGFS) += debugfs.o diff --git a/patches/README b/patches/README new file mode 100644 index 000000000000..e048cb4eab5b --- /dev/null +++ b/patches/README @@ -0,0 +1,16 @@ + +compat-wireless patches +======================= + +You must have a really good reason to be adding files +in this directory. Your reasoning should either match the +explanation already present on the top of each patch file +or you should add your own. + +We try to avoid having patch files because: + + * Its a pain in the ass to maintain them. + + * Most backport changes can be pulled off through + some macro magic or new files which implement + the new functionality on the old kernels. diff --git a/scripts/admin-update.sh b/scripts/admin-update.sh index 979477fc8ab4..3a9dafbeb9bd 100755 --- a/scripts/admin-update.sh +++ b/scripts/admin-update.sh @@ -218,20 +218,15 @@ cp $GIT_TREE/$DIR/* $DIR # Compat stuff -COMPAT_BT="net/compat" -for i in $COMPAT_BT; do - mkdir -p $i - echo "Copying $GIT_COMPAT_TREE/$i/*.[ch]" - cp $GIT_COMPAT_TREE/*.c $i/ - #cp $GIT_COMPAT_TREE/*.h include/net - cp $GIT_COMPAT_TREE/Makefile $i/ - rm -f $i/*.mod.c -done -#cp compat/*.h include/net/ -cp $GIT_COMPAT_TREE/*.h include/net/ -cp compat/compat-2.6.33.h include/net/ - -for i in compat/patches/*.patch; do +COMPAT="compat" +mkdir -p $COMPAT +echo "Copying $GIT_COMPAT_TREE/ files..." +cp $GIT_COMPAT_TREE/compat/*.c $COMPAT/ +cp $GIT_COMPAT_TREE/Makefile $COMPAT/ +cp $GIT_COMPAT_TREE/include/linux/*.h include/linux/ +rm -f $COMPAT/*.mod.c + +for i in patches/*.patch; do echo -e "${GREEN}Applying backport patch${NORMAL}: ${BLUE}$i${NORMAL}" patch -p1 -N -t < $i RET=$?