diff options
| -rw-r--r-- | include/linux/sound.h | 2 | ||||
| -rw-r--r-- | sound/core/sound_oss.c | 7 | ||||
| -rw-r--r-- | sound/sound_core.c | 27 |
3 files changed, 25 insertions, 11 deletions
diff --git a/include/linux/sound.h b/include/linux/sound.h index 428f59794f48..72b9af4c3fd4 100644 --- a/include/linux/sound.h +++ b/include/linux/sound.h | |||
| @@ -29,7 +29,9 @@ | |||
| 29 | * Sound core interface functions | 29 | * Sound core interface functions |
| 30 | */ | 30 | */ |
| 31 | 31 | ||
| 32 | struct device; | ||
| 32 | extern int register_sound_special(struct file_operations *fops, int unit); | 33 | extern int register_sound_special(struct file_operations *fops, int unit); |
| 34 | extern int register_sound_special_device(struct file_operations *fops, int unit, struct device *dev); | ||
| 33 | extern int register_sound_mixer(struct file_operations *fops, int dev); | 35 | extern int register_sound_mixer(struct file_operations *fops, int dev); |
| 34 | extern int register_sound_midi(struct file_operations *fops, int dev); | 36 | extern int register_sound_midi(struct file_operations *fops, int dev); |
| 35 | extern int register_sound_dsp(struct file_operations *fops, int dev); | 37 | extern int register_sound_dsp(struct file_operations *fops, int dev); |
diff --git a/sound/core/sound_oss.c b/sound/core/sound_oss.c index de39d212bc15..e401c6703297 100644 --- a/sound/core/sound_oss.c +++ b/sound/core/sound_oss.c | |||
| @@ -98,6 +98,7 @@ int snd_register_oss_device(int type, snd_card_t * card, int dev, snd_minor_t * | |||
| 98 | int cidx = SNDRV_MINOR_OSS_CARD(minor); | 98 | int cidx = SNDRV_MINOR_OSS_CARD(minor); |
| 99 | int track2 = -1; | 99 | int track2 = -1; |
| 100 | int register1 = -1, register2 = -1; | 100 | int register1 = -1, register2 = -1; |
| 101 | struct device *carddev = NULL; | ||
| 101 | 102 | ||
| 102 | if (minor < 0) | 103 | if (minor < 0) |
| 103 | return minor; | 104 | return minor; |
| @@ -121,11 +122,13 @@ int snd_register_oss_device(int type, snd_card_t * card, int dev, snd_minor_t * | |||
| 121 | track2 = SNDRV_MINOR_OSS(cidx, SNDRV_MINOR_OSS_DMMIDI1); | 122 | track2 = SNDRV_MINOR_OSS(cidx, SNDRV_MINOR_OSS_DMMIDI1); |
| 122 | break; | 123 | break; |
| 123 | } | 124 | } |
| 124 | register1 = register_sound_special(reg->f_ops, minor); | 125 | if (card) |
| 126 | carddev = card->dev; | ||
| 127 | register1 = register_sound_special_device(reg->f_ops, minor, carddev); | ||
| 125 | if (register1 != minor) | 128 | if (register1 != minor) |
| 126 | goto __end; | 129 | goto __end; |
| 127 | if (track2 >= 0) { | 130 | if (track2 >= 0) { |
| 128 | register2 = register_sound_special(reg->f_ops, track2); | 131 | register2 = register_sound_special_device(reg->f_ops, track2, carddev); |
| 129 | if (register2 != track2) | 132 | if (register2 != track2) |
| 130 | goto __end; | 133 | goto __end; |
| 131 | } | 134 | } |
diff --git a/sound/sound_core.c b/sound/sound_core.c index 21a69e096225..954f994592ab 100644 --- a/sound/sound_core.c +++ b/sound/sound_core.c | |||
| @@ -153,7 +153,7 @@ static DEFINE_SPINLOCK(sound_loader_lock); | |||
| 153 | * list. Acquires locks as needed | 153 | * list. Acquires locks as needed |
| 154 | */ | 154 | */ |
| 155 | 155 | ||
| 156 | static int sound_insert_unit(struct sound_unit **list, struct file_operations *fops, int index, int low, int top, const char *name, umode_t mode) | 156 | static int sound_insert_unit(struct sound_unit **list, struct file_operations *fops, int index, int low, int top, const char *name, umode_t mode, struct device *dev) |
| 157 | { | 157 | { |
| 158 | struct sound_unit *s = kmalloc(sizeof(*s), GFP_KERNEL); | 158 | struct sound_unit *s = kmalloc(sizeof(*s), GFP_KERNEL); |
| 159 | int r; | 159 | int r; |
| @@ -175,7 +175,7 @@ static int sound_insert_unit(struct sound_unit **list, struct file_operations *f | |||
| 175 | devfs_mk_cdev(MKDEV(SOUND_MAJOR, s->unit_minor), | 175 | devfs_mk_cdev(MKDEV(SOUND_MAJOR, s->unit_minor), |
| 176 | S_IFCHR | mode, s->name); | 176 | S_IFCHR | mode, s->name); |
| 177 | class_device_create(sound_class, MKDEV(SOUND_MAJOR, s->unit_minor), | 177 | class_device_create(sound_class, MKDEV(SOUND_MAJOR, s->unit_minor), |
| 178 | NULL, s->name+6); | 178 | dev, s->name+6); |
| 179 | return r; | 179 | return r; |
| 180 | 180 | ||
| 181 | fail: | 181 | fail: |
| @@ -227,16 +227,18 @@ static void sound_remove_unit(struct sound_unit **list, int unit) | |||
| 227 | static struct sound_unit *chains[SOUND_STEP]; | 227 | static struct sound_unit *chains[SOUND_STEP]; |
| 228 | 228 | ||
| 229 | /** | 229 | /** |
| 230 | * register_sound_special - register a special sound node | 230 | * register_sound_special_device - register a special sound node |
| 231 | * @fops: File operations for the driver | 231 | * @fops: File operations for the driver |
| 232 | * @unit: Unit number to allocate | 232 | * @unit: Unit number to allocate |
| 233 | * @dev: device pointer | ||
| 233 | * | 234 | * |
| 234 | * Allocate a special sound device by minor number from the sound | 235 | * Allocate a special sound device by minor number from the sound |
| 235 | * subsystem. The allocated number is returned on succes. On failure | 236 | * subsystem. The allocated number is returned on succes. On failure |
| 236 | * a negative error code is returned. | 237 | * a negative error code is returned. |
| 237 | */ | 238 | */ |
| 238 | 239 | ||
| 239 | int register_sound_special(struct file_operations *fops, int unit) | 240 | int register_sound_special_device(struct file_operations *fops, int unit, |
| 241 | struct device *dev) | ||
| 240 | { | 242 | { |
| 241 | const int chain = unit % SOUND_STEP; | 243 | const int chain = unit % SOUND_STEP; |
| 242 | int max_unit = 128 + chain; | 244 | int max_unit = 128 + chain; |
| @@ -294,9 +296,16 @@ int register_sound_special(struct file_operations *fops, int unit) | |||
| 294 | break; | 296 | break; |
| 295 | } | 297 | } |
| 296 | return sound_insert_unit(&chains[chain], fops, -1, unit, max_unit, | 298 | return sound_insert_unit(&chains[chain], fops, -1, unit, max_unit, |
| 297 | name, S_IRUSR | S_IWUSR); | 299 | name, S_IRUSR | S_IWUSR, dev); |
| 298 | } | 300 | } |
| 299 | 301 | ||
| 302 | EXPORT_SYMBOL(register_sound_special_device); | ||
| 303 | |||
| 304 | int register_sound_special(struct file_operations *fops, int unit) | ||
| 305 | { | ||
| 306 | return register_sound_special_device(fops, unit, NULL); | ||
| 307 | } | ||
| 308 | |||
| 300 | EXPORT_SYMBOL(register_sound_special); | 309 | EXPORT_SYMBOL(register_sound_special); |
| 301 | 310 | ||
| 302 | /** | 311 | /** |
| @@ -312,7 +321,7 @@ EXPORT_SYMBOL(register_sound_special); | |||
| 312 | int register_sound_mixer(struct file_operations *fops, int dev) | 321 | int register_sound_mixer(struct file_operations *fops, int dev) |
| 313 | { | 322 | { |
| 314 | return sound_insert_unit(&chains[0], fops, dev, 0, 128, | 323 | return sound_insert_unit(&chains[0], fops, dev, 0, 128, |
| 315 | "mixer", S_IRUSR | S_IWUSR); | 324 | "mixer", S_IRUSR | S_IWUSR, NULL); |
| 316 | } | 325 | } |
| 317 | 326 | ||
| 318 | EXPORT_SYMBOL(register_sound_mixer); | 327 | EXPORT_SYMBOL(register_sound_mixer); |
| @@ -330,7 +339,7 @@ EXPORT_SYMBOL(register_sound_mixer); | |||
| 330 | int register_sound_midi(struct file_operations *fops, int dev) | 339 | int register_sound_midi(struct file_operations *fops, int dev) |
| 331 | { | 340 | { |
| 332 | return sound_insert_unit(&chains[2], fops, dev, 2, 130, | 341 | return sound_insert_unit(&chains[2], fops, dev, 2, 130, |
| 333 | "midi", S_IRUSR | S_IWUSR); | 342 | "midi", S_IRUSR | S_IWUSR, NULL); |
| 334 | } | 343 | } |
| 335 | 344 | ||
| 336 | EXPORT_SYMBOL(register_sound_midi); | 345 | EXPORT_SYMBOL(register_sound_midi); |
| @@ -356,7 +365,7 @@ EXPORT_SYMBOL(register_sound_midi); | |||
| 356 | int register_sound_dsp(struct file_operations *fops, int dev) | 365 | int register_sound_dsp(struct file_operations *fops, int dev) |
| 357 | { | 366 | { |
| 358 | return sound_insert_unit(&chains[3], fops, dev, 3, 131, | 367 | return sound_insert_unit(&chains[3], fops, dev, 3, 131, |
| 359 | "dsp", S_IWUSR | S_IRUSR); | 368 | "dsp", S_IWUSR | S_IRUSR, NULL); |
| 360 | } | 369 | } |
| 361 | 370 | ||
| 362 | EXPORT_SYMBOL(register_sound_dsp); | 371 | EXPORT_SYMBOL(register_sound_dsp); |
| @@ -375,7 +384,7 @@ EXPORT_SYMBOL(register_sound_dsp); | |||
| 375 | int register_sound_synth(struct file_operations *fops, int dev) | 384 | int register_sound_synth(struct file_operations *fops, int dev) |
| 376 | { | 385 | { |
| 377 | return sound_insert_unit(&chains[9], fops, dev, 9, 137, | 386 | return sound_insert_unit(&chains[9], fops, dev, 9, 137, |
| 378 | "synth", S_IRUSR | S_IWUSR); | 387 | "synth", S_IRUSR | S_IWUSR, NULL); |
| 379 | } | 388 | } |
| 380 | 389 | ||
| 381 | EXPORT_SYMBOL(register_sound_synth); | 390 | EXPORT_SYMBOL(register_sound_synth); |
