All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/4] backports: Add an implementation of get_random_int() for <3.10 kernels.
@ 2013-08-17  4:23 Solomon Peachy
  2013-08-17  4:23 ` [PATCH 2/4] backports: move the cw1200 sdio quirk into 26-sdio-quirks Solomon Peachy
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Solomon Peachy @ 2013-08-17  4:23 UTC (permalink / raw
  To: backports; +Cc: Solomon Peachy

get_random_int() was present, but simply not exported for use in modules
until 3.10.  Implement it in terms of the more expensive get_random_bytes()

This is needed by the cw1200 driver.

Signed-off-by: Solomon Peachy <pizza@shaftnet.org>
---
 backport/compat/backport-3.10.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/backport/compat/backport-3.10.c b/backport/compat/backport-3.10.c
index 980ed59..5273758 100644
--- a/backport/compat/backport-3.10.c
+++ b/backport/compat/backport-3.10.c
@@ -12,6 +12,7 @@
 #include <linux/module.h>
 #include <linux/err.h>
 #include <linux/proc_fs.h>
+#include <linux/random.h>
 
 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0))
 #include <linux/init.h>
@@ -77,3 +78,15 @@ void proc_set_user(struct proc_dir_entry *de, kuid_t uid, kgid_t gid)
 	de->gid = gid;
 }
 EXPORT_SYMBOL_GPL(proc_set_user);
+
+/* get_random_int() was not exported for module use until 3.10-rc.
+   Implement it here in terms of the more expensive get_random_bytes()
+ */
+unsigned int get_random_int(void)
+{
+	unsigned int r;
+	get_random_bytes(&r, sizeof(r));
+
+	return r;
+}
+EXPORT_SYMBOL_GPL(get_random_int);
-- 
1.8.3.1


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

* [PATCH 2/4] backports:  move the cw1200 sdio quirk into 26-sdio-quirks
  2013-08-17  4:23 [PATCH 1/4] backports: Add an implementation of get_random_int() for <3.10 kernels Solomon Peachy
@ 2013-08-17  4:23 ` Solomon Peachy
  2013-08-17  4:23 ` [PATCH 3/4] backports: cw1200 utilizes kthreads for <= 2.6.35 Solomon Peachy
  2013-08-17  4:23 ` [PATCH 4/4] backports: cw1200 requires >=2.6.35 Solomon Peachy
  2 siblings, 0 replies; 6+ messages in thread
From: Solomon Peachy @ 2013-08-17  4:23 UTC (permalink / raw
  To: backports; +Cc: Solomon Peachy

This way it's with the other sdio quirk-related patches.

Signed-off-by: Solomon Peachy <pizza@shaftnet.org>
---
 .../26-sdio-quirks/drivers_net_wireless_cw1200_sdio.patch | 15 +++++++++++++++
 .../network/75-cw1200-sdio-quirk/cw1200.patch             | 15 ---------------
 2 files changed, 15 insertions(+), 15 deletions(-)
 create mode 100644 patches/collateral-evolutions/network/26-sdio-quirks/drivers_net_wireless_cw1200_sdio.patch
 delete mode 100644 patches/collateral-evolutions/network/75-cw1200-sdio-quirk/cw1200.patch

diff --git a/patches/collateral-evolutions/network/26-sdio-quirks/drivers_net_wireless_cw1200_sdio.patch b/patches/collateral-evolutions/network/26-sdio-quirks/drivers_net_wireless_cw1200_sdio.patch
new file mode 100644
index 0000000..2533051
--- /dev/null
+++ b/patches/collateral-evolutions/network/26-sdio-quirks/drivers_net_wireless_cw1200_sdio.patch
@@ -0,0 +1,15 @@
+--- a/drivers/net/wireless/cw1200/cw1200_sdio.c
++++ b/drivers/net/wireless/cw1200/cw1200_sdio.c
+@@ -253,6 +253,12 @@ static size_t cw1200_sdio_align_size(struct hwbus_priv *self, size_t size)
+ 	else
+ 		size = sdio_align_size(self->func, size);
+ 
++#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 2, 0))
++	/* A quirk to handle this was committed in 3.2-rc */
++	if (size == SDIO_BLOCK_SIZE)
++		size += SDIO_BLOCK_SIZE;  /* HW bug; force use of block mode */
++#endif
++
+ 	return size;
+ }
+ 
diff --git a/patches/collateral-evolutions/network/75-cw1200-sdio-quirk/cw1200.patch b/patches/collateral-evolutions/network/75-cw1200-sdio-quirk/cw1200.patch
deleted file mode 100644
index 2533051..0000000
--- a/patches/collateral-evolutions/network/75-cw1200-sdio-quirk/cw1200.patch
+++ /dev/null
@@ -1,15 +0,0 @@
---- a/drivers/net/wireless/cw1200/cw1200_sdio.c
-+++ b/drivers/net/wireless/cw1200/cw1200_sdio.c
-@@ -253,6 +253,12 @@ static size_t cw1200_sdio_align_size(struct hwbus_priv *self, size_t size)
- 	else
- 		size = sdio_align_size(self->func, size);
- 
-+#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 2, 0))
-+	/* A quirk to handle this was committed in 3.2-rc */
-+	if (size == SDIO_BLOCK_SIZE)
-+		size += SDIO_BLOCK_SIZE;  /* HW bug; force use of block mode */
-+#endif
-+
- 	return size;
- }
- 
-- 
1.8.3.1


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

