Driver support for system devices
Subsystems (3)
Hi!
This adds devicefs support for motherboard devices. time is going to need it (to restore time after resume), floppy might be critical too (it uses DMA, so we *need* it stopped). Please apply,
Pavel
arch/i386/kernel/i8259.c +14 -0
@@ -11,6 +11,7 @@#include <linux/smp_lock.h> #include <linux/init.h> #include <linux/kernel_stat.h> +#include <linux/device.h> #include <asm/atomic.h> #include <asm/system.h>
@@ -332,6 +333,19 @@ goto handle_real_irq; } } + +static struct device device_i8259A = { + name:"i8259A" , + bus_id:"0020" , + parent: &device_sys, +}; + +static void __init init_8259A_devicefs (void ) +{ +device_register (&device_i8259A); +} + +__initcall (init_8259A_devicefs);void __init init_8259A (int auto_eoi) {
arch/i386/kernel/time.c +13 -0
@@ -41,6 +41,7 @@#include <linux/delay.h> #include <linux/init.h> #include <linux/smp.h> +#include <linux/device.h> #include <asm/io.h> #include <asm/smp.h>
@@ -634,6 +635,18 @@ bad_ctc:return 0 ; } + +static struct device device_i8253; + +static void time_init_driverfs (void ) +{ +strcpy (device_i8253.name,"i8253" ); +strcpy (device_i8253.bus_id,"0040" ); + device_i8253.parent = &device_sys; +device_register (&device_i8253); +} + +__initcall (time_init_driverfs);void __init time_init (void ) {
drivers/base/core.c +19 -1
@@ -24,6 +24,18 @@ name: "System Root", }; +struct device device_sys = { + bus_id:"sys" , + name:"Bus for motherboard devices" , + parent: &device_root, +}; + +struct device device_legacy = { + bus_id:"legacy" , + name:"Bus for devices on southbridge/X-BUS/ISA" , + parent: &device_root, +}; +int (*platform_notify)(struct device * dev) =NULL ;int (*platform_notify_remove)(struct device * dev) =NULL ;
@@ -121,7 +133,13 @@static int __init device_init_root (void ) { -return device_register (&device_root); +int res; + res =device_register (&device_root); +if (res)return res; + res =device_register (&device_sys); +if (res)return res; + res =device_register (&device_legacy); +if (res)return res; }static int __init device_init (void )
drivers/block/floppy.c +6 -0
@@ -167,6 +167,7 @@#include <linux/interrupt.h> #include <linux/init.h> #include <linux/devfs_fs_kernel.h> +#include <linux/device.h> /* * PS/2 floppies have much slower step rates than regular floppies.
@@ -4146,11 +4147,16 @@static int have_no_fdc= -ENODEV ; +static struct device device_floppy;int __init floppy_init (void ) {int i,unit,drive; +strcpy (device_floppy.name,"floppy" ); +strcpy (device_floppy.bus_id,"03?0" ); + device_floppy.parent = &device_sys; +device_register (&device_floppy); raw_cmd =NULL ;
include/linux/device.h +5 -1
@@ -61,6 +61,7 @@int (*suspend) (struct device * dev,u32 state,u32 level);int (*resume) (struct device * dev,u32 level); +int (*enable_wake) (struct device * dev,u32 state,int enable);/* Enable wake event */ };struct device {
@@ -83,7 +84,7 @@device */ void *driver_data;/* data private to the driver */ void *platform_data;/* Platform specific data (e.g. ACPI, -BIOS data relevant to device */ +BIOS data relevant to device) */ u32 current_state;/* Current operating state. In ACPI-speak, this is D0-D3, D0
@@ -142,5 +143,8 @@ }extern void put_device (struct device * dev); +extern struct device device_root; +extern struct device device_legacy; +extern struct device device_sys;#endif /* _DEVICE_H_ */
Signature · 2 lines
(about SSSCA) "I don't say this lightly. However, I really think that the U.S. no longer is classifiable as a democracy, but rather as a plutocracy." --hpa