X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=sound%2Fisa%2Fsb%2Fsb_common.c;h=3094f3852167c57585ff58418d3d92b45e8a1aea;hb=97bf2856c6014879bd04983a3e9dfcdac1e7fe85;hp=f36383a3f144c0568682da767a6deef941145057;hpb=5273a3df6485dc2ad6aa7ddd441b9a21970f003b;p=linux-2.6.git diff --git a/sound/isa/sb/sb_common.c b/sound/isa/sb/sb_common.c index f36383a3f..3094f3852 100644 --- a/sound/isa/sb/sb_common.c +++ b/sound/isa/sb/sb_common.c @@ -33,22 +33,19 @@ #include #include -#define chip_t sb_t - MODULE_AUTHOR("Jaroslav Kysela "); MODULE_DESCRIPTION("ALSA lowlevel driver for Sound Blaster cards"); MODULE_LICENSE("GPL"); -MODULE_CLASSES("{sound}"); #define BUSY_LOOPS 100000 #undef IO_DEBUG -int snd_sbdsp_command(sb_t *chip, unsigned char val) +int snd_sbdsp_command(struct snd_sb *chip, unsigned char val) { int i; #ifdef IO_DEBUG - snd_printk("command 0x%x\n", val); + snd_printk(KERN_DEBUG "command 0x%x\n", val); #endif for (i = BUSY_LOOPS; i; i--) if ((inb(SBP(chip, STATUS)) & 0x80) == 0) { @@ -59,7 +56,7 @@ int snd_sbdsp_command(sb_t *chip, unsigned char val) return 0; } -int snd_sbdsp_get_byte(sb_t *chip) +int snd_sbdsp_get_byte(struct snd_sb *chip) { int val; int i; @@ -67,7 +64,7 @@ int snd_sbdsp_get_byte(sb_t *chip) if (inb(SBP(chip, DATA_AVAIL)) & 0x80) { val = inb(SBP(chip, READ)); #ifdef IO_DEBUG - snd_printk("get_byte 0x%x\n", val); + snd_printk(KERN_DEBUG "get_byte 0x%x\n", val); #endif return val; } @@ -76,7 +73,7 @@ int snd_sbdsp_get_byte(sb_t *chip) return -ENODEV; } -int snd_sbdsp_reset(sb_t *chip) +int snd_sbdsp_reset(struct snd_sb *chip) { int i; @@ -95,7 +92,7 @@ int snd_sbdsp_reset(sb_t *chip) return -ENODEV; } -int snd_sbdsp_version(sb_t * chip) +static int snd_sbdsp_version(struct snd_sb * chip) { unsigned int result = -ENODEV; @@ -105,7 +102,7 @@ int snd_sbdsp_version(sb_t * chip) return result; } -static int snd_sbdsp_probe(sb_t * chip) +static int snd_sbdsp_probe(struct snd_sb * chip) { int version; int major, minor; @@ -157,7 +154,7 @@ static int snd_sbdsp_probe(sb_t * chip) str = "16"; break; default: - snd_printk("SB [0x%lx]: unknown DSP chip version %i.%i\n", + snd_printk(KERN_INFO "SB [0x%lx]: unknown DSP chip version %i.%i\n", chip->port, major, minor); return -ENODEV; } @@ -179,12 +176,10 @@ static int snd_sbdsp_probe(sb_t * chip) return 0; } -static int snd_sbdsp_free(sb_t *chip) +static int snd_sbdsp_free(struct snd_sb *chip) { - if (chip->res_port) { - release_resource(chip->res_port); - kfree_nocheck(chip->res_port); - } + if (chip->res_port) + release_and_free_resource(chip->res_port); if (chip->irq >= 0) free_irq(chip->irq, (void *) chip); #ifdef CONFIG_ISA @@ -197,34 +192,34 @@ static int snd_sbdsp_free(sb_t *chip) free_dma(chip->dma16); } #endif - snd_magic_kfree(chip); + kfree(chip); return 0; } -static int snd_sbdsp_dev_free(snd_device_t *device) +static int snd_sbdsp_dev_free(struct snd_device *device) { - sb_t *chip = snd_magic_cast(sb_t, device->device_data, return -ENXIO); + struct snd_sb *chip = device->device_data; return snd_sbdsp_free(chip); } -int snd_sbdsp_create(snd_card_t *card, +int snd_sbdsp_create(struct snd_card *card, unsigned long port, int irq, - irqreturn_t (*irq_handler)(int, void *, struct pt_regs *), + irq_handler_t irq_handler, int dma8, int dma16, unsigned short hardware, - sb_t **r_chip) + struct snd_sb **r_chip) { - sb_t *chip; + struct snd_sb *chip; int err; - static snd_device_ops_t ops = { + static struct snd_device_ops ops = { .dev_free = snd_sbdsp_dev_free, }; snd_assert(r_chip != NULL, return -EINVAL); *r_chip = NULL; - chip = snd_magic_kcalloc(sb_t, 0, GFP_KERNEL); + chip = kzalloc(sizeof(*chip), GFP_KERNEL); if (chip == NULL) return -ENOMEM; spin_lock_init(&chip->reg_lock); @@ -237,7 +232,7 @@ int snd_sbdsp_create(snd_card_t *card, chip->port = port; if (request_irq(irq, irq_handler, hardware == SB_HW_ALS4000 ? - SA_INTERRUPT | SA_SHIRQ : SA_INTERRUPT, + IRQF_SHARED : IRQF_DISABLED, "SoundBlaster", (void *) chip)) { snd_printk(KERN_ERR "sb: can't grab irq %d\n", irq); snd_sbdsp_free(chip); @@ -298,6 +293,10 @@ EXPORT_SYMBOL(snd_sbmixer_write); EXPORT_SYMBOL(snd_sbmixer_read); EXPORT_SYMBOL(snd_sbmixer_new); EXPORT_SYMBOL(snd_sbmixer_add_ctl); +#ifdef CONFIG_PM +EXPORT_SYMBOL(snd_sbmixer_suspend); +EXPORT_SYMBOL(snd_sbmixer_resume); +#endif /* * INIT part