All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] compat: backport pci_wake_from_d3
@ 2011-01-01 14:23 Hauke Mehrtens
  2011-01-01 14:23 ` [PATCH 2/3] compat: backport alloc_workqueue Hauke Mehrtens
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Hauke Mehrtens @ 2011-01-01 14:23 UTC (permalink / raw)
  To: lrodriguez; +Cc: linux-wireless, mcgrof, Hauke Mehrtens

This is needed by atl1c.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
---
 compat/compat-2.6.28.c        |   22 ++++++++++++++++++++++
 include/linux/compat-2.6.28.h |    2 ++
 2 files changed, 24 insertions(+), 0 deletions(-)

diff --git a/compat/compat-2.6.28.c b/compat/compat-2.6.28.c
index 7a834d2..72c9e09 100644
--- a/compat/compat-2.6.28.c
+++ b/compat/compat-2.6.28.c
@@ -439,3 +439,25 @@ int n_tty_ioctl_helper(struct tty_struct *tty, struct file *file,
 }
 EXPORT_SYMBOL(n_tty_ioctl_helper);
 
+/**
+ * pci_wake_from_d3 - enable/disable device to wake up from D3_hot or D3_cold
+ * @dev: PCI device to prepare
+ * @enable: True to enable wake-up event generation; false to disable
+ *
+ * Many drivers want the device to wake up the system from D3_hot or D3_cold
+ * and this function allows them to set that up cleanly - pci_enable_wake()
+ * should not be called twice in a row to enable wake-up due to PCI PM vs ACPI
+ * ordering constraints.
+ *
+ * This function only returns error code if the device is not capable of
+ * generating PME# from both D3_hot and D3_cold, and the platform is unable to
+ * enable wake-up power for it.
+ */
+int pci_wake_from_d3(struct pci_dev *dev, bool enable)
+{
+	return pci_pme_capable(dev, PCI_D3cold) ?
+			pci_enable_wake(dev, PCI_D3cold, enable) :
+			pci_enable_wake(dev, PCI_D3hot, enable);
+}
+EXPORT_SYMBOL(pci_wake_from_d3);
+
diff --git a/include/linux/compat-2.6.28.h b/include/linux/compat-2.6.28.h
index 1de39ad..b9024d6 100644
--- a/include/linux/compat-2.6.28.h
+++ b/include/linux/compat-2.6.28.h
@@ -234,6 +234,8 @@ extern void skb_add_rx_frag(struct sk_buff *skb, int i, struct page *page,
 extern int n_tty_ioctl_helper(struct tty_struct *tty, struct file *file,
 		       unsigned int cmd, unsigned long arg);
 
+int pci_wake_from_d3(struct pci_dev *dev, bool enable);
+
 #endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28)) */
 
 #endif /* LINUX_26_28_COMPAT_H */
-- 
1.7.1


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

* [PATCH 2/3] compat: backport alloc_workqueue
  2011-01-01 14:23 [PATCH 1/3] compat: backport pci_wake_from_d3 Hauke Mehrtens
@ 2011-01-01 14:23 ` Hauke Mehrtens
  2011-01-05  1:17   ` Philip Prindeville
  2011-01-01 14:23 ` [PATCH 3/3] compat: add generic functions for suspend/resume Hauke Mehrtens
  2011-01-05 23:20 ` [PATCH 1/3] compat: backport pci_wake_from_d3 Luis R. Rodriguez
  2 siblings, 1 reply; 5+ messages in thread
From: Hauke Mehrtens @ 2011-01-01 14:23 UTC (permalink / raw)
  To: lrodriguez; +Cc: linux-wireless, mcgrof, Hauke Mehrtens

This is needed by rtlwifi.

The function signature of __create_workqueue changed in kernel 2.6.28,
so two different defines are needed.

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

diff --git a/include/linux/compat-2.6.28.h b/include/linux/compat-2.6.28.h
index b9024d6..fdb8fb2 100644
--- a/include/linux/compat-2.6.28.h
+++ b/include/linux/compat-2.6.28.h
@@ -236,6 +236,8 @@ extern int n_tty_ioctl_helper(struct tty_struct *tty, struct file *file,
 
 int pci_wake_from_d3(struct pci_dev *dev, bool enable);
 
+#define alloc_workqueue(name, flags, max_active) __create_workqueue(name, flags, max_active)
+
 #endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28)) */
 
 #endif /* LINUX_26_28_COMPAT_H */
diff --git a/include/linux/compat-2.6.36.h b/include/linux/compat-2.6.36.h
index 1f2f507..74d2309 100644
--- a/include/linux/compat-2.6.36.h
+++ b/include/linux/compat-2.6.36.h
@@ -97,6 +97,10 @@ struct pm_qos_request_list {
 static inline __attribute__ ((format (printf, 1, 2)))
 int no_printk(const char *s, ...) { return 0; }
 
+#ifndef alloc_workqueue
+#define alloc_workqueue(name, flags, max_active) __create_workqueue(name, flags, max_active, 0)
+#endif
+
 #endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,36)) */
 
 #endif /* LINUX_26_36_COMPAT_H */
-- 
1.7.1


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

* [PATCH 3/3] compat: add generic functions for suspend/resume
  2011-01-01 14:23 [PATCH 1/3] compat: backport pci_wake_from_d3 Hauke Mehrtens
  2011-01-01 14:23 ` [PATCH 2/3] compat: backport alloc_workqueue Hauke Mehrtens
