Device class rework [0/5]
Subsystems (9)
Hi,
Here's a set of patches that rework the current class support in the kernel today into something that works a bit better, and is simpler to use.
Currently, classes are assigned to drivers at compile time (or at the latest, at driver_register() time) and enforce a 1 to 1 relationship between class devices and struct device objects. This is not practical in the kernel, as there are a number of physical devices that correspond to multiple "class" devices. It's also unwieldy to bind classes to devices so early. They should be explicitly done later when the class device is registered with that subsystem.
So with that in mind, here's some changes. The rework of the driver core is all done right now in one big patch, but I'll split it up smaller for inclusion later on.
This patch gets rid of struct device_class and struct device_interface, and replaces them with struct class[1], struct class_device, and struct class_interface. struct class is much like struct device_class used to be, but is much smaller, and not bound to any drivers. This makes the driver core a lot smaller, as we get hotplug events for free now (struct class_device is a kobject), and is more flexible.
A struct class_device is registered with a class when that device is registered within the kernel. As an example of this, see the tty patch later on in this email thread.
A struct class_interface is used to get a callback whenever a struct class_device is registered or unregistered with a class. This can be used to attach files to the class_device, or do more complicated things. The patch that changes the cpufreq code in this email thread shows how this can be used (although the cpufreq code can be further simplified based on these changes, I've not done it yet.)
If there are no major objections to this, I'll split it up into smaller pieces for inclusion in the kernel tree.
I'll follow this message up with 5 patches that do the following things:
- all of the driver core conversions. This is the meat of the changes.
- Fixes for the input core to build properly. I've not converted the input core to the new class model yet, but will after this.
- Crude patches to the scsi core to get it to build properly. This patch is not correct, but needed if your machines have scsi. Mike Anderson has said he will fix up the scsi code based on these core changes.
- cpufreq changes. This converts the cpufreq code to the new driver class changes.
- tty changes. This converts the tty code to the new driver class changes. With this patch, we now show all tty devices, and their device major/minor number in the /sys/class/tty/ directory. Yes, this is still a bit crude (all ptys are shown, and they should not be), but it's an example of why these changes are needed, and how to add class support to a subsystem. I'll rework this after Christoph's and Al Viro's tty changes are in the main tree, as we all are touching the same part of code.
Oh, and I didn't touch the pcmcia code yet either, with these patches, that code will not compile properly.
Any comments?
thanks,
greg k-h
[1] Yes, that's "struct class", and yes, I mean it. If you don't like it, please propose something else that describes what it does.
RFC 1/1 Device class rework [1/5]
Oh, these are all against a clean 2.5.68, sorry to not note that, last message.
Quoted 2 lines · Greg KH
- all of the driver core conversions. This is the meat of the changes.
drivers/base/Makefile +1 -3
@@ -1,8 +1,6 @@ # Makefile for the Linux device tree obj-y := core.o sys.o interface.o power.o bus.o \ - driver.o class.o intf.o platform.o \ + driver.o class.o platform.o \ cpu.o firmware.o init.o obj-$(CONFIG_NUMA) += node.o memblk.o -obj-y += fs/ -obj-$(CONFIG_HOTPLUG) += hotplug.o
drivers/base/base.h +0 -20
@@ -1,28 +1,8 @@extern struct semaphore device_sem; -extern struct semaphore devclass_sem;extern int bus_add_device (struct device * dev);extern void bus_remove_device (struct device * dev);extern int bus_add_driver (struct device_driver *);extern void bus_remove_driver (struct device_driver *); - -extern int devclass_add_device (struct device *); -extern void devclass_remove_device (struct device *); - -extern int devclass_add_driver (struct device_driver *); -extern void devclass_remove_driver (struct device_driver *); - -extern int interface_add_dev (struct device *); -extern void interface_remove_dev (struct device *); - - -#ifdef CONFIG_HOTPLUG -extern int class_hotplug (struct device *dev,const char *action); -#else -static inline int class_hotplug (struct device *dev,const char *action) -{ -return 0 ; -} -#endif
drivers/base/bus.c +3 -8
@@ -311,8 +311,7 @@* Walk the list of devices that the bus has on it and try to match * the driver with each one. * If bus_match() returns 0 and the @dev->driver is set, we've found -* a compatible pair, so we call devclass_add_device() to add the -* device to the class. +* a compatible pair. * * Note that we ignore the error from bus_match(), since it's perfectly * valid for a driver not to bind to any devices.
@@ -328,8 +327,7 @@list_for_each (entry,&bus->devices.list) { struct device * dev = container_of(entry,struct device,bus_list);if (!dev->driver) { -if (!bus_match (dev,drv)) -devclass_add_device (dev); +bus_match (dev,drv); } } }
@@ -351,7 +349,6 @@if (drv) {sysfs_remove_link (&drv->kobj,dev->kobj.name);list_del_init (&dev->driver_list); -devclass_remove_device (dev);if (drv->remove) drv->remove (dev); dev->driver =NULL ;
@@ -443,8 +440,7 @@ }down_write (&bus->subsys.rwsem); -if (!(error =devclass_add_driver (drv))) -driver_attach (drv); +driver_attach (drv);up_write (&bus->subsys.rwsem);if (error) {
@@ -471,7 +467,6 @@down_write (&drv->bus->subsys.rwsem);pr_debug ("bus %s: remove driver %s\n" ,drv->bus->name,drv->name);driver_detach (drv); -devclass_remove_driver (drv);up_write (&drv->bus->subsys.rwsem);kobject_unregister (&drv->kobj);put_bus (drv->bus);
drivers/base/class.c +300 -173
569 lines not on this page · raw message
drivers/base/core.c +0 -2
@@ -185,7 +185,6 @@INIT_LIST_HEAD (&dev->children);INIT_LIST_HEAD (&dev->driver_list);INIT_LIST_HEAD (&dev->bus_list); -INIT_LIST_HEAD (&dev->class_list); }/**
@@ -235,7 +234,6 @@if (platform_notify)platform_notify (dev); -devclass_add_device (dev); register_done:if (error && parent)put_device (parent);
drivers/base/cpu.c +18 -11
@@ -10,23 +10,16 @@#include <asm/topology.h> -static int cpu_add_device (struct device * dev) -{ -return 0 ; -} -struct device_class cpu_devclass = { +struct class cpu_class = { .name ="cpu" , - .add_device = cpu_add_device, };struct device_driver cpu_driver = { .name ="cpu" , .bus = &system_bus_type, - .devclass = &cpu_devclass, }; -/* * register_cpu - Setup a driverfs device for a CPU. * @num - CPU number to use when creating the device.
@@ -35,6 +28,8 @@*/ int __init register_cpu (struct cpu *cpu,int num,struct node *root) { +int retval; + cpu->node_id =cpu_to_node (num); cpu->sysdev.name ="cpu" ; cpu->sysdev.id = num;
@@ -42,7 +37,19 @@ cpu->sysdev.root = &root->sysroot;snprintf (cpu->sysdev.dev.name,DEVICE_NAME_SIZE ,"CPU %u" , num); cpu->sysdev.dev.driver = &cpu_driver; -return sys_device_register (&cpu->sysdev); + retval =sys_device_register (&cpu->sysdev); +if (retval) +return retval; +memset (&cpu->sysdev.class_dev,0x00 ,sizeof (struct class_device )); + cpu->sysdev.class_dev.dev = &cpu->sysdev.dev; + cpu->sysdev.class_dev.class = &cpu_class; +snprintf (cpu->sysdev.class_dev.class_id,BUS_ID_SIZE ,"cpu%d" , num); + retval =class_device_register (&cpu->sysdev.class_dev); +if (retval) { +// FIXME cleanup sys_device_register +return retval; + } +return 0 ; }
@@ -50,11 +57,11 @@ {int error; - error =devclass_register (&cpu_devclass); + error =class_register (&cpu_class);if (!error) { error =driver_register (&cpu_driver);if (error) -devclass_unregister (&cpu_devclass); +class_unregister (&cpu_class); }return error; }
drivers/base/driver.c +0 -1
@@ -82,7 +82,6 @@int driver_register (struct device_driver * drv) {INIT_LIST_HEAD (&drv->devices); -INIT_LIST_HEAD (&drv->class_list);init_MUTEX_LOCKED (&drv->unload_sem);return bus_add_driver (drv); }
drivers/base/fs/Makefile deleted +0 -2
@@ -1,2 +0,0 @@ -obj-y := device.o -
drivers/base/fs/device.c deleted +0 -49
49 lines not on this page · raw message
drivers/base/fs/fs.h deleted +0 -5
@@ -1,5 +0,0 @@ - -int get_devpath_length (struct device * dev); - -void fill_devpath (struct device * dev,char * path,int length); -
drivers/base/hotplug.c deleted +0 -145
145 lines not on this page · raw message
drivers/base/intf.c deleted +0 -225
225 lines not on this page · raw message
drivers/base/memblk.c +4 -10
@@ -11,20 +11,14 @@#include <asm/topology.h> -static int memblk_add_device (struct device * dev) -{ -return 0 ; -} -struct device_class memblk_devclass = { +static struct class memblk_class = { .name ="memblk" , - .add_device = memblk_add_device, }; -struct device_driver memblk_driver = { +static struct device_driver memblk_driver = { .name ="memblk" , .bus = &system_bus_type, - .devclass = &memblk_devclass, };
@@ -51,11 +45,11 @@ {int error; - error =devclass_register (&memblk_devclass); + error =class_register (&memblk_class);if (!error) { error =driver_register (&memblk_driver);if (error) -devclass_unregister (&memblk_devclass); +class_unregister (&memblk_class); }return error; }
drivers/base/node.c +4 -10
@@ -11,20 +11,14 @@#include <asm/topology.h> -static int node_add_device (struct device * dev) -{ -return 0 ; -} -struct device_class node_devclass = { +static struct class node_class = { .name ="node" , - .add_device = node_add_device, }; -struct device_driver node_driver = { +static struct device_driver node_driver = { .name ="node" , .bus = &system_bus_type, - .devclass = &node_devclass, };
@@ -93,11 +87,11 @@ {int error; - error =devclass_register (&node_devclass); + error =class_register (&node_class);if (!error) { error =driver_register (&node_driver);if (error) -devclass_unregister (&node_devclass); +class_unregister (&node_class); }return error; }
include/linux/device.h +78 -50
197 lines not on this page · raw message
RFC 1/1 Device class rework [2/5]
Quoted 2 lines · Greg KH
- Fixes for the input core to build properly. I've not converted the input core to the new class model yet, but will after this.
drivers/input/evbug.c +0 -12
@@ -88,19 +88,8 @@ .id_table = evbug_ids, }; -static struct device_interface evbug_intf = { - .name ="debug" , - .devclass = &input_devclass, -}; -int __init evbug_init (void ) { -int retval; - - retval =interface_register (&evbug_intf); -if (retval <0 ) -return retval; -input_register_handler (&evbug_handler);return 0 ; }
@@ -108,7 +97,6 @@ void __exit evbug_exit(void) {input_unregister_handler (&evbug_handler); -interface_unregister (&evbug_intf); }module_init (evbug_init);
drivers/input/evdev.c +0 -12
@@ -435,19 +435,8 @@ .id_table = evdev_ids, }; -static struct device_interface evdev_intf = { - .name ="event" , - .devclass = &input_devclass, -}; -static int __init evdev_init (void ) { -int retval; - - retval =interface_register (&evdev_intf); -if (retval <0 ) -return retval; -input_register_handler (&evdev_handler);return 0 ; }
@@ -455,7 +444,6 @@ static void __exit evdev_exit(void) {input_unregister_handler (&evdev_handler); -interface_unregister (&evdev_intf); }module_init (evdev_init);
drivers/input/input.c +4 -4
@@ -38,7 +38,7 @@EXPORT_SYMBOL (input_accept_process);EXPORT_SYMBOL (input_flush_device);EXPORT_SYMBOL (input_event); -EXPORT_SYMBOL (input_devclass); +EXPORT_SYMBOL (input_class);#define INPUT_MAJOR 13#define INPUT_DEVICES 256
@@ -675,7 +675,7 @@#endif -struct device_class input_devclass = { +struct class input_class = { .name ="input" , };
@@ -683,7 +683,7 @@ {struct proc_dir_entry *entry; -devclass_register (&input_devclass); +class_register (&input_class);#ifdef CONFIG_PROC_FS proc_bus_input_dir =proc_mkdir ("input" , proc_bus);
@@ -714,7 +714,7 @@devfs_unregister (input_devfs_handle);if (unregister_chrdev (INPUT_MAJOR ,"input" ))printk (KERN_ERR "input: can't unregister char major %d" ,INPUT_MAJOR ); -devclass_unregister (&input_devclass); +class_unregister (&input_class); }subsys_initcall (input_init);
drivers/input/mousedev.c +0 -11
@@ -487,18 +487,8 @@ };#endif -static struct device_interface mousedev_intf = { - .name ="mouse" , - .devclass = &input_devclass, -}; -static int __init mousedev_init (void ) { -int retval; - -if ((retval =interface_register (&mousedev_intf)) <0 ) -return retval; -input_register_handler (&mousedev_handler);memset (&mousedev_mix,0 ,sizeof (struct mousedev ));
@@ -527,7 +517,6 @@#endif input_unregister_minor (mousedev_mix.devfs);input_unregister_handler (&mousedev_handler); -interface_unregister (&mousedev_intf); }module_init (mousedev_init);
drivers/usb/input/hid-core.c +0 -3
@@ -1664,9 +1664,6 @@ .probe = hid_probe, .disconnect = hid_disconnect, .id_table = hid_usb_ids, - .driver = { - .devclass = &input_devclass, - }, };static int __init hid_init (void )
include/linux/input.h +1 -1
@@ -909,7 +909,7 @@#define input_regs (a,b) do { (a)->regs = (b); } while (0)#define input_sync (a) do { input_event(a, EV_SYN, SYN_REPORT, 0); (a)->regs = NULL; } while (0) -extern struct device_class input_devclass; +extern struct class input_class;#endif #endif
RFC 1/1 Device class rework [3/5]
Quoted 4 lines · Greg KH
- Crude patches to the scsi core to get it to build properly. This patch is not correct, but needed if your machines have scsi. Mike Anderson has said he will fix up the scsi code based on these core changes.
drivers/scsi/hosts.c +1 -1
@@ -294,7 +294,7 @@ sht->info ? sht->info(shost) : sht->name);if (dev) { - dev->class_data = shost; +// dev->class_data = shost; shost->host_gendev = dev; }
drivers/scsi/hosts.h +3 -2
@@ -495,7 +495,8 @@ __attribute__ ((aligned (sizeof(unsigned long)))); }; -#define to_scsi_host (d) d->class_data +//#define to_scsi_host(d) d->class_data +#define to_scsi_host (d) d->driver_data // Major breakage, but we compile now.../* * These two functions are used to allocate and free a pseudo device
@@ -607,7 +608,7 @@extern int scsi_upper_driver_register (struct Scsi_Device_Template *);extern void scsi_upper_driver_unregister (struct Scsi_Device_Template *); -extern struct device_class shost_devclass; +extern struct class shost_devclass;#endif /*
drivers/scsi/scsi_debug.c +1 -1
@@ -183,7 +183,7 @@ .name = sdebug_proc_name, .probe = sdebug_driver_probe, .remove = sdebug_driver_remove, - .devclass = &shost_devclass, +// .devclass = &shost_devclass, }; static const int check_condition_result =
drivers/scsi/scsi_sysfs.c +3 -5
@@ -95,10 +95,8 @@device_remove_file (dev, &dev_attr_class_name); } -struct device_class shost_devclass = { +struct class shost_devclass = { .name ="scsi-host" , - .add_device = scsi_host_class_add_dev, - .remove_device = scsi_host_class_rm_dev, };/**
@@ -136,14 +134,14 @@int scsi_sysfs_register (void ) {bus_register (&scsi_bus_type); -devclass_register (&shost_devclass); +class_register (&shost_devclass);return 0 ; }void scsi_sysfs_unregister (void ) { -devclass_unregister (&shost_devclass); +class_unregister (&shost_devclass);bus_unregister (&scsi_bus_type); }
RFC 1/1 Device class rework [4/5]
Quoted 2 lines · Greg KH
- cpufreq changes. This converts the cpufreq code to the new driver class changes.
include/linux/cpufreq.h +0 -1
@@ -68,7 +68,6 @@unsigned int policy;/* see above */ struct cpufreq_governor *governor;/* see below */ struct cpufreq_cpuinfo cpuinfo;/* see above */ -struct device * dev;struct kobject kobj;struct semaphore lock;/* CPU ->setpolicy or ->target may only be called once a time */
kernel/cpufreq.c +24 -62
205 lines not on this page · raw message
RFC 1/1 Device class rework [5/5]
Quoted 10 lines · Greg KH
- tty changes. This converts the tty code to the new driver class changes. With this patch, we now show all tty devices, and their device major/minor number in the
/sys/class/tty/directory. Yes, this is still a bit crude (all ptys are shown, and they should not be), but it's an example of why these changes are needed, and how to
add class support to a subsystem. I'll rework this after Christoph's
and Al Viro's tty changes are in the main tree, as we all are touching the same part of code.
drivers/char/tty_io.c +79 -8
@@ -2133,18 +2133,94 @@# define tty_register_devfs (driver, minor) do { } while (0)# define tty_unregister_devfs (driver, minor) do { } while (0)#endif /* CONFIG_DEVFS_FS */ +static struct class tty_class = { + .name ="tty" , +}; + +struct tty_dev { +struct list_head node; +struct tty_driver *driver; +unsigned minor; +struct class_device class_dev; +}; +#define to_tty_dev (d) container_of(d, struct tty_dev, class_dev) + +static LIST_HEAD (tty_dev_list); + +static ssize_t show_dev (struct class_device *class_dev,char *buf) +{ +struct tty_dev *tty_dev =to_tty_dev (class_dev); +dev_t base; + + base =MKDEV (tty_dev->driver->major, tty_dev->minor); +return sprintf (buf,"%04x\n" , base); +} +static CLASS_DEVICE_ATTR(dev, S_IRUGO, show_dev, NULL);/* * Register a tty device described by <driver>, with minor number <minor>. */ -void tty_register_device (struct tty_driver *driver,unsigned minor) +void tty_register_device (struct tty_driver *driver,unsigned minor,struct device *dev) { +struct tty_dev *tty_dev =NULL ; +char *name =NULL ; +char *temp; +int retval; +tty_register_devfs (driver, minor); + + tty_dev =kmalloc (sizeof (*tty_dev),GFP_KERNEL ); +if (!tty_dev) +return ; +memset (tty_dev,0x00 ,sizeof (*tty_dev)); + name =kmalloc (DEVICE_NAME_SIZE ,GFP_KERNEL ); +if (!name) + goto error; + +/* stupid '%' in tty name strings... */ +strncpy (name, driver->name,DEVICE_NAME_SIZE ); + temp =strchr (name,'%' ); +if (temp) + *temp =0x00 ; + + tty_dev->class_dev.dev = dev; + tty_dev->class_dev.class = &tty_class; +snprintf (tty_dev->class_dev.class_id,BUS_ID_SIZE ,"%s%d" , name, + minor - driver->minor_start); + retval =class_device_register (&tty_dev->class_dev); +if (retval) + goto error; +class_device_create_file (&tty_dev->class_dev, &class_device_attr_dev); + tty_dev->driver = driver; + tty_dev->minor = minor; +list_add (&tty_dev->node, &tty_dev_list); +return ; +error: +kfree (name); +kfree (tty_dev); }void tty_unregister_device (struct tty_driver *driver,unsigned minor) { +struct tty_dev *tty_dev =NULL ; +struct list_head *tmp; +int found =0 ; +tty_unregister_devfs (driver, minor); + + list_for_each (tmp, &tty_dev_list) { + tty_dev = list_entry(tmp, struct tty_dev, node); +if ((tty_dev->driver == driver) && + (tty_dev->minor == minor)) { + found =1 ; +break ; + } + } +if (found) { +list_del (&tty_dev->node); +class_device_unregister (&tty_dev->class_dev); +kfree (tty_dev); + } }EXPORT_SYMBOL (tty_register_device);
@@ -2175,7 +2251,7 @@if ( !(driver->flags &TTY_DRIVER_NO_DEVFS ) ) {for (i =0 ; i < driver->num; i++) -tty_register_device (driver, driver->minor_start + i); +tty_register_device (driver, driver->minor_start + i,NULL ); }proc_tty_register_driver (driver);return error;
@@ -2263,14 +2339,9 @@extern int vty_init (void );#endif -struct device_class tty_devclass = { - .name ="tty" , -}; -EXPORT_SYMBOL (tty_devclass); -static int __init tty_devclass_init (void ) { -return devclass_register (&tty_devclass); +return class_register (&tty_class); }postcore_initcall (tty_devclass_init);
drivers/char/vt.c +1 -1
@@ -2665,7 +2665,7 @@for (i =0 ; i < console_driver.num; i++)tty_register_device (&console_driver, - console_driver.minor_start + i); + console_driver.minor_start + i,NULL ); }/*
drivers/serial/8250_pci.c +0 -3
@@ -2043,9 +2043,6 @@ .suspend = pciserial_suspend_one, .resume = pciserial_resume_one, .id_table = serial_pci_tbl, - .driver = { - .devclass = &tty_devclass, - }, };static int __init serial8250_pci_init (void )
drivers/serial/core.c +1 -1
@@ -2231,7 +2231,7 @@* Register the port whether it's detected or not. This allows * setserial to be used to alter this ports parameters. */ -tty_register_device (drv->tty_driver, drv->minor + port->line); +tty_register_device (drv->tty_driver, drv->minor + port->line,NULL ); out:up (&port_sem);
drivers/usb/class/bluetty.c +1 -1
@@ -1198,7 +1198,7 @@ bluetooth, endpoint->bInterval);/* initialize the devfs nodes for this device and let the user know what bluetooths we are bound to */ -tty_register_device (&bluetooth_tty_driver, minor); +tty_register_device (&bluetooth_tty_driver, minor, &intf->dev);info ("Bluetooth converter now attached to ttyUB%d (or usb/ttub/%d for devfs)" , minor, minor); bluetooth_table[minor] = bluetooth;
drivers/usb/class/cdc-acm.c +1 -1
@@ -649,7 +649,7 @@usb_driver_claim_interface (&acm_driver, acm->iface +0 , acm);usb_driver_claim_interface (&acm_driver, acm->iface +1 , acm); -tty_register_device (&acm_tty_driver, minor); +tty_register_device (&acm_tty_driver, minor, &intf->dev); acm_table[minor] = acm;usb_set_intfdata (intf, acm);
drivers/usb/serial/bus.c +1 -17
@@ -23,18 +23,6 @@#include "usb-serial.h" -static ssize_t show_dev (struct device *dev,char *buf) -{ -struct usb_serial_port *port=to_usb_serial_port (dev); -dev_t base; - - port =to_usb_serial_port (dev); - - base =MKDEV (SERIAL_TTY_MAJOR , port->number); -return sprintf (buf,"%04x\n" , base); -} -static DEVICE_ATTR(dev, S_IRUGO, show_dev, NULL); -static int usb_serial_device_match (struct device *dev,struct device_driver *drv) {struct usb_serial_device_type *driver;
@@ -88,10 +76,7 @@ } minor = port->number; - -tty_register_device (&usb_serial_tty_driver, minor); -device_create_file (dev, &dev_attr_dev); - +tty_register_device (&usb_serial_tty_driver, minor, dev);dev_info (&port->serial->dev->dev,"%s converter now attached to ttyUSB%d (or usb/tts/%d for devfs)\n" , driver->name, minor, minor);
@@ -142,7 +127,6 @@ device->driver.bus = &usb_serial_bus_type; device->driver.probe = usb_serial_device_probe; device->driver.remove = usb_serial_device_remove; - device->driver.devclass = &tty_devclass; retval =driver_register (&device->driver);
include/linux/tty.h +2 -1
@@ -243,6 +243,7 @@#define L_PENDIN (tty) _L_FLAG((tty),PENDIN)#define L_IEXTEN (tty) _L_FLAG((tty),IEXTEN) +struct device ;/* * Where all of the state associated with a tty is kept while the tty * is open. Since the termios state should be kept even if the tty
@@ -378,7 +379,7 @@extern int tty_register_ldisc (int disc,struct tty_ldisc *new_ldisc);extern int tty_register_driver (struct tty_driver *driver);extern int tty_unregister_driver (struct tty_driver *driver); -extern void tty_register_device (struct tty_driver *driver,unsigned minor); +extern void tty_register_device (struct tty_driver *driver,unsigned minor,struct device *dev);extern void tty_unregister_device (struct tty_driver *driver,unsigned minor);extern int tty_read_raw_data (struct tty_struct *tty,unsigned char *bufp,int buflen);
include/linux/tty_driver.h +0 -2
@@ -231,6 +231,4 @@#define SERIAL_TYPE_NORMAL 1#define SERIAL_TYPE_CALLOUT 2 -extern struct device_class tty_devclass; -#endif /* #ifdef _LINUX_TTY_DRIVER_H */
Quoted 5 lines · --On Tuesday, April 22, 2003 01:55:45 PM -0700 Greg KH <[email protected]> wrote:
Hi,
Here's a set of patches that rework the current class support in the kernel today into something that works a bit better, and is simpler to use.
Greg,
I did a quick sanity test of these patches on a 2-way PIII. It built and booted fine for me. I don't have any devices that span multiple classes but the patch hasnt changed any of my existing /sys/class output.
Hanna
---
[root@w-hlinder2 root]# tree /sys/class/sys/class
|-- cpu
| |-- devices
| | |-- 0 -> ../../../devices/sys/cpu0
| | `-- 1 -> ../../../devices/sys/cpu1
| `-- drivers
| `-- system:cpu -> ../../../bus/system/drivers/cpu
|-- input
| |-- devices
| | |-- 0 -> ../../../devices/pci0/00:0f.2/usb1/1-1/1-1.1/1-1.1:0
| | |-- 1 -> ../../../devices/pci0/00:0f.2/usb1/1-1/1-1.1/1-1.1:1
| | `-- 2 -> ../../../devices/pci0/00:0f.2/usb1/1-1/1-1.2/1-1.2:0
| |-- drivers
| | `-- usb:hid -> ../../../bus/usb/drivers/hid
| `-- mouse
|-- pcmcia_socket
| |-- devices
| |-- drivers
| `-- pcmcia-bus
|-- scsi-host
| |-- devices
| `-- drivers
`-- tty
|-- devices
`-- drivers
`-- pci:serial -> ../../../bus/pci/drivers/serial25 directories, 0 files
Quoted 10 lines · Hanna Linder
Quoted 3 lines · --On Tuesday, April 22, 2003 01:55:45 PM -0700 Greg KH <[email protected]> wrote:
Here's a set of patches that rework the current class support in the kernel today into something that works a bit better, and is simpler to use.
I did a quick sanity test of these patches on a 2-way PIII. It built and booted fine for me. I don't have any devices that span multiple classes but the patch hasnt changed any of my existing
/sys/classoutput.
Hm, are you sure you applied them and are using that kernel? :)
/sys/class should look something like this:
$ tree /sys/class/
/sys/class/
|-- cpu
| `-- cpu0
| |-- device -> ../../../devices/sys/cpu0
| `-- foo
|-- input
`-- tty
|-- console0
| `-- dev
|-- ptmx0
| `-- dev
|-- pts0
| `-- dev
|-- pts1
| `-- dev
|-- pts2
| `-- dev
|-- pts3
| `-- dev
|-- pts4
| `-- dev
|-- pts5
| `-- dev
|-- pts6
| `-- dev
|-- pts7
| `-- dev
|-- pty0
| `-- dev
|-- pty1
| `-- dev
... and so on...thanks,
greg k-h
Quoted 7 lines · --On Tuesday, April 22, 2003 06:54:54 PM -0700 Greg KH <[email protected]> wrote:
Quoted 4 lines
I did a quick sanity test of these patches on a 2-way PIII. It built and booted fine for me. I don't have any devices that span multiple classes but the patch hasnt changed any of my existing
/sys/classoutput.Hm, are you sure you applied them and are using that kernel? :)
Yes. I did apply the patches... Just not to the kernel I booted ;(
Here is the correct tree I see on my 2xPIII:
/sys/class
|-- cpu
| |-- cpu0
| | `-- device -> ../../../devices/sys/cpu0
| `-- cpu1
| `-- device -> ../../../devices/sys/cpu1
|-- input
|-- scsi-host
`-- tty
|-- console0
| `-- dev
|-- ptmx0
| `-- dev
|-- pty0
| `-- dev
|-- pty1
| `-- dev
|-- pty10
| `-- dev
|-- pty100
| `-- dev
|-- pty101
| `-- dev
|-- pty102
| `-- dev
|-- pty103
| `-- dev
|-- pty104
| `-- dev
|-- pty105
| `-- dev
|-- pty106
| `-- dev
|-- pty107
| `-- dev
|-- pty108
| `-- devQuoted 15 lines · Hanna Linder
Quoted 7 lines · --On Tuesday, April 22, 2003 06:54:54 PM -0700 Greg KH <[email protected]> wrote:
Quoted 4 lines
I did a quick sanity test of these patches on a 2-way PIII. It built and booted fine for me. I don't have any devices that span multiple classes but the patch hasnt changed any of my existing
/sys/classoutput.Hm, are you sure you applied them and are using that kernel? :)
Yes. I did apply the patches... Just not to the kernel I booted ;(
Here is the correct tree I see on my 2xPIII:
Quoted 6 lines
/sys/class|-- cpu | |-- cpu0 | | `-- device -> ../../../devices/sys/cpu0 | `-- cpu1 | `-- device -> ../../../devices/sys/cpu1
Looks good. That "foo" file in the example I posted was from an older kernel version on one of my boxes. This is the correct information.
Thanks for testing,
greg k-h