backports: fix build errors for old kernel versions without PCI support
A message that is not in the archive (sent off-list or not yet received): [email protected]
RFC v3 1/9 backports: fix build errors for old kernel versions without PCI support
--- backport/compat/compat-2.6.25.c | 4 ++++ backport/compat/compat-2.6.28.c | 1 + 2 files changed, 5 insertions(+)
backport/compat/compat-2.6.25.c +4 -0
@@ -212,9 +212,13 @@ EXPORT_SYMBOL_GPL(sg_alloc_table);*/ int pci_enable_device_mem (struct pci_dev *dev) { +#ifdef CONFIG_PCI int bars =pci_select_bars (dev,IORESOURCE_MEM );return pci_enable_device_bars (dev, bars); +#else +return 0 ; +#endif }EXPORT_SYMBOL_GPL (pci_enable_device_mem);
backport/compat/compat-2.6.28.c +1 -0
@@ -12,6 +12,7 @@#include <linux/usb.h> #include <linux/tty.h> #include <linux/skbuff.h> +#include <linux/pci.h> #include <asm/poll.h> /* 2.6.28 compat code goes here */
Signature · 20 lines
1.8.1.2 -- Dipl.-Inf. (FH) Patrick Ziegler University Of Applied Sciences Kaiserslautern Amerikastrasse 1 D-66482 Zweibruecken Germany Phone: +49 631 3724 5526 Mail: [email protected] PGP KeyID 0xB4796B8C http://www.fh-kl.de http://www.fh-kl.de/fachbereiche/imst/iuk-knowhow.html
RFC v3 2/9 backports: add eth_prepare_mac_addr_change() and eth_commit_mac_addr_change()
In reply to a message not in the archiveThese functions are required by qmi_wwan device driver.
--- backport/backport-include/linux/etherdevice.h | 7 ++++++ backport/backport-include/linux/if.h | 4 ++++ backport/compat/compat-3.9.c | 33 +++++++++++++++++++++++++++ 3 files changed, 44 insertions(+)
backport/backport-include/linux/etherdevice.h +7 -0
@@ -114,6 +114,13 @@ static inline int is_unicast_ether_addr(const u8 *addr) }#endif +#if LINUX_VERSION_CODE <KERNEL_VERSION (3 ,9 ,0 ) +#define eth_prepare_mac_addr_change LINUX_BACKPORT(eth_prepare_mac_addr_change) +extern int eth_prepare_mac_addr_change (struct net_device *dev,void *p); +#define eth_commit_mac_addr_change LINUX_BACKPORT(eth_commit_mac_addr_change) +extern void eth_commit_mac_addr_change (struct net_device *dev,void *p); +#endif /* < 3.9 */ +#if LINUX_VERSION_CODE <KERNEL_VERSION (2 ,6 ,29 )#define eth_mac_addr LINUX_BACKPORT(eth_mac_addr)extern int eth_mac_addr (struct net_device *dev,void *p);
backport/backport-include/linux/if.h +4 -0
@@ -29,4 +29,8 @@#define IFF_TX_SKB_SHARING 0x10000#endif +#ifndef IFF_LIVE_ADDR_CHANGE +#define IFF_LIVE_ADDR_CHANGE 0x100000 +#endif +#endif /* _BACKPORT_LINUX_IF_H */
backport/compat/compat-3.9.c +33 -0
@@ -12,6 +12,9 @@#include <linux/scatterlist.h> #include <linux/device.h> #include <linux/err.h> +#include <linux/netdevice.h> +#include <linux/if.h> +#include <linux/if_ether.h> #ifdef __sg_page_iter_next
@@ -64,4 +67,34 @@ void __iomem *devm_ioremap_resource(struct device *dev, struct resource *res) }EXPORT_SYMBOL_GPL (devm_ioremap_resource); +/** +* eth_prepare_mac_addr_change - prepare for mac change +* @dev: network device +* @p: socket address +*/ +int eth_prepare_mac_addr_change (struct net_device *dev,void *p) +{ +struct sockaddr *addr = p; + +if (!(dev->priv_flags &IFF_LIVE_ADDR_CHANGE ) &&netif_running (dev)) +return -EBUSY ; +if (!is_valid_ether_addr (addr->sa_data)) +return -EADDRNOTAVAIL ; +return 0 ; +} +EXPORT_SYMBOL (eth_prepare_mac_addr_change); + +/** +* eth_commit_mac_addr_change - commit mac change +* @dev: network device +* @p: socket address +*/ +void eth_commit_mac_addr_change (struct net_device *dev,void *p) +{ +struct sockaddr *addr = p; + +memcpy (dev->dev_addr, addr->sa_data,ETH_ALEN ); +} +EXPORT_SYMBOL (eth_commit_mac_addr_change); +#endif /* __sg_page_iter_next */
Signature · 20 lines
1.8.1.2 -- Dipl.-Inf. (FH) Patrick Ziegler University Of Applied Sciences Kaiserslautern Amerikastrasse 1 D-66482 Zweibruecken Germany Phone: +49 631 3724 5526 Mail: [email protected] PGP KeyID 0xB4796B8C http://www.fh-kl.de http://www.fh-kl.de/fachbereiche/imst/iuk-knowhow.html
Re: [RFC v3 2/9] backports: add eth_prepare_mac_addr_change() and eth_commit_mac_addr_change()
Quoted 1 line · Patrick Ziegler
+EXPORT_SYMBOL(eth_prepare_mac_addr_change);
Just one thing:
If you want I can mend on my end, let me know.
Luis
RFC v3 3/9 backports: define PM_EVENT_AUTO
In reply to a message not in the archiveThis macro is missing for < 2.6.25
--- backport/backport-include/linux/pm.h | 4 ++++ 1 file changed, 4 insertions(+)
backport/backport-include/linux/pm.h +4 -0
@@ -2,6 +2,10 @@#define __BACKPORT_PM_H#include_next <linux/pm.h> +#ifndef PM_EVENT_AUTO +#define PM_EVENT_AUTO 0x0400 +#endif +#ifndef PM_EVENT_SLEEP #define PM_EVENT_SLEEP (PM_EVENT_SUSPEND)#endif
Signature · 20 lines
1.8.1.2 -- Dipl.-Inf. (FH) Patrick Ziegler University Of Applied Sciences Kaiserslautern Amerikastrasse 1 D-66482 Zweibruecken Germany Phone: +49 631 3724 5526 Mail: [email protected] PGP KeyID 0xB4796B8C http://www.fh-kl.de http://www.fh-kl.de/fachbereiche/imst/iuk-knowhow.html
RFC v3 4/9 backports: add usb_translate_errors()
In reply to a message not in the archiveThis inline function is missing for version < 2.6.39 but required by em28xx and cdc-wdm device driver.
--- backport/backport-include/linux/usb.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
backport/backport-include/linux/usb.h +17 -0
@@ -145,4 +145,21 @@ extern void usb_unpoison_urb(struct urb *urb);extern int usb_anchor_empty (struct usb_anchor *anchor);#endif /* 2.6.23-2.6.27 */ +#if LINUX_VERSION_CODE <KERNEL_VERSION (2 ,6 ,39 ) +#if defined(CONFIG_USB ) || defined(CONFIG_USB_MODULE ) +static inline int usb_translate_errors (int error_code) +{ +switch (error_code) { +case 0 : +case -ENOMEM : +case -ENODEV : +case -EOPNOTSUPP : +return error_code; +default : +return -EIO ; + } +} +#endif /* CONFIG_USB */ +#endif /* < 2.6.39 */ +#endif /* __BACKPORT_USB_H */
Signature · 20 lines
1.8.1.2 -- Dipl.-Inf. (FH) Patrick Ziegler University Of Applied Sciences Kaiserslautern Amerikastrasse 1 D-66482 Zweibruecken Germany Phone: +49 631 3724 5526 Mail: [email protected] PGP KeyID 0xB4796B8C http://www.fh-kl.de http://www.fh-kl.de/fachbereiche/imst/iuk-knowhow.html
RFC v3 5/9 backports: add usb_endpoint_maxp()
In reply to a message not in the archiveThis function is missing for kernel version < 3.2 but required by uvc_video and cdc-wdm device drivers.
--- backport/backport-include/linux/usb/ch9.h | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 backport/backport-include/linux/usb/ch9.h
backport/backport-include/linux/usb/ch9.h new file +23 -0
@@ -0,0 +1,23 @@ +#ifndef __BACKPORT__LINUX_USB_CH9_H +#define __BACKPORT__LINUX_USB_CH9_H + +#include_next <linux/usb/ch9.h> +#include <linux/version.h> + +#if LINUX_VERSION_CODE <KERNEL_VERSION (3 ,2 ,0 ) +#include <linux/types.h> /* __u8 etc */ +#include <asm/byteorder.h> /* le16_to_cpu */ + +/** +* usb_endpoint_maxp - get endpoint's max packet size +* @epd: endpoint to be checked +* +* Returns @epd's max packet +*/ +static inline int usb_endpoint_maxp (const struct usb_endpoint_descriptor *epd) +{ +return __le16_to_cpu (epd->wMaxPacketSize); +} +#endif /* < 3.2 */ + +#endif /* __BACKPORT__LINUX_USB_CH9_H */
Signature · 20 lines
1.8.1.2 -- Dipl.-Inf. (FH) Patrick Ziegler University Of Applied Sciences Kaiserslautern Amerikastrasse 1 D-66482 Zweibruecken Germany Phone: +49 631 3724 5526 Mail: [email protected] PGP KeyID 0xB4796B8C http://www.fh-kl.de http://www.fh-kl.de/fachbereiche/imst/iuk-knowhow.html
RFC v3 6/9 backports: update enum usb_device_speed with USB_SPEED_SUPER
In reply to a message not in the archiveUSB_SPEED_SUPER is missing for kernel versions < 2.6.30 but used by uvc_video and usbnet.
--- backport/backport-include/linux/usb/ch9.h | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-)
backport/backport-include/linux/usb/ch9.h +23 -1
@@ -1,9 +1,31 @@#ifndef __BACKPORT__LINUX_USB_CH9_H#define __BACKPORT__LINUX_USB_CH9_H -#include_next <linux/usb/ch9.h>#include <linux/version.h> +#if LINUX_VERSION_CODE <KERNEL_VERSION (2 ,6 ,30 ) +#define usb_device_speed old_usb_device_speed +#define USB_SPEED_UNKNOWN OLD_USB_SPEED_UNKNOWN +#define USB_SPEED_LOW OLD_USB_SPEED_LOW +#define USB_SPEED_FULL OLD_USB_SPEED_FULL +#define USB_SPEED_HIGH OLD_USB_SPEED_HIGH +#include_next <linux/usb/ch9.h> +#undef usb_device_speed +#undef USB_SPEED_UNKNOWN +#undef USB_SPEED_LOW +#undef USB_SPEED_FULL +#undef USB_SPEED_HIGH +enum usb_device_speed { +USB_SPEED_UNKNOWN =0 ,/* enumerating */ +USB_SPEED_LOW ,USB_SPEED_FULL ,/* usb 1.1 */ +USB_SPEED_HIGH ,/* usb 2.0 */ +USB_SPEED_WIRELESS ,/* wireless (usb 2.5) */ +USB_SPEED_SUPER ,/* usb 3.0 */ +}; +#else +#include_next <linux/usb/ch9.h> +#endif /* < 2.6.30 */ +#if LINUX_VERSION_CODE <KERNEL_VERSION (3 ,2 ,0 )#include <linux/types.h> /* __u8 etc */ #include <asm/byteorder.h> /* le16_to_cpu */
Signature · 20 lines
1.8.1.2 -- Dipl.-Inf. (FH) Patrick Ziegler University Of Applied Sciences Kaiserslautern Amerikastrasse 1 D-66482 Zweibruecken Germany Phone: +49 631 3724 5526 Mail: [email protected] PGP KeyID 0xB4796B8C http://www.fh-kl.de http://www.fh-kl.de/fachbereiche/imst/iuk-knowhow.html
RFC v3 7/9 backports: include headers directly if math64 header is missing
In reply to a message not in the archiveIf math64 header is not available, include div64.h directly. It is required for do_div() that is used inside the backport version of math64.h.
--- backport/backport-include/linux/math64.h | 3 +++ 1 file changed, 3 insertions(+)
backport/backport-include/linux/math64.h +3 -0
@@ -5,6 +5,9 @@#if (LINUX_VERSION_CODE >KERNEL_VERSION (2 ,6 ,25 ))#include_next <linux/math64.h> +#else +#include <linux/types.h> +#include <asm/div64.h> #endif /* (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,25)) */ #if LINUX_VERSION_CODE <KERNEL_VERSION (2 ,6 ,26 )
Signature · 20 lines
1.8.1.2 -- Dipl.-Inf. (FH) Patrick Ziegler University Of Applied Sciences Kaiserslautern Amerikastrasse 1 D-66482 Zweibruecken Germany Phone: +49 631 3724 5526 Mail: [email protected] PGP KeyID 0xB4796B8C http://www.fh-kl.de http://www.fh-kl.de/fachbereiche/imst/iuk-knowhow.html
RFC v3 8/9 backports: define phys_addr_t for ARM on kernel version < 2.6.25
In reply to a message not in the archivephys_addr_t is not defined on ARM systems if kernel version < 2.6.25.
--- backport/backport-include/linux/types.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
backport/backport-include/linux/types.h +2 -2
@@ -4,7 +4,7 @@#include <linux/version.h> #if LINUX_VERSION_CODE <KERNEL_VERSION (2 ,6 ,25 ) -#if defined(CONFIG_X86 ) || defined(CONFIG_X86_64 ) +#if defined(CONFIG_X86 ) || defined(CONFIG_X86_64 ) || defined(CONFIG_ARM )#if defined(CONFIG_64BIT ) || defined(CONFIG_X86_PAE ) || defined(CONFIG_PHYS_64BIT )typedef u64 phys_addr_t ;
@@ -12,7 +12,7 @@ typedef u64 phys_addr_t;typedef u32 phys_addr_t ;#endif -#endif /* x86 */ +#endif /* x86 || ARM */ #elif LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28)/* < 2.6.25 */ #if defined(CONFIG_X86 ) || defined(CONFIG_X86_64 ) || defined(CONFIG_PPC )
Signature · 20 lines
1.8.1.2 -- Dipl.-Inf. (FH) Patrick Ziegler University Of Applied Sciences Kaiserslautern Amerikastrasse 1 D-66482 Zweibruecken Germany Phone: +49 631 3724 5526 Mail: [email protected] PGP KeyID 0xB4796B8C http://www.fh-kl.de http://www.fh-kl.de/fachbereiche/imst/iuk-knowhow.html
RFC v3 9/9 backports: add wwan device drivers
In reply to a message not in the archiveAdd cdc_mbim, cdc_ncm, sierra_net, qmi_wwan device drivers.
--- backport/Kconfig | 2 ++ backport/Makefile.kernel | 3 +++ copy-list | 14 ++++++++++++++ .../network/0001-netdev_ops/qmi_wwan.patch | 11 +++++++++++ .../network/0001-netdev_ops/sierra_net.patch | 11 +++++++++++ .../62-usb_driver_lpm/drivers_net_usb_cdc_mbim.patch | 12 ++++++++++++ .../62-usb_driver_lpm/drivers_net_usb_cdc_ncm.patch | 12 ++++++++++++ .../62-usb_driver_lpm/drivers_net_usb_qmi_wwan.patch | 12 ++++++++++++ .../62-usb_driver_lpm/drivers_net_usb_sierra_net.patch | 12 ++++++++++++ .../62-usb_driver_lpm/drivers_usb_class_cdc-wdm.patch | 12 ++++++++++++ 10 files changed, 101 insertions(+) create mode 100644 patches/collateral-evolutions/network/0001-netdev_ops/qmi_wwan.patch create mode 100644 patches/collateral-evolutions/network/0001-netdev_ops/sierra_net.patch create mode 100644 patches/collateral-evolutions/network/62-usb_driver_lpm/drivers_net_usb_cdc_mbim.patch create mode 100644 patches/collateral-evolutions/network/62-usb_driver_lpm/drivers_net_usb_cdc_ncm.patch create mode 100644 patches/collateral-evolutions/network/62-usb_driver_lpm/drivers_net_usb_qmi_wwan.patch create mode 100644 patches/collateral-evolutions/network/62-usb_driver_lpm/drivers_net_usb_sierra_net.patch create mode 100644 patches/collateral-evolutions/network/62-usb_driver_lpm/drivers_usb_class_cdc-wdm.patch
backport/Kconfig +2 -0
@@ -48,3 +48,5 @@ source drivers/platform/x86/Kconfig source net/ieee802154/Kconfig source net/mac802154/Kconfig source drivers/net/ieee802154/Kconfig + +source drivers/usb/class/Kconfig
backport/Makefile.kernel +3 -0
@@ -40,3 +40,6 @@ obj-$(CPTCFG_INTEL_IPS) += drivers/platform/x86/ obj-$(CPTCFG_IEEE802154) += net/ieee802154/ obj-$(CPTCFG_MAC802154) += net/mac802154/ obj-$(CPTCFG_IEEE802154) += drivers/net/ieee802154/ + +obj-$(CPTCFG_USB_WDM) += drivers/usb/class/ +obj-$(CPTCFG_USB_USBNET) += drivers/net/usb/
copy-list +14 -0
@@ -100,6 +100,20 @@ drivers/net/ethernet/broadcom/Makefile drivers/net/ethernet/broadcom/b44.c drivers/net/ethernet/broadcom/b44.h +# wwan drivers +include/uapi/linux/usb/cdc.h +include/uapi/linux/usb/cdc-wdm.h +include/linux/usb/cdc_ncm.h +include/linux/usb/cdc-wdm.h + +drivers/usb/class/Makefile +drivers/usb/class/Kconfig +drivers/usb/class/cdc-wdm.c +drivers/net/usb/cdc_mbim.c +drivers/net/usb/cdc_ncm.c +drivers/net/usb/sierra_net.c +drivers/net/usb/qmi_wwan.c + # DRM include/drm/ include/uapi/drm/
patches/collateral-evolutions/network/0001-netdev_ops/qmi_wwan.patch new file +11 -0
@@ -0,0 +1,11 @@ +--- a/drivers/net/usb/qmi_wwan.c ++++ b/drivers/net/usb/qmi_wwan.c +@@ -331,7 +331,7 @@ + dev->net->dev_addr[0] |= 0x02; /* set local assignment bit */ + dev->net->dev_addr[0] &= 0xbf; /* clear "IP" bit */ + } +- dev->net->netdev_ops = &qmi_wwan_netdev_ops; ++ netdev_attach_ops(dev->net, &qmi_wwan_netdev_ops); + err: + return status; + }
patches/collateral-evolutions/network/0001-netdev_ops/sierra_net.patch new file +11 -0
@@ -0,0 +1,11 @@ +--- a/drivers/net/usb/sierra_net.c ++++ b/drivers/net/usb/sierra_net.c +@@ -695,7 +695,7 @@ + + priv->usbnet = dev; + priv->ifnum = ifacenum; +- dev->net->netdev_ops = &sierra_net_device_ops; ++ netdev_attach_ops(dev->net, &sierra_net_device_ops); + + /* change MAC addr to include, ifacenum, and to be unique */ + dev->net->dev_addr[ETH_ALEN-2] = atomic_inc_return(&iface_counter);
patches/collateral-evolutions/network/62-usb_driver_lpm/drivers_net_usb_cdc_mbim.patch new file +12 -0
@@ -0,0 +1,12 @@ +--- a/drivers/net/usb/cdc_mbim.c ++++ b/drivers/net/usb/cdc_mbim.c +@@ -417,7 +417,9 @@ + .resume = cdc_mbim_resume, + .reset_resume = cdc_mbim_resume, + .supports_autosuspend = 1, ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,5,0)) + .disable_hub_initiated_lpm = 1, ++#endif + }; + module_usb_driver(cdc_mbim_driver); +
patches/collateral-evolutions/network/62-usb_driver_lpm/drivers_net_usb_cdc_ncm.patch new file +12 -0
@@ -0,0 +1,12 @@ +--- a/drivers/net/usb/cdc_ncm.c ++++ b/drivers/net/usb/cdc_ncm.c +@@ -1271,7 +1271,9 @@ + .resume = usbnet_resume, + .reset_resume = usbnet_resume, + .supports_autosuspend = 1, ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,5,0)) + .disable_hub_initiated_lpm = 1, ++#endif + }; + + module_usb_driver(cdc_ncm_driver);
patches/collateral-evolutions/network/62-usb_driver_lpm/drivers_net_usb_qmi_wwan.patch new file +12 -0
@@ -0,0 +1,12 @@ +--- a/drivers/net/usb/qmi_wwan.c ++++ b/drivers/net/usb/qmi_wwan.c +@@ -672,7 +672,9 @@ + .resume = qmi_wwan_resume, + .reset_resume = qmi_wwan_resume, + .supports_autosuspend = 1, ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,5,0)) + .disable_hub_initiated_lpm = 1, ++#endif + }; + + module_usb_driver(qmi_wwan_driver);
patches/collateral-evolutions/network/62-usb_driver_lpm/drivers_net_usb_sierra_net.patch new file +12 -0
@@ -0,0 +1,12 @@ +--- a/drivers/net/usb/sierra_net.c ++++ b/drivers/net/usb/sierra_net.c +@@ -959,7 +959,9 @@ + .suspend = usbnet_suspend, + .resume = usbnet_resume, + .no_dynamic_id = 1, ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,5,0)) + .disable_hub_initiated_lpm = 1, ++#endif + }; + + module_usb_driver(sierra_net_driver);
patches/collateral-evolutions/network/62-usb_driver_lpm/drivers_usb_class_cdc-wdm.patch new file +12 -0
@@ -0,0 +1,12 @@ +--- a/drivers/usb/class/cdc-wdm.c ++++ b/drivers/usb/class/cdc-wdm.c +@@ -1060,7 +1060,9 @@ + .post_reset = wdm_post_reset, + .id_table = wdm_ids, + .supports_autosuspend = 1, ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,5,0)) + .disable_hub_initiated_lpm = 1, ++#endif + }; + + module_usb_driver(wdm_driver);
Signature · 19 lines
1.8.1.2 -- Dipl.-Inf. (FH) Patrick Ziegler University Of Applied Sciences Kaiserslautern Amerikastrasse 1 D-66482 Zweibruecken Germany Phone: +49 631 3724 5526 Mail: [email protected] PGP KeyID 0xB4796B8C http://www.fh-kl.de http://www.fh-kl.de/fachbereiche/imst/iuk-knowhow.html