Skip to contentSkip to conversation

cfg80211: fix initialisation if built-in

PATCH In review Johannes Berg 4 participants 6 messages Sep 10, 2007 – Sep 21, 2007 1 message not in the archive

Subsystems (4)
lore
Share & tools
lore

Johannes Berg

author maintainer
#0 lore raw

PATCH 1/1 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.

---
 net/wireless/core.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/wireless/core.c +1 -1
@@ -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)
 {

A message that is not in the archive (sent off-list or not yet received): [email protected]

#2 lore raw
Quoted 4 lines · Johannes Berg

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

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.

net/mac80211/rc80211_simple.c 2007-09-09 18:11:48.000000000 +0900 renamed from net/mac80211/rc80211_simple.c +2 -1
@@ -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

#3 lore raw

net/mac80211/rc80211_simple.c 2007-09-09 18:11:48.000000000 +0900 static void __exit rate_control_simple_e · line 438

Quoted 6 lines · Magnus Damm
net/mac80211/rc80211_simple.c 2007-09-09 18:11:48.000000000 +0900 renamed from net/mac80211/rc80211_simple.c +2 -1
-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;
                        }
author maintainer
#4 lore raw
In reply to Magnus Damm
Quoted 6 lines · Magnus Damm
Quoted 4 lines · Johannes Berg

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

Quoted 7 lines

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

author maintainer
#6 lore raw
Quoted 2 lines · Greg KH

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