* [PATCH 3/4] backports: cw1200 utilizes kthreads for <= 2.6.35
  2013-08-17  4:23 [PATCH 1/4] backports: Add an implementation of get_random_int() for <3.10 kernels Solomon Peachy
  2013-08-17  4:23 ` [PATCH 2/4] backports: move the cw1200 sdio quirk into 26-sdio-quirks Solomon Peachy
@ 2013-08-17  4:23 ` Solomon Peachy
  2013-08-17  4:26   ` Solomon Peachy
  2013-08-17  4:23 ` [PATCH 4/4] backports: cw1200 requires >=2.6.35 Solomon Peachy
  2 siblings, 1 reply; 6+ messages in thread
From: Solomon Peachy @ 2013-08-17  4:23 UTC (permalink / raw
  To: backports; +Cc: Solomon Peachy

The new workqueue APIs in 2.6.36 allowed us to scrap the old kthread worker
that had been used; unfortunately the backported API isn't complete so
in order to support older kernels, resurrect this patch.

Signed-off-by: Solomon Peachy <pizza@shaftnet.org>
---
 .../75-cw1200-workqueues/cw1200_workqueues.patch   | 133 +++++++++++++++++++++
 1 file changed, 133 insertions(+)
 create mode 100644 patches/collateral-evolutions/network/75-cw1200-workqueues/cw1200_workqueues.patch

diff --git a/patches/collateral-evolutions/network/75-cw1200-workqueues/cw1200_workqueues.patch b/patches/collateral-evolutions/network/75-cw1200-workqueues/cw1200_workqueues.patch
new file mode 100644
index 0000000..3bf3197
--- /dev/null
+++ b/patches/collateral-evolutions/network/75-cw1200-workqueues/cw1200_workqueues.patch
@@ -0,0 +1,133 @@
+diff --git a/drivers/net/wireless/cw1200/bh.c b/drivers/net/wireless/cw1200/bh.c
+index c1ec2a4..5dcbb4e 100644
+--- a/drivers/net/wireless/cw1200/bh.c
++++ b/drivers/net/wireless/cw1200/bh.c
+@@ -48,16 +48,22 @@ enum cw1200_bh_pm_state {
+ typedef int (*cw1200_wsm_handler)(struct cw1200_common *priv,
+ 	u8 *data, size_t size);
+ 
++#ifndef CW1200_USE_COMPAT_KTHREAD
+ static void cw1200_bh_work(struct work_struct *work)
+ {
+ 	struct cw1200_common *priv =
+ 	container_of(work, struct cw1200_common, bh_work);
+ 	cw1200_bh(priv);
+ }
++#endif
+ 
+ int cw1200_register_bh(struct cw1200_common *priv)
+ {
+ 	int err = 0;
++#ifdef CW1200_USE_COMPAT_KTHREAD
++	struct sched_param param = { .sched_priority = 1 };
++	BUG_ON(priv->bh_thread);
++#else
+ 	/* Realtime workqueue */
+ 	priv->bh_workqueue = alloc_workqueue("cw1200_bh",
+ 				WQ_MEM_RECLAIM | WQ_HIGHPRI
+@@ -67,6 +73,7 @@ int cw1200_register_bh(struct cw1200_common *priv)
+ 		return -ENOMEM;
+ 
+ 	INIT_WORK(&priv->bh_work, cw1200_bh_work);
++#endif
+ 
+ 	pr_debug("[BH] register.\n");
+ 
+@@ -81,20 +88,44 @@ int cw1200_register_bh(struct cw1200_common *priv)
+ 	init_waitqueue_head(&priv->bh_wq);
+ 	init_waitqueue_head(&priv->bh_evt_wq);
+ 
++#ifdef CW1200_USE_COMPAT_KTHREAD
++	priv->bh_thread = kthread_create(&cw1200_bh, priv, "cw1200_bh");
++	if (IS_ERR(priv->bh_thread)) {
++		err = PTR_ERR(priv->bh_thread);
++		priv->bh_thread = NULL;
++	} else {
++		WARN_ON(sched_setscheduler(priv->bh_thread,
++					   SCHED_FIFO, &param));
++		wake_up_process(priv->bh_thread);
++	}
++#else
+ 	err = !queue_work(priv->bh_workqueue, &priv->bh_work);
+ 	WARN_ON(err);
++#endif
++
+ 	return err;
+ }
+ 
+ void cw1200_unregister_bh(struct cw1200_common *priv)
+ {
++#ifdef CW1200_USE_COMPAT_KTHREAD
++	struct task_struct *thread = priv->bh_thread;
++	if (WARN_ON(!thread))
++		return;
++#endif
++
+ 	atomic_add(1, &priv->bh_term);
+ 	wake_up(&priv->bh_wq);
+ 
++#ifdef CW1200_USE_COMPAT_KTHREAD
++	kthread_stop(thread);
++	priv->bh_thread = NULL;
++#else
+ 	flush_workqueue(priv->bh_workqueue);
+ 
+ 	destroy_workqueue(priv->bh_workqueue);
+ 	priv->bh_workqueue = NULL;
++#endif
+ 
+ 	pr_debug("[BH] unregistered.\n");
+ }
+@@ -614,6 +645,16 @@ static int cw1200_bh(void *arg)
+ 		pr_err("[BH] Fatal error, exiting.\n");
+ 		priv->bh_error = 1;
+ 		/* TODO: schedule_work(recovery) */
++#ifdef CW1200_USE_COMPAT_KTHREAD
++		for (;;) {
++			int status = wait_event_interruptible(priv->bh_wq, ({
++				term = atomic_xchg(&priv->bh_term, 0);
++				(term);
++			}));
++		if (status || term)
++			break;
++	}
++#endif
+ 	}
+ 	return 0;
+ }
+diff --git a/drivers/net/wireless/cw1200/cw1200.h b/drivers/net/wireless/cw1200/cw1200.h
+index 1ad7d36..300dbbb 100644
+--- a/drivers/net/wireless/cw1200/cw1200.h
++++ b/drivers/net/wireless/cw1200/cw1200.h
+@@ -23,12 +23,18 @@
+ #include <linux/workqueue.h>
+ #include <net/mac80211.h>
+ 
++#include <linux/version.h>
++
+ #include "queue.h"
+ #include "wsm.h"
+ #include "scan.h"
+ #include "txrx.h"
+ #include "pm.h"
+ 
++#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 36))
++#define CW1200_USE_COMPAT_KTHREAD
++#endif
++
+ /* Forward declarations */
+ struct hwbus_ops;
+ struct task_struct;
+@@ -190,8 +196,12 @@ struct cw1200_common {
+ 	atomic_t			bh_term;
+ 	atomic_t			bh_suspend;
+ 
++#ifdef CW1200_USE_COMPAT_KTHREAD
++	struct task_struct              *bh_thread;
++#else
+ 	struct workqueue_struct         *bh_workqueue;
+ 	struct work_struct              bh_work;
++#endif
+ 
+ 	int				bh_error;
+ 	wait_queue_head_t		bh_wq;
-- 
1.8.3.1


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

* [PATCH 4/4] backports: cw1200 requires >=2.6.35
  2013-08-17  4:23 [PATCH 1/4] backports: Add an implementation of get_random_int() for <3.10 kernels Solomon Peachy
  2013-08-17  4:23 ` [PATCH 2/4] backports: move the cw1200 sdio quirk into 26-sdio-quirks Solomon Peachy
  2013-08-17  4:23 ` [PATCH 3/4] backports: cw1200 utilizes kthreads for <= 2.6.35 Solomon Peachy
@ 2013-08-17  4:23 ` Solomon Peachy
  2 siblings, 0 replies; 6+ messages in thread
From: Solomon Peachy @ 2013-08-17  4:23 UTC (permalink / raw
  To: backports; +Cc: Solomon Peachy

The reason for the >=2.6.35 is mainly due to the multicast changes;
patch is coming to fix this in due course.

Signed-off-by: Solomon Peachy <pizza@shaftnet.org>
---
 dependencies | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/dependencies b/dependencies
index f1e514b..31427af 100644
--- a/dependencies
+++ b/dependencies
@@ -36,6 +36,8 @@ P54_SPI 2.6.25
 WL1251_SDIO 2.6.37
 WLCORE_SDIO 2.6.38
 
+CW1200 2.6.35
+
 BRCMFMAC 2.6.29
 
 WL_TI 2.6.30
-- 
1.8.3.1


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

* Re: [PATCH 3/4] backports: cw1200 utilizes kthreads for <= 2.6.35
  2013-08-17  4:23 ` [PATCH 3/4] backports: cw1200 utilizes kthreads for <= 2.6.35 Solomon Peachy
@ 2013-08-17  4:26   ` Solomon Peachy
  2013-08-17  4:34     ` Solomon Peachy
  0 siblings, 1 reply; 6+ messages in thread
From: Solomon Peachy @ 2013-08-17  4:26 UTC (permalink / raw
  To: backports

[-- Attachment #1: Type: text/plain, Size: 576 bytes --]

On Sat, Aug 17, 2013 at 12:23:02AM -0400, Solomon Peachy wrote:
> The new workqueue APIs in 2.6.36 allowed us to scrap the old kthread worker
> that had been used; unfortunately the backported API isn't complete so
> in order to support older kernels, resurrect this patch.

Please ignore this patch; I accidentally committed the wrong file in my 
tree.  I think it's time I go to bed.

 - Solomon
-- 
Solomon Peachy        		       pizza at shaftnet dot org
Delray Beach, FL                          ^^ (email/xmpp) ^^
Quidquid latine dictum sit, altum viditur.

[-- Attachment #2: Type: application/pgp-signature, Size: 190 bytes --]

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

* Re: [PATCH 3/4] backports: cw1200 utilizes kthreads for <= 2.6.35
  2013-08-17  4:26   ` Solomon Peachy
@ 2013-08-17  4:34     ` Solomon Peachy
  0 siblings, 0 replies; 6+ messages in thread
From: Solomon Peachy @ 2013-08-17  4:34 UTC (permalink / raw
  To: backports

[-- Attachment #1: Type: text/plain, Size: 830 bytes --]

On Sat, Aug 17, 2013 at 12:26:23AM -0400, Solomon Peachy wrote:
> On Sat, Aug 17, 2013 at 12:23:02AM -0400, Solomon Peachy wrote:
> > The new workqueue APIs in 2.6.36 allowed us to scrap the old kthread worker
> > that had been used; unfortunately the backported API isn't complete so
> > in order to support older kernels, resurrect this patch.
> 
> Please ignore this patch; I accidentally committed the wrong file in my 
> tree.  I think it's time I go to bed.

... I just double-faked myself out.  I was mistaken; this patch is 
indeed correct.  Sorry about that.  I'm turning this off before I make 
any more boneheaded mistakes.

 - Solomon
-- 
Solomon Peachy        		       pizza at shaftnet dot org
Delray Beach, FL                          ^^ (email/xmpp) ^^
Quidquid latine dictum sit, altum viditur.

[-- Attachment #2: Type: application/pgp-signature, Size: 190 bytes --]

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

end of thread, other threads:[~2013-08-17  4:34 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-17  4:23 [PATCH 1/4] backports: Add an implementation of get_random_int() for <3.10 kernels Solomon Peachy
2013-08-17  4:23 ` [PATCH 2/4] backports: move the cw1200 sdio quirk into 26-sdio-quirks Solomon Peachy
2013-08-17  4:23 ` [PATCH 3/4] backports: cw1200 utilizes kthreads for <= 2.6.35 Solomon Peachy
2013-08-17  4:26   ` Solomon Peachy
2013-08-17  4:34     ` Solomon Peachy
2013-08-17  4:23 ` [PATCH 4/4] backports: cw1200 requires >=2.6.35 Solomon Peachy

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.