Hi,
Here are a few kobject and driver core changes for 2.6.1. The majority
of these are the "class_simple" patches that have been in the -mm tree
for quite a while now. They add sysfs class support for a wide range of
different class devices, which is required for tools like udev to be
able to do device naming in userspace. Andrew suggested that I send
them to you now. All of the different driver subsystem maintainers
(when there is one) have ACKed these changes.
Please pull from:
bk://kernel.bkbits.net/gregkh/linux/driver-2.6
thanks,
greg k-h
p.s. I'll send these as patches in response to this email to lkml for
those who want to see them.
drivers/base/Makefile | 2
drivers/base/class.c | 14 +++
drivers/base/class_simple.c | 201 ++++++++++++++++++++++++++++++++++++++++++++
drivers/base/core.c | 9 +
drivers/char/lp.c | 6 +
drivers/char/mem.c | 7 +
drivers/char/misc.c | 17 +++
drivers/char/tty_io.c | 91 ++-----------------
drivers/input/evdev.c | 4
drivers/input/input.c | 8 -
drivers/input/joydev.c | 4
drivers/input/mousedev.c | 8 +
drivers/input/tsdev.c | 4
include/linux/device.h | 10 ++
include/linux/input.h | 3
include/linux/kobject.h | 1
include/linux/miscdevice.h | 3
include/sound/core.h | 1
lib/kobject.c | 51 ++++-------
sound/core/sound.c | 34 ++++---
sound/oss/soundcard.c | 13 ++
sound/pci/intel8x0.c | 1
sound/sound_core.c | 10 ++
23 files changed, 368 insertions(+), 134 deletions(-)
-----
Dmitry Torokhov:
o kobject: make kobject hotplug function public
Greg Kroah-Hartman:
o Kobject: prevent oops in kset_find_obj() if kobject_name() is NULL
o ALSA: add sysfs class support for ALSA sound devices
o OSS: add sysfs class support for OSS sound devices
o MISC: add sysfs class support for misc devices
o MEM: add sysfs class support for mem devices
o LP: add sysfs class support for lp devices
o Input: add sysfs class support for input devices
o TTY: clean up sysfs class support for tty devices
o Driver Core: add class_simple support
Hollis Blanchard:
o Driver Core: add device_find() function
ChangeSet 1.1495, 2004/01/19 16:21:50-08:00, [email protected]
[PATCH] kobject: make kobject hotplug function public
make kobject hotplug mechanism public so that others may call it.
include/linux/kobject.h | 1
lib/kobject.c | 49 ++++++++++++++++++++----------------------------
2 files changed, 22 insertions(+), 28 deletions(-)
diff -Nru a/include/linux/kobject.h b/include/linux/kobject.h
--- a/include/linux/kobject.h Mon Jan 19 17:05:23 2004
+++ b/include/linux/kobject.h Mon Jan 19 17:05:23 2004
@@ -56,6 +56,7 @@
extern struct kobject * kobject_get(struct kobject *);
extern void kobject_put(struct kobject *);
+extern void kobject_hotplug(const char *action, struct kobject *);
struct kobj_type {
void (*release)(struct kobject *);
diff -Nru a/lib/kobject.c b/lib/kobject.c
--- a/lib/kobject.c Mon Jan 19 17:05:23 2004
+++ b/lib/kobject.c Mon Jan 19 17:05:23 2004
@@ -198,9 +198,24 @@
kfree(envp);
return;
}
+
+void kobject_hotplug(const char *action, struct kobject *kobj)
+{
+ struct kobject * top_kobj = kobj;
+
+ /* If this kobj does not belong to a kset,
+ try to find a parent that does. */
+ if (!top_kobj->kset && top_kobj->parent) {
+ do {
+ top_kobj = top_kobj->parent;
+ } while (!top_kobj->kset && top_kobj->parent);
+ }
+
+ if (top_kobj->kset && top_kobj->kset->hotplug_ops)
+ kset_hotplug(action, top_kobj->kset, kobj);
+}
#else
-static void kset_hotplug(const char *action, struct kset *kset,
- struct kobject *kobj)
+void kobject_hotplug(const char *action, struct kobject *kobj)
{
return;
}
@@ -248,7 +263,6 @@
{
int error = 0;
struct kobject * parent;
- struct kobject * top_kobj;
if (!(kobj = kobject_get(kobj)))
return -ENOENT;
@@ -277,18 +291,9 @@
if (parent)
kobject_put(parent);
} else {
- /* If this kobj does not belong to a kset,
- try to find a parent that does. */
- top_kobj = kobj;
- if (!top_kobj->kset && top_kobj->parent) {
- do {
- top_kobj = top_kobj->parent;
- } while (!top_kobj->kset && top_kobj->parent);
- }
-
- if (top_kobj->kset && top_kobj->kset->hotplug_ops)
- kset_hotplug("add", top_kobj->kset, kobj);
+ kobject_hotplug("add", kobj);
}
+
return error;
}
@@ -396,20 +401,7 @@
void kobject_del(struct kobject * kobj)
{
- struct kobject * top_kobj;
-
- /* If this kobj does not belong to a kset,
- try to find a parent that does. */
- top_kobj = kobj;
- if (!top_kobj->kset && top_kobj->parent) {
- do {
- top_kobj = top_kobj->parent;
- } while (!top_kobj->kset && top_kobj->parent);
- }
-
- if (top_kobj->kset && top_kobj->kset->hotplug_ops)
- kset_hotplug("remove", top_kobj->kset, kobj);
-
+ kobject_hotplug("remove", kobj);
sysfs_remove_dir(kobj);
unlink(kobj);
}
@@ -638,6 +630,7 @@
EXPORT_SYMBOL(kobject_unregister);
EXPORT_SYMBOL(kobject_get);
EXPORT_SYMBOL(kobject_put);
+EXPORT_SYMBOL(kobject_hotplug);
EXPORT_SYMBOL(kset_register);
EXPORT_SYMBOL(kset_unregister);
ChangeSet 1.1504, 2004/01/19 16:45:49-08:00, [email protected]
[PATCH] ALSA: add sysfs class support for ALSA sound devices
This patch adds support for all ALSA sound devices. The previous OSS
sound patch is required for this one to work properly.
This patch is based on a work originally written by
Leann Ogasawara <[email protected]>
include/sound/core.h | 1 +
sound/core/sound.c | 34 ++++++++++++++++++++--------------
sound/pci/intel8x0.c | 1 +
3 files changed, 22 insertions(+), 14 deletions(-)
diff -Nru a/include/sound/core.h b/include/sound/core.h
--- a/include/sound/core.h Mon Jan 19 17:04:44 2004
+++ b/include/sound/core.h Mon Jan 19 17:04:44 2004
@@ -160,6 +160,7 @@
int shutdown; /* this card is going down */
wait_queue_head_t shutdown_sleep;
struct work_struct free_workq; /* for free in workqueue */
+ struct device *dev;
#ifdef CONFIG_PM
int (*set_power_state) (snd_card_t *card, unsigned int state);
diff -Nru a/sound/core/sound.c b/sound/core/sound.c
--- a/sound/core/sound.c Mon Jan 19 17:04:44 2004
+++ b/sound/core/sound.c Mon Jan 19 17:04:44 2004
@@ -38,9 +38,7 @@
static int major = CONFIG_SND_MAJOR;
int snd_major;
static int cards_limit = SNDRV_CARDS;
-#ifdef CONFIG_DEVFS_FS
static int device_mode = S_IFCHR | S_IRUGO | S_IWUGO;
-#endif
MODULE_AUTHOR("Jaroslav Kysela <[email protected]>");
MODULE_DESCRIPTION("Advanced Linux Sound Architecture driver for soundcards.");
@@ -66,6 +64,7 @@
static DECLARE_MUTEX(sound_mutex);
+extern struct class_simple *sound_class;
#ifdef CONFIG_KMOD
/**
@@ -203,6 +202,7 @@
{
int minor = snd_kernel_minor(type, card, dev);
snd_minor_t *preg;
+ struct device *device = NULL;
if (minor < 0)
return minor;
@@ -221,10 +221,14 @@
return -EBUSY;
}
list_add_tail(&preg->list, &snd_minors_hash[SNDRV_MINOR_CARD(minor)]);
-#ifdef CONFIG_DEVFS_FS
- if (strncmp(name, "controlC", 8)) /* created in sound.c */
+
+ if (strncmp(name, "controlC", 8)) { /* created in sound.c */
devfs_mk_cdev(MKDEV(major, minor), S_IFCHR | device_mode, "snd/%s", name);
-#endif
+ if (card)
+ device = card->dev;
+ class_simple_device_add(sound_class, MKDEV(major, minor), device, name);
+ }
+
up(&sound_mutex);
return 0;
}
@@ -252,10 +256,12 @@
up(&sound_mutex);
return -EINVAL;
}
-#ifdef CONFIG_DEVFS_FS
- if (strncmp(mptr->name, "controlC", 8)) /* created in sound.c */
+
+ if (strncmp(mptr->name, "controlC", 8)) { /* created in sound.c */
devfs_remove("snd/%s", mptr->name);
-#endif
+ class_simple_device_remove(MKDEV(major, minor));
+ }
+
list_del(&mptr->list);
up(&sound_mutex);
kfree(mptr);
@@ -322,9 +328,7 @@
static int __init alsa_sound_init(void)
{
-#ifdef CONFIG_DEVFS_FS
short controlnum;
-#endif
#ifdef CONFIG_SND_OSSEMUL
int err;
#endif
@@ -358,10 +362,10 @@
#ifdef CONFIG_SND_OSSEMUL
snd_info_minor_register();
#endif
-#ifdef CONFIG_DEVFS_FS
- for (controlnum = 0; controlnum < cards_limit; controlnum++)
+ for (controlnum = 0; controlnum < cards_limit; controlnum++) {
devfs_mk_cdev(MKDEV(major, controlnum<<5), S_IFCHR | device_mode, "snd/controlC%d", controlnum);
-#endif
+ class_simple_device_add(sound_class, MKDEV(major, controlnum<<5), NULL, "controlC%d", controlnum);
+ }
#ifndef MODULE
printk(KERN_INFO "Advanced Linux Sound Architecture Driver Version " CONFIG_SND_VERSION CONFIG_SND_DATE ".\n");
#endif
@@ -372,8 +376,10 @@
{
short controlnum;
- for (controlnum = 0; controlnum < cards_limit; controlnum++)
+ for (controlnum = 0; controlnum < cards_limit; controlnum++) {
devfs_remove("snd/controlC%d", controlnum);
+ class_simple_device_remove(MKDEV(major, controlnum<<5));
+ }
#ifdef CONFIG_SND_OSSEMUL
snd_info_minor_unregister();
diff -Nru a/sound/pci/intel8x0.c b/sound/pci/intel8x0.c
--- a/sound/pci/intel8x0.c Mon Jan 19 17:04:44 2004
+++ b/sound/pci/intel8x0.c Mon Jan 19 17:04:44 2004
@@ -2591,6 +2591,7 @@
break;
}
}
+ card->dev = &pci->dev;
if ((err = snd_intel8x0_create(card, pci, pci_id->driver_data, &chip)) < 0) {
snd_card_free(card);
ChangeSet 1.1498, 2004/01/19 16:36:04-08:00, [email protected]
[PATCH] TTY: clean up sysfs class support for tty devices
This patch ports the existing tty class support to the class_simple
interface, saving a lot of code in the process.
drivers/char/tty_io.c | 91 ++++++--------------------------------------------
1 files changed, 11 insertions(+), 80 deletions(-)
diff -Nru a/drivers/char/tty_io.c b/drivers/char/tty_io.c
--- a/drivers/char/tty_io.c Mon Jan 19 17:05:10 2004
+++ b/drivers/char/tty_io.c Mon Jan 19 17:05:10 2004
@@ -2069,79 +2069,7 @@
tty->driver->write(tty, 0, &ch, 1);
}
-struct tty_dev {
- struct list_head node;
- dev_t dev;
- struct class_device class_dev;
-};
-#define to_tty_dev(d) container_of(d, struct tty_dev, class_dev)
-
-static void release_tty_dev(struct class_device *class_dev)
-{
- struct tty_dev *tty_dev = to_tty_dev(class_dev);
- kfree(tty_dev);
-}
-
-static struct class tty_class = {
- .name = "tty",
- .release = &release_tty_dev,
-};
-
-static LIST_HEAD(tty_dev_list);
-static spinlock_t tty_dev_list_lock = SPIN_LOCK_UNLOCKED;
-
-static ssize_t show_dev(struct class_device *class_dev, char *buf)
-{
- struct tty_dev *tty_dev = to_tty_dev(class_dev);
- return print_dev_t(buf, tty_dev->dev);
-}
-static CLASS_DEVICE_ATTR(dev, S_IRUGO, show_dev, NULL);
-
-static void tty_add_class_device(char *name, dev_t dev, struct device *device)
-{
- struct tty_dev *tty_dev = NULL;
- int retval;
-
- tty_dev = kmalloc(sizeof(*tty_dev), GFP_KERNEL);
- if (!tty_dev)
- return;
- memset(tty_dev, 0x00, sizeof(*tty_dev));
-
- tty_dev->class_dev.dev = device;
- tty_dev->class_dev.class = &tty_class;
- snprintf(tty_dev->class_dev.class_id, BUS_ID_SIZE, "%s", name);
- 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->dev = dev;
- spin_lock(&tty_dev_list_lock);
- list_add(&tty_dev->node, &tty_dev_list);
- spin_unlock(&tty_dev_list_lock);
- return;
-error:
- kfree(tty_dev);
-}
-
-static void tty_remove_class_device(dev_t dev)
-{
- struct tty_dev *tty_dev = NULL;
- struct list_head *tmp;
- int found = 0;
-
- spin_lock(&tty_dev_list_lock);
- list_for_each (tmp, &tty_dev_list) {
- tty_dev = list_entry(tmp, struct tty_dev, node);
- if (tty_dev->dev == dev) {
- list_del(&tty_dev->node);
- found = 1;
- break;
- }
- }
- spin_unlock(&tty_dev_list_lock);
- if (found)
- class_device_unregister(&tty_dev->class_dev);
-}
+static struct class_simple *tty_class;
/**
* tty_register_device - register a tty device
@@ -2174,7 +2102,7 @@
if (driver->type != TTY_DRIVER_TYPE_PTY) {
char name[64];
tty_line_name(driver, index, name);
- tty_add_class_device(name, dev, device);
+ class_simple_device_add(tty_class, dev, device, name);
}
}
@@ -2189,7 +2117,7 @@
void tty_unregister_device(struct tty_driver *driver, unsigned index)
{
devfs_remove("%s%d", driver->devfs_name, index + driver->name_base);
- tty_remove_class_device(MKDEV(driver->major, driver->minor_start) + index);
+ class_simple_device_remove(MKDEV(driver->major, driver->minor_start) + index);
}
EXPORT_SYMBOL(tty_register_device);
@@ -2406,7 +2334,10 @@
static int __init tty_class_init(void)
{
- return class_register(&tty_class);
+ tty_class = class_simple_create(THIS_MODULE, "tty");
+ if (IS_ERR(tty_class))
+ return PTR_ERR(tty_class);
+ return 0;
}
postcore_initcall(tty_class_init);
@@ -2431,7 +2362,7 @@
register_chrdev_region(MKDEV(TTYAUX_MAJOR, 0), 1, "/dev/tty") < 0)
panic("Couldn't register /dev/tty driver\n");
devfs_mk_cdev(MKDEV(TTYAUX_MAJOR, 0), S_IFCHR|S_IRUGO|S_IWUGO, "tty");
- tty_add_class_device ("tty", MKDEV(TTYAUX_MAJOR, 0), NULL);
+ class_simple_device_add(tty_class, MKDEV(TTYAUX_MAJOR, 0), NULL, "tty");
strcpy(console_cdev.kobj.name, "dev.console");
cdev_init(&console_cdev, &console_fops);
@@ -2439,7 +2370,7 @@
register_chrdev_region(MKDEV(TTYAUX_MAJOR, 1), 1, "/dev/console") < 0)
panic("Couldn't register /dev/console driver\n");
devfs_mk_cdev(MKDEV(TTYAUX_MAJOR, 1), S_IFCHR|S_IRUSR|S_IWUSR, "console");
- tty_add_class_device ("console", MKDEV(TTYAUX_MAJOR, 1), NULL);
+ class_simple_device_add(tty_class, MKDEV(TTYAUX_MAJOR, 1), NULL, "console");
tty_kobj.kset = tty_cdev.kobj.kset;
kobject_register(&tty_kobj);
@@ -2451,7 +2382,7 @@
register_chrdev_region(MKDEV(TTYAUX_MAJOR, 2), 1, "/dev/ptmx") < 0)
panic("Couldn't register /dev/ptmx driver\n");
devfs_mk_cdev(MKDEV(TTYAUX_MAJOR, 2), S_IFCHR|S_IRUGO|S_IWUGO, "ptmx");
- tty_add_class_device ("ptmx", MKDEV(TTYAUX_MAJOR, 2), NULL);
+ class_simple_device_add(tty_class, MKDEV(TTYAUX_MAJOR, 2), NULL, "ptmx");
#endif
#ifdef CONFIG_VT
@@ -2461,7 +2392,7 @@
register_chrdev_region(MKDEV(TTY_MAJOR, 0), 1, "/dev/vc/0") < 0)
panic("Couldn't register /dev/tty0 driver\n");
devfs_mk_cdev(MKDEV(TTY_MAJOR, 0), S_IFCHR|S_IRUSR|S_IWUSR, "vc/0");
- tty_add_class_device ("tty0", MKDEV(TTY_MAJOR, 0), NULL);
+ class_simple_device_add(tty_class, MKDEV(TTY_MAJOR, 0), NULL, "tty0");
vty_init();
#endif
ChangeSet 1.1499, 2004/01/19 16:38:36-08:00, [email protected]
[PATCH] Input: add sysfs class support for input devices
This patch adds sysfs support for all input devices. It also provides
the "device" and "driver" symlink for all Input devices that specify it.
drivers/input/evdev.c | 4 ++++
drivers/input/input.c | 8 +++-----
drivers/input/joydev.c | 4 ++++
drivers/input/mousedev.c | 8 +++++++-
drivers/input/tsdev.c | 4 ++++
include/linux/input.h | 3 ++-
6 files changed, 24 insertions(+), 7 deletions(-)
diff -Nru a/drivers/input/evdev.c b/drivers/input/evdev.c
--- a/drivers/input/evdev.c Mon Jan 19 17:05:06 2004
+++ b/drivers/input/evdev.c Mon Jan 19 17:05:06 2004
@@ -92,6 +92,7 @@
static void evdev_free(struct evdev *evdev)
{
devfs_remove("input/event%d", evdev->minor);
+ class_simple_device_remove(MKDEV(INPUT_MAJOR, EVDEV_MINOR_BASE + evdev->minor));
evdev_table[evdev->minor] = NULL;
kfree(evdev);
}
@@ -426,6 +427,9 @@
devfs_mk_cdev(MKDEV(INPUT_MAJOR, EVDEV_MINOR_BASE + minor),
S_IFCHR|S_IRUGO|S_IWUSR, "input/event%d", minor);
+ class_simple_device_add(input_class,
+ MKDEV(INPUT_MAJOR, EVDEV_MINOR_BASE + minor),
+ dev->dev, "event%d", minor);
return &evdev->handle;
}
diff -Nru a/drivers/input/input.c b/drivers/input/input.c
--- a/drivers/input/input.c Mon Jan 19 17:05:06 2004
+++ b/drivers/input/input.c Mon Jan 19 17:05:06 2004
@@ -720,15 +720,13 @@
static inline int input_proc_init(void) { return 0; }
#endif
-struct class input_class = {
- .name = "input",
-};
+struct class_simple *input_class;
static int __init input_init(void)
{
int retval = -ENOMEM;
- class_register(&input_class);
+ input_class = class_simple_create(THIS_MODULE, "input");
input_proc_init();
retval = register_chrdev(INPUT_MAJOR, "input", &input_fops);
if (retval) {
@@ -757,7 +755,7 @@
devfs_remove("input");
unregister_chrdev(INPUT_MAJOR, "input");
- class_unregister(&input_class);
+ class_simple_destroy(input_class);
}
subsys_initcall(input_init);
diff -Nru a/drivers/input/joydev.c b/drivers/input/joydev.c
--- a/drivers/input/joydev.c Mon Jan 19 17:05:06 2004
+++ b/drivers/input/joydev.c Mon Jan 19 17:05:06 2004
@@ -145,6 +145,7 @@
{
devfs_remove("js%d", joydev->minor);
joydev_table[joydev->minor] = NULL;
+ class_simple_device_remove(MKDEV(INPUT_MAJOR, JOYDEV_MINOR_BASE + joydev->minor));
kfree(joydev);
}
@@ -444,6 +445,9 @@
devfs_mk_cdev(MKDEV(INPUT_MAJOR, JOYDEV_MINOR_BASE + minor),
S_IFCHR|S_IRUGO|S_IWUSR, "js%d", minor);
+ class_simple_device_add(input_class,
+ MKDEV(INPUT_MAJOR, JOYDEV_MINOR_BASE + minor),
+ dev->dev, "js%d", minor);
return &joydev->handle;
}
diff -Nru a/drivers/input/mousedev.c b/drivers/input/mousedev.c
--- a/drivers/input/mousedev.c Mon Jan 19 17:05:06 2004
+++ b/drivers/input/mousedev.c Mon Jan 19 17:05:06 2004
@@ -225,6 +225,7 @@
static void mousedev_free(struct mousedev *mousedev)
{
devfs_remove("input/mouse%d", mousedev->minor);
+ class_simple_device_remove(MKDEV(INPUT_MAJOR, MOUSEDEV_MINOR_BASE + mousedev->minor));
mousedev_table[mousedev->minor] = NULL;
kfree(mousedev);
}
@@ -486,6 +487,9 @@
devfs_mk_cdev(MKDEV(INPUT_MAJOR, MOUSEDEV_MINOR_BASE + minor),
S_IFCHR|S_IRUGO|S_IWUSR, "input/mouse%d", minor);
+ class_simple_device_add(input_class,
+ MKDEV(INPUT_MAJOR, MOUSEDEV_MINOR_BASE + minor),
+ dev->dev, "mouse%d", minor);
return &mousedev->handle;
}
@@ -564,7 +568,8 @@
devfs_mk_cdev(MKDEV(INPUT_MAJOR, MOUSEDEV_MINOR_BASE + MOUSEDEV_MIX),
S_IFCHR|S_IRUGO|S_IWUSR, "input/mice");
-
+ class_simple_device_add(input_class, MKDEV(INPUT_MAJOR, MOUSEDEV_MINOR_BASE + MOUSEDEV_MIX),
+ NULL, "mice");
#ifdef CONFIG_INPUT_MOUSEDEV_PSAUX
if (!(mousedev_mix.misc = !misc_register(&psaux_mouse)))
@@ -583,6 +588,7 @@
misc_deregister(&psaux_mouse);
#endif
devfs_remove("input/mice");
+ class_simple_device_remove(MKDEV(INPUT_MAJOR, MOUSEDEV_MINOR_BASE + MOUSEDEV_MIX));
input_unregister_handler(&mousedev_handler);
}
diff -Nru a/drivers/input/tsdev.c b/drivers/input/tsdev.c
--- a/drivers/input/tsdev.c Mon Jan 19 17:05:06 2004
+++ b/drivers/input/tsdev.c Mon Jan 19 17:05:06 2004
@@ -129,6 +129,7 @@
static void tsdev_free(struct tsdev *tsdev)
{
devfs_remove("input/ts%d", tsdev->minor);
+ class_simple_device_remove(MKDEV(INPUT_MAJOR, TSDEV_MINOR_BASE + tsdev->minor));
tsdev_table[tsdev->minor] = NULL;
kfree(tsdev);
}
@@ -343,6 +344,9 @@
devfs_mk_cdev(MKDEV(INPUT_MAJOR, TSDEV_MINOR_BASE + minor),
S_IFCHR|S_IRUGO|S_IWUSR, "input/ts%d", minor);
+ class_simple_device_add(input_class,
+ MKDEV(INPUT_MAJOR, TSDEV_MINOR_BASE + minor),
+ dev->dev, "ts%d", minor);
return &tsdev->handle;
}
diff -Nru a/include/linux/input.h b/include/linux/input.h
--- a/include/linux/input.h Mon Jan 19 17:05:06 2004
+++ b/include/linux/input.h Mon Jan 19 17:05:06 2004
@@ -809,6 +809,7 @@
int (*erase_effect)(struct input_dev *dev, int effect_id);
struct input_handle *grab;
+ struct device *dev;
struct list_head h_list;
struct list_head node;
@@ -921,7 +922,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 class input_class;
+extern struct class_simple *input_class;
#endif
#endif
ChangeSet 1.1505, 2004/01/19 16:57:07-08:00, [email protected]
[PATCH] Kobject: prevent oops in kset_find_obj() if kobject_name() is NULL
Thanks to Hollis Blanchard <[email protected]> for pointing this out.
lib/kobject.c | 2 +-
1 files changed, 1 insertion(+), 1 deletion(-)
diff -Nru a/lib/kobject.c b/lib/kobject.c
--- a/lib/kobject.c Mon Jan 19 17:04:40 2004
+++ b/lib/kobject.c Mon Jan 19 17:04:40 2004
@@ -547,7 +547,7 @@
down_read(&kset->subsys->rwsem);
list_for_each(entry,&kset->list) {
struct kobject * k = to_kobj(entry);
- if (!strcmp(kobject_name(k),name)) {
+ if (kobject_name(k) && (!strcmp(kobject_name(k),name))) {
ret = k;
break;
}
ChangeSet 1.1500, 2004/01/19 16:39:52-08:00, [email protected]
[PATCH] LP: add sysfs class support for lp devices
Add sysfs class support for lp devices.
Based on a patch from Hanna Linder <[email protected]>
drivers/char/lp.c | 6 ++++++
1 files changed, 6 insertions(+)
diff -Nru a/drivers/char/lp.c b/drivers/char/lp.c
--- a/drivers/char/lp.c Mon Jan 19 17:05:01 2004
+++ b/drivers/char/lp.c Mon Jan 19 17:05:01 2004
@@ -145,6 +145,7 @@
struct lp_struct lp_table[LP_NO];
static unsigned int lp_count = 0;
+static struct class_simple *lp_class;
#ifdef CONFIG_LP_CONSOLE
static struct parport *console_registered; // initially NULL
@@ -795,6 +796,8 @@
if (reset)
lp_reset(nr);
+ class_simple_device_add(lp_class, MKDEV(LP_MAJOR, nr), NULL,
+ "lp%d", nr);
devfs_mk_cdev(MKDEV(LP_MAJOR, nr), S_IFCHR | S_IRUGO | S_IWUGO,
"printers/%d", nr);
@@ -897,6 +900,7 @@
}
devfs_mk_dir("printers");
+ lp_class = class_simple_create(THIS_MODULE, "printer");
if (parport_register_driver (&lp_driver)) {
printk (KERN_ERR "lp: unable to register with parport\n");
@@ -958,8 +962,10 @@
continue;
parport_unregister_device(lp_table[offset].dev);
devfs_remove("printers/%d", offset);
+ class_simple_device_remove(MKDEV(LP_MAJOR, offset));
}
devfs_remove("printers");
+ class_simple_destroy(lp_class);
}
__setup("lp=", lp_setup);
ChangeSet 1.1496, 2004/01/19 16:31:36-08:00, [email protected]
[PATCH] Driver Core: add device_find() function
Greg KH wrote:
>
> How about just adding a device_find() function to the driver core, where
> you pass in a name and a type, so that others can use it?
Something like this?
drivers/base/core.c | 9 +++++++++
include/linux/device.h | 1 +
2 files changed, 10 insertions(+)
diff -Nru a/drivers/base/core.c b/drivers/base/core.c
--- a/drivers/base/core.c Mon Jan 19 17:05:19 2004
+++ b/drivers/base/core.c Mon Jan 19 17:05:19 2004
@@ -400,6 +400,14 @@
return error;
}
+struct device *device_find(const char *name, struct bus_type *bus)
+{
+ struct kobject *k = kset_find_obj(&bus->devices, name);
+ if (k)
+ return to_dev(k);
+ return NULL;
+}
+
int __init devices_init(void)
{
return subsystem_register(&devices_subsys);
@@ -416,6 +424,7 @@
EXPORT_SYMBOL(device_unregister_wait);
EXPORT_SYMBOL(get_device);
EXPORT_SYMBOL(put_device);
+EXPORT_SYMBOL(device_find);
EXPORT_SYMBOL(device_create_file);
EXPORT_SYMBOL(device_remove_file);
diff -Nru a/include/linux/device.h b/include/linux/device.h
--- a/include/linux/device.h Mon Jan 19 17:05:19 2004
+++ b/include/linux/device.h Mon Jan 19 17:05:19 2004
@@ -354,6 +354,7 @@
*/
extern struct device * get_device(struct device * dev);
extern void put_device(struct device * dev);
+extern struct device *device_find(const char *name, struct bus_type *bus);
/* drivers/base/platform.c */
ChangeSet 1.1503, 2004/01/19 16:45:11-08:00, [email protected]
[PATCH] OSS: add sysfs class support for OSS sound devices
This patch adds support for all OSS sound devices.
This patch is based on a work originally written by
Leann Ogasawara <[email protected]>
sound/oss/soundcard.c | 13 ++++++++++++-
sound/sound_core.c | 10 ++++++++++
2 files changed, 22 insertions(+), 1 deletion(-)
diff -Nru a/sound/oss/soundcard.c b/sound/oss/soundcard.c
--- a/sound/oss/soundcard.c Mon Jan 19 17:04:49 2004
+++ b/sound/oss/soundcard.c Mon Jan 19 17:04:49 2004
@@ -73,6 +73,7 @@
unsigned long seq_time = 0; /* Time for /dev/sequencer */
+extern struct class_simple *sound_class;
/*
* Table for configurable mixer volume handling
@@ -569,6 +570,9 @@
devfs_mk_cdev(MKDEV(SOUND_MAJOR, dev_list[i].minor),
S_IFCHR | dev_list[i].mode,
"sound/%s", dev_list[i].name);
+ class_simple_device_add(sound_class,
+ MKDEV(SOUND_MAJOR, dev_list[i].minor),
+ NULL, "%s", dev_list[i].name);
if (!dev_list[i].num)
continue;
@@ -578,6 +582,10 @@
dev_list[i].minor + (j*0x10)),
S_IFCHR | dev_list[i].mode,
"sound/%s%d", dev_list[i].name, j);
+ class_simple_device_add(sound_class,
+ MKDEV(SOUND_MAJOR, dev_list[i].minor + (j*0x10)),
+ NULL,
+ "%s%d", dev_list[i].name, j);
}
}
@@ -593,10 +601,13 @@
for (i = 0; i < sizeof (dev_list) / sizeof *dev_list; i++) {
devfs_remove("sound/%s", dev_list[i].name);
+ class_simple_device_remove(MKDEV(SOUND_MAJOR, dev_list[i].minor));
if (!dev_list[i].num)
continue;
- for (j = 1; j < *dev_list[i].num; j++)
+ for (j = 1; j < *dev_list[i].num; j++) {
devfs_remove("sound/%s%d", dev_list[i].name, j);
+ class_simple_device_remove(MKDEV(SOUND_MAJOR, dev_list[i].minor + (j*0x10)));
+ }
}
unregister_sound_special(1);
diff -Nru a/sound/sound_core.c b/sound/sound_core.c
--- a/sound/sound_core.c Mon Jan 19 17:04:49 2004
+++ b/sound/sound_core.c Mon Jan 19 17:04:49 2004
@@ -65,6 +65,9 @@
extern int msnd_pinnacle_init(void);
#endif
+struct class_simple *sound_class;
+EXPORT_SYMBOL(sound_class);
+
/*
* Low level list operator. Scan the ordered list, find a hole and
* join into it. Called with the lock asserted
@@ -171,6 +174,8 @@
devfs_mk_cdev(MKDEV(SOUND_MAJOR, s->unit_minor),
S_IFCHR | mode, s->name);
+ class_simple_device_add(sound_class, MKDEV(SOUND_MAJOR, s->unit_minor),
+ NULL, s->name+6);
return r;
fail:
@@ -193,6 +198,7 @@
spin_unlock(&sound_loader_lock);
if (p) {
devfs_remove(p->name);
+ class_simple_device_remove(MKDEV(SOUND_MAJOR, p->unit_minor));
kfree(p);
}
}
@@ -556,6 +562,7 @@
empty */
unregister_chrdev(SOUND_MAJOR, "sound");
devfs_remove("sound");
+ class_simple_destroy(sound_class);
}
static int __init init_soundcore(void)
@@ -565,6 +572,9 @@
return -EBUSY;
}
devfs_mk_dir ("sound");
+ sound_class = class_simple_create(THIS_MODULE, "sound");
+ if (IS_ERR(sound_class))
+ return PTR_ERR(sound_class);
return 0;
}
ChangeSet 1.1497, 2004/01/19 16:33:14-08:00, [email protected]
[PATCH] Driver Core: add class_simple support
This patch adds a struct class_simple which can be used to create
"simple" class support for subsystems.
It also adds a class_release() callback for struct class, as it is
needed to properly handle the reference counting logic.
drivers/base/Makefile | 2
drivers/base/class.c | 14 +++
drivers/base/class_simple.c | 201 ++++++++++++++++++++++++++++++++++++++++++++
include/linux/device.h | 9 +
4 files changed, 225 insertions(+), 1 deletion(-)
diff -Nru a/drivers/base/Makefile b/drivers/base/Makefile
--- a/drivers/base/Makefile Mon Jan 19 17:05:14 2004
+++ b/drivers/base/Makefile Mon Jan 19 17:05:14 2004
@@ -1,7 +1,7 @@
# Makefile for the Linux device tree
obj-y := core.o sys.o interface.o bus.o \
- driver.o class.o platform.o \
+ driver.o class.o class_simple.o platform.o \
cpu.o firmware.o init.o map.o
obj-y += power/
obj-$(CONFIG_FW_LOADER) += firmware_class.o
diff -Nru a/drivers/base/class.c b/drivers/base/class.c
--- a/drivers/base/class.c Mon Jan 19 17:05:14 2004
+++ b/drivers/base/class.c Mon Jan 19 17:05:14 2004
@@ -46,6 +46,19 @@
return ret;
}
+static void class_release(struct kobject * kobj)
+{
+ struct class *class = to_class(kobj);
+
+ pr_debug("class '%s': release.\n", class->name);
+
+ if (class->class_release)
+ class->class_release(class);
+ else
+ pr_debug("class '%s' does not have a release() function, "
+ "be careful\n", class->name);
+}
+
static struct sysfs_ops class_sysfs_ops = {
.show = class_attr_show,
.store = class_attr_store,
@@ -53,6 +66,7 @@
static struct kobj_type ktype_class = {
.sysfs_ops = &class_sysfs_ops,
+ .release = class_release,
};
/* Hotplug events for classes go to the class_obj subsys */
diff -Nru a/drivers/base/class_simple.c b/drivers/base/class_simple.c
--- /dev/null Wed Dec 31 16:00:00 1969
+++ b/drivers/base/class_simple.c Mon Jan 19 17:05:14 2004
@@ -0,0 +1,201 @@
+/*
+ * class_simple.c - a "simple" interface for classes for simple char devices.
+ *
+ * Copyright (c) 2003-2004 Greg Kroah-Hartman <[email protected]>
+ * Copyright (c) 2003-2004 IBM Corp.
+ *
+ * This file is released under the GPLv2
+ *
+ */
+
+#define DEBUG 1
+
+#include <linux/device.h>
+#include <linux/kdev_t.h>
+#include <linux/err.h>
+
+struct class_simple {
+ struct class_device_attribute attr;
+ struct class class;
+};
+#define to_class_simple(d) container_of(d, struct class_simple, class)
+
+struct simple_dev {
+ struct list_head node;
+ dev_t dev;
+ struct class_device class_dev;
+};
+#define to_simple_dev(d) container_of(d, struct simple_dev, class_dev)
+
+static LIST_HEAD(simple_dev_list);
+static spinlock_t simple_dev_list_lock = SPIN_LOCK_UNLOCKED;
+
+static void release_simple_dev(struct class_device *class_dev)
+{
+ struct simple_dev *s_dev = to_simple_dev(class_dev);
+ kfree(s_dev);
+}
+
+static ssize_t show_dev(struct class_device *class_dev, char *buf)
+{
+ struct simple_dev *s_dev = to_simple_dev(class_dev);
+ return print_dev_t(buf, s_dev->dev);
+}
+
+static void class_simple_release(struct class *class)
+{
+ struct class_simple *cs = to_class_simple(class);
+ kfree(cs);
+}
+
+/**
+ * class_simple_create - create a struct class_simple structure
+ * @owner: pointer to the module that is to "own" this struct class_simple
+ * @name: pointer to a string for the name of this class.
+ *
+ * This is used to create a struct class_simple pointer that can then be used
+ * in calls to class_simple_device_add(). This is used when you do not wish to
+ * create a full blown class support for a type of char devices.
+ *
+ * Note, the pointer created here is to be destroyed when finished by making a
+ * call to class_simple_destroy().
+ */
+struct class_simple *class_simple_create(struct module *owner, char *name)
+{
+ struct class_simple *cs;
+ int retval;
+
+ cs = kmalloc(sizeof(*cs), GFP_KERNEL);
+ if (!cs) {
+ retval = -ENOMEM;
+ goto error;
+ }
+ memset(cs, 0x00, sizeof(*cs));
+
+ cs->class.name = name;
+ cs->class.class_release = class_simple_release;
+ cs->class.release = release_simple_dev;
+
+ cs->attr.attr.name = "dev";
+ cs->attr.attr.mode = S_IRUGO;
+ cs->attr.attr.owner = owner;
+ cs->attr.show = show_dev;
+ cs->attr.store = NULL;
+
+ retval = class_register(&cs->class);
+ if (retval)
+ goto error;
+
+ return cs;
+
+error:
+ kfree(cs);
+ return ERR_PTR(retval);
+}
+EXPORT_SYMBOL(class_simple_create);
+
+/**
+ * class_simple_destroy - destroys a struct class_simple structure
+ * @cs: pointer to the struct class_simple that is to be destroyed
+ *
+ * Note, the pointer to be destroyed must have been created with a call to
+ * class_simple_create().
+ */
+void class_simple_destroy(struct class_simple *cs)
+{
+ if ((cs == NULL) || (IS_ERR(cs)))
+ return;
+
+ class_unregister(&cs->class);
+}
+EXPORT_SYMBOL(class_simple_destroy);
+
+/**
+ * class_simple_device_add - adds a class device to sysfs for a character driver
+ * @cs: pointer to the struct class_simple that this device should be registered to.
+ * @dev: the dev_t for the device to be added.
+ * @device: a pointer to a struct device that is assiociated with this class device.
+ * @fmt: string for the class device's name
+ *
+ * This function can be used by simple char device classes that do not
+ * implement their own class device registration. A struct class_device will
+ * be created in sysfs, registered to the specified class. A "dev" file will
+ * be created, showing the dev_t for the device. The pointer to the struct
+ * class_device will be returned from the call. Any further sysfs files that
+ * might be required can be created using this pointer.
+ * Note: the struct class_device passed to this function must have previously been
+ * created with a call to class_simple_create().
+ */
+struct class_device *class_simple_device_add(struct class_simple *cs, dev_t dev, struct device *device, const char *fmt, ...)
+{
+ va_list args;
+ struct simple_dev *s_dev = NULL;
+ int retval;
+
+ if ((cs == NULL) || (IS_ERR(cs))) {
+ retval = -ENODEV;
+ goto error;
+ }
+
+ s_dev = kmalloc(sizeof(*s_dev), GFP_KERNEL);
+ if (!s_dev) {
+ retval = -ENOMEM;
+ goto error;
+ }
+ memset(s_dev, 0x00, sizeof(*s_dev));
+
+ s_dev->dev = dev;
+ s_dev->class_dev.dev = device;
+ s_dev->class_dev.class = &cs->class;
+
+ va_start(args,fmt);
+ vsnprintf(s_dev->class_dev.class_id, BUS_ID_SIZE, fmt, args);
+ va_end(args);
+ retval = class_device_register(&s_dev->class_dev);
+ if (retval)
+ goto error;
+
+ class_device_create_file(&s_dev->class_dev, &cs->attr);
+
+ spin_lock(&simple_dev_list_lock);
+ list_add(&s_dev->node, &simple_dev_list);
+ spin_unlock(&simple_dev_list_lock);
+
+ return &s_dev->class_dev;
+
+error:
+ kfree(s_dev);
+ return ERR_PTR(retval);
+}
+EXPORT_SYMBOL(class_simple_device_add);
+
+/**
+ * class_simple_device_remove - removes a class device that was created with class_simple_device_add()
+ * @dev: the dev_t of the device that was previously registered.
+ *
+ * This call unregisters and cleans up a class device that was created with a
+ * call to class_device_simple_add()
+ */
+void class_simple_device_remove(dev_t dev)
+{
+ struct simple_dev *s_dev = NULL;
+ struct list_head *tmp;
+ int found = 0;
+
+ spin_lock(&simple_dev_list_lock);
+ list_for_each(tmp, &simple_dev_list) {
+ s_dev = list_entry(tmp, struct simple_dev, node);
+ if (s_dev->dev == dev) {
+ found = 1;
+ break;
+ }
+ }
+ if (found) {
+ list_del(&s_dev->node);
+ spin_unlock(&simple_dev_list_lock);
+ class_device_unregister(&s_dev->class_dev);
+ } else {
+ spin_unlock(&simple_dev_list_lock);
+ }
+}
+EXPORT_SYMBOL(class_simple_device_remove);
diff -Nru a/include/linux/device.h b/include/linux/device.h
--- a/include/linux/device.h Mon Jan 19 17:05:14 2004
+++ b/include/linux/device.h Mon Jan 19 17:05:14 2004
@@ -46,6 +46,7 @@
struct device_driver;
struct class;
struct class_device;
+struct class_simple;
struct bus_type {
char * name;
@@ -155,6 +156,7 @@
int num_envp, char *buffer, int buffer_size);
void (*release)(struct class_device *dev);
+ void (*class_release)(struct class *class);
};
extern int class_register(struct class *);
@@ -245,6 +247,13 @@
extern int class_interface_register(struct class_interface *);
extern void class_interface_unregister(struct class_interface *);
+
+/* interface for class simple stuff */
+extern struct class_simple *class_simple_create(struct module *owner, char *name);
+extern void class_simple_destroy(struct class_simple *cs);
+extern struct class_device *class_simple_device_add(struct class_simple *cs, dev_t dev, struct device *device, const char *fmt, ...)
+ __attribute__((format(printf,4,5)));
+extern void class_simple_device_remove(dev_t dev);
struct device {
ChangeSet 1.1502, 2004/01/19 16:41:53-08:00, [email protected]
[PATCH] MISC: add sysfs class support for misc devices
This adds class/misc/ for all misc devices (ones that use the
misc_register() function).
drivers/char/misc.c | 17 +++++++++++++++--
include/linux/miscdevice.h | 3 +++
2 files changed, 18 insertions(+), 2 deletions(-)
diff -Nru a/drivers/char/misc.c b/drivers/char/misc.c
--- a/drivers/char/misc.c Mon Jan 19 17:04:53 2004
+++ b/drivers/char/misc.c Mon Jan 19 17:04:53 2004
@@ -47,7 +47,7 @@
#include <linux/devfs_fs_kernel.h>
#include <linux/stat.h>
#include <linux/init.h>
-
+#include <linux/device.h>
#include <linux/tty.h>
#include <linux/kmod.h>
@@ -180,6 +180,13 @@
return err;
}
+/*
+ * TODO for 2.7:
+ * - add a struct class_device to struct miscdevice and make all usages of
+ * them dynamic.
+ */
+static struct class_simple *misc_class;
+
static struct file_operations misc_fops = {
.owner = THIS_MODULE,
.open = misc_open,
@@ -234,6 +241,8 @@
"misc/%s", misc->name);
}
+ class_simple_device_add(misc_class, MKDEV(MISC_MAJOR, misc->minor),
+ misc->dev, misc->name);
devfs_mk_cdev(MKDEV(MISC_MAJOR, misc->minor),
S_IFCHR|S_IRUSR|S_IWUSR|S_IRGRP, misc->devfs_name);
@@ -265,6 +274,7 @@
down(&misc_sem);
list_del(&misc->list);
+ class_simple_device_remove(MKDEV(MISC_MAJOR, misc->minor));
devfs_remove(misc->devfs_name);
if (i < DYNAMIC_MINORS && i>0) {
misc_minors[i>>3] &= ~(1 << (misc->minor & 7));
@@ -285,6 +295,9 @@
if (ent)
ent->proc_fops = &misc_proc_fops;
#endif
+ misc_class = class_simple_create(THIS_MODULE, "misc");
+ if (IS_ERR(misc_class))
+ return PTR_ERR(misc_class);
#ifdef CONFIG_MVME16x
rtc_MK48T08_init();
#endif
@@ -319,4 +332,4 @@
}
return 0;
}
-module_init(misc_init);
+subsys_initcall(misc_init);
diff -Nru a/include/linux/miscdevice.h b/include/linux/miscdevice.h
--- a/include/linux/miscdevice.h Mon Jan 19 17:04:53 2004
+++ b/include/linux/miscdevice.h Mon Jan 19 17:04:53 2004
@@ -36,12 +36,15 @@
#define TUN_MINOR 200
+struct device;
+
struct miscdevice
{
int minor;
const char *name;
struct file_operations *fops;
struct list_head list;
+ struct device *dev;
char devfs_name[64];
};
ChangeSet 1.1501, 2004/01/19 16:40:57-08:00, [email protected]
[PATCH] MEM: add sysfs class support for mem devices
This adds class/mem/ for all memory devices (random, raw, null, etc.)
drivers/char/mem.c | 7 +++++++
1 files changed, 7 insertions(+)
diff -Nru a/drivers/char/mem.c b/drivers/char/mem.c
--- a/drivers/char/mem.c Mon Jan 19 17:04:57 2004
+++ b/drivers/char/mem.c Mon Jan 19 17:04:57 2004
@@ -24,6 +24,7 @@
#include <linux/smp_lock.h>
#include <linux/devfs_fs_kernel.h>
#include <linux/ptrace.h>
+#include <linux/device.h>
#include <asm/uaccess.h>
#include <asm/io.h>
@@ -676,6 +677,8 @@
{11,"kmsg", S_IRUGO | S_IWUSR, &kmsg_fops},
};
+static struct class_simple *mem_class;
+
static int __init chr_dev_init(void)
{
int i;
@@ -683,7 +686,11 @@
if (register_chrdev(MEM_MAJOR,"mem",&memory_fops))
printk("unable to get major %d for memory devs\n", MEM_MAJOR);
+ mem_class = class_simple_create(THIS_MODULE, "mem");
for (i = 0; i < ARRAY_SIZE(devlist); i++) {
+ class_simple_device_add(mem_class,
+ MKDEV(MEM_MAJOR, devlist[i].minor),
+ NULL, devlist[i].name);
devfs_mk_cdev(MKDEV(MEM_MAJOR, devlist[i].minor),
S_IFCHR | devlist[i].mode, devlist[i].name);
}
Greg KH <[email protected]> writes:
> o ALSA: add sysfs class support for ALSA sound devices
This is still only completed for the intel8x0 driver, right?
--
M?ns Rullg?rd
[email protected]
On Tue, 20 Jan 2004 08:49:50 +0000, Måns Rullgård wrote:
> Greg KH <[email protected]> writes:
>
>> o ALSA: add sysfs class support for ALSA sound devices
>
> This is still only completed for the intel8x0 driver, right?
I have an maestro3 sound chip, and
/sys/class/sound/ contains device information for both
oss emulation and alsa devices.
Andreas
On Tue, Jan 20, 2004 at 09:40:22AM +0100, M?ns Rullg?rd wrote:
> Greg KH <[email protected]> writes:
>
> > o ALSA: add sysfs class support for ALSA sound devices
>
> This is still only completed for the intel8x0 driver, right?
The "device" and "driver" symlink will only show up for that driver,
yes. But the class support will work for all alsa devices. Now we can
add 1 line patches for all of the alsa drivers to enable those
symlinks...
thanks,
greg k-h
Greg KH <[email protected]> writes:
> On Tue, Jan 20, 2004 at 09:40:22AM +0100, M?ns Rullg?rd wrote:
>> Greg KH <[email protected]> writes:
>>
>> > o ALSA: add sysfs class support for ALSA sound devices
>>
>> This is still only completed for the intel8x0 driver, right?
>
> The "device" and "driver" symlink will only show up for that driver,
> yes. But the class support will work for all alsa devices. Now we can
> add 1 line patches for all of the alsa drivers to enable those
> symlinks...
I see.
BTW, I still don't get a snd/controlC0 in /udev. All the other ALSA
devices are there.
--
M?ns Rullg?rd
[email protected]
On Tue, Jan 20, 2004 at 06:48:50PM +0100, M?ns Rullg?rd wrote:
> Greg KH <[email protected]> writes:
>
> > On Tue, Jan 20, 2004 at 09:40:22AM +0100, M?ns Rullg?rd wrote:
> >> Greg KH <[email protected]> writes:
> >>
> >> > o ALSA: add sysfs class support for ALSA sound devices
> >>
> >> This is still only completed for the intel8x0 driver, right?
> >
> > The "device" and "driver" symlink will only show up for that driver,
> > yes. But the class support will work for all alsa devices. Now we can
> > add 1 line patches for all of the alsa drivers to enable those
> > symlinks...
>
> I see.
>
> BTW, I still don't get a snd/controlC0 in /udev. All the other ALSA
> devices are there.
Is there for me :)
What does /sys/class/sound show for you?
thanks,
greg k-h
Greg KH <[email protected]> writes:
> On Tue, Jan 20, 2004 at 06:48:50PM +0100, M?ns Rullg?rd wrote:
>> Greg KH <[email protected]> writes:
>>
>> > On Tue, Jan 20, 2004 at 09:40:22AM +0100, M?ns Rullg?rd wrote:
>> >> Greg KH <[email protected]> writes:
>> >>
>> >> > o ALSA: add sysfs class support for ALSA sound devices
>> >>
>> >> This is still only completed for the intel8x0 driver, right?
>> >
>> > The "device" and "driver" symlink will only show up for that driver,
>> > yes. But the class support will work for all alsa devices. Now we can
>> > add 1 line patches for all of the alsa drivers to enable those
>> > symlinks...
>>
>> I see.
>>
>> BTW, I still don't get a snd/controlC0 in /udev. All the other ALSA
>> devices are there.
>
> Is there for me :)
>
> What does /sys/class/sound show for you?
$ ls /sys/class/sound
pcmC0D0c pcmC0D0p pcmC0D1c timer
FWIW, I've updated my kernel to ALSA 1.0.1 and merged your patches.
--
M?ns Rullg?rd
[email protected]
On Wed, Jan 21, 2004 at 02:59:07AM +0100, M?ns Rullg?rd wrote:
> Greg KH <[email protected]> writes:
>
> > On Tue, Jan 20, 2004 at 06:48:50PM +0100, M?ns Rullg?rd wrote:
> >> Greg KH <[email protected]> writes:
> >>
> >> > On Tue, Jan 20, 2004 at 09:40:22AM +0100, M?ns Rullg?rd wrote:
> >> >> Greg KH <[email protected]> writes:
> >> >>
> >> >> > o ALSA: add sysfs class support for ALSA sound devices
> >> >>
> >> >> This is still only completed for the intel8x0 driver, right?
> >> >
> >> > The "device" and "driver" symlink will only show up for that driver,
> >> > yes. But the class support will work for all alsa devices. Now we can
> >> > add 1 line patches for all of the alsa drivers to enable those
> >> > symlinks...
> >>
> >> I see.
> >>
> >> BTW, I still don't get a snd/controlC0 in /udev. All the other ALSA
> >> devices are there.
> >
> > Is there for me :)
> >
> > What does /sys/class/sound show for you?
>
> $ ls /sys/class/sound
> pcmC0D0c pcmC0D0p pcmC0D1c timer
>
> FWIW, I've updated my kernel to ALSA 1.0.1 and merged your patches.
I don't know if any recent ALSA changes took away the controlC nodes,
but your sound/core/sound.c::alsa_sound_init() should have a line in it
that looks like:
class_simple_device_add(sound_class, MKDEV(major, controlnum<<5), NULL, "controlC%d", controlnum);
and that should always get called (make sure you took the stupid
#ifdef CONFIG_DEVFS around that for loop.)
I'm guessing you didn't merge quite right :)
thanks,
greg k-h
Greg KH <[email protected]> writes:
> On Wed, Jan 21, 2004 at 02:59:07AM +0100, M?ns Rullg?rd wrote:
>> Greg KH <[email protected]> writes:
>>
>> > On Tue, Jan 20, 2004 at 06:48:50PM +0100, M?ns Rullg?rd wrote:
>> >> Greg KH <[email protected]> writes:
>> >>
>> >> > On Tue, Jan 20, 2004 at 09:40:22AM +0100, M?ns Rullg?rd wrote:
>> >> >> Greg KH <[email protected]> writes:
>> >> >>
>> >> >> > o ALSA: add sysfs class support for ALSA sound devices
>> >> >>
>> >> >> This is still only completed for the intel8x0 driver, right?
>> >> >
>> >> > The "device" and "driver" symlink will only show up for that driver,
>> >> > yes. But the class support will work for all alsa devices. Now we can
>> >> > add 1 line patches for all of the alsa drivers to enable those
>> >> > symlinks...
>> >>
>> >> I see.
>> >>
>> >> BTW, I still don't get a snd/controlC0 in /udev. All the other ALSA
>> >> devices are there.
>> >
>> > Is there for me :)
>> >
>> > What does /sys/class/sound show for you?
>>
>> $ ls /sys/class/sound
>> pcmC0D0c pcmC0D0p pcmC0D1c timer
>>
>> FWIW, I've updated my kernel to ALSA 1.0.1 and merged your patches.
>
> I don't know if any recent ALSA changes took away the controlC nodes,
> but your sound/core/sound.c::alsa_sound_init() should have a line in it
> that looks like:
> class_simple_device_add(sound_class, MKDEV(major, controlnum<<5), NULL, "controlC%d", controlnum);
> and that should always get called (make sure you took the stupid
> #ifdef CONFIG_DEVFS around that for loop.)
>
> I'm guessing you didn't merge quite right :)
It seems like something did go wrong with my merge. I'm still trying
to get the hang of bitkeeper, so I'll blame it on the learning curve.
--
M?ns Rullg?rd
[email protected]