linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] compat: backport skb_checksum_start_offset
@ 2010-12-17 22:41 Hauke Mehrtens
  2010-12-17 22:41 ` [PATCH 2/3] compat backport no_printk Hauke Mehrtens
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Hauke Mehrtens @ 2010-12-17 22:41 UTC (permalink / raw)
  To: lrodriguez; +Cc: linux-wireless, mcgrof, Hauke Mehrtens

This is needed by atlx, atl1c and atl1e.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
---
 include/linux/compat-2.6.38.h |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/include/linux/compat-2.6.38.h b/include/linux/compat-2.6.38.h
index dfc406e..0521156 100644
--- a/include/linux/compat-2.6.38.h
+++ b/include/linux/compat-2.6.38.h
@@ -6,6 +6,7 @@
 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,38))
 
 #include <linux/kernel.h>
+#include <linux/skbuff.h>
 
 /*
  * This is not part of The 2.6.37 kernel yet but we
@@ -56,6 +57,11 @@ static inline unsigned long ewma_read(const struct ewma *avg)
 
 #define pr_warn pr_warning
 
+static inline int skb_checksum_start_offset(const struct sk_buff *skb)
+{
+	return skb->csum_start - skb_headroom(skb);
+}
+
 #endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,38)) */
 
 #endif /* LINUX_26_38_COMPAT_H */
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/3] compat backport no_printk
  2010-12-17 22:41 [PATCH 1/3] compat: backport skb_checksum_start_offset Hauke Mehrtens
@ 2010-12-17 22:41 ` Hauke Mehrtens
  2010-12-17 22:41 ` [PATCH 3/3] compat: backport pci_is_pcie and pci_pcie_cap Hauke Mehrtens
  2010-12-18 20:08 ` [PATCH 1/3] compat: backport skb_checksum_start_offset Luis R. Rodriguez
  2 siblings, 0 replies; 4+ messages in thread
From: Hauke Mehrtens @ 2010-12-17 22:41 UTC (permalink / raw)
  To: lrodriguez; +Cc: linux-wireless, mcgrof, Hauke Mehrtens

This is needed by brcm80211.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
---
 include/linux/compat-2.6.36.h |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/include/linux/compat-2.6.36.h b/include/linux/compat-2.6.36.h
