[PATCH] locking fixes for OSS

From: Christoph Hellwig (hch@ns.lst.de)
Date: Fri Aug 11 2000 - 10:19:08 EST


Hi Linus,
this patch fixes the module races for the OSS code.
Yes, they look ugly, but they fix the module races and
IMHO the old sound locking was much uglier ...
It has been tested with sb16 and mpu401.

Please apply.

        Christoph

-- 
Always remember that you are unique.  Just like everyone else.

diff -uNr linux.orig/drivers/sound/aci.c linux/drivers/sound/aci.c --- linux.orig/drivers/sound/aci.c Wed Mar 8 20:37:03 2000 +++ linux/drivers/sound/aci.c Wed Aug 9 18:42:46 2000 @@ -537,10 +537,10 @@ static struct mixer_operations aci_mixer_operations = { - "ACI", - "ACI mixer", - aci_mixer_ioctl, - NULL + owner: THIS_MODULE, + id: "ACI", + name: "ACI mixer", + ioctl: aci_mixer_ioctl }; static unsigned char diff -uNr linux.orig/drivers/sound/ad1816.c linux/drivers/sound/ad1816.c --- linux.orig/drivers/sound/ad1816.c Mon Mar 27 20:41:51 2000 +++ linux/drivers/sound/ad1816.c Wed Aug 9 18:42:46 2000 @@ -36,7 +36,6 @@ #include <linux/isapnp.h> #include <linux/stddef.h> -#include "soundmodule.h" #include "sound_config.h" #define DEBUGNOISE(x) @@ -248,13 +247,6 @@ restore_flags (flags); } - -static int ad1816_ioctl (int dev, unsigned int cmd, caddr_t arg) -{ - return -(EINVAL); -} - - static int ad1816_prepare_for_input (int dev, int bsize, int bcount) { unsigned long flags; @@ -535,24 +527,20 @@ static struct audio_driver ad1816_audio_driver = { - ad1816_open, - ad1816_close, - ad1816_output_block, - ad1816_start_input, - ad1816_ioctl, - ad1816_prepare_for_input, - ad1816_prepare_for_output, - ad1816_halt, - NULL, - NULL, - ad1816_halt_input, - ad1816_halt_output, - ad1816_trigger, - ad1816_set_speed, - ad1816_set_bits, - ad1816_set_channels, - NULL, - NULL + owner: THIS_MODULE, + open: ad1816_open, + close: ad1816_close, + output_block: ad1816_output_block, + start_input: ad1816_start_input, + prepare_for_input: ad1816_prepare_for_input, + prepare_for_output: ad1816_prepare_for_output, + halt_io: ad1816_halt, + halt_input: ad1816_halt_input, + halt_output: ad1816_halt_output, + trigger: ad1816_trigger, + set_speed: ad1816_set_speed, + set_bits: ad1816_set_bits, + set_channels: ad1816_set_channels, }; @@ -992,9 +980,10 @@ /* Mixer structure */ static struct mixer_operations ad1816_mixer_operations = { - "AD1816", - "AD1816 Mixer", - ad1816_mixer_ioctl + owner: THIS_MODULE, + id: "AD1816", + name: "AD1816 Mixer", + ioctl: ad1816_mixer_ioctl }; @@ -1424,7 +1413,6 @@ } attach_ad1816(&cfg); - SOUND_LOCK; return 0; } @@ -1441,7 +1429,6 @@ } nr_ad1816_devs=0; - SOUND_LOCK_END; #if defined CONFIG_ISAPNP || defined CONFIG_ISAPNP_MODULE if(activated) if(ad1816_dev) diff -uNr linux.orig/drivers/sound/ad1848.c linux/drivers/sound/ad1848.c --- linux.orig/drivers/sound/ad1848.c Wed Apr 12 18:47:26 2000 +++ linux/drivers/sound/ad1848.c Wed Aug 9 18:42:46 2000 @@ -39,8 +39,6 @@ #include <linux/stddef.h> #include <linux/pm.h> -#include "soundmodule.h" - #define DEB(x) #define DEB1(x) #include "sound_config.h" @@ -892,29 +890,28 @@ static struct audio_driver ad1848_audio_driver = { - ad1848_open, - ad1848_close, - ad1848_output_block, - ad1848_start_input, - NULL, - ad1848_prepare_for_input, - ad1848_prepare_for_output, - ad1848_halt, - NULL, - NULL, - ad1848_halt_input, - ad1848_halt_output, - ad1848_trigger, - ad1848_set_speed, - ad1848_set_bits, - ad1848_set_channels + owner: THIS_MODULE, + open: ad1848_open, + close: ad1848_close, + output_block: ad1848_output_block, + start_input: ad1848_start_input, + prepare_for_input: ad1848_prepare_for_input, + prepare_for_output: ad1848_prepare_for_output, + halt_io: ad1848_halt, + halt_input: ad1848_halt_input, + halt_output: ad1848_halt_output, + trigger: ad1848_trigger, + set_speed: ad1848_set_speed, + set_bits: ad1848_set_bits, + set_channels: ad1848_set_channels }; static struct mixer_operations ad1848_mixer_operations = { - "SOUNDPORT", - "AD1848/CS4248/CS4231", - ad1848_mixer_ioctl + owner: THIS_MODULE, + id: "SOUNDPORT", + name: "AD1848/CS4248/CS4231", + ioctl: ad1848_mixer_ioctl }; static int ad1848_open(int dev, int mode) @@ -1849,7 +1846,8 @@ return 1; } -int ad1848_init(char *name, int io_base, int irq, int dma_playback, int dma_capture, int share_dma, int *osp) +int ad1848_init (char *name, int io_base, int irq, int dma_playback, + int dma_capture, int share_dma, int *osp, struct module *owner) { /* * NOTE! If irq < 0, there is another driver which has allocated the IRQ @@ -1901,7 +1899,10 @@ portc = (ad1848_port_info *) kmalloc(sizeof(ad1848_port_info), GFP_KERNEL); if(portc==NULL) return -1; - + + if (owner) + ad1848_audio_driver.owner = owner; + if ((my_dev = sound_install_audiodrv(AUDIO_DRIVER_VERSION, dev_name, &ad1848_audio_driver, @@ -2498,7 +2499,7 @@ return ad1848_detect(hw_config->io_base + 4, NULL, hw_config->osp); } -void attach_ms_sound(struct address_info *hw_config) +void attach_ms_sound(struct address_info *hw_config, struct module *owner) { static signed char interrupt_bits[12] = { @@ -2523,7 +2524,8 @@ hw_config->irq, hw_config->dma, hw_config->dma2, 0, - hw_config->osp); + hw_config->osp, + owner); request_region(hw_config->io_base, 4, "WSS config"); return; } @@ -2581,7 +2583,8 @@ hw_config->slots[0] = ad1848_init("MS Sound System", hw_config->io_base + 4, hw_config->irq, dma, dma2, 0, - hw_config->osp); + hw_config->osp, + THIS_MODULE); request_region(hw_config->io_base, 4, "WSS config"); } @@ -2829,17 +2832,15 @@ if(!probe_ms_sound(&cfg)) return -ENODEV; - attach_ms_sound(&cfg); + attach_ms_sound(&cfg, THIS_MODULE); loaded = 1; } - SOUND_LOCK; return 0; } static void __exit cleanup_ad1848(void) { - SOUND_LOCK_END; if(loaded) unload_ms_sound(&cfg); } diff -uNr linux.orig/drivers/sound/ad1848.h linux/drivers/sound/ad1848.h --- linux.orig/drivers/sound/ad1848.h Tue Mar 7 22:40:24 2000 +++ linux/drivers/sound/ad1848.h Wed Aug 9 18:42:46 2000 @@ -15,14 +15,14 @@ int ad1848_init(char *name, int io_base, int irq, int dma_playback, - int dma_capture, int share_dma, int *osp); + int dma_capture, int share_dma, int *osp, struct module *owner); void ad1848_unload (int io_base, int irq, int dma_playback, int dma_capture, int share_dma); int ad1848_detect (int io_base, int *flags, int *osp); int ad1848_control(int cmd, int arg); void adintr(int irq, void *dev_id, struct pt_regs * dummy); -void attach_ms_sound(struct address_info * hw_config); +void attach_ms_sound(struct address_info * hw_config, struct module * owner); int probe_ms_sound(struct address_info *hw_config); void unload_ms_sound(struct address_info *hw_info); diff -uNr linux.orig/drivers/sound/adlib_card.c linux/drivers/sound/adlib_card.c --- linux.orig/drivers/sound/adlib_card.c Tue Mar 7 22:40:24 2000 +++ linux/drivers/sound/adlib_card.c Wed Aug 9 18:42:46 2000 @@ -14,13 +14,12 @@ #include <linux/init.h> #include "sound_config.h" -#include "soundmodule.h" #include "opl3.h" static void __init attach_adlib_card(struct address_info *hw_config) { - hw_config->slots[0] = opl3_init(hw_config->io_base, hw_config->osp); + hw_config->slots[0] = opl3_init(hw_config->io_base, hw_config->osp, THIS_MODULE); request_region(hw_config->io_base, 4, "OPL3/OPL2"); } @@ -50,7 +49,7 @@ if (probe_adlib(&cfg) == 0) return -ENODEV; attach_adlib_card(&cfg); - SOUND_LOCK; + return 0; } @@ -59,7 +58,6 @@ release_region(cfg.io_base, 4); sound_unload_synthdev(cfg.slots[0]); - SOUND_LOCK_END; } module_init(init_adlib); diff -uNr linux.orig/drivers/sound/aedsp16.c linux/drivers/sound/aedsp16.c --- linux.orig/drivers/sound/aedsp16.c Mon Mar 27 19:48:11 2000 +++ linux/drivers/sound/aedsp16.c Wed Aug 9 18:42:46 2000 @@ -28,7 +28,6 @@ #include <linux/module.h> #include <linux/init.h> #include "sound_config.h" -#include "soundmodule.h" /* * Sanity checks @@ -1357,13 +1356,11 @@ */ return -EINVAL; } - SOUND_LOCK; return 0; } static void __exit cleanup_aedsp16(void) { uninit_aedsp16(); - SOUND_LOCK_END; } module_init(do_init_aedsp16); diff -uNr linux.orig/drivers/sound/audio.c linux/drivers/sound/audio.c --- linux.orig/drivers/sound/audio.c Mon Feb 28 16:18:20 2000 +++ linux/drivers/sound/audio.c Wed Aug 9 18:42:46 2000 @@ -82,14 +82,15 @@ if (dev < 0 || dev >= num_audiodevs) return -ENXIO; + if (audio_devs[dev]->d->owner) + __MOD_INC_USE_COUNT (audio_devs[dev]->d->owner); + if ((ret = DMAbuf_open(dev, mode)) < 0) return ret; - if (audio_devs[dev]->coproc) - { + if (audio_devs[dev]->coproc) { if ((ret = audio_devs[dev]->coproc-> - open(audio_devs[dev]->coproc->devc, COPR_PCM)) < 0) - { + open(audio_devs[dev]->coproc->devc, COPR_PCM)) < 0) { audio_release(dev, file); printk(KERN_WARNING "Sound: Can't access coprocessor device\n"); return ret; @@ -178,6 +179,9 @@ if (audio_devs[dev]->coproc) audio_devs[dev]->coproc->close(audio_devs[dev]->coproc->devc, COPR_PCM); DMAbuf_release(dev, mode); + + if (audio_devs[dev]->d->owner) + __MOD_DEC_USE_COUNT (audio_devs[dev]->d->owner); } static void translate_bytes(const unsigned char *table, unsigned char *buff, int n) diff -uNr linux.orig/drivers/sound/awe_wave.c linux/drivers/sound/awe_wave.c --- linux.orig/drivers/sound/awe_wave.c Mon Jun 19 22:42:41 2000 +++ linux/drivers/sound/awe_wave.c Wed Aug 9 18:42:46 2000 @@ -31,7 +31,6 @@ #endif #include "sound_config.h" -#include "soundmodule.h" #include "awe_wave.h" #include "awe_hw.h" @@ -496,27 +495,28 @@ static struct synth_operations awe_operations = { - "EMU8K", - &awe_info, - 0, - SYNTH_TYPE_SAMPLE, - SAMPLE_TYPE_AWE32, - awe_open, - awe_close, - awe_ioctl, - awe_kill_note, - awe_start_note, - awe_set_instr_2, - awe_reset, - awe_hw_control, - awe_load_patch, - awe_aftertouch, - awe_controller, - awe_panning, - awe_volume_method, - awe_bender, - awe_alloc, - awe_setup_voice + owner: THIS_MODULE, + id: "EMU8K", + info: &awe_info, + midi_dev: 0, + synth_type: SYNTH_TYPE_SAMPLE, + synth_subtype: SAMPLE_TYPE_AWE32, + open: awe_open, + close: awe_close, + ioctl: awe_ioctl, + kill_note: awe_kill_note, + start_note: awe_start_note, + set_instr: awe_set_instr_2, + reset: awe_reset, + hw_control: awe_hw_control, + load_patch: awe_load_patch, + aftertouch: awe_aftertouch, + controller: awe_controller, + panning: awe_panning, + volume_method: awe_volume_method, + bender: awe_bender, + alloc_voice: awe_alloc, + setup_voice: awe_setup_voice }; @@ -575,8 +575,6 @@ awe_present = TRUE; - SOUND_LOCK; - return 1; } @@ -608,7 +606,6 @@ #endif sound_unload_synthdev(my_dev); awe_present = FALSE; - SOUND_LOCK_END; } } @@ -4293,8 +4290,10 @@ static int my_mixerdev = -1; static struct mixer_operations awe_mixer_operations = { - "AWE32 Equalizer", - awe_mixer_ioctl, + owner: THIS_MODULE, + id: "AWE", + name: "AWE32 Equalizer", + ioctl: awe_mixer_ioctl, }; static void __init attach_mixer(void) @@ -5225,17 +5224,13 @@ static struct midi_operations awe_midi_operations = { - {"AWE Midi Emu", 0, 0, SNDCARD_SB}, - NULL /*&std_midi_synth*/, - {0}, /* input_info */ - awe_midi_open, /*open*/ - awe_midi_close, /*close*/ - awe_midi_ioctl, /*ioctl*/ - awe_midi_outputc, /*outputc*/ - NULL /*start_read*/, - NULL /*end_read*/, - NULL, /* kick */ - NULL, /* command */ + owner: THIS_MODULE, + info: {"AWE Midi Emu", 0, 0, SNDCARD_SB}, + in_info: {0}, + open: awe_midi_open, /*open*/ + close: awe_midi_close, /*close*/ + ioctl: awe_midi_ioctl, /*ioctl*/ + outputc: awe_midi_outputc, /*outputc*/ }; static int my_mididev = -1; diff -uNr linux.orig/drivers/sound/cs4232.c linux/drivers/sound/cs4232.c --- linux.orig/drivers/sound/cs4232.c Mon Jun 19 22:42:41 2000 +++ linux/drivers/sound/cs4232.c Wed Aug 9 18:42:46 2000 @@ -46,7 +46,6 @@ #include <linux/init.h> #include "sound_config.h" -#include "soundmodule.h" #include "cs4232.h" #include "ad1848.h" @@ -229,7 +228,8 @@ dma1, /* Playback DMA */ dma2, /* Capture DMA */ 0, - hw_config->osp); + hw_config->osp, + THIS_MODULE); if (hw_config->slots[0] != -1 && audio_devs[hw_config->slots[0]]->mixer_dev!=-1) @@ -258,7 +258,7 @@ if (probe_uart401(&hw_config2)) { mpu_detected = 1; - attach_uart401(&hw_config2); + attach_uart401(&hw_config2, THIS_MODULE); } else { @@ -266,7 +266,6 @@ } hw_config->slots[1] = hw_config2.slots[1]; } - SOUND_LOCK; } void unload_cs4232(struct address_info *hw_config) @@ -376,7 +375,6 @@ static void __exit cleanup_cs4232(void) { unload_cs4232(&cfg); /* unloads MPU as well, if needed */ - SOUND_LOCK_END; } module_init(init_cs4232); diff -uNr linux.orig/drivers/sound/dev_table.h linux/drivers/sound/dev_table.h --- linux.orig/drivers/sound/dev_table.h Mon Apr 3 00:45:06 2000 +++ linux/drivers/sound/dev_table.h Wed Aug 9 18:42:46 2000 @@ -160,6 +160,7 @@ struct audio_driver { + struct module *owner; int (*open) (int dev, int mode); void (*close) (int dev); void (*output_block) (int dev, unsigned long buf, @@ -239,6 +240,7 @@ struct mixer_operations { + struct module *owner; char id[16]; char name[64]; int (*ioctl) (int dev, unsigned int cmd, caddr_t arg); @@ -249,6 +251,7 @@ struct synth_operations { + struct module *owner; char *id; /* Unique identifier (ASCII) max 29 char */ struct synth_info *info; int midi_dev; @@ -301,6 +304,7 @@ struct midi_operations { + struct module *owner; struct midi_info info; struct synth_operations *converter; struct midi_input_info in_info; @@ -332,6 +336,7 @@ struct sound_timer_operations { + struct module *owner; struct sound_timer_info info; int priority; int devlink; diff -uNr linux.orig/drivers/sound/gus_card.c linux/drivers/sound/gus_card.c --- linux.orig/drivers/sound/gus_card.c Tue Mar 7 22:40:24 2000 +++ linux/drivers/sound/gus_card.c Wed Aug 9 18:42:46 2000 @@ -20,7 +20,6 @@ #include <linux/module.h> #include "sound_config.h" -#include "soundmodule.h" #include "gus.h" #include "gus_hw.h" @@ -184,7 +183,8 @@ hw_config->irq, hw_config->dma, hw_config->dma, 0, - hw_config->osp); + hw_config->osp, + THIS_MODULE); } static void __exit unload_gus_db16(struct address_info *hw_config) @@ -259,7 +259,7 @@ if (!probe_gus(&cfg)) return -ENODEV; attach_gus(&cfg); - SOUND_LOCK; + return 0; } @@ -270,7 +270,6 @@ unload_gus_db16(&cfg); #endif unload_gus(&cfg); - SOUND_LOCK_END; } module_init(init_gus); diff -uNr linux.orig/drivers/sound/gus_midi.c linux/drivers/sound/gus_midi.c --- linux.orig/drivers/sound/gus_midi.c Tue Mar 7 22:40:24 2000 +++ linux/drivers/sound/gus_midi.c Wed Aug 9 18:42:46 2000 @@ -186,23 +186,17 @@ static struct midi_operations gus_midi_operations = { - { - "Gravis UltraSound Midi", 0, 0, SNDCARD_GUS - }, - &std_midi_synth, - {0}, - gus_midi_open, - gus_midi_close, - NULL, /* ioctl */ - gus_midi_out, - gus_midi_start_read, - gus_midi_end_read, - gus_midi_kick, - NULL, /* - * command - */ - gus_midi_buffer_status, - NULL + owner: THIS_MODULE, + info: {"Gravis UltraSound Midi", 0, 0, SNDCARD_GUS}, + converter: &std_midi_synth, + in_info: {0}, + open: gus_midi_open, + close: gus_midi_close, + outputc: gus_midi_out, + start_read: gus_midi_start_read, + end_read: gus_midi_end_read, + kick: gus_midi_kick, + buffer_status: gus_midi_buffer_status, }; void gus_midi_init(struct address_info *hw_config) diff -uNr linux.orig/drivers/sound/gus_wave.c linux/drivers/sound/gus_wave.c --- linux.orig/drivers/sound/gus_wave.c Tue Mar 7 22:40:24 2000 +++ linux/drivers/sound/gus_wave.c Wed Aug 9 18:42:46 2000 @@ -2613,16 +2613,16 @@ static struct audio_driver gus_audio_driver = { - gus_audio_open, - gus_audio_close, - gus_audio_output_block, - gus_audio_start_input, - gus_audio_ioctl, - gus_audio_prepare_for_input, - gus_audio_prepare_for_output, - gus_audio_reset, - gus_local_qlen, - NULL + owner: THIS_MODULE, + open: gus_audio_open, + close: gus_audio_close, + output_block: gus_audio_output_block, + start_input: gus_audio_start_input, + ioctl: gus_audio_ioctl, + prepare_for_input: gus_audio_prepare_for_input, + prepare_for_output: gus_audio_prepare_for_output, + halt_io: gus_audio_reset, + local_qlen: gus_local_qlen, }; static void guswave_setup_voice(int dev, int voice, int chn) @@ -2702,27 +2702,28 @@ static struct synth_operations guswave_operations = { - "GUS", - &gus_info, - 0, - SYNTH_TYPE_SAMPLE, - SAMPLE_TYPE_GUS, - guswave_open, - guswave_close, - guswave_ioctl, - guswave_kill_note, - guswave_start_note, - guswave_set_instr, - guswave_reset, - guswave_hw_control, - guswave_load_patch, - guswave_aftertouch, - guswave_controller, - guswave_panning, - guswave_volume_method, - guswave_bender, - guswave_alloc, - guswave_setup_voice + owner: THIS_MODULE, + id: "GUS", + info: &gus_info, + midi_dev: 0, + synth_type: SYNTH_TYPE_SAMPLE, + synth_subtype: SAMPLE_TYPE_GUS, + open: guswave_open, + close: guswave_close, + ioctl: guswave_ioctl, + kill_note: guswave_kill_note, + start_note: guswave_start_note, + set_instr: guswave_set_instr, + reset: guswave_reset, + hw_control: guswave_hw_control, + load_patch: guswave_load_patch, + aftertouch: guswave_aftertouch, + controller: guswave_controller, + panning: guswave_panning, + volume_method: guswave_volume_method, + bender: guswave_bender, + alloc_voice: guswave_alloc, + setup_voice: guswave_setup_voice }; static void set_input_volumes(void) @@ -2894,9 +2895,10 @@ static struct mixer_operations gus_mixer_operations = { - "GUS", - "Gravis Ultrasound", - gus_default_mixer_ioctl + owner: THIS_MODULE, + id: "GUS", + name: "Gravis Ultrasound", + ioctl: gus_default_mixer_ioctl }; static int gus_default_mixer_init(void) @@ -3050,7 +3052,8 @@ -irq, gus_dma2, /* Playback DMA */ gus_dma, /* Capture DMA */ 1, /* Share DMA channels with GF1 */ - hw_config->osp); + hw_config->osp, + THIS_MODULE); if (num_mixers > old_num_mixers) { diff -uNr linux.orig/drivers/sound/ics2101.c linux/drivers/sound/ics2101.c --- linux.orig/drivers/sound/ics2101.c Tue Mar 7 22:40:24 2000 +++ linux/drivers/sound/ics2101.c Wed Aug 9 18:42:46 2000 @@ -206,9 +206,10 @@ static struct mixer_operations ics2101_mixer_operations = { - "ICS2101", - "ICS2101 Multimedia Mixer", - ics2101_mixer_ioctl + owner: THIS_MODULE, + id: "ICS2101", + name: "ICS2101 Multimedia Mixer", + ioctl: ics2101_mixer_ioctl }; int diff -uNr linux.orig/drivers/sound/mad16.c linux/drivers/sound/mad16.c --- linux.orig/drivers/sound/mad16.c Thu May 11 01:56:43 2000 +++ linux/drivers/sound/mad16.c Wed Aug 9 18:42:46 2000 @@ -73,7 +73,6 @@ #include <linux/module.h> #include "sound_config.h" -#include "soundmodule.h" #include "ad1848.h" #include "sb.h" @@ -710,7 +709,8 @@ hw_config->irq, dma, dma2, 0, - hw_config->osp); + hw_config->osp, + THIS_MODULE); request_region(hw_config->io_base, 4, "MAD16 WSS config"); } @@ -724,7 +724,7 @@ hw_config->io_base = 0x220; hw_config->name = "Mad16/Mozart"; - sb_dsp_init(hw_config); + sb_dsp_init(hw_config, THIS_MODULE); return; #endif @@ -733,7 +733,7 @@ hw_config->driver_use_1 = SB_MIDI_ONLY; hw_config->name = "Mad16/Mozart"; - attach_uart401(hw_config); + attach_uart401(hw_config, THIS_MODULE); } static int __init probe_mad16_mpu(struct address_info *hw_config) @@ -1094,7 +1094,6 @@ if (found_mpu) attach_mad16_mpu(&cfg_mpu); - SOUND_LOCK; return 0; } @@ -1103,7 +1102,6 @@ if (found_mpu) unload_mad16_mpu(&cfg_mpu); unload_mad16(&cfg); - SOUND_LOCK_END; } module_init(init_mad16); diff -uNr linux.orig/drivers/sound/maui.c linux/drivers/sound/maui.c --- linux.orig/drivers/sound/maui.c Tue Mar 7 22:40:24 2000 +++ linux/drivers/sound/maui.c Wed Aug 9 18:42:46 2000 @@ -30,7 +30,6 @@ #define USE_SIMPLE_MACROS #include "sound_config.h" -#include "soundmodule.h" #include "sound_firmware.h" #include "mpu401.h" @@ -375,7 +374,7 @@ hw_config->irq *= -1; hw_config->name = "Maui"; - attach_mpu401(hw_config); + attach_mpu401(hw_config, THIS_MODULE); if (hw_config->slots[1] != -1) /* The MPU401 driver installed itself */ { struct synth_operations *synth; @@ -443,7 +442,7 @@ if (probe_maui(&cfg) == 0) return -ENODEV; attach_maui(&cfg); - SOUND_LOCK; + return 0; } @@ -452,7 +451,6 @@ if (fw_load && maui_os) vfree(maui_os); unload_maui(&cfg); - SOUND_LOCK_END; } module_init(init_maui); diff -uNr linux.orig/drivers/sound/maui_boot.h linux/drivers/sound/maui_boot.h --- linux.orig/drivers/sound/maui_boot.h Thu Jan 1 01:00:00 1970 +++ linux/drivers/sound/maui_boot.h Wed Aug 9 18:42:46 2000 @@ -0,0 +1,2 @@ +static unsigned char * maui_os = NULL; +static int maui_osLen = 0; diff -uNr linux.orig/drivers/sound/midi_synth.c linux/drivers/sound/midi_synth.c --- linux.orig/drivers/sound/midi_synth.c Mon Feb 28 16:18:20 2000 +++ linux/drivers/sound/midi_synth.c Wed Aug 9 18:47:32 2000 @@ -431,9 +431,6 @@ if ((err = midi_devs[orig_dev]->open(orig_dev, mode, midi_synth_input, midi_synth_output)) < 0) return err; -#ifdef MODULE - MOD_INC_USE_COUNT; -#endif inc = &midi_devs[orig_dev]->in_info; save_flags(flags); @@ -461,9 +458,6 @@ midi_devs[orig_dev]->outputc(orig_dev, 0xfe); midi_devs[orig_dev]->close(orig_dev); -#ifdef MODULE - MOD_DEC_USE_COUNT; -#endif } void diff -uNr linux.orig/drivers/sound/midi_synth.h linux/drivers/sound/midi_synth.h --- linux.orig/drivers/sound/midi_synth.h Tue Sep 30 17:46:45 1997 +++ linux/drivers/sound/midi_synth.h Wed Aug 9 18:42:46 2000 @@ -22,27 +22,26 @@ static struct synth_operations std_midi_synth = { - "MIDI", - &std_synth_info, - 0, - SYNTH_TYPE_MIDI, - 0, - midi_synth_open, - midi_synth_close, - midi_synth_ioctl, - midi_synth_kill_note, - midi_synth_start_note, - midi_synth_set_instr, - midi_synth_reset, - midi_synth_hw_control, - midi_synth_load_patch, - midi_synth_aftertouch, - midi_synth_controller, - midi_synth_panning, - NULL, - midi_synth_bender, - NULL, /* alloc_voice */ - midi_synth_setup_voice, - midi_synth_send_sysex + owner: THIS_MODULE, + id: "MIDI", + info: &std_synth_info, + midi_dev: 0, + synth_type: SYNTH_TYPE_MIDI, + synth_subtype: 0, + open: midi_synth_open, + close: midi_synth_close, + ioctl: midi_synth_ioctl, + kill_note: midi_synth_kill_note, + start_note: midi_synth_start_note, + set_instr: midi_synth_set_instr, + reset: midi_synth_reset, + hw_control: midi_synth_hw_control, + load_patch: midi_synth_load_patch, + aftertouch: midi_synth_aftertouch, + controller: midi_synth_controller, + panning: midi_synth_panning, + bender: midi_synth_bender, + setup_voice: midi_synth_setup_voice, + send_sysex: midi_synth_send_sysex }; #endif diff -uNr linux.orig/drivers/sound/midibuf.c linux/drivers/sound/midibuf.c --- linux.orig/drivers/sound/midibuf.c Wed May 3 10:45:17 2000 +++ linux/drivers/sound/midibuf.c Wed Aug 9 18:42:46 2000 @@ -172,6 +172,9 @@ * Interrupts disabled. Be careful */ + if (midi_devs[dev]->owner) + __MOD_INC_USE_COUNT (midi_devs[dev]->owner); + if ((err = midi_devs[dev]->open(dev, mode, midi_input_intr, midi_output_intr)) < 0) return err; @@ -257,6 +260,9 @@ if (open_devs < 2) del_timer(&poll_timer);; open_devs--; + + if (midi_devs[dev]->owner) + __MOD_DEC_USE_COUNT (midi_devs[dev]->owner); } int MIDIbuf_write(int dev, struct file *file, const char *buf, int count) diff -uNr linux.orig/drivers/sound/mpu401.c linux/drivers/sound/mpu401.c --- linux.orig/drivers/sound/mpu401.c Mon Mar 13 21:34:01 2000 +++ linux/drivers/sound/mpu401.c Wed Aug 9 18:42:46 2000 @@ -15,14 +15,13 @@ * Alan Cox modularisation, use normal request_irq, use dev_id */ -#include <linux/init.h> #include <linux/module.h> +#include <linux/init.h> #define USE_SEQ_MACROS #define USE_SIMPLE_MACROS #include "sound_config.h" -#include "soundmodule.h" #include "coproc.h" #include "mpu401.h" @@ -866,47 +865,45 @@ static struct synth_operations mpu401_synth_proto = { - "MPU401", - NULL, - 0, - SYNTH_TYPE_MIDI, - 0, - mpu_synth_open, - mpu_synth_close, - mpu_synth_ioctl, - midi_synth_kill_note, - midi_synth_start_note, - midi_synth_set_instr, - midi_synth_reset, - midi_synth_hw_control, - midi_synth_load_patch, - midi_synth_aftertouch, - midi_synth_controller, - midi_synth_panning, - NULL, - midi_synth_bender, - NULL, /* alloc */ - midi_synth_setup_voice, - midi_synth_send_sysex + owner: THIS_MODULE, + id: "MPU401", + info: NULL, + midi_dev: 0, + synth_type: SYNTH_TYPE_MIDI, + synth_subtype: 0, + open: mpu_synth_open, + close: mpu_synth_close, + ioctl: mpu_synth_ioctl, + kill_note: midi_synth_kill_note, + start_note: midi_synth_start_note, + set_instr: midi_synth_set_instr, + reset: midi_synth_reset, + hw_control: midi_synth_hw_control, + load_patch: midi_synth_load_patch, + aftertouch: midi_synth_aftertouch, + controller: midi_synth_controller, + panning: midi_synth_panning, + bender: midi_synth_bender, + setup_voice: midi_synth_setup_voice, + send_sysex: midi_synth_send_sysex }; static struct synth_operations *mpu401_synth_operations[MAX_MIDI_DEV]; static struct midi_operations mpu401_midi_proto = { - {"MPU-401 Midi", 0, MIDI_CAP_MPU401, SNDCARD_MPU401}, - NULL, - {0}, - mpu401_open, - mpu401_close, - mpu401_ioctl, - mpu401_out, - mpu401_start_read, - mpu401_end_read, - mpu401_kick, - NULL, - mpu401_buffer_status, - mpu401_prefix_cmd + owner: THIS_MODULE, + info: {"MPU-401 Midi", 0, MIDI_CAP_MPU401, SNDCARD_MPU401}, + in_info: {0}, + open: mpu401_open, + close: mpu401_close, + ioctl: mpu401_ioctl, + outputc: mpu401_out, + start_read: mpu401_start_read, + end_read: mpu401_end_read, + kick: mpu401_kick, + buffer_status: mpu401_buffer_status, + prefix_cmd: mpu401_prefix_cmd }; static struct midi_operations mpu401_midi_operations[MAX_MIDI_DEV]; @@ -942,7 +939,7 @@ restore_flags(flags); } -void __init attach_mpu401(struct address_info *hw_config) +void __init attach_mpu401(struct address_info *hw_config, struct module *owner) { unsigned long flags; char revision_char; @@ -1089,6 +1086,10 @@ hw_config->slots[2] = mpu_timer_init(m); midi_devs[m] = &mpu401_midi_operations[devc->devno]; + + if (owner) + midi_devs[m]->owner = owner; + hw_config->slots[1] = m; sequencer_init(); } @@ -1574,15 +1575,16 @@ static struct sound_timer_operations mpu_timer = { - {"MPU-401 Timer", 0}, - 10, /* Priority */ - 0, /* Local device link */ - mpu_timer_open, - mpu_timer_close, - mpu_timer_event, - mpu_timer_get_time, - mpu_timer_ioctl, - mpu_timer_arm + owner: THIS_MODULE, + info: {"MPU-401 Timer", 0}, + priority: 10, /* Priority */ + devlink: 0, /* Local device link */ + open: mpu_timer_open, + close: mpu_timer_close, + event: mpu_timer_event, + get_time: mpu_timer_get_time, + ioctl: mpu_timer_ioctl, + arm_timer: mpu_timer_arm }; static void mpu_timer_interrupt(void) @@ -1731,10 +1733,9 @@ cfg.io_base = io; if (probe_mpu401(&cfg) == 0) return -ENODEV; - attach_mpu401(&cfg); + attach_mpu401(&cfg, THIS_MODULE); } - SOUND_LOCK; return 0; } @@ -1744,7 +1745,6 @@ /* Check for use by, for example, sscape driver */ unload_mpu401(&cfg); } - SOUND_LOCK_END; } module_init(init_mpu401); diff -uNr linux.orig/drivers/sound/mpu401.h linux/drivers/sound/mpu401.h --- linux.orig/drivers/sound/mpu401.h Tue Mar 7 22:40:24 2000 +++ linux/drivers/sound/mpu401.h Wed Aug 9 18:42:46 2000 @@ -7,14 +7,14 @@ /* From uart401.c */ int probe_uart401 (struct address_info *hw_config); -void attach_uart401 (struct address_info *hw_config); +void attach_uart401 (struct address_info *hw_config, struct module *owner); void unload_uart401 (struct address_info *hw_config); void uart401intr (int irq, void *dev_id, struct pt_regs * dummy); /* From mpu401.c */ int probe_mpu401(struct address_info *hw_config); -void attach_mpu401(struct address_info * hw_config); +void attach_mpu401(struct address_info * hw_config, struct module *owner); void unload_mpu401(struct address_info *hw_info); int intchk_mpu401(void *dev_id); diff -uNr linux.orig/drivers/sound/nm256_audio.c linux/drivers/sound/nm256_audio.c --- linux.orig/drivers/sound/nm256_audio.c Wed Jul 19 01:09:27 2000 +++ linux/drivers/sound/nm256_audio.c Wed Aug 9 18:42:46 2000 @@ -20,7 +20,6 @@ #include <linux/pm.h> #include <linux/delay.h> #include "sound_config.h" -#include "soundmodule.h" #include "nm256.h" #include "nm256_coeff.h" @@ -926,9 +925,10 @@ } static struct mixer_operations nm256_mixer_operations = { - "NeoMagic", - "NM256AC97Mixer", - nm256_default_mixer_ioctl + owner: THIS_MODULE, + id: "NeoMagic", + name: "NM256AC97Mixer", + ioctl: nm256_default_mixer_ioctl }; /* @@ -1621,22 +1621,16 @@ static struct audio_driver nm256_audio_driver = { - nm256_audio_open, /* open */ - nm256_audio_close, /* close */ - nm256_audio_output_block, /* output_block */ - nm256_audio_start_input, /* start_input */ - nm256_audio_ioctl, /* ioctl */ - nm256_audio_prepare_for_input, /* prepare_for_input */ - nm256_audio_prepare_for_output, /* prepare_for_output */ - nm256_audio_reset, /* reset */ - nm256_audio_local_qlen, /*+local_qlen */ - NULL, /*+copy_from_user */ - NULL, /*+halt_input */ - NULL, /* halt_output */ - NULL, /*+trigger */ - NULL, /*+set_speed */ - NULL, /*+set_bits */ - NULL, /*+set_channels */ + owner: THIS_MODULE, + open: nm256_audio_open, + close: nm256_audio_close, + output_block: nm256_audio_output_block, + start_input: nm256_audio_start_input, + ioctl: nm256_audio_ioctl, + prepare_for_input: nm256_audio_prepare_for_input, + prepare_for_output:nm256_audio_prepare_for_output, + halt_io: nm256_audio_reset, + local_qlen: nm256_audio_local_qlen, }; EXPORT_SYMBOL(init_nm256); @@ -1654,7 +1648,6 @@ printk (KERN_INFO "NeoMagic 256AV/256ZX audio driver, version 1.1\n"); if (init_nm256 () == 0) { - SOUND_LOCK; loaded = 1; return 0; } @@ -1668,8 +1661,6 @@ struct nm256_info *card; struct nm256_info *next_card; - SOUND_LOCK_END; - for (card = nmcard_list; card != NULL; card = next_card) { stopPlay (card); stopRecord (card); diff -uNr linux.orig/drivers/sound/opl3.c linux/drivers/sound/opl3.c --- linux.orig/drivers/sound/opl3.c Tue Mar 7 22:40:24 2000 +++ linux/drivers/sound/opl3.c Wed Aug 9 18:46:16 2000 @@ -31,7 +31,6 @@ */ #include "sound_config.h" -#include "soundmodule.h" #include "opl3.h" #include "opl3_hw.h" @@ -769,7 +768,6 @@ if (devc->busy) return -EBUSY; - MOD_INC_USE_COUNT; devc->busy = 1; devc->v_alloc->max_voice = devc->nr_voice = (devc->model == 2) ? 18 : 9; @@ -798,7 +796,6 @@ devc->fm_info.perc_mode = 0; opl3_reset(dev); - MOD_DEC_USE_COUNT; } static void opl3_hw_control(int dev, unsigned char *event) @@ -1061,30 +1058,31 @@ static struct synth_operations opl3_operations = { - "OPL", - NULL, - 0, - SYNTH_TYPE_FM, - FM_TYPE_ADLIB, - opl3_open, - opl3_close, - opl3_ioctl, - opl3_kill_note, - opl3_start_note, - opl3_set_instr, - opl3_reset, - opl3_hw_control, - opl3_load_patch, - opl3_aftertouch, - opl3_controller, - opl3_panning, - opl3_volume_method, - opl3_bender, - opl3_alloc_voice, - opl3_setup_voice + owner: THIS_MODULE, + id: "OPL", + info: NULL, + midi_dev: 0, + synth_type: SYNTH_TYPE_FM, + synth_subtype: FM_TYPE_ADLIB, + open: opl3_open, + close: opl3_close, + ioctl: opl3_ioctl, + kill_note: opl3_kill_note, + start_note: opl3_start_note, + set_instr: opl3_set_instr, + reset: opl3_reset, + hw_control: opl3_hw_control, + load_patch: opl3_load_patch, + aftertouch: opl3_aftertouch, + controller: opl3_controller, + panning: opl3_panning, + volume_method: opl3_volume_method, + bender: opl3_bender, + alloc_voice: opl3_alloc_voice, + setup_voice: opl3_setup_voice }; -int opl3_init(int ioaddr, int *osp) +int opl3_init(int ioaddr, int *osp, struct module *owner) { int i; int me; @@ -1131,6 +1129,10 @@ opl3_operations.info = &devc->fm_info; synth_devs[me] = &opl3_operations; + + if (owner) + synth_devs[me]->owner = owner; + sequencer_init(); devc->v_alloc = &opl3_operations.alloc; devc->chn_info = &opl3_operations.chn_info[0]; @@ -1198,11 +1200,11 @@ { return -ENODEV; } - me = opl3_init(io, NULL); + me = opl3_init(io, NULL, THIS_MODULE); request_region(io, 4, devc->fm_info.name); } - SOUND_LOCK; + return 0; } @@ -1216,7 +1218,6 @@ devc = NULL; sound_unload_synthdev(me); } - SOUND_LOCK_END; } module_init(init_opl3); diff -uNr linux.orig/drivers/sound/opl3.h linux/drivers/sound/opl3.h --- linux.orig/drivers/sound/opl3.h Tue Mar 7 22:40:24 2000 +++ linux/drivers/sound/opl3.h Wed Aug 9 18:42:46 2000 @@ -6,6 +6,6 @@ */ int opl3_detect (int ioaddr, int *osp); -int opl3_init(int ioaddr, int *osp); +int opl3_init(int ioaddr, int *osp, struct module *owner); void enable_opl3_mode(int left, int right, int both); diff -uNr linux.orig/drivers/sound/opl3sa.c linux/drivers/sound/opl3sa.c --- linux.orig/drivers/sound/opl3sa.c Tue Mar 7 22:40:24 2000 +++ linux/drivers/sound/opl3sa.c Wed Aug 9 18:42:46 2000 @@ -25,7 +25,6 @@ #undef SB_OK #include "sound_config.h" -#include "soundmodule.h" #include "ad1848.h" #include "mpu401.h" @@ -167,7 +166,7 @@ int nm = num_mixers; /* FIXME */ - attach_ms_sound(hw_config); + attach_ms_sound(hw_config, THIS_MODULE); if (num_mixers > nm) /* A mixer was installed */ { AD1848_REROUTE(SOUND_MIXER_LINE1, SOUND_MIXER_CD); @@ -180,7 +179,7 @@ static void __init attach_opl3sa_mpu(struct address_info *hw_config) { hw_config->name = "OPL3-SA (MPU401)"; - attach_uart401(hw_config); + attach_uart401(hw_config, THIS_MODULE); } static int __init probe_opl3sa_mpu(struct address_info *hw_config) @@ -313,7 +312,7 @@ attach_opl3sa_wss(&cfg); if(found_mpu) attach_opl3sa_mpu(&cfg_mpu); - SOUND_LOCK; + return 0; } @@ -322,7 +321,6 @@ if(found_mpu) unload_opl3sa_mpu(&cfg_mpu); unload_opl3sa_wss(&cfg); - SOUND_LOCK_END; } module_init(init_opl3sa); diff -uNr linux.orig/drivers/sound/opl3sa2.c linux/drivers/sound/opl3sa2.c --- linux.orig/drivers/sound/opl3sa2.c Tue Mar 7 22:40:24 2000 +++ linux/drivers/sound/opl3sa2.c Wed Aug 9 18:42:46 2000 @@ -41,7 +41,6 @@ #include <linux/module.h> #include "sound_config.h" -#include "soundmodule.h" #include "ad1848.h" #include "mpu401.h" @@ -436,9 +435,10 @@ static struct mixer_operations opl3sa2_mixer_operations = { - "Yamaha", - "", - opl3sa2_mixer_ioctl + owner: THIS_MODULE, + id: "Yamaha", + name: "", /* hmm? */ + ioctl: opl3sa2_mixer_ioctl }; /* End of mixer-related stuff */ @@ -452,7 +452,7 @@ static inline void __init attach_opl3sa2_mpu(struct address_info *hw_config) { - attach_mpu401(hw_config); + attach_mpu401(hw_config, THIS_MODULE); } @@ -493,7 +493,7 @@ opl3sa2_mixer_reset(devc); - attach_ms_sound(hw_config); /* Slot 0 */ + attach_ms_sound(hw_config, THIS_MODULE); /* Slot 0 */ if(hw_config->slots[0] != -1) { /* Did the MSS driver install? */ @@ -699,7 +699,7 @@ attach_opl3sa2_mpu(&cfg_mpu); } } - SOUND_LOCK; + return 0; } @@ -711,7 +711,6 @@ } unload_opl3sa2_mss(&cfg2); unload_opl3sa2(&cfg); - SOUND_LOCK_END; } module_init(init_opl3sa2); diff -uNr linux.orig/drivers/sound/pas2_card.c linux/drivers/sound/pas2_card.c --- linux.orig/drivers/sound/pas2_card.c Tue Mar 7 22:40:24 2000 +++ linux/drivers/sound/pas2_card.c Wed Aug 9 18:42:46 2000 @@ -8,7 +8,6 @@ #include <linux/init.h> #include <linux/module.h> #include "sound_config.h" -#include "soundmodule.h" #include "pas2.h" #include "sb.h" @@ -426,14 +425,13 @@ if (!probe_pas(&cfg)) return -ENODEV; attach_pas_card(&cfg); - SOUND_LOCK; + return 0; } static void __exit cleanup_pas2(void) { unload_pas(&cfg); - SOUND_LOCK_END; } module_init(init_pas2); diff -uNr linux.orig/drivers/sound/pas2_midi.c linux/drivers/sound/pas2_midi.c --- linux.orig/drivers/sound/pas2_midi.c Tue Mar 7 22:40:24 2000 +++ linux/drivers/sound/pas2_midi.c Wed Aug 9 18:42:46 2000 @@ -191,19 +191,17 @@ static struct midi_operations pas_midi_operations = { - {"Pro Audio Spectrum", 0, 0, SNDCARD_PAS}, - &std_midi_synth, - {0}, - pas_midi_open, - pas_midi_close, - NULL, - pas_midi_out, - pas_midi_start_read, - pas_midi_end_read, - pas_midi_kick, - NULL, - pas_buffer_status, - NULL + owner: THIS_MODULE, + info: {"Pro Audio Spectrum", 0, 0, SNDCARD_PAS}, + converter: &std_midi_synth, + in_info: {0}, + open: pas_midi_open, + close: pas_midi_close, + outputc: pas_midi_out, + start_read: pas_midi_start_read, + end_read: pas_midi_end_read, + kick: pas_midi_kick, + buffer_status: pas_buffer_status, }; void pas_midi_init(void) diff -uNr linux.orig/drivers/sound/pas2_mixer.c linux/drivers/sound/pas2_mixer.c --- linux.orig/drivers/sound/pas2_mixer.c Mon Jun 19 22:42:41 2000 +++ linux/drivers/sound/pas2_mixer.c Wed Aug 9 18:42:46 2000 @@ -309,9 +309,10 @@ static struct mixer_operations pas_mixer_operations = { - "PAS16", - "Pro Audio Spectrum 16", - pas_mixer_ioctl + owner: THIS_MODULE, + id: "PAS16", + name: "Pro Audio Spectrum 16", + ioctl: pas_mixer_ioctl }; int diff -uNr linux.orig/drivers/sound/pas2_pcm.c linux/drivers/sound/pas2_pcm.c --- linux.orig/drivers/sound/pas2_pcm.c Tue Mar 7 22:40:24 2000 +++ linux/drivers/sound/pas2_pcm.c Wed Aug 9 18:42:46 2000 @@ -373,19 +373,16 @@ static struct audio_driver pas_audio_driver = { - pas_audio_open, - pas_audio_close, - pas_audio_output_block, - pas_audio_start_input, - pas_audio_ioctl, - pas_audio_prepare_for_input, - pas_audio_prepare_for_output, - pas_audio_reset, - NULL, - NULL, - NULL, - NULL, - pas_audio_trigger + owner: THIS_MODULE, + open: pas_audio_open, + close: pas_audio_close, + output_block: pas_audio_output_block, + start_input: pas_audio_start_input, + ioctl: pas_audio_ioctl, + prepare_for_input: pas_audio_prepare_for_input, + prepare_for_output: pas_audio_prepare_for_output, + halt_io: pas_audio_reset, + trigger: pas_audio_trigger }; void pas_pcm_init(struct address_info *hw_config) diff -uNr linux.orig/drivers/sound/pss.c linux/drivers/sound/pss.c --- linux.orig/drivers/sound/pss.c Tue Mar 7 22:40:24 2000 +++ linux/drivers/sound/pss.c Wed Aug 9 18:42:46 2000 @@ -35,7 +35,6 @@ #include "sound_config.h" #include "sound_firmware.h" -#include "soundmodule.h" #include "ad1848.h" #include "mpu401.h" @@ -569,9 +568,10 @@ static struct mixer_operations pss_mixer_operations = { - "SOUNDPORT", - "PSS-AD1848", - pss_mixer_ioctl + owner: THIS_MODULE, + id: "SOUNDPORT", + name: "PSS-AD1848", + ioctl: pss_mixer_ioctl }; void attach_pss(struct address_info *hw_config) @@ -918,7 +918,7 @@ static void __init attach_pss_mpu(struct address_info *hw_config) { - attach_mpu401(hw_config); /* Slot 1 */ + attach_mpu401(hw_config, THIS_MODULE); /* Slot 1 */ if (hw_config->slots[1] != -1) /* The MPU driver installed itself */ midi_devs[hw_config->slots[1]]->coproc = &pss_coproc_operations; } @@ -987,7 +987,7 @@ } } pss_mixer_reset(devc); - attach_ms_sound(hw_config); /* Slot 0 */ + attach_ms_sound(hw_config, THIS_MODULE); /* Slot 0 */ if (hw_config->slots[0] != -1) { @@ -1087,7 +1087,7 @@ pssmss = 1; attach_pss_mss(&cfg2); } - SOUND_LOCK; + return 0; } @@ -1100,7 +1100,6 @@ if (pssmpu) unload_pss_mpu(&cfg_mpu); unload_pss(&cfg); - SOUND_LOCK_END; } module_init(init_pss); diff -uNr linux.orig/drivers/sound/sb.h linux/drivers/sound/sb.h --- linux.orig/drivers/sound/sb.h Mon Mar 27 21:02:54 2000 +++ linux/drivers/sound/sb.h Wed Aug 9 18:42:47 2000 @@ -158,14 +158,14 @@ void sb_setmixer (sb_devc *devc, unsigned int port, unsigned int value); unsigned int sb_getmixer (sb_devc *devc, unsigned int port); int sb_dsp_detect (struct address_info *hw_config, int pci, int pciio, struct sb_module_options *sbmo); -int sb_dsp_init (struct address_info *hw_config); +int sb_dsp_init (struct address_info *hw_config, struct module *owner); void sb_dsp_unload(struct address_info *hw_config, int sbmpu); -int sb_mixer_init(sb_devc *devc); +int sb_mixer_init(sb_devc *devc, struct module *owner); void sb_mixer_unload(sb_devc *devc); void sb_mixer_set_stereo (sb_devc *devc, int mode); void smw_mixer_init(sb_devc *devc); -void sb_dsp_midi_init (sb_devc *devc); -void sb_audio_init (sb_devc *devc, char *name); +void sb_dsp_midi_init (sb_devc *devc, struct module *owner); +void sb_audio_init (sb_devc *devc, char *name, struct module *owner); void sb_midi_interrupt (sb_devc *devc); void sb_chgmixer (sb_devc * devc, unsigned int reg, unsigned int mask, unsigned int val); int sb_common_mixer_set(sb_devc * devc, int dev, int left, int right); @@ -178,7 +178,7 @@ /* From sb_common.c */ void sb_dsp_disable_midi(int port); void sb_dsp_disable_recording(int port); -void attach_sbmpu (struct address_info *hw_config); +void attach_sbmpu (struct address_info *hw_config, struct module *owner); int probe_sbmpu (struct address_info *hw_config); void unload_sbmpu (struct address_info *hw_config); diff -uNr linux.orig/drivers/sound/sb_audio.c linux/drivers/sound/sb_audio.c --- linux.orig/drivers/sound/sb_audio.c Mon Feb 28 16:18:20 2000 +++ linux/drivers/sound/sb_audio.c Wed Aug 9 18:42:47 2000 @@ -933,128 +933,103 @@ static struct audio_driver sb1_audio_driver = /* SB1.x */ { - sb_audio_open, - sb_audio_close, - sb_set_output_parms, - sb_set_input_parms, - NULL, /* ioctl */ - sb1_audio_prepare_for_input, - sb1_audio_prepare_for_output, - sb1_audio_halt_xfer, - NULL, /* local_qlen */ - NULL, /* copy_from_user */ - NULL, - NULL, - sb1_audio_trigger, - sb1_audio_set_speed, - sb1_audio_set_bits, - sb1_audio_set_channels + owner: THIS_MODULE, + open: sb_audio_open, + close: sb_audio_close, + output_block: sb_set_output_parms, + start_input: sb_set_input_parms, + prepare_for_input: sb1_audio_prepare_for_input, + prepare_for_output: sb1_audio_prepare_for_output, + halt_io: sb1_audio_halt_xfer, + trigger: sb1_audio_trigger, + set_speed: sb1_audio_set_speed, + set_bits: sb1_audio_set_bits, + set_channels: sb1_audio_set_channels }; static struct audio_driver sb20_audio_driver = /* SB2.0 */ { - sb_audio_open, - sb_audio_close, - sb_set_output_parms, - sb_set_input_parms, - NULL, - sb1_audio_prepare_for_input, - sb1_audio_prepare_for_output, - sb1_audio_halt_xfer, - NULL, /* local_qlen */ - NULL, /* copy_from_user */ - NULL, - NULL, - sb20_audio_trigger, - sb1_audio_set_speed, - sb1_audio_set_bits, - sb1_audio_set_channels + owner: THIS_MODULE, + open: sb_audio_open, + close: sb_audio_close, + output_block: sb_set_output_parms, + start_input: sb_set_input_parms, + prepare_for_input: sb1_audio_prepare_for_input, + prepare_for_output: sb1_audio_prepare_for_output, + halt_io: sb1_audio_halt_xfer, + trigger: sb20_audio_trigger, + set_speed: sb1_audio_set_speed, + set_bits: sb1_audio_set_bits, + set_channels: sb1_audio_set_channels }; static struct audio_driver sb201_audio_driver = /* SB2.01 */ { - sb_audio_open, - sb_audio_close, - sb_set_output_parms, - sb_set_input_parms, - NULL, - sb1_audio_prepare_for_input, - sb1_audio_prepare_for_output, - sb1_audio_halt_xfer, - NULL, /* local_qlen */ - NULL, /* copy_from_user */ - NULL, - NULL, - sb20_audio_trigger, - sb201_audio_set_speed, - sb1_audio_set_bits, - sb1_audio_set_channels + owner: THIS_MODULE, + open: sb_audio_open, + close: sb_audio_close, + output_block: sb_set_output_parms, + start_input: sb_set_input_parms, + prepare_for_input: sb1_audio_prepare_for_input, + prepare_for_output: sb1_audio_prepare_for_output, + halt_io: sb1_audio_halt_xfer, + trigger: sb20_audio_trigger, + set_speed: sb201_audio_set_speed, + set_bits: sb1_audio_set_bits, + set_channels: sb1_audio_set_channels }; static struct audio_driver sbpro_audio_driver = /* SB Pro */ { - sb_audio_open, - sb_audio_close, - sb_set_output_parms, - sb_set_input_parms, - NULL, - sbpro_audio_prepare_for_input, - sbpro_audio_prepare_for_output, - sb1_audio_halt_xfer, - NULL, /* local_qlen */ - NULL, /* copy_from_user */ - NULL, - NULL, - sb20_audio_trigger, - sbpro_audio_set_speed, - sb1_audio_set_bits, - sbpro_audio_set_channels + owner: THIS_MODULE, + open: sb_audio_open, + close: sb_audio_close, + output_block: sb_set_output_parms, + start_input: sb_set_input_parms, + prepare_for_input: sbpro_audio_prepare_for_input, + prepare_for_output: sbpro_audio_prepare_for_output, + halt_io: sb1_audio_halt_xfer, + trigger: sb20_audio_trigger, + set_speed: sbpro_audio_set_speed, + set_bits: sb1_audio_set_bits, + set_channels: sbpro_audio_set_channels }; static struct audio_driver jazz16_audio_driver = /* Jazz16 and SM Wave */ { - sb_audio_open, - sb_audio_close, - sb_set_output_parms, - sb_set_input_parms, - NULL, - sbpro_audio_prepare_for_input, - sbpro_audio_prepare_for_output, - sb1_audio_halt_xfer, - NULL, /* local_qlen */ - NULL, /* copy_from_user */ - NULL, - NULL, - sb20_audio_trigger, - jazz16_audio_set_speed, - sb16_audio_set_bits, - sbpro_audio_set_channels + owner: THIS_MODULE, + open: sb_audio_open, + close: sb_audio_close, + output_block: sb_set_output_parms, + start_input: sb_set_input_parms, + prepare_for_input: sbpro_audio_prepare_for_input, + prepare_for_output: sbpro_audio_prepare_for_output, + halt_io: sb1_audio_halt_xfer, + trigger: sb20_audio_trigger, + set_speed: jazz16_audio_set_speed, + set_bits: sb16_audio_set_bits, + set_channels: sbpro_audio_set_channels }; static struct audio_driver sb16_audio_driver = /* SB16 */ { - sb_audio_open, - sb_audio_close, - sb_set_output_parms, - sb_set_input_parms, - NULL, - sb16_audio_prepare_for_input, - sb16_audio_prepare_for_output, - sb1_audio_halt_xfer, - NULL, /* local_qlen */ - sb16_copy_from_user, /* copy_from_user */ - NULL, - NULL, - sb16_audio_trigger, - sb16_audio_set_speed, - sb16_audio_set_bits, - sbpro_audio_set_channels, - NULL, - NULL, - sb16_audio_mmap + owner: THIS_MODULE, + open: sb_audio_open, + close: sb_audio_close, + output_block: sb_set_output_parms, + start_input: sb_set_input_parms, + prepare_for_input: sb16_audio_prepare_for_input, + prepare_for_output: sb16_audio_prepare_for_output, + halt_io: sb1_audio_halt_xfer, + copy_user: sb16_copy_from_user, + trigger: sb16_audio_trigger, + set_speed: sb16_audio_set_speed, + set_bits: sb16_audio_set_bits, + set_channels: sbpro_audio_set_channels, + mmap: sb16_audio_mmap }; -void sb_audio_init(sb_devc * devc, char *name) +void sb_audio_init(sb_devc * devc, char *name, struct module *owner) { int audio_flags = 0; int format_mask = AFMT_U8; @@ -1111,6 +1086,9 @@ driver = &sbpro_audio_driver; } + if (owner) + driver->owner = owner; + if ((devc->dev = sound_install_audiodrv(AUDIO_DRIVER_VERSION, name,driver, sizeof(struct audio_driver), audio_flags, format_mask, devc, diff -uNr linux.orig/drivers/sound/sb_card.c linux/drivers/sound/sb_card.c --- linux.orig/drivers/sound/sb_card.c Mon Jun 19 22:42:41 2000 +++ linux/drivers/sound/sb_card.c Wed Aug 9 18:42:47 2000 @@ -54,7 +54,6 @@ #include <linux/isapnp.h> #include "sound_config.h" -#include "soundmodule.h" #include "sb_mixer.h" #include "sb.h" @@ -88,7 +87,7 @@ static void __init attach_sb_card(struct address_info *hw_config) { - if(!sb_dsp_init(hw_config)) + if(!sb_dsp_init(hw_config, THIS_MODULE)) hw_config->slots[0] = -1; } @@ -684,11 +683,9 @@ if (probe_sbmpu(&cfg_mpu[card])) sbmpu[card] = 1; if (sbmpu[card]) - attach_sbmpu(&cfg_mpu[card]); + attach_sbmpu(&cfg_mpu[card], THIS_MODULE); } - SOUND_LOCK; - if(isapnp) printk(KERN_NOTICE "sb: %d Soundblaster PnP card(s) found.\n", sb_cards_num); @@ -718,7 +715,6 @@ opl_dev[i]->deactivate(opl_dev[i]); #endif } - SOUND_LOCK_END; } module_init(init_sb); diff -uNr linux.orig/drivers/sound/sb_common.c linux/drivers/sound/sb_common.c --- linux.orig/drivers/sound/sb_common.c Wed Jul 5 19:56:14 2000 +++ linux/drivers/sound/sb_common.c Wed Aug 9 18:42:47 2000 @@ -634,7 +634,7 @@ return 1; } -int sb_dsp_init(struct address_info *hw_config) +int sb_dsp_init(struct address_info *hw_config, struct module *owner) { sb_devc *devc; char name[100]; @@ -812,10 +812,10 @@ if (!(devc->caps & SB_NO_MIXER)) if (devc->major == 3 || devc->major == 4) - sb_mixer_init(devc); + sb_mixer_init(devc, owner); if (!(devc->caps & SB_NO_MIDI)) - sb_dsp_midi_init(devc); + sb_dsp_midi_init(devc, owner); if (hw_config->name == NULL) hw_config->name = "Sound Blaster (8 BIT/MONO ONLY)"; @@ -861,7 +861,7 @@ if (sound_alloc_dma(devc->dma16, "SoundBlaster16")) printk(KERN_WARNING "Sound Blaster: can't allocate 16 bit DMA channel %d.\n", devc->dma16); } - sb_audio_init(devc, name); + sb_audio_init(devc, name, owner); hw_config->slots[0]=devc->dev; } else @@ -1190,18 +1190,18 @@ return 1; } -void attach_sbmpu(struct address_info *hw_config) +void attach_sbmpu(struct address_info *hw_config, struct module *owner) { if (last_sb->model == MDL_ESS) { #if defined(CONFIG_SOUND_MPU401) - attach_mpu401(hw_config); + attach_mpu401(hw_config, owner); if (last_sb->irq == -hw_config->irq) { last_sb->midi_irq_cookie=(void *)hw_config->slots[1]; } #endif return; } - attach_uart401(hw_config); + attach_uart401(hw_config, THIS_MODULE); last_sb->midi_irq_cookie=midi_devs[hw_config->slots[4]]->devc; } diff -uNr linux.orig/drivers/sound/sb_ess.c linux/drivers/sound/sb_ess.c --- linux.orig/drivers/sound/sb_ess.c Mon Mar 27 21:02:55 2000 +++ linux/drivers/sound/sb_ess.c Wed Aug 9 18:42:47 2000 @@ -707,22 +707,18 @@ static struct audio_driver ess_audio_driver = /* ESS ES688/1688 */ { - sb_audio_open, - sb_audio_close, - ess_set_output_parms, - ess_set_input_parms, - NULL, - ess_audio_prepare_for_input, - ess_audio_prepare_for_output, - ess_audio_halt_xfer, - NULL, /* local_qlen */ - NULL, /* copy_from_user */ - NULL, - NULL, - ess_audio_trigger, - ess_audio_set_speed, - ess_audio_set_bits, - ess_audio_set_channels + owner: THIS_MODULE, + open: sb_audio_open, + close: sb_audio_close, + output_block: ess_set_output_parms, + start_input: ess_set_input_parms, + prepare_for_input: ess_audio_prepare_for_input, + prepare_for_output: ess_audio_prepare_for_output, + halt_io: ess_audio_halt_xfer, + trigger: ess_audio_trigger, + set_speed: ess_audio_set_speed, + set_bits: ess_audio_set_bits, + set_channels: ess_audio_set_channels }; /* diff -uNr linux.orig/drivers/sound/sb_midi.c linux/drivers/sound/sb_midi.c --- linux.orig/drivers/sound/sb_midi.c Mon Feb 28 16:18:20 2000 +++ linux/drivers/sound/sb_midi.c Wed Aug 9 18:42:47 2000 @@ -147,24 +147,19 @@ static struct midi_operations sb_midi_operations = { - { - "Sound Blaster", 0, 0, SNDCARD_SB - }, - &std_midi_synth, - {0}, - sb_midi_open, - sb_midi_close, - sb_midi_ioctl, - sb_midi_out, - sb_midi_start_read, - sb_midi_end_read, - NULL, - NULL, - NULL, - NULL + owner: THIS_MODULE, + info: {"Sound Blaster", 0, 0, SNDCARD_SB}, + converter: &std_midi_synth, + in_info: {0}, + open: sb_midi_open, + close: sb_midi_close, + ioctl: sb_midi_ioctl, + outputc: sb_midi_out, + start_read: sb_midi_start_read, + end_read: sb_midi_end_read, }; -void sb_dsp_midi_init(sb_devc * devc) +void sb_dsp_midi_init(sb_devc * devc, struct module *owner) { int dev; @@ -189,6 +184,9 @@ memcpy((char *) midi_devs[dev], (char *) &sb_midi_operations, sizeof(struct midi_operations)); + if (owner) + midi_devs[dev]->owner = owner; + midi_devs[dev]->devc = devc; diff -uNr linux.orig/drivers/sound/sb_mixer.c linux/drivers/sound/sb_mixer.c --- linux.orig/drivers/sound/sb_mixer.c Mon Mar 27 21:02:55 2000 +++ linux/drivers/sound/sb_mixer.c Wed Aug 9 18:42:47 2000 @@ -626,16 +626,18 @@ static struct mixer_operations sb_mixer_operations = { - "SB", - "Sound Blaster", - sb_mixer_ioctl + owner: THIS_MODULE, + id: "SB", + name: "Sound Blaster", + ioctl: sb_mixer_ioctl }; static struct mixer_operations als007_mixer_operations = { - "ALS007", - "Avance ALS-007", - sb_mixer_ioctl + owner: THIS_MODULE, + id: "ALS007", + name: "Avance ALS-007", + ioctl: sb_mixer_ioctl }; static void sb_mixer_reset(sb_devc * devc) @@ -658,7 +660,7 @@ }; } -int sb_mixer_init(sb_devc * devc) +int sb_mixer_init(sb_devc * devc, struct module *owner) { int mixer_type = 0; int m; @@ -735,6 +737,10 @@ memcpy ((char *) mixer_devs[m], (char *) &als007_mixer_operations, sizeof (struct mixer_operations)); mixer_devs[m]->devc = devc; + + if (owner) + mixer_devs[m]->owner = owner; + devc->my_mixerdev = m; sb_mixer_reset(devc); return 1; diff -uNr linux.orig/drivers/sound/sequencer.c linux/drivers/sound/sequencer.c --- linux.orig/drivers/sound/sequencer.c Fri Apr 21 22:29:03 2000 +++ linux/drivers/sound/sequencer.c Wed Aug 9 18:42:47 2000 @@ -1068,6 +1068,9 @@ if (synth_devs[i]==NULL) continue; + if (synth_devs[i]->owner) + __MOD_INC_USE_COUNT (synth_devs[i]->owner); + if ((tmp = synth_devs[i]->open(i, mode)) < 0) { printk(KERN_WARNING "Sequencer: Warning! Cannot open synth device #%d (%d)\n", i, tmp); @@ -1101,6 +1104,9 @@ for (i = 0; i < max_mididev; i++) if (!midi_opened[i] && midi_devs[i]) { + if (midi_devs[i]->owner) + __MOD_INC_USE_COUNT (midi_devs[i]->owner); + if ((retval = midi_devs[i]->open(i, mode, sequencer_midi_input, sequencer_midi_output)) >= 0) { @@ -1108,8 +1114,12 @@ } } } - if (seq_mode == SEQ_2) + + if (seq_mode == SEQ_2) { + if (tmr->owner) + __MOD_INC_USE_COUNT (tmr->owner); tmr->open(tmr_no, seq_mode); + } init_waitqueue_head(&seq_sleeper); init_waitqueue_head(&midi_sleeper); @@ -1191,6 +1201,9 @@ { synth_devs[i]->close(i); + if (synth_devs[i]->owner) + __MOD_DEC_USE_COUNT (synth_devs[i]->owner); + if (synth_devs[i]->midi_dev) midi_opened[synth_devs[i]->midi_dev] = 0; } @@ -1198,12 +1211,18 @@ for (i = 0; i < max_mididev; i++) { - if (midi_opened[i]) + if (midi_opened[i]) { midi_devs[i]->close(i); + if (midi_devs[i]->owner) + __MOD_DEC_USE_COUNT (midi_devs[i]->owner); + } } - if (seq_mode == SEQ_2) + if (seq_mode == SEQ_2) { tmr->close(tmr_no); + if (tmr->owner) + __MOD_DEC_USE_COUNT (tmr->owner); + } if (obsolete_api_used) printk(KERN_WARNING "/dev/music: Obsolete (4 byte) API was used by %s\n", current->comm); diff -uNr linux.orig/drivers/sound/sgalaxy.c linux/drivers/sound/sgalaxy.c --- linux.orig/drivers/sound/sgalaxy.c Tue Mar 7 22:40:24 2000 +++ linux/drivers/sound/sgalaxy.c Wed Aug 9 18:42:47 2000 @@ -22,8 +22,6 @@ #include <linux/module.h> #include "sound_config.h" -#include "soundmodule.h" - #include "ad1848.h" static void sleep( unsigned howlong ) @@ -115,7 +113,7 @@ request_region( ai->ai_sgbase, 0x10, "SoundGalaxy SB" ); - attach_ms_sound( ai ); + attach_ms_sound(ai, THIS_MODULE); n=ai->slots[0]; if (n!=-1 && audio_devs[n]->mixer_dev != -1 ) { @@ -163,14 +161,12 @@ attach_sgalaxy(&cfg); - SOUND_LOCK; return 0; } static void __exit cleanup_sgalaxy(void) { unload_sgalaxy(&cfg); - SOUND_LOCK_END; } module_init(init_sgalaxy); diff -uNr linux.orig/drivers/sound/skeleton.c linux/drivers/sound/skeleton.c --- linux.orig/drivers/sound/skeleton.c Mon Jun 19 22:42:41 2000 +++ linux/drivers/sound/skeleton.c Wed Aug 9 18:42:47 2000 @@ -27,7 +27,6 @@ #include <asm/io.h> #include "sound_config.h" -#include "soundmodule.h" /* * Define our PCI vendor ID here @@ -137,7 +136,13 @@ */ mss_data[cards].slots[3] = ad1848_init("MyCard MSS 16bit", - mssbase, mss_data[cards].irq); + mssbase, + mss_data[cards].irq, + mss_data[cards].dma, + mss_data[cards].dma, + 0, + 0, + THIS_MODULE); cards++; return 1; @@ -187,17 +192,13 @@ printk(KERN_ERR "No "CARD_NAME" cards found.\n"); return -ENODEV; } - /* - * Binds us to the sound subsystem - */ - SOUND_LOCK; + return 0; } /* * This is called when it is removed. It will only be removed - * when its use count is 0. For sound the SOUND_LOCK/SOUND_UNLOCK - * macros hide the entire work for this. + * when its use count is 0. */ void cleanup_module(void) @@ -218,9 +219,5 @@ */ sound_unload_audiodevice(mss_data[i].slots[3]); } - /* - * Final clean up with the sound layer - */ - SOUND_LOCK_END; } diff -uNr linux.orig/drivers/sound/softoss.c linux/drivers/sound/softoss.c --- linux.orig/drivers/sound/softoss.c Tue Mar 7 22:40:24 2000 +++ linux/drivers/sound/softoss.c Wed Aug 9 18:42:47 2000 @@ -32,7 +32,6 @@ #define NO_SAMPLE 0xffff #include "sound_config.h" -#include "soundmodule.h" #include "softoss.h" #include <linux/ultrasound.h> @@ -1394,27 +1393,28 @@ static struct synth_operations softsyn_operations = { - "SoftOSS", - &softsyn_info, - 0, - SYNTH_TYPE_SAMPLE, - 0, - softsyn_open, - softsyn_close, - softsyn_ioctl, - softsyn_kill_note, - softsyn_start_note, - softsyn_set_instr, - softsyn_reset, - softsyn_hw_control, - softsyn_load_patch, - softsyn_aftertouch, - softsyn_controller, - softsyn_panning, - softsyn_volume_method, - softsyn_bender, - softsyn_alloc_voice, - softsyn_setup_voice + owner: THIS_MODULE, + id: "SoftOSS", + info: &softsyn_info, + midi_dev: 0, + synth_type: SYNTH_TYPE_SAMPLE, + synth_subtype: 0, + open: softsyn_open, + close: softsyn_close, + ioctl: softsyn_ioctl, + kill_note: softsyn_kill_note, + start_note: softsyn_start_note, + set_instr: softsyn_set_instr, + reset: softsyn_reset, + hw_control: softsyn_hw_control, + load_patch: softsyn_load_patch, + aftertouch: softsyn_aftertouch, + controller: softsyn_controller, + panning: softsyn_panning, + volume_method: softsyn_volume_method, + bender: softsyn_bender, + alloc_voice: softsyn_alloc_voice, + setup_voice: softsyn_setup_voice }; /* @@ -1517,7 +1517,7 @@ if (!probe_softsyn(&cfg)) return -ENODEV; attach_softsyn_card(&cfg); - SOUND_LOCK; + return 0; } @@ -1526,7 +1526,6 @@ unload_softsyn(&cfg); sound_unload_synthdev(devc->synthdev); sound_unload_timerdev(devc->timerdev); - SOUND_LOCK_END; } module_init(init_softoss); diff -uNr linux.orig/drivers/sound/sound_syms.c linux/drivers/sound/sound_syms.c --- linux.orig/drivers/sound/sound_syms.c Wed Jul 5 19:56:14 2000 +++ linux/drivers/sound/sound_syms.c Wed Aug 9 18:42:47 2000 @@ -52,11 +52,5 @@ extern int softoss_dev; EXPORT_SYMBOL(softoss_dev); -/* Locking */ -extern struct notifier_block *sound_locker; -extern void sound_notifier_chain_register(struct notifier_block *); -EXPORT_SYMBOL(sound_locker); -EXPORT_SYMBOL(sound_notifier_chain_register); - MODULE_DESCRIPTION("OSS Sound subsystem"); MODULE_AUTHOR("Hannu Savolainen, et al."); diff -uNr linux.orig/drivers/sound/sound_timer.c linux/drivers/sound/sound_timer.c --- linux.orig/drivers/sound/sound_timer.c Mon Feb 28 16:18:20 2000 +++ linux/drivers/sound/sound_timer.c Wed Aug 9 18:42:47 2000 @@ -264,15 +264,16 @@ static struct sound_timer_operations sound_timer = { - {"Sound Timer", 0}, - 1, /* Priority */ - 0, /* Local device link */ - timer_open, - timer_close, - timer_event, - timer_get_time, - timer_ioctl, - timer_arm + owner: THIS_MODULE, + info: {"Sound Timer", 0}, + priority: 1, /* Priority */ + devlink: 0, /* Local device link */ + open: timer_open, + close: timer_close, + event: timer_event, + get_time: timer_get_time, + ioctl: timer_ioctl, + arm_timer: timer_arm }; void sound_timer_interrupt(void) diff -uNr linux.orig/drivers/sound/soundcard.c linux/drivers/sound/soundcard.c --- linux.orig/drivers/sound/soundcard.c Thu Jul 13 06:58:43 2000 +++ linux/drivers/sound/soundcard.c Wed Aug 9 18:42:47 2000 @@ -43,11 +43,6 @@ #include <linux/delay.h> #include <linux/proc_fs.h> #include <linux/smp_lock.h> -#include <linux/notifier.h> - - -struct notifier_block *sound_locker=(struct notifier_block *)0; -static int lock_depth = 0; /* * This ought to be moved into include/asm/dma.h @@ -78,7 +73,6 @@ #define DMA_MAP_BUSY 2 -static int in_use = 0; /* Total # of open devices */ unsigned long seq_time = 0; /* Time for /dev/sequencer */ /* @@ -221,7 +215,7 @@ DEB(printk("sound_open(dev=%d)\n", dev)); if ((dev >= SND_NDEVS) || (dev < 0)) { - /* printk(KERN_ERR "Invalid minor device %d\n", dev);*/ + printk(KERN_ERR "Invalid minor device %d\n", dev); return -ENXIO; } switch (dev & 0x0f) { @@ -234,6 +228,9 @@ } if (dev && (dev >= num_mixers || mixer_devs[dev] == NULL)) return -ENXIO; + + if (mixer_devs[dev]->owner) + __MOD_INC_USE_COUNT (mixer_devs[dev]->owner); break; case SND_DEV_SEQ: @@ -258,10 +255,6 @@ printk(KERN_ERR "Invalid minor device %d\n", dev); return -ENXIO; } - in_use++; - - notifier_call_chain(&sound_locker, 1, 0); - lock_depth++; return 0; } @@ -274,6 +267,8 @@ DEB(printk("sound_release(dev=%d)\n", dev)); switch (dev & 0x0f) { case SND_DEV_CTL: + if (mixer_devs[dev]->owner) + __MOD_DEC_USE_COUNT (mixer_devs[dev]->owner); break; case SND_DEV_SEQ: @@ -294,10 +289,6 @@ default: printk(KERN_ERR "Sound error: Releasing unknown device 0x%02x\n", dev); } - in_use--; - - notifier_call_chain(&sound_locker, 0, 0); - lock_depth--; unlock_kernel(); return 0; @@ -811,27 +802,3 @@ printk("\n"); #endif } - -/* - * Module and lock management - */ - -/* - * When a sound module is registered we need to bring it to the current - * lock level... - */ - -void sound_notifier_chain_register(struct notifier_block *bl) -{ - int ct=0; - - notifier_chain_register(&sound_locker, bl); - /* - * Normalise the lock count by calling the entry directly. We - * have to call the module as it owns its own use counter - */ - while(ct<lock_depth) { - bl->notifier_call(bl, 1, 0); - ct++; - } -} diff -uNr linux.orig/drivers/sound/soundmodule.h linux/drivers/sound/soundmodule.h --- linux.orig/drivers/sound/soundmodule.h Thu May 11 22:45:35 2000 +++ linux/drivers/sound/soundmodule.h Thu Jan 1 01:00:00 1970 @@ -1,29 +0,0 @@ -#ifndef _SOUNDMODULE_H -#define _SOUNDMODULE_H - -#include <linux/notifier.h> -#include <linux/module.h> - -extern struct notifier_block *sound_locker; -extern void sound_notifier_chain_register(struct notifier_block *); - -#define SOUND_LOCK sound_notifier_chain_register(&sound_notifier); -#define SOUND_LOCK_END notifier_chain_unregister(&sound_locker, &sound_notifier) - -static int my_notifier_call(struct notifier_block *b, unsigned long foo, void *bar) -{ - if(foo) - MOD_INC_USE_COUNT; - else - MOD_DEC_USE_COUNT; - return NOTIFY_DONE; -} - -static struct notifier_block sound_notifier= -{ - my_notifier_call, - (void *)0, - 0 -}; - -#endif /* _SOUNDMODULE_H */ diff -uNr linux.orig/drivers/sound/sscape.c linux/drivers/sound/sscape.c --- linux.orig/drivers/sound/sscape.c Wed Aug 9 14:31:50 2000 +++ linux/drivers/sound/sscape.c Wed Aug 9 18:42:47 2000 @@ -20,7 +20,6 @@ #include <linux/module.h> #include "sound_config.h" -#include "soundmodule.h" #include "sound_firmware.h" #include <linux/types.h> @@ -728,7 +727,7 @@ hw_config->name = "SoundScape"; hw_config->irq *= -1; /* Negative value signals IRQ sharing */ - attach_mpu401(hw_config); + attach_mpu401(hw_config, THIS_MODULE); hw_config->irq *= -1; /* Restore it */ if (hw_config->slots[1] != -1) /* The MPU driver installed itself */ @@ -1378,21 +1377,16 @@ if (hw_config->irq == devc->irq) printk(KERN_WARNING "soundscape: Warning! The WSS mode can't share IRQ with MIDI\n"); - if (! sscape_is_pnp ) - hw_config->slots[0] = ad1848_init("SoundScape", hw_config->io_base, - hw_config->irq, - hw_config->dma, - hw_config->dma, - 0, - devc->osp); - - else - hw_config->slots[0] = ad1848_init("SoundScape PNP", hw_config->io_base, - hw_config->irq, - hw_config->dma, - hw_config->dma, - 0, - devc->osp); + hw_config->slots[0] = ad1848_init( + sscape_is_pnp ? "SoundScape" : "SoundScape PNP", + hw_config->io_base, + hw_config->irq, + hw_config->dma, + hw_config->dma, + 0, + devc->osp, + THIS_MODULE); + if (hw_config->slots[0] != -1) /* The AD1848 driver installed itself */ { @@ -1497,7 +1491,7 @@ if (mss) attach_ss_ms_sound(&cfg); - SOUND_LOCK; + return 0; } @@ -1505,7 +1499,6 @@ { if (mss) unload_ss_ms_sound(&cfg); - SOUND_LOCK_END; unload_sscape(&cfg_mpu); } diff -uNr linux.orig/drivers/sound/sys_timer.c linux/drivers/sound/sys_timer.c --- linux.orig/drivers/sound/sys_timer.c Wed May 3 10:45:18 2000 +++ linux/drivers/sound/sys_timer.c Wed Aug 9 18:42:47 2000 @@ -274,13 +274,14 @@ struct sound_timer_operations default_sound_timer = { - {"System clock", 0}, - 0, /* Priority */ - 0, /* Local device link */ - def_tmr_open, - def_tmr_close, - def_tmr_event, - def_tmr_get_time, - def_tmr_ioctl, - def_tmr_arm + owner: THIS_MODULE, + info: {"System clock", 0}, + priority: 0, /* Priority */ + devlink: 0, /* Local device link */ + open: def_tmr_open, + close: def_tmr_close, + event: def_tmr_event, + get_time: def_tmr_get_time, + ioctl: def_tmr_ioctl, + arm_timer: def_tmr_arm }; diff -uNr linux.orig/drivers/sound/trix.c linux/drivers/sound/trix.c --- linux.orig/drivers/sound/trix.c Thu May 11 01:56:43 2000 +++ linux/drivers/sound/trix.c Wed Aug 9 18:42:47 2000 @@ -21,7 +21,6 @@ #include <linux/module.h> #include "sound_config.h" -#include "soundmodule.h" #include "sb.h" #include "sound_firmware.h" @@ -259,7 +258,8 @@ dma1, dma2, 0, - hw_config->osp); + hw_config->osp, + THIS_MODULE); request_region(hw_config->io_base, 4, "MSS config"); if (num_mixers > old_num_mixers) /* Mixer got installed */ @@ -332,7 +332,7 @@ old_quiet = sb_be_quiet; sb_be_quiet = 1; - sb_dsp_init(hw_config); + sb_dsp_init(hw_config, THIS_MODULE); sb_be_quiet = old_quiet; } @@ -340,7 +340,7 @@ static void __init attach_trix_mpu(struct address_info *hw_config) { hw_config->name = "AudioTrix Pro"; - attach_uart401(hw_config); + attach_uart401(hw_config, THIS_MODULE); } static int __init probe_trix_mpu(struct address_info *hw_config) @@ -515,7 +515,7 @@ if (mpu) attach_trix_mpu(&cfg_mpu); } - SOUND_LOCK; + return 0; } @@ -528,7 +528,6 @@ if (mpu) unload_trix_mpu(&cfg_mpu); unload_trix_wss(&cfg); - SOUND_LOCK_END; } module_init(init_trix); diff -uNr linux.orig/drivers/sound/uart401.c linux/drivers/sound/uart401.c --- linux.orig/drivers/sound/uart401.c Tue Mar 7 22:40:24 2000 +++ linux/drivers/sound/uart401.c Wed Aug 9 18:42:47 2000 @@ -24,7 +24,6 @@ #include <linux/module.h> #include "sound_config.h" -#include "soundmodule.h" #include "mpu401.h" @@ -206,21 +205,17 @@ static struct midi_operations uart401_operations = { - { - "MPU-401 (UART) MIDI", 0, 0, SNDCARD_MPU401 - }, - &std_midi_synth, - {0}, - uart401_open, - uart401_close, - NULL, /* ioctl */ - uart401_out, - uart401_start_read, - uart401_end_read, - uart401_kick, - NULL, - uart401_buffer_status, - NULL + owner: THIS_MODULE, + info: {"MPU-401 (UART) MIDI", 0, 0, SNDCARD_MPU401}, + converter: &std_midi_synth, + in_info: {0}, + open: uart401_open, + close: uart401_close, + outputc: uart401_out, + start_read: uart401_start_read, + end_read: uart401_end_read, + kick: uart401_kick, + buffer_status: uart401_buffer_status, }; static void enter_uart_mode(uart401_devc * devc) @@ -246,7 +241,7 @@ restore_flags(flags); } -void attach_uart401(struct address_info *hw_config) +void attach_uart401(struct address_info *hw_config, struct module *owner) { uart401_devc *devc; char *name = "MPU-401 (UART) MIDI"; @@ -311,6 +306,9 @@ memcpy((char *) midi_devs[devc->my_dev], (char *) &uart401_operations, sizeof(struct midi_operations)); + if (owner) + midi_devs[devc->my_dev]->owner = owner; + midi_devs[devc->my_dev]->devc = devc; midi_devs[devc->my_dev]->converter = (struct synth_operations *)kmalloc(sizeof(struct synth_operations), GFP_KERNEL); if (midi_devs[devc->my_dev]->converter == NULL) @@ -473,9 +471,9 @@ printk(KERN_INFO "MPU-401 UART driver Copyright (C) Hannu Savolainen 1993-1997"); if (probe_uart401(&cfg_mpu) == 0) return -ENODEV; - attach_uart401(&cfg_mpu); + attach_uart401(&cfg_mpu, THIS_MODULE); } - SOUND_LOCK; + return 0; } @@ -483,7 +481,6 @@ { if (cfg_mpu.io_base != -1 && cfg_mpu.irq != -1) unload_uart401(&cfg_mpu); - SOUND_LOCK_END; } module_init(init_uart401); diff -uNr linux.orig/drivers/sound/uart6850.c linux/drivers/sound/uart6850.c --- linux.orig/drivers/sound/uart6850.c Wed May 3 10:45:18 2000 +++ linux/drivers/sound/uart6850.c Wed Aug 9 18:46:58 2000 @@ -26,7 +26,6 @@ */ #include "sound_config.h" -#include "soundmodule.h" static int uart6850_base = 0x330; @@ -148,7 +147,6 @@ return -EBUSY; }; - MOD_INC_USE_COUNT; uart6850_cmd(UART_RESET); uart6850_input_loop(); midi_input_intr = input; @@ -165,7 +163,6 @@ uart6850_cmd(UART_MODE_ON); del_timer(&uart6850_timer); uart6850_opened = 0; - MOD_DEC_USE_COUNT; } static int uart6850_out(int dev, unsigned char midi_byte) @@ -234,18 +231,18 @@ static struct midi_operations uart6850_operations = { - {"6850 UART", 0, 0, SNDCARD_UART6850}, - &std_midi_synth, - {0}, - uart6850_open, - uart6850_close, - NULL, /* ioctl */ - uart6850_out, - uart6850_start_read, - uart6850_end_read, - uart6850_kick, - uart6850_command, - uart6850_buffer_status + owner: THIS_MODULE, + info: {"6850 UART", 0, 0, SNDCARD_UART6850}, + converter: &std_midi_synth, + in_info: {0}, + open: uart6850_open, + close: uart6850_close, + outputc: uart6850_out, + start_read: uart6850_start_read, + end_read: uart6850_end_read, + kick: uart6850_kick, + command: uart6850_command, + buffer_status: uart6850_buffer_status }; @@ -338,14 +335,12 @@ if (probe_uart6850(&cfg_mpu)) return -ENODEV; - SOUND_LOCK; return 0; } static void __exit cleanup_uart6850(void) { unload_uart6850(&cfg_mpu); - SOUND_LOCK_END; } module_init(init_uart6850); diff -uNr linux.orig/drivers/sound/v_midi.c linux/drivers/sound/v_midi.c --- linux.orig/drivers/sound/v_midi.c Tue Mar 7 22:40:24 2000 +++ linux/drivers/sound/v_midi.c Wed Aug 9 18:42:47 2000 @@ -23,7 +23,6 @@ #include <linux/module.h> #include "sound_config.h" -#include "soundmodule.h" #include "v_midi.h" @@ -136,36 +135,30 @@ static struct midi_operations v_midi_operations = { - {"Loopback MIDI Port 1", 0, 0, SNDCARD_VMIDI}, - &std_midi_synth, - {0}, - v_midi_open, - v_midi_close, - v_midi_ioctl, - v_midi_out, - v_midi_start_read, - v_midi_end_read, - NULL, - NULL, - NULL, - NULL + owner: THIS_MODULE, + info: {"Loopback MIDI Port 1", 0, 0, SNDCARD_VMIDI}, + converter: &std_midi_synth, + in_info: {0}, + open: v_midi_open, + close: v_midi_close, + ioctl: v_midi_ioctl, + outputc: v_midi_out, + start_read: v_midi_start_read, + end_read: v_midi_end_read, }; static struct midi_operations v_midi_operations2 = { - {"Loopback MIDI Port 2", 0, 0, SNDCARD_VMIDI}, - &std_midi_synth, - {0}, - v_midi_open, - v_midi_close, - v_midi_ioctl, - v_midi_out, - v_midi_start_read, - v_midi_end_read, - NULL, - NULL, - NULL, - NULL + owner: THIS_MODULE, + info: {"Loopback MIDI Port 2", 0, 0, SNDCARD_VMIDI}, + converter: &std_midi_synth, + in_info: {0}, + open: v_midi_open, + close: v_midi_close, + ioctl: v_midi_ioctl, + outputc: v_midi_out, + start_read: v_midi_start_read, + end_read: v_midi_end_read, }; /* @@ -284,15 +277,12 @@ return -ENODEV; attach_v_midi(&cfg); - SOUND_LOCK; - return 0; } static void __exit cleanup_vmidi(void) { unload_v_midi(&cfg); - SOUND_LOCK_END; } module_init(init_vmidi); diff -uNr linux.orig/drivers/sound/vidc.c linux/drivers/sound/vidc.c --- linux.orig/drivers/sound/vidc.c Mon Jun 26 21:04:42 2000 +++ linux/drivers/sound/vidc.c Wed Aug 9 18:42:47 2000 @@ -26,7 +26,6 @@ #include <asm/system.h> #include "sound_config.h" -#include "soundmodule.h" #include "vidc.h" #ifndef _SIOC_TYPE @@ -362,6 +361,7 @@ static struct audio_driver vidc_audio_driver = { + owner: THIS_MODULE, open: vidc_audio_open, close: vidc_audio_close, output_block: vidc_audio_output_block, @@ -377,6 +377,7 @@ }; static struct mixer_operations vidc_mixer_operations = { + owner: THIS_MODULE, id: "VIDC", name: "VIDCsound", ioctl: vidc_mixer_ioctl @@ -519,16 +520,12 @@ } static struct address_info cfg; -/* - * Note! Module use count is handled by SOUNDLOCK/SOUND_LOCK_END - */ static int __init init_vidc(void) { if (probe_vidc(&cfg) == 0) return -ENODEV; - SOUND_LOCK; attach_vidc(&cfg); return 0; @@ -537,7 +534,6 @@ static void __exit cleanup_vidc(void) { unload_vidc(&cfg); - SOUND_LOCK_END; } module_init(init_vidc); diff -uNr linux.orig/drivers/sound/waveartist.c linux/drivers/sound/waveartist.c --- linux.orig/drivers/sound/waveartist.c Mon Mar 13 04:39:39 2000 +++ linux/drivers/sound/waveartist.c Wed Aug 9 18:42:47 2000 @@ -42,7 +42,6 @@ #include <asm/hardware.h> #include <asm/system.h> -#include "soundmodule.h" #include "sound_config.h" #include "waveartist.h" @@ -801,22 +800,21 @@ } static struct audio_driver waveartist_audio_driver = { - waveartist_open, - waveartist_close, - waveartist_output_block, - waveartist_start_input, - waveartist_ioctl, - waveartist_prepare_for_input, - waveartist_prepare_for_output, - waveartist_halt, - NULL, - NULL, - waveartist_halt_input, - waveartist_halt_output, - waveartist_trigger, - waveartist_set_speed, - waveartist_set_bits, - waveartist_set_channels + owner: THIS_MODULE, + open: waveartist_open, + close: waveartist_close, + output_block: waveartist_output_block, + start_input: waveartist_start_input, + ioctl: waveartist_ioctl, + prepare_for_input: waveartist_prepare_for_input, + prepare_for_output: waveartist_prepare_for_output, + halt_io: waveartist_halt, + halt_input: waveartist_halt_input, + halt_output: waveartist_halt_output, + trigger: waveartist_trigger, + set_speed: waveartist_set_speed, + set_bits: waveartist_set_bits, + set_channels: waveartist_set_channels }; @@ -1186,9 +1184,10 @@ static struct mixer_operations waveartist_mixer_operations = { - "WaveArtist", - "WaveArtist NetWinder", - waveartist_mixer_ioctl + owner: THIS_MODULE, + id: "WaveArtist", + name: "WaveArtist NetWinder", + ioctl: waveartist_mixer_ioctl }; static int @@ -1794,16 +1793,13 @@ attach_waveartist(&cfg); attached = 1; - SOUND_LOCK; return 0; } static void __exit cleanup_waveartist(void) { - if (attached) { - SOUND_LOCK_END; + if (attached) unload_waveartist(&cfg); - } } module_init(init_waveartist); diff -uNr linux.orig/drivers/sound/wavfront.c linux/drivers/sound/wavfront.c --- linux.orig/drivers/sound/wavfront.c Thu Jul 13 06:58:43 2000 +++ linux/drivers/sound/wavfront.c Wed Aug 9 18:42:47 2000 @@ -78,7 +78,6 @@ #include <linux/delay.h> #include "sound_config.h" -#include "soundmodule.h" #include <linux/wavefront.h> @@ -2115,28 +2114,25 @@ static struct synth_operations wavefront_operations = { - "WaveFront", - &wavefront_info, - 0, - SYNTH_TYPE_SAMPLE, - SAMPLE_TYPE_WAVEFRONT, - wavefront_oss_open, - wavefront_oss_close, - wavefront_oss_ioctl, - - midi_synth_kill_note, - midi_synth_start_note, - midi_synth_set_instr, - midi_synth_reset, - NULL, /* hw_control */ - midi_synth_load_patch, - midi_synth_aftertouch, - midi_synth_controller, - midi_synth_panning, - NULL, /* volume method */ - midi_synth_bender, - NULL, /* alloc voice */ - midi_synth_setup_voice + owner: THIS_MODULE, + id: "WaveFront", + info: &wavefront_info, + midi_dev: 0, + synth_type: SYNTH_TYPE_SAMPLE, + synth_subtype: SAMPLE_TYPE_WAVEFRONT, + open: wavefront_oss_open, + close: wavefront_oss_close, + ioctl: wavefront_oss_ioctl, + kill_note: midi_synth_kill_note, + start_note: midi_synth_start_note, + set_instr: midi_synth_set_instr, + reset: midi_synth_reset, + load_patch: midi_synth_load_patch, + aftertouch: midi_synth_aftertouch, + controller: midi_synth_controller, + panning: midi_synth_panning, + bender: midi_synth_bender, + setup_voice: midi_synth_setup_voice }; #endif OSS_SUPPORT_SEQ @@ -3569,14 +3565,12 @@ return -EIO; } - SOUND_LOCK; return 0; } static void __exit cleanup_wavfront (void) { uninstall_wavefront (); - SOUND_LOCK_END; } module_init(init_wavfront); diff -uNr linux.orig/drivers/sound/wf_midi.c linux/drivers/sound/wf_midi.c --- linux.orig/drivers/sound/wf_midi.c Fri Mar 10 08:31:43 2000 +++ linux/drivers/sound/wf_midi.c Wed Aug 9 18:42:47 2000 @@ -51,7 +51,6 @@ #include <linux/init.h> #include "sound_config.h" -#include "soundmodule.h" #include <linux/wavefront.h> @@ -550,19 +549,16 @@ static struct midi_operations wf_mpu_midi_proto = { - {"WF-MPU MIDI", 0, MIDI_CAP_MPU401, SNDCARD_MPU401}, - NULL, /*converter*/ - {0}, /* in_info */ - wf_mpu_open, - wf_mpu_close, - wf_mpu_ioctl, - wf_mpu_out, - wf_mpu_start_read, - wf_mpu_end_read, - NULL, - NULL, - wf_mpu_buffer_status, - NULL + owner: THIS_MODULE, + info: {"WF-MPU MIDI", 0, MIDI_CAP_MPU401, SNDCARD_MPU401}, + in_info: {0}, /* in_info */ + open: wf_mpu_open, + close: wf_mpu_close, + ioctl: wf_mpu_ioctl, + outputc: wf_mpu_out, + start_read: wf_mpu_start_read, + end_read: wf_mpu_end_read, + buffer_status: wf_mpu_buffer_status, }; static struct synth_info wf_mpu_synth_info_proto = @@ -671,28 +667,27 @@ static struct synth_operations wf_mpu_synth_proto = { - "WaveFront (ICS2115)", - NULL, /* info field, filled in during configuration */ - 0, /* MIDI dev XXX should this be -1 ? */ - SYNTH_TYPE_MIDI, - SAMPLE_TYPE_WAVEFRONT, - wf_mpu_synth_open, - wf_mpu_synth_close, - wf_mpu_synth_ioctl, - midi_synth_kill_note, - midi_synth_start_note, - midi_synth_set_instr, - midi_synth_reset, - midi_synth_hw_control, - midi_synth_load_patch, - midi_synth_aftertouch, - midi_synth_controller, - midi_synth_panning, - NULL, - midi_synth_bender, - NULL, /* alloc */ - midi_synth_setup_voice, - midi_synth_send_sysex + owner: THIS_MODULE, + id: "WaveFront (ICS2115)", + info: NULL, /* info field, filled in during configuration */ + midi_dev: 0, /* MIDI dev XXX should this be -1 ? */ + synth_type: SYNTH_TYPE_MIDI, + synth_subtype: SAMPLE_TYPE_WAVEFRONT, + open: wf_mpu_synth_open, + close: wf_mpu_synth_close, + ioctl: wf_mpu_synth_ioctl, + kill_note: midi_synth_kill_note, + start_note: midi_synth_start_note, + set_instr: midi_synth_set_instr, + reset: midi_synth_reset, + hw_control: midi_synth_hw_control, + load_patch: midi_synth_load_patch, + aftertouch: midi_synth_aftertouch, + controller: midi_synth_controller, + panning: midi_synth_panning, + bender: midi_synth_bender, + setup_voice: midi_synth_setup_voice, + send_sysex: midi_synth_send_sysex }; static int diff -uNr linux.orig/drivers/sound/ymf_sb.c linux/drivers/sound/ymf_sb.c --- linux.orig/drivers/sound/ymf_sb.c Tue Jun 20 16:52:36 2000 +++ linux/drivers/sound/ymf_sb.c Wed Aug 9 18:42:47 2000 @@ -54,7 +54,6 @@ #include <asm/io.h> #include "sound_config.h" -#include "soundmodule.h" #include "sb.h" #include "724hwmcode.h" @@ -64,11 +63,6 @@ /* ---------------------------------------------------------------------- */ -#ifndef SOUND_LOCK -#define SOUND_LOCK do {} while (0) -#define SOUND_LOCK_END do {} while (0) -#endif - #ifndef PCI_VENDOR_ID_YAMAHA #define PCI_VENDOR_ID_YAMAHA 0x1073 #endif @@ -641,7 +635,7 @@ static void __init ymf7xxsb_attach_sb(struct address_info *hw_config) { - if(!sb_dsp_init(hw_config)) + if(!sb_dsp_init(hw_config, THIS_MODULE)) hw_config->slots[0] = -1; } @@ -784,7 +778,7 @@ ymf7xxsb_unload_sb (&sb_data[cards], 0); return -ENODEV; } - ymf7xxsb_attach_midi (&mpu_data[cards]); + ymf7xxsb_attach_midi (&mpu_data[cards], THIS_MODULE); } #endif @@ -804,11 +798,6 @@ { int i; - /* - * Binds us to the sound subsystem - */ - SOUND_LOCK; - if ( master_vol < 0 ) master_vol = 50; if ( master_vol > 100 ) master_vol = 100; @@ -816,10 +805,8 @@ ymfbase[i] = NULL; i = pci_module_init (&ymf7xxsb_driver); - if (i < 0) { - SOUND_LOCK_END; + if (i < 0) return i; - } printk (KERN_INFO PFX YMFSB_CARD_NAME " loaded\n"); @@ -853,10 +840,6 @@ free_iomaps(); - /* - * Final clean up with the sound layer - */ - SOUND_LOCK_END; } MODULE_AUTHOR("Daisuke Nagano, breeze.nagano@nifty.ne.jp");

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Tue Aug 15 2000 - 21:00:24 EST