sysfs: Initialization order and system devices

sysfs: Initialization order and system devices

Post by Jeremy Fitzharding » Fri, 13 Jun 2003 00:30:21



With the current system device changes (I picked them up in 2.5.70-mm8),
the system device class assumes that all system device drivers are
registered before any system devices are registered.

Unfortunately, this is often not the case.  CPU devices are registered
very early, but cpufreq registers drivers for them; since cpufreq
drivers can be loaded as modules, they clearly can't be registered
before the device is.

This patch keeps a list of all registered devices* off the system
device class.  When a new driver is registered, it calls the driver's
add() function with all existing devices.

Conversely, when a driver is unregistered, it calls the driver's
remove() function for all existing devices so the driver can clean up.

        J

  sysdev-init-order.patch
3K Download
 
 
 

sysfs: Initialization order and system devices

Post by Patrick Moche » Fri, 13 Jun 2003 00:40:12



Quote:> With the current system device changes (I picked them up in 2.5.70-mm8),
> the system device class assumes that all system device drivers are
> registered before any system devices are registered.

> Unfortunately, this is often not the case.  CPU devices are registered
> very early, but cpufreq registers drivers for them; since cpufreq
> drivers can be loaded as modules, they clearly can't be registered
> before the device is.

> This patch keeps a list of all registered devices* off the system
> device class.  When a new driver is registered, it calls the driver's
> add() function with all existing devices.

> Conversely, when a driver is unregistered, it calls the driver's
> remove() function for all existing devices so the driver can clean up.

D'oh. I meant to add this piece for precisely this reason. Thanks, though
there is one thing:

+
+       /* If devices of this class already exist, tell the driver */
+       if (drv->add) {
+               struct sys_device *dev;
+               list_for_each_entry(dev, &cls->devices, entry)
+                       drv->add(dev);
+       }
+

in sysdev_driver_register(). You must check that cls is not NULL. I've
fixed it up and applied it.

Thanks,

        -pat

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in

More majordomo info at  http://www.veryComputer.com/
Please read the FAQ at  http://www.veryComputer.com/

 
 
 

1. Failed to register 'sysfs' in sysfs?

Saw that in my dmesg. What does it mean? Do I have something configured
incorrectly? I tried doing a search of the mailing list but found
nothing. A search of the web also revealing nothing as did a look at
Documentation/filesystems/sysfs.txt.

--
"Other countries of course, bear the same risk. But there's no doubt his
hatred is mainly directed at us. After all this is the guy who tried to         kill my dad."
        - George W. Bush Jr, 'President' of the United States
          September 26, 2002 (from a political fundraiser in Huston, Texas)

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in

More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

2. 2.4.19-rc3, i810_audio: ignoring ready status of ICH for i845G chipset / Epox mainboard

3. sysfs: compile fix for fs/sysfs/mount.c

4. IP forwarding stopped working in Linux 2.0.22!!! Why????

5. New: Failed to register 'sysfs' in sysfs

6. <VirtualHost> mismatch by port

7. 2/2 Initialization Ordering For Built-in Modules

8. apache and *.php PLEASE HELP!!!

9. 1/2 Initialization Ordering For Built-in Modules

10. pcmcia: get initialization ordering right [Was: [PATCH 2.5] : i82365 & platform_bus_type]

11. Work around console initialization ordering problem

12. Shared library initialization order.

13. How to determine/influence c++ static initialization order?