diff options
author | Takashi Iwai <tiwai@suse.de> | 2011-03-09 11:33:48 -0500 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2011-03-09 14:10:37 -0500 |
commit | 848669da3a92fa6ab815e0517af3294afb3ea928 (patch) | |
tree | ac00a24c870f08e069397c94d506ae263c0bd1c1 /sound/oss | |
parent | a2800300f28bd1814f3ba8cfd93ecb0b00c2dfe3 (diff) |
sound: Use sound_register_*() for additional OSS minor devices
Since OSS driver creates the device entries for /dev/audio* and
/dev/dspW* by itself without coping with sound_core, it leads to
conflicts with others and let sysfs spewing warnings.
This patch rewrites the registration part of OSS driver to use
the standard method also for additional minor devices.
Reported-by: Steven Rostedt <rostedt@goodmis.org> (with ktest.pl)
Tested-by: Steven Rostedt <rostedt@goodmis.org> (with ktest.pl)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/oss')
-rw-r--r-- | sound/oss/soundcard.c | 56 |
1 files changed, 20 insertions, 36 deletions
diff --git a/sound/oss/soundcard.c b/sound/oss/soundcard.c index fcb14a099822..7c7793a0eb25 100644 --- a/sound/oss/soundcard.c +++ b/sound/oss/soundcard.c | |||
@@ -526,31 +526,21 @@ bad: | |||
526 | } | 526 | } |
527 | 527 | ||
528 | 528 | ||
529 | /* These device names follow the official Linux device list, | ||
530 | * Documentation/devices.txt. Let us know if there are other | ||
531 | * common names we should support for compatibility. | ||
532 | * Only those devices not created by the generic code in sound_core.c are | ||
533 | * registered here. | ||
534 | */ | ||
535 | static const struct { | ||
536 | unsigned short minor; | ||
537 | char *name; | ||
538 | umode_t mode; | ||
539 | int *num; | ||
540 | } dev_list[] = { /* list of minor devices */ | ||
541 | /* seems to be some confusion here -- this device is not in the device list */ | ||
542 | {SND_DEV_DSP16, "dspW", S_IWUGO | S_IRUSR | S_IRGRP, | ||
543 | &num_audiodevs}, | ||
544 | {SND_DEV_AUDIO, "audio", S_IWUGO | S_IRUSR | S_IRGRP, | ||
545 | &num_audiodevs}, | ||
546 | }; | ||
547 | |||
548 | static int dmabuf; | 529 | static int dmabuf; |
549 | static int dmabug; | 530 | static int dmabug; |
550 | 531 | ||
551 | module_param(dmabuf, int, 0444); | 532 | module_param(dmabuf, int, 0444); |
552 | module_param(dmabug, int, 0444); | 533 | module_param(dmabug, int, 0444); |
553 | 534 | ||
535 | /* additional minors for compatibility */ | ||
536 | struct oss_minor_dev { | ||
537 | unsigned short minor; | ||
538 | unsigned int enabled; | ||
539 | } dev_list[] = { | ||
540 | { SND_DEV_DSP16 }, | ||
541 | { SND_DEV_AUDIO }, | ||
542 | }; | ||
543 | |||
554 | static int __init oss_init(void) | 544 | static int __init oss_init(void) |
555 | { | 545 | { |
556 | int err; | 546 | int err; |
@@ -571,18 +561,12 @@ static int __init oss_init(void) | |||
571 | sound_dmap_flag = (dmabuf > 0 ? 1 : 0); | 561 | sound_dmap_flag = (dmabuf > 0 ? 1 : 0); |
572 | 562 | ||
573 | for (i = 0; i < ARRAY_SIZE(dev_list); i++) { | 563 | for (i = 0; i < ARRAY_SIZE(dev_list); i++) { |
574 | device_create(sound_class, NULL, | 564 | j = 0; |
575 | MKDEV(SOUND_MAJOR, dev_list[i].minor), NULL, | 565 | do { |
576 | "%s", dev_list[i].name); | 566 | unsigned short minor = dev_list[i].minor + j * 0x10; |
577 | 567 | if (!register_sound_special(&oss_sound_fops, minor)) | |
578 | if (!dev_list[i].num) | 568 | dev_list[i].enabled = (1 << j); |
579 | continue; | 569 | } while (++j < num_audiodevs); |
580 | |||
581 | for (j = 1; j < *dev_list[i].num; j++) | ||
582 | device_create(sound_class, NULL, | ||
583 | MKDEV(SOUND_MAJOR, | ||
584 | dev_list[i].minor + (j*0x10)), | ||
585 | NULL, "%s%d", dev_list[i].name, j); | ||
586 | } | 570 | } |
587 | 571 | ||
588 | if (sound_nblocks >= MAX_MEM_BLOCKS - 1) | 572 | if (sound_nblocks >= MAX_MEM_BLOCKS - 1) |
@@ -596,11 +580,11 @@ static void __exit oss_cleanup(void) | |||
596 | int i, j; | 580 | int i, j; |
597 | 581 | ||
598 | for (i = 0; i < ARRAY_SIZE(dev_list); i++) { | 582 | for (i = 0; i < ARRAY_SIZE(dev_list); i++) { |
599 | device_destroy(sound_class, MKDEV(SOUND_MAJOR, dev_list[i].minor)); | 583 | j = 0; |
600 | if (!dev_list[i].num) | 584 | do { |
601 | continue; | 585 | if (dev_list[i].enabled & (1 << j)) |
602 | for (j = 1; j < *dev_list[i].num; j++) | 586 | unregister_sound_special(dev_list[i].minor); |
603 | device_destroy(sound_class, MKDEV(SOUND_MAJOR, dev_list[i].minor + (j*0x10))); | 587 | } while (++j < num_audiodevs); |
604 | } | 588 | } |
605 | 589 | ||
606 | unregister_sound_special(1); | 590 | unregister_sound_special(1); |