2007-09-10 11:43:16

by Johannes Berg

[permalink] [raw]
Subject: [PATCH] cfg80211: fix initialisation if built-in

When cfg80211 is built into the kernel it needs to init earlier
so that device registrations are run after it has initialised.

Signed-off-by: Johannes Berg <[email protected]>

---
net/wireless/core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

--- wireless-dev.orig/net/wireless/core.c 2007-09-10 13:00:18.567257487 +0200
+++ wireless-dev/net/wireless/core.c 2007-09-10 13:00:59.837219347 +0200
@@ -363,7 +363,7 @@ out_fail_notifier:
out_fail_sysfs:
return err;
}
-module_init(cfg80211_init);
+subsys_initcall(cfg80211_init);

static void cfg80211_exit(void)
{




2007-09-21 22:05:22

by Johannes Berg

[permalink] [raw]
Subject: Re: [stable] [PATCH] cfg80211: fix initialisation if built-in

On Fri, 2007-09-21 at 15:02 -0700, Greg KH wrote:

> When this goes into Linus's tree, please resend it to the
> [email protected] address so we can add it to our queue.

It's on the way, sitting in net-2.6.24 right now but I don't know
whether it's scheduled for .23. I'm no longer sure if it really matters
for -stable since we have no drivers there so typically drivers build as
out-of-tree modules and the issue doesn't matter.

johannes


Attachments:
signature.asc (190.00 B)
This is a digitally signed message part

2007-09-11 01:18:14

by Rob Hussey

[permalink] [raw]
Subject: Re: [PATCH] cfg80211: fix initialisation if built-in

On 9/10/07, Magnus Damm <[email protected]> wrote:
> -module_init(rate_control_simple_init);
> +//module_init(rate_control_simple_init);
> +postcore_initcall(rate_control_simple_init);
> module_exit(rate_control_simple_exit);
>
> MODULE_DESCRIPTION("Simple rate control algorithm for ieee80211");

Same problem here, except with the rt2x00 driver. I changed it to
subsys_initcall(rate_control_simple_init), which also worked. I also
found that without this change, it was failing at this point in
ieee80211_rate.c:

ieee80211_try_rate_control_ops_get(const char *name)
{
struct rate_control_alg *alg;
struct rate_control_ops *ops = NULL;

mutex_lock(&rate_ctrl_mutex);
list_for_each_entry(alg, &rate_ctrl_algs, list) { <===== Here
if (!name || !strcmp(alg->ops->name, name))
if (try_module_get(alg->ops->module)) {
ops = alg->ops;
break;
}

2007-09-11 10:23:28

by Johannes Berg

[permalink] [raw]
Subject: Re: [PATCH] cfg80211: fix initialisation if built-in

On Tue, 2007-09-11 at 10:04 +0900, Magnus Damm wrote:
> On 9/10/07, Johannes Berg <[email protected]> wrote:
> > When cfg80211 is built into the kernel it needs to init earlier
> > so that device registrations are run after it has initialised.
> >
> > Signed-off-by: Johannes Berg <[email protected]>
>
> Yep, I need this fix as well. Without it the ath5k driver built in
> bombs out during module_init(). Something with kref and a struct
> device pointing to an uninitialized ieee80211_class.
>
> I need a similar fix for net/mac80211/rc80211_simple.c as well to get
> ath5k working though, not sure why at the moment. There may be some
> bug with request_module() not being called properly.

Nah, it's just all too late and the rate control algorithm is built-in
too iirc. Rob tested a patch that changes those to subsys_initcall() as
well, so I'll be posting that.

johannes


Attachments:
signature.asc (190.00 B)
This is a digitally signed message part

2007-09-21 22:02:52

by Greg KH

[permalink] [raw]
Subject: Re: [stable] [PATCH] cfg80211: fix initialisation if built-in

On Mon, Sep 10, 2007 at 01:44:45PM +0200, Johannes Berg wrote:
> When cfg80211 is built into the kernel it needs to init earlier
> so that device registrations are run after it has initialised.
>
> Signed-off-by: Johannes Berg <[email protected]>

When this goes into Linus's tree, please resend it to the
[email protected] address so we can add it to our queue.

thanks,

greg k-h

2007-09-11 01:04:22

by Magnus Damm

[permalink] [raw]
Subject: Re: [PATCH] cfg80211: fix initialisation if built-in

On 9/10/07, Johannes Berg <[email protected]> wrote:
> When cfg80211 is built into the kernel it needs to init earlier
> so that device registrations are run after it has initialised.
>
> Signed-off-by: Johannes Berg <[email protected]>

Yep, I need this fix as well. Without it the ath5k driver built in
bombs out during module_init(). Something with kref and a struct
device pointing to an uninitialized ieee80211_class.

I need a similar fix for net/mac80211/rc80211_simple.c as well to get
ath5k working though, not sure why at the moment. There may be some
bug with request_module() not being called properly.
ieee80211_register_hw() calls ieee80211_init_rate_ctrl_alg() with NULL
as name which calls rate_control_alloc() with NULL which always seems
to fail when built in.

This hack works around that problem, not sure what the real fix is.

--- 0002/net/mac80211/rc80211_simple.c
+++ work/net/mac80211/rc80211_simple.c 2007-09-09 18:11:48.000000000 +0900
@@ -431,7 +431,8 @@ static void __exit rate_control_simple_e
}


-module_init(rate_control_simple_init);
+//module_init(rate_control_simple_init);
+postcore_initcall(rate_control_simple_init);
module_exit(rate_control_simple_exit);

MODULE_DESCRIPTION("Simple rate control algorithm for ieee80211");

Thanks,

/ magnus