• Patrick Mochel's avatar
    Driver model: improve support for system devices. · 8b755139
    Patrick Mochel authored
      
    - Create struct sys_device to describe system-level devices (CPUs, PICs, etc.). This 
      structure includes a 'name' and 'id' field for drivers to fill in with a simple
      canonical name (like 'pic' or 'floppy') and the id of the device relative to its 
      discovery in the system (it's enumerated value).
    
      The core then constructs the bus_id for the device from these, giving them meaningful
      names when exporting them to userspace:
    
    # tree -d /sys/root/sys/
    /sys/root/sys/
    |-- pic0
    `-- rtc0
    
    - Replace 
    	int register_sys_device(struct device * dev);
    	with 
    	int sys_device_register(struct sys_device * sysdev);
    
    - Fixup the users of the API.
    
    - Add a system_bus_type for devices to associate themselves with. This provides a 
      bus/system/ directory in driverfs that looks like:
    
    # tree -d /sys/bus/system/
    /sys/bus/system/
    |-- devices
    |   |-- pic0 -> ../../../root/sys/pic0
    |   `-- rtc0 -> ../../../root/sys/rtc0
    `-- drivers
        `-- pic
    8b755139
i8259.c 9.79 KB