• Patrick Mochel's avatar
    driver model: add better platform device support. · f6bec0e6
    Patrick Mochel authored
    Platform devices are devices commonly found on the motherboard of systems. This
    includes legacy devices (serial ports, floppy controllers, parallel ports, etc)
    and host bridges to peripheral buses. 
    
    We already had a platform bus type, which gives a way to group platform devices
    and drivers, and allow each to be bound to each other dynamically. Though before,
    it didn't do anything. It still doesn't do much, but we now have:
    
    - struct platform_device, which generically describes platform deviecs. This only
      includes a name and id in addition to a struct device, but more may be added later.
    
    - implelemnt platform_device_register() and platform_device_unregister() to handle
      adding and removing these devices. 
    
    - Create legacy_bus - a default parent device for legacy devices. 
    
    - Change the floppy driver to define a platform_device (instead of a sys_device). 
      In driverfs, this gives us now:
    
    a# tree -d /sys/bus/platform/
    /sys/bus/platform/
    |-- devices
    |   `-- floppy0 -> ../../../root/legacy/floppy0
    `-- drivers
    
    and
    
    # tree -d /sys/root/legacy/
    /sys/root/legacy/
    `-- floppy0
    f6bec0e6
floppy.c 116 KB