index 83b7f06..1f2f507 100644
--- a/include/linux/compat-2.6.36.h
+++ b/include/linux/compat-2.6.36.h
@@ -90,6 +90,13 @@ struct pm_qos_request_list {
 
 #endif
 
+/*
+ * Dummy printk for disabled debugging statements to use whilst maintaining
+ * gcc's format and side-effect checking.
+ */
+static inline __attribute__ ((format (printf, 1, 2)))
+int no_printk(const char *s, ...) { return 0; }
+
 #endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,36)) */
 
 #endif /* LINUX_26_36_COMPAT_H */
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 3/3] compat: backport pci_is_pcie and pci_pcie_cap
  2010-12-17 22:41 [PATCH 1/3] compat: backport skb_checksum_start_offset Hauke Mehrtens
  2010-12-17 22:41 ` [PATCH 2/3] compat backport no_printk Hauke Mehrtens
@ 2010-12-17 22:41 ` Hauke Mehrtens
  2010-12-18 20:08 ` [PATCH 1/3] compat: backport skb_checksum_start_offset Luis R. Rodriguez
  2 siblings, 0 replies; 4+ messages in thread
From: Hauke Mehrtens @ 2010-12-17 22:41 UTC (permalink / raw)
  To: lrodriguez; +Cc: linux-wireless, mcgrof, Hauke Mehrtens

compat_is_pcie already did the same thing as pci_is_pcie, but this
method is now in kernel so the mainline drivers should use this
function instead of accessing the  member in the struct directly. We
backported this function for older kernels.
pci_pcie_cap is used in rtlwifi so we also need this.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
---
 compat/compat-2.6.24.c        |   12 ------------
 include/linux/compat-2.6.24.h |    3 ---
 include/linux/compat-2.6.33.h |   32 ++++++++++++++++++++++++++++++++
 3 files changed, 32 insertions(+), 15 deletions(-)

diff --git a/compat/compat-2.6.24.c b/compat/compat-2.6.24.c
index a5c9c97..5e2a77d 100644
--- a/compat/compat-2.6.24.c
+++ b/compat/compat-2.6.24.c
@@ -165,15 +165,3 @@ int eth_rebuild_header(struct sk_buff *skb)
 }
 EXPORT_SYMBOL(eth_rebuild_header);
 
-/* 2.6.24 will introduce struct pci_dev is_pcie bit. To help
- * with the compatibility code (compat.diff) being smaller, we provide a helper
- * so in cases where that will be used we can simply slap ifdefs with this
- * routine. Use compat_ prefex to not pollute namespace.  */
-int compat_is_pcie(struct pci_dev *pdev)
-{
-	int cap;
-	cap = pci_find_capability(pdev, PCI_CAP_ID_EXP);
-	return cap ? 1 : 0;
-}
-EXPORT_SYMBOL(compat_is_pcie);
-
diff --git a/include/linux/compat-2.6.24.h b/include/linux/compat-2.6.24.h
index f9c777c..6e09530 100644
--- a/include/linux/compat-2.6.24.h
+++ b/include/linux/compat-2.6.24.h
@@ -249,9 +249,6 @@ static inline int usb_endpoint_num(const struct usb_endpoint_descriptor *epd)
 	return epd->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK;
 }
 
-/* Helper to make struct pci_dev is_pcie compatibility code smaller */
-int compat_is_pcie(struct pci_dev *pdev);
-
 #endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)) */
 
 #endif /* LINUX_26_24_COMPAT_H */
diff --git a/include/linux/compat-2.6.33.h b/include/linux/compat-2.6.33.h
index c2dbc1b..2ccf141 100644
--- a/include/linux/compat-2.6.33.h
+++ b/include/linux/compat-2.6.33.h
@@ -6,6 +6,7 @@
 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,33))
 
 #include <linux/skbuff.h>
+#include <linux/pci.h>
 #if defined(CONFIG_PCCARD) || defined(CONFIG_PCCARD_MODULE)
 #include <pcmcia/cs_types.h>
 #include <pcmcia/cistpl.h>
@@ -147,6 +148,37 @@ static inline void compat_kfifo_free(struct kfifo **fifo) {
 
 #define sock_recv_ts_and_drops(msg, sk, skb) sock_recv_timestamp(msg, sk, skb)
 
+/**
+ * pci_pcie_cap - get the saved PCIe capability offset
+ * @dev: PCI device
+ *
+ * PCIe capability offset is calculated at PCI device initialization
+ * time and saved in the data structure. This function returns saved
+ * PCIe capability offset. Using this instead of pci_find_capability()
+ * reduces unnecessary search in the PCI configuration space. If you
+ * need to calculate PCIe capability offset from raw device for some
+ * reasons, please use pci_find_capability() instead.
+ */
+static inline int pci_pcie_cap(struct pci_dev *dev)
+{
+	return pci_find_capability(dev, PCI_CAP_ID_EXP);
+}
+
+/**
+ * pci_is_pcie - check if the PCI device is PCI Express capable
+ * @dev: PCI device
+ *
+ * Retrun true if the PCI device is PCI Express capable, false otherwise.
+ */
+static inline bool pci_is_pcie(struct pci_dev *dev)
+{
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24))
+	return dev->is_pcie;
+#else
+	return !!pci_pcie_cap(dev);
+#endif
+}
+
 #endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,33)) */
 
 #endif /* LINUX_26_33_COMPAT_H */
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/3] compat: backport skb_checksum_start_offset
  2010-12-17 22:41 [PATCH 1/3] compat: backport skb_checksum_start_offset Hauke Mehrtens
  2010-12-17 22:41 ` [PATCH 2/3] compat backport no_printk Hauke Mehrtens
  2010-12-17 22:41 ` [PATCH 3/3] compat: backport pci_is_pcie and pci_pcie_cap Hauke Mehrtens
@ 2010-12-18 20:08 ` Luis R. Rodriguez
  2 siblings, 0 replies; 4+ messages in thread
From: Luis R. Rodriguez @ 2010-12-18 20:08 UTC (permalink / raw)
  To: Hauke Mehrtens
  Cc: Luis Rodriguez, linux-wireless@vger.kernel.org,
	mcgrof@infradead.org

On Fri, Dec 17, 2010 at 02:41:36PM -0800, Hauke Mehrtens wrote:
> This is needed by atlx, atl1c and atl1e.
 

Applied all and pushed, thanks!

  Luis

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-12-18 20:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-17 22:41 [PATCH 1/3] compat: backport skb_checksum_start_offset Hauke Mehrtens
2010-12-17 22:41 ` [PATCH 2/3] compat backport no_printk Hauke Mehrtens
2010-12-17 22:41 ` [PATCH 3/3] compat: backport pci_is_pcie and pci_pcie_cap Hauke Mehrtens
2010-12-18 20:08 ` [PATCH 1/3] compat: backport skb_checksum_start_offset Luis R. Rodriguez

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).