Register sysctl before doing pci registration.

This fixes a bug when renaming multiple wireless cards on slow devices.
The pci registration causes udev to rename the device but the sysctl is
not registered yet so the device renames but the corresponding sysctl
entries are not renamed.


git-svn-id: http://madwifi-project.org/svn/madwifi/trunk@3746 0192ed92-7a03-0410-a25b-9323aeb14dbd
This commit is contained in:
scottr 2008-06-26 08:23:41 +00:00
parent 7a04e2c8e8
commit 57f22bcbda
2 changed files with 11 additions and 3 deletions

View File

@ -11024,6 +11024,10 @@ ath_dynamic_sysctl_register(struct ath_softc *sc)
unsigned int i, space;
char *dev_name = NULL;
/* Prevent multiple registrations */
if (sc->sc_sysctls)
return;
space = 5 * sizeof(struct ctl_table) + sizeof(ath_sysctl_template);
sc->sc_sysctls = kzalloc(space, GFP_KERNEL);
if (sc->sc_sysctls == NULL) {
@ -11041,6 +11045,8 @@ ath_dynamic_sysctl_register(struct ath_softc *sc)
dev_name = kmalloc((strlen(DEV_NAME(sc->sc_dev)) + 1) * sizeof(char), GFP_KERNEL);
if (dev_name == NULL) {
EPRINTF(sc, "Insufficient memory for device name storage!\n");
kfree(sc->sc_sysctls);
sc->sc_sysctls = NULL;
return;
}
strncpy(dev_name, DEV_NAME(sc->sc_dev), strlen(DEV_NAME(sc->sc_dev)) + 1);

View File

@ -380,10 +380,12 @@ MODULE_LICENSE("Dual BSD/GPL");
static int __init
init_ath_pci(void)
{
int status = pci_register_driver(&ath_pci_driver);
if (status)
return (status);
int status;
ath_sysctl_register();
if ((status = pci_register_driver(&ath_pci_driver))) {
ath_sysctl_unregister();
return (status);
}
return (0);
}
module_init(init_ath_pci);