@ 2011-01-01 14:23 ` Hauke Mehrtens
  2011-01-05 23:20 ` [PATCH 1/3] compat: backport pci_wake_from_d3 Luis R. Rodriguez
  2 siblings, 0 replies; 5+ messages in thread
From: Hauke Mehrtens @ 2011-01-01 14:23 UTC (permalink / raw)
  To: lrodriguez; +Cc: linux-wireless, mcgrof, Hauke Mehrtens

This define is used to generate a suspend and a resume function for pci
devices using the old power management interface. The new interface was
introduced in kernel 2.6.29.

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

diff --git a/include/linux/compat-2.6.29.h b/include/linux/compat-2.6.29.h
index 78b2d58..b4e1236 100644
--- a/include/linux/compat-2.6.29.h
+++ b/include/linux/compat-2.6.29.h
@@ -278,6 +278,36 @@ static inline struct net *read_pnet(struct net * const *pnet)
 
 extern int		init_dummy_netdev(struct net_device *dev);
 
+#define compat_pci_suspend(fn)						\
+	int fn##_compat(struct pci_dev *pdev, pm_message_t state) 	\
+	{								\
+		int r;							\
+									\
+		r = fn(&pdev->dev);					\
+		if (r)							\
+			return r;					\
+									\
+		pci_save_state(pdev);					\
+		pci_disable_device(pdev);				\
+		pci_set_power_state(pdev, PCI_D3hot);			\
+									\
+		return 0;						\
+	}
+
+#define compat_pci_resume(fn)						\
+	int fn##_compat(struct pci_dev *pdev)				\
+	{								\
+		int r;							\
+									\
+		pci_set_power_state(pdev, PCI_D0);			\
+		r = pci_enable_device(pdev);				\
+		if (r)							\
+			return r;					\
+		pci_restore_state(pdev);				\
+									\
+		return fn(&pdev->dev);					\
+	}
+
 #else
 
 static inline void netdev_attach_ops(struct net_device *dev,
@@ -285,6 +315,10 @@ static inline void netdev_attach_ops(struct net_device *dev,
 {
 	dev->netdev_ops = ops;
 }
+
+#define compat_pci_suspend(fn)
+#define compat_pci_resume(fn)
+
 #endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29)) */
 
 #endif /*  LINUX_26_29_COMPAT_H */
-- 
1.7.1


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

* Re: [PATCH 2/3] compat: backport alloc_workqueue
  2011-01-01 14:23 ` [PATCH 2/3] compat: backport alloc_workqueue Hauke Mehrtens
@ 2011-01-05  1:17   ` Philip Prindeville
  0 siblings, 0 replies; 5+ messages in thread
From: Philip Prindeville @ 2011-01-05  1:17 UTC (permalink / raw)
  To: Hauke Mehrtens; +Cc: lrodriguez, linux-wireless, mcgrof

I just patched this against 2.6.27.49 and it builds.  I'll try to fire up an image later, though I'm using Ath9k cards...


On 1/1/11 6:23 AM, Hauke Mehrtens wrote:
> This is needed by rtlwifi.
>
> The function signature of __create_workqueue changed in kernel 2.6.28,
> so two different defines are needed.
>
> Signed-off-by: Hauke Mehrtens<hauke@hauke-m.de>
> ---
>   include/linux/compat-2.6.28.h |    2 ++
>   include/linux/compat-2.6.36.h |    4 ++++
>   2 files changed, 6 insertions(+), 0 deletions(-)
>
> diff --git a/include/linux/compat-2.6.28.h b/include/linux/compat-2.6.28.h
> index b9024d6..fdb8fb2 100644
> --- a/include/linux/compat-2.6.28.h
> +++ b/include/linux/compat-2.6.28.h
> @@ -236,6 +236,8 @@ extern int n_tty_ioctl_helper(struct tty_struct *tty, struct file *file,
>
>   int pci_wake_from_d3(struct pci_dev *dev, bool enable);
>
> +#define alloc_workqueue(name, flags, max_active) __create_workqueue(name, flags, max_active)
> +
>   #endif /* (LINUX_VERSION_CODE<  KERNEL_VERSION(2,6,28)) */
>
>   #endif /* LINUX_26_28_COMPAT_H */
> diff --git a/include/linux/compat-2.6.36.h b/include/linux/compat-2.6.36.h
> index 1f2f507..74d2309 100644
> --- a/include/linux/compat-2.6.36.h
> +++ b/include/linux/compat-2.6.36.h
> @@ -97,6 +97,10 @@ struct pm_qos_request_list {
>   static inline __attribute__ ((format (printf, 1, 2)))
>   int no_printk(const char *s, ...) { return 0; }
>
> +#ifndef alloc_workqueue
> +#define alloc_workqueue(name, flags, max_active) __create_workqueue(name, flags, max_active, 0)
> +#endif
> +
>   #endif /* (LINUX_VERSION_CODE<  KERNEL_VERSION(2,6,36)) */
>
>   #endif /* LINUX_26_36_COMPAT_H */


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

* Re: [PATCH 1/3] compat: backport pci_wake_from_d3
  2011-01-01 14:23 [PATCH 1/3] compat: backport pci_wake_from_d3 Hauke Mehrtens
  2011-01-01 14:23 ` [PATCH 2/3] compat: backport alloc_workqueue Hauke Mehrtens
  2011-01-01 14:23 ` [PATCH 3/3] compat: add generic functions for suspend/resume Hauke Mehrtens
@ 2011-01-05 23:20 ` Luis R. Rodriguez
  2 siblings, 0 replies; 5+ messages in thread
From: Luis R. Rodriguez @ 2011-01-05 23:20 UTC (permalink / raw)
  To: Hauke Mehrtens; +Cc: Luis Rodriguez, linux-wireless, mcgrof

On Sat, Jan 01, 2011 at 06:23:33AM -0800, Hauke Mehrtens wrote:
> This is needed by atl1c.

Applied and pushed, thanks!

  Luis

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

end of thread, other threads:[~2011-01-05 23:20 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-01 14:23 [PATCH 1/3] compat: backport pci_wake_from_d3 Hauke Mehrtens
2011-01-01 14:23 ` [PATCH 2/3] compat: backport alloc_workqueue Hauke Mehrtens
2011-01-05  1:17   ` Philip Prindeville
2011-01-01 14:23 ` [PATCH 3/3] compat: add generic functions for suspend/resume Hauke Mehrtens
2011-01-05 23:20 ` [PATCH 1/3] compat: backport pci_wake_from_d3 Luis R. Rodriguez

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.