diff options
Diffstat (limited to 'sound')
84 files changed, 538 insertions, 470 deletions
diff --git a/sound/Kconfig b/sound/Kconfig index e0d791a9845..9d77300746c 100644 --- a/sound/Kconfig +++ b/sound/Kconfig @@ -64,11 +64,11 @@ source "sound/arm/Kconfig" source "sound/mips/Kconfig" -# the following will depenend on the order of config. +# the following will depend on the order of config. # here assuming USB is defined before ALSA source "sound/usb/Kconfig" -# the following will depenend on the order of config. +# the following will depend on the order of config. # here assuming PCMCIA is defined before ALSA source "sound/pcmcia/Kconfig" @@ -93,4 +93,12 @@ endmenu endif +config AC97_BUS + tristate + help + This is used to avoid config and link hard dependencies between the + sound subsystem and other function drivers completely unrelated to + sound although they're sharing the AC97 bus. Concerned drivers + should "select" this. + endmenu diff --git a/sound/Makefile b/sound/Makefile index 5f6bef57e82..9aee54c4882 100644 --- a/sound/Makefile +++ b/sound/Makefile @@ -8,6 +8,9 @@ obj-$(CONFIG_DMASOUND) += oss/ obj-$(CONFIG_SND) += core/ i2c/ drivers/ isa/ pci/ ppc/ arm/ synth/ usb/ sparc/ parisc/ pcmcia/ mips/ obj-$(CONFIG_SND_AOA) += aoa/ +# This one must be compilable even if sound is configured out +obj-$(CONFIG_AC97_BUS) += ac97_bus.o + ifeq ($(CONFIG_SND),y) obj-y += last.o endif diff --git a/sound/pci/ac97/ac97_bus.c b/sound/ac97_bus.c index 66de2c2f155..66de2c2f155 100644 --- a/sound/pci/ac97/ac97_bus.c +++ b/sound/ac97_bus.c diff --git a/sound/aoa/aoa-gpio.h b/sound/aoa/aoa-gpio.h index 3a61f311557..ee64f5de896 100644 --- a/sound/aoa/aoa-gpio.h +++ b/sound/aoa/aoa-gpio.h @@ -59,10 +59,10 @@ struct gpio_methods { }; struct gpio_notification { + struct delayed_work work; notify_func_t notify; void *data; void *gpio_private; - struct work_struct work; struct mutex mutex; }; diff --git a/sound/aoa/codecs/snd-aoa-codec-tas.c b/sound/aoa/codecs/snd-aoa-codec-tas.c index 2ef55a17917..9de8485ba3f 100644 --- a/sound/aoa/codecs/snd-aoa-codec-tas.c +++ b/sound/aoa/codecs/snd-aoa-codec-tas.c @@ -514,9 +514,15 @@ static int tas_snd_capture_source_put(struct snd_kcontrol *kcontrol, mutex_lock(&tas->mtx); oldacr = tas->acr; - tas->acr &= ~TAS_ACR_INPUT_B; + /* + * Despite what the data sheet says in one place, the + * TAS_ACR_B_MONAUREAL bit forces mono output even when + * input A (line in) is selected. + */ + tas->acr &= ~(TAS_ACR_INPUT_B | TAS_ACR_B_MONAUREAL); if (ucontrol->value.enumerated.item[0]) - tas->acr |= TAS_ACR_INPUT_B; + tas->acr |= TAS_ACR_INPUT_B | TAS_ACR_B_MONAUREAL | + TAS_ACR_B_MON_SEL_RIGHT; if (oldacr == tas->acr) { mutex_unlock(&tas->mtx); return 0; @@ -686,8 +692,7 @@ static int tas_reset_init(struct tas *tas) if (tas_write_reg(tas, TAS_REG_MCS, 1, &tmp)) goto outerr; - tas->acr |= TAS_ACR_ANALOG_PDOWN | TAS_ACR_B_MONAUREAL | - TAS_ACR_B_MON_SEL_RIGHT; + tas->acr |= TAS_ACR_ANALOG_PDOWN; if (tas_write_reg(tas, TAS_REG_ACR, 1, &tas->acr)) goto outerr; diff --git a/sound/aoa/core/snd-aoa-gpio-feature.c b/sound/aoa/core/snd-aoa-gpio-feature.c index 40eb47eccf9..2b03bc798bc 100644 --- a/sound/aoa/core/snd-aoa-gpio-feature.c +++ b/sound/aoa/core/snd-aoa-gpio-feature.c @@ -195,9 +195,10 @@ static void ftr_gpio_all_amps_restore(struct gpio_runtime *rt) ftr_gpio_set_lineout(rt, (s>>2)&1); } -static void ftr_handle_notify(void *data) +static void ftr_handle_notify(struct work_struct *work) { - struct gpio_notification *notif = data; + struct gpio_notification *notif = + container_of(work, struct gpio_notification, work.work); mutex_lock(¬if->mutex); if (notif->notify) @@ -253,12 +254,9 @@ static void ftr_gpio_init(struct gpio_runtime *rt) ftr_gpio_all_amps_off(rt); rt->implementation_private = 0; - INIT_WORK(&rt->headphone_notify.work, ftr_handle_notify, - &rt->headphone_notify); - INIT_WORK(&rt->line_in_notify.work, ftr_handle_notify, - &rt->line_in_notify); - INIT_WORK(&rt->line_out_notify.work, ftr_handle_notify, - &rt->line_out_notify); + INIT_DELAYED_WORK(&rt->headphone_notify.work, ftr_handle_notify); + INIT_DELAYED_WORK(&rt->line_in_notify.work, ftr_handle_notify); + INIT_DELAYED_WORK(&rt->line_out_notify.work, ftr_handle_notify); mutex_init(&rt->headphone_notify.mutex); mutex_init(&rt->line_in_notify.mutex); mutex_init(&rt->line_out_notify.mutex); @@ -287,7 +285,7 @@ static irqreturn_t ftr_handle_notify_irq(int xx, void *data) { struct gpio_notification *notif = data; - schedule_work(¬if->work); + schedule_delayed_work(¬if->work, 0); return IRQ_HANDLED; } diff --git a/sound/aoa/core/snd-aoa-gpio-pmf.c b/sound/aoa/core/snd-aoa-gpio-pmf.c index 2836c321839..5ca2220eac7 100644 --- a/sound/aoa/core/snd-aoa-gpio-pmf.c +++ b/sound/aoa/core/snd-aoa-gpio-pmf.c @@ -69,9 +69,10 @@ static void pmf_gpio_all_amps_restore(struct gpio_runtime *rt) pmf_gpio_set_lineout(rt, (s>>2)&1); } -static void pmf_handle_notify(void *data) +static void pmf_handle_notify(struct work_struct *work) { - struct gpio_notification *notif = data; + struct gpio_notification *notif = + container_of(work, struct gpio_notification, work.work); mutex_lock(¬if->mutex); if (notif->notify) @@ -83,12 +84,9 @@ static void pmf_gpio_init(struct gpio_runtime *rt) { pmf_gpio_all_amps_off(rt); rt->implementation_private = 0; - INIT_WORK(&rt->headphone_notify.work, pmf_handle_notify, - &rt->headphone_notify); - INIT_WORK(&rt->line_in_notify.work, pmf_handle_notify, - &rt->line_in_notify); - INIT_WORK(&rt->line_out_notify.work, pmf_handle_notify, - &rt->line_out_notify); + INIT_DELAYED_WORK(&rt->headphone_notify.work, pmf_handle_notify); + INIT_DELAYED_WORK(&rt->line_in_notify.work, pmf_handle_notify); + INIT_DELAYED_WORK(&rt->line_out_notify.work, pmf_handle_notify); mutex_init(&rt->headphone_notify.mutex); mutex_init(&rt->line_in_notify.mutex); mutex_init(&rt->line_out_notify.mutex); @@ -129,7 +127,7 @@ static void pmf_handle_notify_irq(void *data) { struct gpio_notification *notif = data; - schedule_work(¬if->work); + schedule_delayed_work(¬if->work, 0); } static int pmf_set_notify(struct gpio_runtime *rt, diff --git a/sound/arm/sa11xx-uda1341.c b/sound/arm/sa11xx-uda1341.c index c79a9afd095..c7e1b264619 100644 --- a/sound/arm/sa11xx-uda1341.c +++ b/sound/arm/sa11xx-uda1341.c @@ -125,7 +125,7 @@ struct audio_stream { #else dma_regs_t *dma_regs; /* points to our DMA registers */ #endif - int active:1; /* we are using this stream for transfer now */ + unsigned int active:1; /* we are using this stream for transfer now */ int period; /* current transfer period */ int periods; /* current count of periods registerd in the DMA engine */ int tx_spin; /* are we recoding - flag used to do DMA trans. for sync */ diff --git a/sound/core/control.c b/sound/core/control.c index 6973a9686b6..48ef0a09a7a 100644 --- a/sound/core/control.c +++ b/sound/core/control.c @@ -1018,10 +1018,6 @@ static int snd_ctl_elem_add(struct snd_ctl_file *file, } switch (info->type) { case SNDRV_CTL_ELEM_TYPE_BOOLEAN: - private_size = sizeof(char); - if (info->count > 128) - return -EINVAL; - break; case SNDRV_CTL_ELEM_TYPE_INTEGER: private_size = sizeof(long); if (info->count > 128) diff --git a/sound/core/info.c b/sound/core/info.c index e43662b33f1..54591e2eb6e 100644 --- a/sound/core/info.c +++ b/sound/core/info.c @@ -120,7 +120,10 @@ int snd_iprintf(struct snd_info_buffer *buffer, char *fmt,...) len = buffer->len - buffer->size; va_start(args, fmt); for (;;) { - res = vsnprintf(buffer->buffer + buffer->curr, len, fmt, args); + va_list ap; + va_copy(ap, args); + res = vsnprintf(buffer->buffer + buffer->curr, len, fmt, ap); + va_end(ap); if (res < len) break; err = resize_info_buffer(buffer, buffer->len + PAGE_SIZE); @@ -485,7 +488,7 @@ static long snd_info_entry_ioctl(struct file *file, unsigned int cmd, static int snd_info_entry_mmap(struct file *file, struct vm_area_struct *vma) { - struct inode *inode = file->f_dentry->d_inode; + struct inode *inode = file->f_path.dentry->d_inode; struct snd_info_private_data *data; struct snd_info_entry *entry; diff --git a/sound/core/init.c b/sound/core/init.c index 3058d626a90..6152a7554df 100644 --- a/sound/core/init.c +++ b/sound/core/init.c @@ -361,6 +361,8 @@ static int snd_card_do_free(struct snd_card *card) snd_printk(KERN_WARNING "unable to free card info\n"); /* Not fatal error */ } + if (card->dev) + device_unregister(card->dev); kfree(card); return 0; } @@ -495,6 +497,12 @@ int snd_card_register(struct snd_card *card) int err; snd_assert(card != NULL, return -EINVAL); + if (!card->dev) { + card->dev = device_create(sound_class, card->parent, 0, + "card%i", card->number); + if (IS_ERR(card->dev)) + card->dev = NULL; + } if ((err = snd_device_register_all(card)) < 0) return err; mutex_lock(&snd_card_mutex); diff --git a/sound/core/oss/pcm_oss.c b/sound/core/oss/pcm_oss.c index 505b23ec405..e0821eb3d85 100644 --- a/sound/core/oss/pcm_oss.c +++ b/sound/core/oss/pcm_oss.c @@ -2359,7 +2359,8 @@ static int snd_pcm_oss_release(struct inode *inode, struct file *file) substream = pcm_oss_file->streams[SNDRV_PCM_STREAM_CAPTURE]; snd_assert(substream != NULL, return -ENXIO); pcm = substream->pcm; - snd_pcm_oss_sync(pcm_oss_file); + if (!pcm->card->shutdown) + snd_pcm_oss_sync(pcm_oss_file); mutex_lock(&pcm->open_mutex); snd_pcm_oss_release_file(pcm_oss_file); mutex_unlock(&pcm->open_mutex); diff --git a/sound/core/pcm.c b/sound/core/pcm.c index fbbbcd20c4c..5ac6e19ccb4 100644 --- a/sound/core/pcm.c +++ b/sound/core/pcm.c @@ -910,7 +910,8 @@ void snd_pcm_detach_substream(struct snd_pcm_substream *substream) substream->pstr->substream_opened--; } -static ssize_t show_pcm_class(struct class_device *class_device, char *buf) +static ssize_t show_pcm_class(struct device *dev, + struct device_attribute *attr, char *buf) { struct snd_pcm *pcm; const char *str; @@ -921,7 +922,7 @@ static ssize_t show_pcm_class(struct class_device *class_device, char *buf) [SNDRV_PCM_CLASS_DIGITIZER] = "digitizer", }; - if (! (pcm = class_get_devdata(class_device)) || + if (! (pcm = dev_get_drvdata(dev)) || pcm->dev_class > SNDRV_PCM_CLASS_LAST) str = "none"; else @@ -929,7 +930,7 @@ static ssize_t show_pcm_class(struct class_device *class_device, char *buf) return snprintf(buf, PAGE_SIZE, "%s\n", str); } -static struct class_device_attribute pcm_attrs = +static struct device_attribute pcm_attrs = __ATTR(pcm_class, S_IRUGO, show_pcm_class, NULL); static int snd_pcm_dev_register(struct snd_device *device) diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c index 37b4b10850a..b52e89393fa 100644 --- a/sound/core/pcm_native.c +++ b/sound/core/pcm_native.c @@ -1310,7 +1310,8 @@ static int snd_pcm_pre_prepare(struct snd_pcm_substream *substream, int f_flags) { struct snd_pcm_runtime *runtime = substream->runtime; - if (runtime->status->state == SNDRV_PCM_STATE_OPEN) + if (runtime->status->state == SNDRV_PCM_STATE_OPEN || + runtime->status->state == SNDRV_PCM_STATE_DISCONNECTED) return -EBADFD; if (snd_pcm_running(substream)) return -EBUSY; @@ -1568,7 +1569,8 @@ static int snd_pcm_drop(struct snd_pcm_substream *substream) runtime = substream->runtime; card = substream->pcm->card; - if (runtime->status->state == SNDRV_PCM_STATE_OPEN) + if (runtime->status->state == SNDRV_PCM_STATE_OPEN || + runtime->status->state == SNDRV_PCM_STATE_DISCONNECTED) return -EBADFD; snd_power_lock(card); @@ -1602,7 +1604,7 @@ static struct file *snd_pcm_file_fd(int fd) file = fget(fd); if (!file) return NULL; - inode = file->f_dentry->d_inode; + inode = file->f_path.dentry->d_inode; if (!S_ISCHR(inode->i_mode) || imajor(inode) != snd_major) { fput(file); @@ -3025,7 +3027,7 @@ static struct page * snd_pcm_mmap_status_nopage(struct vm_area_struct *area, struct page * page; if (substream == NULL) - return NOPAGE_OOM; + return NOPAGE_SIGBUS; runtime = substream->runtime; page = virt_to_page(runtime->status); get_page(page); @@ -3068,7 +3070,7 @@ static struct page * snd_pcm_mmap_control_nopage(struct vm_area_struct *area, struct page * page; if (substream == NULL) - return NOPAGE_OOM; + return NOPAGE_SIGBUS; runtime = substream->runtime; page = virt_to_page(runtime->control); get_page(page); @@ -3129,18 +3131,18 @@ static struct page *snd_pcm_mmap_data_nopage(struct vm_area_struct *area, size_t dma_bytes; if (substream == NULL) - return NOPAGE_OOM; + return NOPAGE_SIGBUS; runtime = substream->runtime; offset = area->vm_pgoff << PAGE_SHIFT; offset += address - area->vm_start; - snd_assert((offset % PAGE_SIZE) == 0, return NOPAGE_OOM); + snd_assert((offset % PAGE_SIZE) == 0, return NOPAGE_SIGBUS); dma_bytes = PAGE_ALIGN(runtime->dma_bytes); if (offset > dma_bytes - PAGE_SIZE) return NOPAGE_SIGBUS; if (substream->ops->page) { page = substream->ops->page(substream, offset); if (! page) - return NOPAGE_OOM; + return NOPAGE_OOM; /* XXX: is this really due to OOM? */ } else { vaddr = runtime->dma_area + offset; page = virt_to_page(vaddr); diff --git a/sound/core/rtctimer.c b/sound/core/rtctimer.c index 412dd62b654..9f7b32e1ccd 100644 --- a/sound/core/rtctimer.c +++ b/sound/core/rtctimer.c @@ -22,13 +22,10 @@ #include <sound/driver.h> #include <linux/init.h> -#include <linux/time.h> -#include <linux/threads.h> #include <linux/interrupt.h> #include <linux/moduleparam.h> #include <sound/core.h> #include <sound/timer.h> -#include <sound/info.h> #if defined(CONFIG_RTC) || defined(CONFIG_RTC_MODULE) @@ -50,7 +47,9 @@ static int rtctimer_stop(struct snd_timer *t); * The hardware dependent description for this timer. */ static struct snd_timer_hardware rtc_hw = { - .flags = SNDRV_TIMER_HW_FIRST|SNDRV_TIMER_HW_AUTO, + .flags = SNDRV_TIMER_HW_AUTO | + SNDRV_TIMER_HW_FIRST | + SNDRV_TIMER_HW_TASKLET, .ticks = 100000000L, /* FIXME: XXX */ .open = rtctimer_open, .close = rtctimer_close, @@ -60,6 +59,7 @@ static struct snd_timer_hardware rtc_hw = { static int rtctimer_freq = RTC_FREQ; /* frequency */ static struct snd_timer *rtctimer; +static struct tasklet_struct rtc_tasklet; static rtc_task_t rtc_task; @@ -81,6 +81,7 @@ rtctimer_close(struct snd_timer *t) rtc_task_t *rtc = t->private_data; if (rtc) { rtc_unregister(rtc); + tasklet_kill(&rtc_tasklet); t->private_data = NULL; } return 0; @@ -105,12 +106,17 @@ rtctimer_stop(struct snd_timer *timer) return 0; } +static void rtctimer_tasklet(unsigned long data) +{ + snd_timer_interrupt((struct snd_timer *)data, 1); +} + /* * interrupt */ static void rtctimer_interrupt(void *private_data) { - snd_timer_interrupt(private_data, 1); + tasklet_hi_schedule(private_data); } @@ -139,9 +145,11 @@ static int __init rtctimer_init(void) timer->hw = rtc_hw; timer->hw.resolution = NANO_SEC / rtctimer_freq; + tasklet_init(&rtc_tasklet, rtctimer_tasklet, (unsigned long)timer); + /* set up RTC callback */ rtc_task.func = rtctimer_interrupt; - rtc_task.private_data = timer; + rtc_task.private_data = &rtc_tasklet; err = snd_timer_global_register(timer); if (err < 0) { diff --git a/sound/core/sound.c b/sound/core/sound.c index efa476c5210..282742022de 100644 --- a/sound/core/sound.c +++ b/sound/core/sound.c @@ -61,9 +61,6 @@ EXPORT_SYMBOL(snd_ecards_limit); static struct snd_minor *snd_minors[SNDRV_OS_MINORS]; static DEFINE_MUTEX(sound_mutex); -extern struct class *sound_class; - - #ifdef CONFIG_KMOD /** @@ -268,11 +265,10 @@ int snd_register_device(int type, struct snd_card *card, int dev, snd_minors[minor] = preg; if (card) device = card->dev; - preg->class_dev = class_device_create(sound_class, NULL, - MKDEV(major, minor), - device, "%s", name); - if (preg->class_dev) - class_set_devdata(preg->class_dev, private_data); + preg->dev = device_create(sound_class, device, MKDEV(major, minor), + "%s", name); + if (preg->dev) + dev_set_drvdata(preg->dev, private_data); mutex_unlock(&sound_mutex); return 0; @@ -320,7 +316,7 @@ int snd_unregister_device(int type, struct snd_card *card, int dev) return -EINVAL; } - class_device_destroy(sound_class, MKDEV(major, minor)); + device_destroy(sound_class, MKDEV(major, minor)); kfree(snd_minors[minor]); snd_minors[minor] = NULL; @@ -331,15 +327,15 @@ int snd_unregister_device(int type, struct snd_card *card, int dev) EXPORT_SYMBOL(snd_unregister_device); int snd_add_device_sysfs_file(int type, struct snd_card *card, int dev, - const struct class_device_attribute *attr) + struct device_attribute *attr) { int minor, ret = -EINVAL; - struct class_device *cdev; + struct device *d; mutex_lock(&sound_mutex); minor = find_snd_minor(type, card, dev); - if (minor >= 0 && (cdev = snd_minors[minor]->class_dev) != NULL) - ret = class_device_create_file(cdev, attr); + if (minor >= 0 && (d = snd_minors[minor]->dev) != NULL) + ret = device_create_file(d, attr); mutex_unlock(&sound_mutex); return ret; diff --git a/sound/drivers/Kconfig b/sound/drivers/Kconfig index 7971285dfd5..40ebd2f4405 100644 --- a/sound/drivers/Kconfig +++ b/sound/drivers/Kconfig @@ -26,11 +26,7 @@ config SND_VX_LIB config SND_AC97_CODEC tristate select SND_PCM - select SND_AC97_BUS - -config SND_AC97_BUS - tristate - + select AC97_BUS config SND_DUMMY tristate "Dummy (/dev/null) soundcard" diff --git a/sound/i2c/other/ak4114.c b/sound/i2c/other/ak4114.c index 12ffffc9e81..d2f2c5078e6 100644 --- a/sound/i2c/other/ak4114.c +++ b/sound/i2c/other/ak4114.c @@ -35,7 +35,7 @@ MODULE_LICENSE("GPL"); #define AK4114_ADDR 0x00 /* fixed address */ -static void ak4114_stats(void *); +static void ak4114_stats(struct work_struct *work); static void reg_write(struct ak4114 *ak4114, unsigned char reg, unsigned char val) { @@ -158,7 +158,7 @@ void snd_ak4114_reinit(struct ak4114 *chip) reg_write(chip, AK4114_REG_PWRDN, old | AK4114_RST | AK4114_PWN); /* bring up statistics / event queing */ chip->init = 0; - INIT_WORK(&chip->work, ak4114_stats, chip); + INIT_DELAYED_WORK(&chip->work, ak4114_stats); queue_delayed_work(chip->workqueue, &chip->work, HZ / 10); } @@ -561,9 +561,9 @@ int snd_ak4114_check_rate_and_errors(struct ak4114 *ak4114, unsigned int flags) return res; } -static void ak4114_stats(void *data) +static void ak4114_stats(struct work_struct *work) { - struct ak4114 *chip = (struct ak4114 *)data; + struct ak4114 *chip = container_of(work, struct ak4114, work.work); if (chip->init) return; diff --git a/sound/isa/Kconfig b/sound/isa/Kconfig index 557c4de2296..57371f1a441 100644 --- a/sound/isa/Kconfig +++ b/sound/isa/Kconfig @@ -13,6 +13,7 @@ config SND_CS4231_LIB config SND_ADLIB tristate "AdLib FM card" + depends on SND select SND_OPL3_LIB help Say Y here to include support for AdLib FM cards. diff --git a/sound/isa/ad1816a/ad1816a.c b/sound/isa/ad1816a/ad1816a.c index b33a5fb59ec..59034507175 100644 --- a/sound/isa/ad1816a/ad1816a.c +++ b/sound/isa/ad1816a/ad1816a.c @@ -120,6 +120,8 @@ static int __devinit snd_card_ad1816a_pnp(int dev, struct snd_card_ad1816a *acar struct pnp_resource_table *cfg = kmalloc(sizeof(*cfg), GFP_KERNEL); int err; + if (!cfg) + return -ENOMEM; acard->dev = pnp_request_card_device(card, id->devs[0].id, NULL); if (acard->dev == NULL) { kfree(cfg); diff --git a/sound/isa/cmi8330.c b/sound/isa/cmi8330.c index 3c1e9fd56fe..d1f6dfcec46 100644 --- a/sound/isa/cmi8330.c +++ b/sound/isa/cmi8330.c @@ -289,6 +289,8 @@ static int __devinit snd_cmi8330_pnp(int dev, struct snd_cmi8330 *acard, struct pnp_resource_table * cfg = kmalloc(sizeof(struct pnp_resource_table), GFP_KERNEL); int err; + if (!cfg) + return -ENOMEM; acard->cap = pnp_request_card_device(card, id->devs[0].id, NULL); if (acard->cap == NULL) { kfree(cfg); diff --git a/sound/isa/gus/interwave.c b/sound/isa/gus/interwave.c index f12cd09d1fc..4ec2d79431f 100644 --- a/sound/isa/gus/interwave.c +++ b/sound/isa/gus/interwave.c @@ -564,6 +564,8 @@ static int __devinit snd_interwave_pnp(int dev, struct snd_interwave *iwcard, struct pnp_resource_table * cfg = kmalloc(sizeof(struct pnp_resource_table), GFP_KERNEL); int err; + if (!cfg) + return -ENOMEM; iwcard->dev = pnp_request_card_device(card, id->devs[0].id, NULL); if (iwcard->dev == NULL) { kfree(cfg); diff --git a/sound/isa/opti9xx/opti92x-ad1848.c b/sound/isa/opti9xx/opti92x-ad1848.c index a1ad39a8cdc..df227377c33 100644 --- a/sound/isa/opti9xx/opti92x-ad1848.c +++ b/sound/isa/opti9xx/opti92x-ad1848.c @@ -1683,6 +1683,8 @@ static int __init snd_card_opti9xx_pnp(struct snd_opti9xx *chip, struct pnp_card struct pnp_resource_table *cfg = kmalloc(sizeof(*cfg), GFP_KERNEL); int err; + if (!cfg) + return -ENOMEM; chip->dev = pnp_request_card_device(card, pid->devs[0].id, NULL); if (chip->dev == NULL) { kfree(cfg); diff --git a/sound/oss/Kconfig b/sound/oss/Kconfig index cc2b9ab7f4e..a0588c21324 100644 --- a/sound/oss/Kconfig +++ b/sound/oss/Kconfig @@ -5,20 +5,6 @@ # # Prompt user for primary drivers. -config OSS_OBSOLETE_DRIVER - bool "Obsolete OSS drivers" - depends on SOUND_PRIME - help - This option enables support for obsolete OSS drivers that - are scheduled for removal in the near future since there - are ALSA drivers for the same hardware. - - Please contact Adrian Bunk <bunk@stusta.de> if you had to - say Y here because your soundcard is not properly supported - by ALSA. - - If unsure, say N. - config SOUND_BT878 tristate "BT878 audio dma" depends on SOUND_PRIME && PCI @@ -35,40 +21,6 @@ config SOUND_BT878 To compile this driver as a module, choose M here: the module will be called btaudio. -config SOUND_EMU10K1 - tristate "Creative SBLive! (EMU10K1)" - depends on SOUND_PRIME && PCI && OSS_OBSOLETE_DRIVER - ---help--- - Say Y or M if you have a PCI sound card using the EMU10K1 chipset, - such as the Creative SBLive!, SB PCI512 or Emu-APS. - - For more information on this driver and the degree of support for - the different card models please check: - - <http://sourceforge.net/projects/emu10k1/> - - It is now possible to load dsp microcode patches into the EMU10K1 - chip. These patches are used to implement real time sound - processing effects which include for example: signal routing, - bass/treble control, AC3 passthrough, ... - Userspace tools to create new patches and load/unload them can be - found in the emu-tools package at the above URL. - -config MIDI_EMU10K1 - bool "Creative SBLive! MIDI (EXPERIMENTAL)" - depends on SOUND_EMU10K1 && EXPERIMENTAL && ISA_DMA_API - help - Say Y if you want to be able to use the OSS /dev/sequencer - interface. This code is still experimental. - -config SOUND_FUSION - tristate "Crystal SoundFusion (CS4280/461x)" - depends on SOUND_PRIME && PCI && OSS_OBSOLETE_DRIVER - help - This module drives the Crystal SoundFusion devices (CS4280/46xx - series) when wired as native sound drivers with AC97 codecs. If - this driver does not work try the CS4232 driver. - config SOUND_BCM_CS4297A tristate "Crystal Sound CS4297a (for Swarm)" depends on SOUND_PRIME && SIBYTE_SWARM @@ -448,47 +400,6 @@ config SOUND_DMAP Say Y unless you have 16MB or more RAM or a PCI sound card. -config SOUND_AD1816 - tristate "AD1816(A) based cards (EXPERIMENTAL)" - depends on EXPERIMENTAL && SOUND_OSS && OSS_OBSOLETE_DRIVER - help - Say M here if you have a sound card based on the Analog Devices - AD1816(A) chip. - - If you compile the driver into the kernel, you have to add - "ad1816=<io>,<irq>,<dma>,<dma2>" to the kernel command line. - -config SOUND_AD1889 - tristate "AD1889 based cards (AD1819 codec) (EXPERIMENTAL)" - depends on EXPERIMENTAL && SOUND_OSS && PCI && OSS_OBSOLETE_DRIVER - help - Say M here if you have a sound card based on the Analog Devices - AD1889 chip. - -config SOUND_ADLIB - tristate "Adlib Cards" - depends on SOUND_OSS && OSS_OBSOLETE_DRIVER - help - Includes ASB 64 4D. Information on programming AdLib cards is - available at <http://www.itsnet.com/home/ldragon/Specs/adlib.html>. - -config SOUND_ACI_MIXER - tristate "ACI mixer (miroSOUND PCM1-pro/PCM12/PCM20)" - depends on SOUND_OSS && OSS_OBSOLETE_DRIVER - ---help--- - ACI (Audio Command Interface) is a protocol used to communicate with - the microcontroller on some sound cards produced by miro and - Cardinal Technologies. The main function of the ACI is to control - the mixer and to get a product identification. - - This VoxWare ACI driver currently supports the ACI functions on the - miroSOUND PCM1-pro, PCM12 and PCM20 radio. On the PCM20 radio, ACI - also controls the radio tuner. This is supported in the video4linux - miropcm20 driver (say M or Y here and go back to "Multimedia - devices" -> "Radio Adapters"). - - This driver is also available as a module and will be called aci. - config SOUND_CS4232 tristate "Crystal CS4232 based (PnP) cards" depends on SOUND_OSS @@ -594,18 +505,6 @@ config SOUND_MPU401 If you compile the driver into the kernel, you have to add "mpu401=<io>,<irq>" to the kernel command line. -config SOUND_NM256 - tristate "NM256AV/NM256ZX audio support" - depends on SOUND_OSS && OSS_OBSOLETE_DRIVER - help - Say M here to include audio support for the NeoMagic 256AV/256ZX - chipsets. These are the audio chipsets found in the Sony - Z505S/SX/DX, some Sony F-series, and the Dell Latitude CPi and CPt - laptops. It includes support for an AC97-compatible mixer and an - apparently proprietary sound engine. - - See <file:Documentation/sound/oss/NM256> for further information. - config SOUND_PAS tristate "ProAudioSpectrum 16 support" depends on SOUND_OSS @@ -714,20 +613,6 @@ config SOUND_YM3812 If unsure, say Y. -config SOUND_OPL3SA2 - tristate "Yamaha OPL3-SA2 and SA3 based PnP cards" - depends on SOUND_OSS && OSS_OBSOLETE_DRIVER - help - Say Y or M if you have a card based on one of these Yamaha sound - chipsets or the "SAx", which is actually a SA3. Read - <file:Documentation/sound/oss/OPL3-SA2> for more information on - configuring these cards. - - If you compile the driver into the kernel and do not also - configure in the optional ISA PnP support, you will have to add - "opl3sa2=<io>,<irq>,<dma>,<dma2>,<mssio>,<mpuio>" to the kernel - command line. - config SOUND_UART6850 tristate "6850 UART support" depends on SOUND_OSS diff --git a/sound/oss/btaudio.c b/sound/oss/btaudio.c index 6ad38411423..ad7210a00dc 100644 --- a/sound/oss/btaudio.c +++ b/sound/oss/btaudio.c @@ -1020,6 +1020,7 @@ static int __devinit btaudio_probe(struct pci_dev *pci_dev, fail2: free_irq(bta->irq,bta); fail1: + iounmap(bta->mmio); kfree(bta); fail0: release_mem_region(pci_resource_start(pci_dev,0), @@ -1051,6 +1052,7 @@ static void __devexit btaudio_remove(struct pci_dev *pci_dev) free_irq(bta->irq,bta); release_mem_region(pci_resource_start(pci_dev,0), pci_resource_len(pci_dev,0)); + iounmap(bta->mmio); /* remove from linked list */ if (bta == btaudios) { diff --git a/sound/oss/cs46xx.c b/sound/oss/cs46xx.c index 6e3c41f530e..147c8a95113 100644 --- a/sound/oss/cs46xx.c +++ b/sound/oss/cs46xx.c @@ -91,6 +91,7 @@ #include <linux/poll.h> #include <linux/ac97_codec.h> #include <linux/mutex.h> +#include <linux/mm.h> #include <asm/io.h> #include <asm/dma.h> @@ -779,7 +780,7 @@ static unsigned int cs_set_adc_rate(struct cs_state *state, unsigned int rate) rate = 48000 / 9; /* - * We can not capture at at rate greater than the Input Rate (48000). + * We cannot capture at at rate greater than the Input Rate (48000). * Return an error if an attempt is made to stray outside that limit. */ if (rate > 48000) @@ -4754,8 +4755,8 @@ static int cs_hardware_init(struct cs_card *card) mdelay(5 * cs_laptop_wait); /* Shouldnt be needed ?? */ /* -* If we are resuming under 2.2.x then we can not schedule a timeout. -* so, just spin the CPU. +* If we are resuming under 2.2.x then we cannot schedule a timeout, +* so just spin the CPU. */ if (card->pm.flags & CS46XX_PM_IDLE) { /* diff --git a/sound/oss/dmabuf.c b/sound/oss/dmabuf.c index b256c040116..eaf69971bf9 100644 --- a/sound/oss/dmabuf.c +++ b/sound/oss/dmabuf.c @@ -25,6 +25,7 @@ #define BE_CONSERVATIVE #define SAMPLE_ROUNDUP 0 +#include <linux/mm.h> #include "sound_config.h" #define DMAP_FREE_ON_CLOSE 0 diff --git a/sound/oss/dmasound/dmasound_core.c b/sound/oss/dmasound/dmasound_core.c index 87bd3100aef..80b836e80d9 100644 --- a/sound/oss/dmasound/dmasound_core.c +++ b/sound/oss/dmasound/dmasound_core.c @@ -1051,7 +1051,7 @@ static int sq_release(struct inode *inode, struct file *file) if (file->f_mode & FMODE_WRITE) { if (write_sq.busy) - rc = sq_fsync(file, file->f_dentry); + rc = sq_fsync(file, file->f_path.dentry); sq_reset_output() ; /* make sure dma is stopped and all is quiet */ write_sq_release_buffers(); @@ -1217,7 +1217,7 @@ static int sq_ioctl(struct inode *inode, struct file *file, u_int cmd, if ((file->f_mode & FMODE_READ) && dmasound.mach.record) sq_reset_input() ; if (file->f_mode & FMODE_WRITE) { - result = sq_fsync(file, file->f_dentry); + result = sq_fsync(file, file->f_path.dentry); sq_reset_output() ; } /* if we are the shared resource owner then release them */ diff --git a/sound/oss/emu10k1/audio.c b/sound/oss/emu10k1/audio.c index cde4d59d543..49f902f35c2 100644 --- a/sound/oss/emu10k1/audio.c +++ b/sound/oss/emu10k1/audio.c @@ -36,6 +36,7 @@ #include <linux/bitops.h> #include <asm/io.h> #include <linux/sched.h> +#include <linux/mm.h> #include <linux/smp_lock.h> #include "hwaccess.h" @@ -110,9 +111,15 @@ static ssize_t emu10k1_audio_read(struct file *file, char __user *buffer, size_t if ((bytestocopy >= wiinst->buffer.fragment_size) || (bytestocopy >= count)) { + int rc; + bytestocopy = min_t(u32, bytestocopy, count); - emu10k1_wavein_xferdata(wiinst, (u8 __user *)buffer, &bytestocopy); + rc = emu10k1_wavein_xferdata(wiinst, + (u8 __user *)buffer, + &bytestocopy); + if (rc) + return rc; count -= bytestocopy; buffer += bytestocopy; diff --git a/sound/oss/emu10k1/cardwi.c b/sound/oss/emu10k1/cardwi.c index 8bbf44b881b..060d1be94d3 100644 --- a/sound/oss/emu10k1/cardwi.c +++ b/sound/oss/emu10k1/cardwi.c @@ -304,11 +304,12 @@ void emu10k1_wavein_getxfersize(struct wiinst *wiinst, u32 * size) } } -static void copy_block(u8 __user *dst, u8 * src, u32 str, u32 len, u8 cov) +static int copy_block(u8 __user *dst, u8 * src, u32 str, u32 len, u8 cov) { - if (cov == 1) - __copy_to_user(dst, src + str, len); - else { + if (cov == 1) { + if (__copy_to_user(dst, src + str, len)) + return -EFAULT; + } else { u8 byte; u32 i; @@ -316,22 +317,26 @@ static void copy_block(u8 __user *dst, u8 * src, u32 str, u32 len, u8 cov) for (i = 0; i < len; i++) { byte = src[2 * i] ^ 0x80; - __copy_to_user(dst + i, &byte, 1); + if (__copy_to_user(dst + i, &byte, 1)) + return -EFAULT; } } + + return 0; } -void emu10k1_wavein_xferdata(struct wiinst *wiinst, u8 __user *data, u32 * size) +int emu10k1_wavein_xferdata(struct wiinst *wiinst, u8 __user *data, u32 * size) { struct wavein_buffer *buffer = &wiinst->buffer; u32 sizetocopy, sizetocopy_now, start; unsigned long flags; + int ret; sizetocopy = min_t(u32, buffer->size, *size); *size = sizetocopy; if (!sizetocopy) - return; + return 0; spin_lock_irqsave(&wiinst->lock, flags); start = buffer->pos; @@ -345,11 +350,17 @@ void emu10k1_wavein_xferdata(struct wiinst *wiinst, u8 __user *data, u32 * size) if (sizetocopy > sizetocopy_now) { sizetocopy -= sizetocopy_now; - copy_block(data, buffer->addr, start, sizetocopy_now, buffer->cov); - copy_block(data + sizetocopy_now, buffer->addr, 0, sizetocopy, buffer->cov); + ret = copy_block(data, buffer->addr, start, sizetocopy_now, + buffer->cov); + if (ret == 0) + ret = copy_block(data + sizetocopy_now, buffer->addr, 0, + sizetocopy, buffer->cov); } else { - copy_block(data, buffer->addr, start, sizetocopy, buffer->cov); + ret = copy_block(data, buffer->addr, start, sizetocopy, + buffer->cov); } + + return ret; } void emu10k1_wavein_update(struct emu10k1_card *card, struct wiinst *wiinst) diff --git a/sound/oss/emu10k1/cardwi.h b/sound/oss/emu10k1/cardwi.h index 15cfb9b3559..e82029b46ad 100644 --- a/sound/oss/emu10k1/cardwi.h +++ b/sound/oss/emu10k1/cardwi.h @@ -83,7 +83,7 @@ void emu10k1_wavein_close(struct emu10k1_wavedevice *); void emu10k1_wavein_start(struct emu10k1_wavedevice *); void emu10k1_wavein_stop(struct emu10k1_wavedevice *); void emu10k1_wavein_getxfersize(struct wiinst *, u32 *); -void emu10k1_wavein_xferdata(struct wiinst *, u8 __user *, u32 *); +int emu10k1_wavein_xferdata(struct wiinst *, u8 __user *, u32 *); int emu10k1_wavein_setformat(struct emu10k1_wavedevice *, struct wave_format *); void emu10k1_wavein_update(struct emu10k1_card *, struct wiinst *); diff --git a/sound/oss/emu10k1/passthrough.c b/sound/oss/emu10k1/passthrough.c index 4e3baca7d41..6d21d4368de 100644 --- a/sound/oss/emu10k1/passthrough.c +++ b/sound/oss/emu10k1/passthrough.c @@ -162,12 +162,15 @@ ssize_t emu10k1_pt_write(struct file *file, const char __user *buffer, size_t co DPD(3, "prepend size %d, prepending %d bytes\n", pt->prepend_size, needed); if (count < needed) { - copy_from_user(pt->buf + pt->prepend_size, buffer, count); + if (copy_from_user(pt->buf + pt->prepend_size, + buffer, count)) + return -EFAULT; pt->prepend_size += count; DPD(3, "prepend size now %d\n", pt->prepend_size); return count; } - copy_from_user(pt->buf + pt->prepend_size, buffer, needed); + if (copy_from_user(pt->buf + pt->prepend_size, buffer, needed)) + return -EFAULT; r = pt_putblock(wave_dev, (u16 *) pt->buf, nonblock); if (r) return r; @@ -178,7 +181,8 @@ ssize_t emu10k1_pt_write(struct file *file, const char __user *buffer, size_t co blocks_copied = 0; while (blocks > 0) { u16 __user *bufptr = (u16 __user *) buffer + (bytes_copied/2); - copy_from_user(pt->buf, bufptr, PT_BLOCKSIZE); + if (copy_from_user(pt->buf, bufptr, PT_BLOCKSIZE)) + return -EFAULT; r = pt_putblock(wave_dev, (u16 *)pt->buf, nonblock); if (r) { if (bytes_copied) @@ -193,7 +197,8 @@ ssize_t emu10k1_pt_write(struct file *file, const char __user *buffer, size_t co i = count - bytes_copied; if (i) { pt->prepend_size = i; - copy_from_user(pt->buf, buffer + bytes_copied, i); + if (copy_from_user(pt->buf, buffer + bytes_copied, i)) + return -EFAULT; bytes_copied += i; DPD(3, "filling prepend buffer with %d bytes", i); } diff --git a/sound/oss/es1371.c b/sound/oss/es1371.c index ddf6b0a0bca..cc282a0cd53 100644 --- a/sound/oss/es1371.c +++ b/sound/oss/es1371.c @@ -130,6 +130,7 @@ #include <linux/wait.h> #include <linux/dma-mapping.h> #include <linux/mutex.h> +#include <linux/mm.h> #include <asm/io.h> #include <asm/page.h> diff --git a/sound/oss/i810_audio.c b/sound/oss/i810_audio.c index 240cc7939b6..c3c8a720d55 100644 --- a/sound/oss/i810_audio.c +++ b/sound/oss/i810_audio.c @@ -101,6 +101,7 @@ #include <linux/ac97_codec.h> #include <linux/bitops.h> #include <linux/mutex.h> +#include <linux/mm.h> #include <asm/uaccess.h> diff --git a/sound/oss/msnd_pinnacle.c b/sound/oss/msnd_pinnacle.c index d5146790f5e..24110d63b13 100644 --- a/sound/oss/msnd_pinnacle.c +++ b/sound/oss/msnd_pinnacle.c @@ -1007,7 +1007,7 @@ static int dsp_write(const char __user *buf, size_t len) static ssize_t dev_read(struct file *file, char __user *buf, size_t count, loff_t *off) { - int minor = iminor(file->f_dentry->d_inode); + int minor = iminor(file->f_path.dentry->d_inode); if (minor == dev.dsp_minor) return dsp_read(buf, count); else @@ -1016,7 +1016,7 @@ static ssize_t dev_read(struct file *file, char __user *buf, size_t count, loff_ static ssize_t dev_write(struct file *file, const char __user *buf, size_t count, loff_t *off) { - int minor = iminor(file->f_dentry->d_inode); + int minor = iminor(file->f_path.dentry->d_inode); if (minor == dev.dsp_minor) return dsp_write(buf, count); else diff --git a/sound/oss/sh_dac_audio.c b/sound/oss/sh_dac_audio.c index 3b3b4da8cfd..51f554154c4 100644 --- a/sound/oss/sh_dac_audio.c +++ b/sound/oss/sh_dac_audio.c @@ -26,7 +26,7 @@ #include <asm/cpu/dac.h> #include <asm/cpu/timer.h> #include <asm/machvec.h> -#include <asm/hp6xx/hp6xx.h> +#include <asm/hp6xx.h> #include <asm/hd64461.h> #define MODNAME "sh_dac_audio" diff --git a/sound/oss/soundcard.c b/sound/oss/soundcard.c index 2344d09c711..a89108cb74e 100644 --- a/sound/oss/soundcard.c +++ b/sound/oss/soundcard.c @@ -42,6 +42,7 @@ #include <linux/proc_fs.h> #include <linux/smp_lock.h> #include <linux/module.h> +#include <linux/mm.h> /* * This ought to be moved into include/asm/dma.h @@ -140,7 +141,7 @@ static int get_mixer_levels(void __user * arg) static ssize_t sound_read(struct file *file, char __user *buf, size_t count, loff_t *ppos) { - int dev = iminor(file->f_dentry->d_inode); + int dev = iminor(file->f_path.dentry->d_inode); int ret = -EINVAL; /* @@ -173,7 +174,7 @@ static ssize_t sound_read(struct file *file, char __user *buf, size_t count, lof static ssize_t sound_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos) { - int dev = iminor(file->f_dentry->d_inode); + int dev = iminor(file->f_path.dentry->d_inode); int ret = -EINVAL; lock_kernel(); @@ -392,7 +393,7 @@ static int sound_ioctl(struct inode *inode, struct file *file, static unsigned int sound_poll(struct file *file, poll_table * wait) { - struct inode *inode = file->f_dentry->d_inode; + struct inode *inode = file->f_path.dentry->d_inode; int dev = iminor(inode); DEB(printk("sound_poll(dev=%d)\n", dev)); @@ -417,7 +418,7 @@ static int sound_mmap(struct file *file, struct vm_area_struct *vma) int dev_class; unsigned long size; struct dma_buffparms *dmap = NULL; - int dev = iminor(file->f_dentry->d_inode); + int dev = iminor(file->f_path.dentry->d_inode); dev_class = dev & 0x0f; dev >>= 4; @@ -557,17 +558,17 @@ static int __init oss_init(void) sound_dmap_flag = (dmabuf > 0 ? 1 : 0); for (i = 0; i < sizeof (dev_list) / sizeof *dev_list; i++) { - class_device_create(sound_class, NULL, - MKDEV(SOUND_MAJOR, dev_list[i].minor), - NULL, "%s", dev_list[i].name); + device_create(sound_class, NULL, + MKDEV(SOUND_MAJOR, dev_list[i].minor), + "%s", dev_list[i].name); if (!dev_list[i].num) continue; for (j = 1; j < *dev_list[i].num; j++) - class_device_create(sound_class, NULL, - MKDEV(SOUND_MAJOR, dev_list[i].minor + (j*0x10)), - NULL, "%s%d", dev_list[i].name, j); + device_create(sound_class, NULL, + MKDEV(SOUND_MAJOR, dev_list[i].minor + (j*0x10)), + "%s%d", dev_list[i].name, j); } if (sound_nblocks >= 1024) @@ -581,11 +582,11 @@ static void __exit oss_cleanup(void) int i, j; for (i = 0; i < sizeof (dev_list) / sizeof *dev_list; i++) { - class_device_destroy(sound_class, MKDEV(SOUND_MAJOR, dev_list[i].minor)); + device_destroy(sound_class, MKDEV(SOUND_MAJOR, dev_list[i].minor)); if (!dev_list[i].num) continue; for (j = 1; j < *dev_list[i].num; j++) - class_device_destroy(sound_class, MKDEV(SOUND_MAJOR, dev_list[i].minor + (j*0x10))); + device_destroy(sound_class, MKDEV(SOUND_MAJOR, dev_list[i].minor + (j*0x10))); } unregister_sound_special(1); diff --git a/sound/oss/sscape.c b/sound/oss/sscape.c index 51f2fa61541..30c36d1f35d 100644 --- a/sound/oss/sscape.c +++ b/sound/oss/sscape.c @@ -39,6 +39,7 @@ #include <linux/ioport.h> #include <linux/delay.h> #include <linux/proc_fs.h> +#include <linux/mm.h> #include <linux/spinlock.h> #include "coproc.h" diff --git a/sound/oss/trident.c b/sound/oss/trident.c index 7a363a178af..6b1f8c9cdcf 100644 --- a/sound/oss/trident.c +++ b/sound/oss/trident.c @@ -216,6 +216,7 @@ #include <linux/gameport.h> #include <linux/kernel.h> #include <linux/mutex.h> +#include <linux/mm.h> #include <asm/uaccess.h> #include <asm/io.h> diff --git a/sound/oss/via82cxxx_audio.c b/sound/oss/via82cxxx_audio.c index 17837d4b5ed..c96cc8c68b3 100644 --- a/sound/oss/via82cxxx_audio.c +++ b/sound/oss/via82cxxx_audio.c @@ -2120,8 +2120,8 @@ static struct page * via_mm_nopage (struct vm_area_struct * vma, return NOPAGE_SIGBUS; /* Disallow mremap */ } if (!card) { - DPRINTK ("EXIT, returning NOPAGE_OOM\n"); - return NOPAGE_OOM; /* Nothing allocated */ + DPRINTK ("EXIT, returning NOPAGE_SIGBUS\n"); + return NOPAGE_SIGBUS; /* Nothing allocated */ } pgoff = vma->vm_pgoff + ((address - vma->vm_start) >> PAGE_SHIFT); diff --git a/sound/pci/ac97/Makefile b/sound/pci/ac97/Makefile index 77b3482cb13..3c3222122d8 100644 --- a/sound/pci/ac97/Makefile +++ b/sound/pci/ac97/Makefile @@ -10,11 +10,9 @@ snd-ac97-codec-objs += ac97_proc.o endif snd-ak4531-codec-objs := ak4531_codec.o -snd-ac97-bus-objs := ac97_bus.o # Toplevel Module Dependency obj-$(CONFIG_SND_AC97_CODEC) += snd-ac97-codec.o obj-$(CONFIG_SND_ENS1370) += snd-ak4531-codec.o -obj-$(CONFIG_SND_AC97_BUS) += snd-ac97-bus.o obj-m := $(sort $(obj-m)) diff --git a/sound/pci/ac97/ac97_codec.c b/sound/pci/ac97/ac97_codec.c index a79e91850ba..7abcb10b275 100644 --- a/sound/pci/ac97/ac97_codec.c +++ b/sound/pci/ac97/ac97_codec.c @@ -570,8 +570,7 @@ int snd_ac97_put_volsw(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value ac97->power_up &= ~(1 << (reg>>1)); else ac97->power_up |= 1 << (reg>>1); - if (power_save) - update_power_regs(ac97); + update_power_regs(ac97); } #endif return err; @@ -1928,9 +1927,10 @@ static int snd_ac97_dev_disconnect(struct snd_device *device) static struct snd_ac97_build_ops null_build_ops; #ifdef CONFIG_SND_AC97_POWER_SAVE -static void do_update_power(void *data) +static void do_update_power(struct work_struct *work) { - update_power_regs(data); + update_power_regs( + container_of(work, struct snd_ac97, power_work.work)); } #endif @@ -1990,7 +1990,7 @@ int snd_ac97_mixer(struct snd_ac97_bus *bus, struct snd_ac97_template *template, mutex_init(&ac97->page_mutex); #ifdef CONFIG_SND_AC97_POWER_SAVE ac97->power_workq = create_workqueue("ac97"); - INIT_WORK(&ac97->power_work, do_update_power, ac97); + INIT_DELAYED_WORK(&ac97->power_work, do_update_power); #endif #ifdef CONFIG_PCI @@ -2337,10 +2337,7 @@ int snd_ac97_update_power(struct snd_ac97 *ac97, int reg, int powerup) } } - if (! power_save) - return 0; - - if (! powerup && ac97->power_workq) + if (power_save && !powerup && ac97->power_workq) /* adjust power-down bits after two seconds delay * (for avoiding loud click noises for many (OSS) apps * that open/close frequently) diff --git a/sound/pci/ali5451/ali5451.c b/sound/pci/ali5451/ali5451.c index 13a8cefa774..a7edd56542d 100644 --- a/sound/pci/ali5451/ali5451.c +++ b/sound/pci/ali5451/ali5451.c @@ -2032,8 +2032,10 @@ static int ali_suspend(struct pci_dev *pci, pm_message_t state) outl(0xffffffff, ALI_REG(chip, ALI_STOP)); spin_unlock_irq(&chip->reg_lock); + pci_disable_device(pci); pci_save_state(pci); + pci_set_power_state(pci, pci_choose_state(pci, state)); return 0; } @@ -2048,8 +2050,15 @@ static int ali_resume(struct pci_dev *pci) if (! im) return 0; + pci_set_power_state(pci, PCI_D0); pci_restore_state(pci); - pci_enable_device(pci); + if (pci_enable_device(pci) < 0) { + printk(KERN_ERR "ali5451: pci_enable_device failed, " + "disabling device\n"); + snd_card_disconnect(card); + return -EIO; + } + pci_set_master(pci); spin_lock_irq(&chip->reg_lock); diff --git a/sound/pci/als300.c b/sound/pci/als300.c index 9b16c299f0a..95f70f3cc37 100644 --- a/sound/pci/als300.c +++ b/sound/pci/als300.c @@ -768,9 +768,9 @@ static int snd_als300_suspend(struct pci_dev *pci, pm_message_t state) snd_pcm_suspend_all(chip->pcm); snd_ac97_suspend(chip->ac97); - pci_set_power_state(pci, PCI_D3hot); pci_disable_device(pci); pci_save_state(pci); + pci_set_power_state(pci, pci_choose_state(pci, state)); return 0; } @@ -779,9 +779,14 @@ static int snd_als300_resume(struct pci_dev *pci) struct snd_card *card = pci_get_drvdata(pci); struct snd_als300 *chip = card->private_data; - pci_restore_state(pci); - pci_enable_device(pci); pci_set_power_state(pci, PCI_D0); + pci_restore_state(pci); + if (pci_enable_device(pci) < 0) { + printk(KERN_ERR "als300: pci_enable_device failed, " + "disabling device\n"); + snd_card_disconnect(card); + return -EIO; + } pci_set_master(pci); snd_als300_init(chip); diff --git a/sound/pci/als4000.c b/sound/pci/als4000.c index 15fc3929b5f..8fb55d3b454 100644 --- a/sound/pci/als4000.c +++ b/sound/pci/als4000.c @@ -804,9 +804,9 @@ static int snd_als4000_suspend(struct pci_dev *pci, pm_message_t state) snd_pcm_suspend_all(chip->pcm); snd_sbmixer_suspend(chip); - pci_set_power_state(pci, PCI_D3hot); pci_disable_device(pci); pci_save_state(pci); + pci_set_power_state(pci, pci_choose_state(pci, state)); return 0; } @@ -816,9 +816,14 @@ static int snd_als4000_resume(struct pci_dev *pci) struct snd_card_als4000 *acard = card->private_data; struct snd_sb *chip = acard->chip; - pci_restore_state(pci); - pci_enable_device(pci); pci_set_power_state(pci, PCI_D0); + pci_restore_state(pci); + if (pci_enable_device(pci) < 0) { + printk(KERN_ERR "als4000: pci_enable_device failed, " + "disabling device\n"); + snd_card_disconnect(card); + return -EIO; + } pci_set_master(pci); snd_als4000_configure(chip); diff --git a/sound/pci/atiixp.c b/sound/pci/atiixp.c index 3e8fc5a0006..e3e99f39671 100644 --- a/sound/pci/atiixp.c +++ b/sound/pci/atiixp.c @@ -1442,9 +1442,9 @@ static int snd_atiixp_suspend(struct pci_dev *pci, pm_message_t state) snd_atiixp_aclink_down(chip); snd_atiixp_chip_stop(chip); - pci_set_power_state(pci, PCI_D3hot); pci_disable_device(pci); pci_save_state(pci); + pci_set_power_state(pci, pci_choose_state(pci, state)); return 0; } @@ -1454,9 +1454,14 @@ static int snd_atiixp_resume(struct pci_dev *pci) struct atiixp *chip = card->private_data; int i; - pci_restore_state(pci); - pci_enable_device(pci); pci_set_power_state(pci, PCI_D0); + pci_restore_state(pci); + if (pci_enable_device(pci) < 0) { + printk(KERN_ERR "atiixp: pci_enable_device failed, " + "disabling device\n"); + snd_card_disconnect(card); + return -EIO; + } pci_set_master(pci); snd_atiixp_aclink_reset(chip); diff --git a/sound/pci/atiixp_modem.c b/sound/pci/atiixp_modem.c index c5dda1bf3d4..dc54f2c68ed 100644 --- a/sound/pci/atiixp_modem.c +++ b/sound/pci/atiixp_modem.c @@ -1128,9 +1128,9 @@ static int snd_atiixp_suspend(struct pci_dev *pci, pm_message_t state) snd_atiixp_aclink_down(chip); snd_atiixp_chip_stop(chip); - pci_set_power_state(pci, PCI_D3hot); pci_disable_device(pci); pci_save_state(pci); + pci_set_power_state(pci, pci_choose_state(pci, state)); return 0; } @@ -1140,9 +1140,14 @@ static int snd_atiixp_resume(struct pci_dev *pci) struct atiixp_modem *chip = card->private_data; int i; - pci_restore_state(pci); - pci_enable_device(pci); pci_set_power_state(pci, PCI_D0); + pci_restore_state(pci); + if (pci_enable_device(pci) < 0) { + printk(KERN_ERR "atiixp-modem: pci_enable_device failed, " + "disabling device\n"); + snd_card_disconnect(card); + return -EIO; + } pci_set_master(pci); snd_atiixp_aclink_reset(chip); diff --git a/sound/pci/azt3328.c b/sound/pci/azt3328.c index 692f203d65d..2414ee63075 100644 --- a/sound/pci/azt3328.c +++ b/sound/pci/azt3328.c @@ -1903,9 +1903,9 @@ snd_azf3328_suspend(struct pci_dev *pci, pm_message_t state) for (reg = 0; reg < AZF_IO_SIZE_SYNTH_PM / 2; reg++) chip->saved_regs_synth[reg] = inw(chip->synth_port + reg * 2); - pci_set_power_state(pci, PCI_D3hot); pci_disable_device(pci); pci_save_state(pci); + pci_set_power_state(pci, pci_choose_state(pci, state)); return 0; } @@ -1916,9 +1916,14 @@ snd_azf3328_resume(struct pci_dev *pci) struct snd_azf3328 *chip = card->private_data; int reg; - pci_restore_state(pci); - pci_enable_device(pci); pci_set_power_state(pci, PCI_D0); + pci_restore_state(pci); + if (pci_enable_device(pci) < 0) { + printk(KERN_ERR "azt3328: pci_enable_device failed, " + "disabling device\n"); + snd_card_disconnect(card); + return -EIO; + } pci_set_master(pci); for (reg = 0; reg < AZF_IO_SIZE_IO2_PM / 2; reg++) diff --git a/sound/pci/cmipci.c b/sound/pci/cmipci.c index 1f7e7108306..0093cd1f92d 100644 --- a/sound/pci/cmipci.c +++ b/sound/pci/cmipci.c @@ -3122,9 +3122,9 @@ static int snd_cmipci_suspend(struct pci_dev *pci, pm_message_t state) /* disable ints */ snd_cmipci_write(cm, CM_REG_INT_HLDCLR, 0); - pci_set_power_state(pci, PCI_D3hot); pci_disable_device(pci); pci_save_state(pci); + pci_set_power_state(pci, pci_choose_state(pci, state)); return 0; } @@ -3134,9 +3134,14 @@ static int snd_cmipci_resume(struct pci_dev *pci) struct cmipci *cm = card->private_data; int i; - pci_restore_state(pci); - pci_enable_device(pci); pci_set_power_state(pci, PCI_D0); + pci_restore_state(pci); + if (pci_enable_device(pci) < 0) { + printk(KERN_ERR "cmipci: pci_enable_device failed, " + "disabling device\n"); + snd_card_disconnect(card); + return -EIO; + } pci_set_master(pci); /* reset / initialize to a sane state */ diff --git a/sound/pci/cs4281.c b/sound/pci/cs4281.c index d54924e60bb..0905fa88129 100644 --- a/sound/pci/cs4281.c +++ b/sound/pci/cs4281.c @@ -2050,6 +2050,7 @@ static int cs4281_suspend(struct pci_dev *pci, pm_message_t state) pci_disable_device(pci); pci_save_state(pci); + pci_set_power_state(pci, pci_choose_state(pci, state)); return 0; } @@ -2060,8 +2061,14 @@ static int cs4281_resume(struct pci_dev *pci) unsigned int i; u32 ulCLK; + pci_set_power_state(pci, PCI_D0); pci_restore_state(pci); - pci_enable_device(pci); + if (pci_enable_device(pci) < 0) { + printk(KERN_ERR "cs4281: pci_enable_device failed, " + "disabling device\n"); + snd_card_disconnect(card); + return -EIO; + } pci_set_master(pci); ulCLK = snd_cs4281_peekBA0(chip, BA0_CLKCR1); diff --git a/sound/pci/cs46xx/cs46xx_lib.c b/sound/pci/cs46xx/cs46xx_lib.c index 16d4ebf2a33..2807b9756ef 100644 --- a/sound/pci/cs46xx/cs46xx_lib.c +++ b/sound/pci/cs46xx/cs46xx_lib.c @@ -3687,8 +3687,10 @@ int snd_cs46xx_suspend(struct pci_dev *pci, pm_message_t state) /* disable CLKRUN */ chip->active_ctrl(chip, -chip->amplifier); chip->amplifier = amp_saved; /* restore the status */ + pci_disable_device(pci); pci_save_state(pci); + pci_set_power_state(pci, pci_choose_state(pci, state)); return 0; } @@ -3698,9 +3700,16 @@ int snd_cs46xx_resume(struct pci_dev *pci) struct snd_cs46xx *chip = card->private_data; int amp_saved; + pci_set_power_state(pci, PCI_D0); pci_restore_state(pci); - pci_enable_device(pci); + if (pci_enable_device(pci) < 0) { + printk(KERN_ERR "cs46xx: pci_enable_device failed, " + "disabling device\n"); + snd_card_disconnect(card); + return -EIO; + } pci_set_master(pci); + amp_saved = chip->amplifier; chip->amplifier = 0; chip->active_ctrl(chip, 1); /* force to on */ diff --git a/sound/pci/cs5535audio/cs5535audio_pm.c b/sound/pci/cs5535audio/cs5535audio_pm.c index aad0e69db9c..3e4d198a450 100644 --- a/sound/pci/cs5535audio/cs5535audio_pm.c +++ b/sound/pci/cs5535audio/cs5535audio_pm.c @@ -73,9 +73,10 @@ int snd_cs5535audio_suspend(struct pci_dev *pci, pm_message_t state) snd_ac97_suspend(cs5535au->ac97); /* save important regs, then disable aclink in hw */ snd_cs5535audio_stop_hardware(cs5535au); + pci_disable_device(pci); pci_save_state(pci); - + pci_set_power_state(pci, pci_choose_state(pci, state)); return 0; } @@ -87,8 +88,14 @@ int snd_cs5535audio_resume(struct pci_dev *pci) int timeout; int i; + pci_set_power_state(pci, PCI_D0); pci_restore_state(pci); - pci_enable_device(pci); + if (pci_enable_device(pci) < 0) { + printk(KERN_ERR "cs5535audio: pci_enable_device failed, " + "disabling device\n"); + snd_card_disconnect(card); + return -EIO; + } pci_set_master(pci); /* set LNK_WRM_RST to reset AC link */ diff --git a/sound/pci/emu10k1/emu10k1.c b/sound/pci/emu10k1/emu10k1.c index 493ec0816bb..55caf341933 100644 --- a/sound/pci/emu10k1/emu10k1.c +++ b/sound/pci/emu10k1/emu10k1.c @@ -226,9 +226,9 @@ static int snd_emu10k1_suspend(struct pci_dev *pci, pm_message_t state) snd_emu10k1_done(emu); - pci_set_power_state(pci, PCI_D3hot); pci_disable_device(pci); pci_save_state(pci); + pci_set_power_state(pci, pci_choose_state(pci, state)); return 0; } @@ -237,11 +237,16 @@ static int snd_emu10k1_resume(struct pci_dev *pci) struct snd_card *card = pci_get_drvdata(pci); struct snd_emu10k1 *emu = card->private_data; - pci_restore_state(pci); - pci_enable_device(pci); pci_set_power_state(pci, PCI_D0); + pci_restore_state(pci); + if (pci_enable_device(pci) < 0) { + printk(KERN_ERR "emu10k1: pci_enable_device failed, " + "disabling device\n"); + snd_card_disconnect(card); + return -EIO; + } pci_set_master(pci); - + snd_emu10k1_resume_init(emu); snd_emu10k1_efx_resume(emu); snd_ac97_resume(emu->ac97); diff --git a/sound/pci/emu10k1/emu10k1_main.c b/sound/pci/emu10k1/emu10k1_main.c index 8058059c56e..8bc4ffa6220 100644 --- a/sound/pci/emu10k1/emu10k1_main.c +++ b/sound/pci/emu10k1/emu10k1_main.c @@ -956,6 +956,7 @@ static struct snd_emu_chip_details emu_chip_details[] = { .ca0151_chip = 1, .spk71 = 1, .spdif_bug = 1, + .adc_1361t = 1, /* 24 bit capture instead of 16bit. Fixes ALSA bug#324 */ .ac97_chip = 1} , {.vendor = 0x1102, .device = 0x0004, .revision = 0x04, .driver = "Audigy2", .name = "Audigy 2 [Unknown]", diff --git a/sound/pci/ens1370.c b/sound/pci/ens1370.c index 8cb4fb2412d..d2a811f222c 100644 --- a/sound/pci/ens1370.c +++ b/sound/pci/ens1370.c @@ -2072,9 +2072,10 @@ static int snd_ensoniq_suspend(struct pci_dev *pci, pm_message_t state) udelay(100); snd_ak4531_suspend(ensoniq->u.es1370.ak4531); #endif - pci_set_power_state(pci, PCI_D3hot); + pci_disable_device(pci); pci_save_state(pci); + pci_set_power_state(pci, pci_choose_state(pci, state)); return 0; } @@ -2083,9 +2084,14 @@ static int snd_ensoniq_resume(struct pci_dev *pci) struct snd_card *card = pci_get_drvdata(pci); struct ensoniq *ensoniq = card->private_data; - pci_restore_state(pci); - pci_enable_device(pci); pci_set_power_state(pci, PCI_D0); + pci_restore_state(pci); + if (pci_enable_device(pci) < 0) { + printk(KERN_ERR DRIVER_NAME ": pci_enable_device failed, " + "disabling device\n"); + snd_card_disconnect(card); + return -EIO; + } pci_set_master(pci); snd_ensoniq_chip_init(ensoniq); diff --git a/sound/pci/es1938.c b/sound/pci/es1938.c index 2da988f78ba..1a8d36df4b5 100644 --- a/sound/pci/es1938.c +++ b/sound/pci/es1938.c @@ -1481,10 +1481,14 @@ static int es1938_suspend(struct pci_dev *pci, pm_message_t state) *d = snd_es1938_reg_read(chip, *s); outb(0x00, SLIO_REG(chip, IRQCONTROL)); /* disable irqs */ - if (chip->irq >= 0) + if (chip->irq >= 0) { + synchronize_irq(chip->irq); free_irq(chip->irq, chip); + chip->irq = -1; + } pci_disable_device(pci); pci_save_state(pci); + pci_set_power_state(pci, pci_choose_state(pci, state)); return 0; } @@ -1494,10 +1498,22 @@ static int es1938_resume(struct pci_dev *pci) struct es1938 *chip = card->private_data; unsigned char *s, *d; + pci_set_power_state(pci, PCI_D0); pci_restore_state(pci); - pci_enable_device(pci); - request_irq(pci->irq, snd_es1938_interrupt, - IRQF_DISABLED|IRQF_SHARED, "ES1938", chip); + if (pci_enable_device(pci) < 0) { + printk(KERN_ERR "es1938: pci_enable_device failed, " + "disabling device\n"); + snd_card_disconnect(card); + return -EIO; + } + + if (request_irq(pci->irq, snd_es1938_interrupt, + IRQF_DISABLED|IRQF_SHARED, "ES1938", chip)) { + printk(KERN_ERR "es1938: unable to grab IRQ %d, " + "disabling device\n", pci->irq); + snd_card_disconnect(card); + return -EIO; + } chip->irq = pci->irq; snd_es1938_chip_init(chip); @@ -1556,8 +1572,10 @@ static int snd_es1938_free(struct es1938 *chip) snd_es1938_free_gameport(chip); - if (chip->irq >= 0) + if (chip->irq >= 0) { + synchronize_irq(chip->irq); free_irq(chip->irq, chip); + } pci_release_regions(chip->pci); pci_disable_device(chip->pci); kfree(chip); @@ -1602,6 +1620,7 @@ static int __devinit snd_es1938_create(struct snd_card *card, spin_lock_init(&chip->mixer_lock); chip->card = card; chip->pci = pci; + chip->irq = -1; if ((err = pci_request_regions(pci, "ESS Solo-1")) < 0) { kfree(chip); pci_disable_device(pci); diff --git a/sound/pci/es1968.c b/sound/pci/es1968.c index b9d723c7e1d..092da53e146 100644 --- a/sound/pci/es1968.c +++ b/sound/pci/es1968.c @@ -432,46 +432,6 @@ MODULE_PARM_DESC(joystick, "Enable joystick."); #define ESM_MODE_PLAY 0 #define ESM_MODE_CAPTURE 1 -/* acpi states */ -enum { - ACPI_D0=0, - ACPI_D1, - ACPI_D2, - ACPI_D3 -}; - -/* bits in the acpi masks */ -#define ACPI_12MHZ ( 1 << 15) -#define ACPI_24MHZ ( 1 << 14) -#define ACPI_978 ( 1 << 13) -#define ACPI_SPDIF ( 1 << 12) -#define ACPI_GLUE ( 1 << 11) -#define ACPI__10 ( 1 << 10) /* reserved */ -#define ACPI_PCIINT ( 1 << 9) -#define ACPI_HV ( 1 << 8) /* hardware volume */ -#define ACPI_GPIO ( 1 << 7) -#define ACPI_ASSP ( 1 << 6) -#define ACPI_SB ( 1 << 5) /* sb emul */ -#define ACPI_FM ( 1 << 4) /* fm emul */ -#define ACPI_RB ( 1 << 3) /* ringbus / aclink */ -#define ACPI_MIDI ( 1 << 2) -#define ACPI_GP ( 1 << 1) /* game port */ -#define ACPI_WP ( 1 << 0) /* wave processor */ - -#define ACPI_ALL (0xffff) -#define ACPI_SLEEP (~(ACPI_SPDIF|ACPI_ASSP|ACPI_SB|ACPI_FM| \ - ACPI_MIDI|ACPI_GP|ACPI_WP)) -#define ACPI_NONE (ACPI__10) - -/* these masks indicate which units we care about at - which states */ -static u16 acpi_state_mask[] = { - [ACPI_D0] = ACPI_ALL, - [ACPI_D1] = ACPI_SLEEP, - [ACPI_D2] = ACPI_SLEEP, - [ACPI_D3] = ACPI_NONE -}; - /* APU use in the driver */ enum snd_enum_apu_type { @@ -2160,21 +2120,6 @@ static void snd_es1968_reset(struct es1968 *chip) } /* - * power management - */ -static void snd_es1968_set_acpi(struct es1968 *chip, int state) -{ - u16 active_mask = acpi_state_mask[state]; - - pci_set_power_state(chip->pci, state); - /* make sure the units we care about are on - XXX we might want to do this before state flipping? */ - pci_write_config_word(chip->pci, 0x54, ~ active_mask); - pci_write_config_word(chip->pci, 0x56, ~ active_mask); -} - - -/* * initialize maestro chip */ static void snd_es1968_chip_init(struct es1968 *chip) @@ -2196,9 +2141,6 @@ static void snd_es1968_chip_init(struct es1968 *chip) * IRQs. */ - /* do config work at full power */ - snd_es1968_set_acpi(chip, ACPI_D0); - /* Config Reg A */ pci_read_config_word(pci, ESM_CONFIG_A, &w); @@ -2397,9 +2339,10 @@ static int es1968_suspend(struct pci_dev *pci, pm_message_t state) snd_pcm_suspend_all(chip->pcm); snd_ac97_suspend(chip->ac97); snd_es1968_bob_stop(chip); - snd_es1968_set_acpi(chip, ACPI_D3); + pci_disable_device(pci); pci_save_state(pci); + pci_set_power_state(pci, pci_choose_state(pci, state)); return 0; } @@ -2413,9 +2356,16 @@ static int es1968_resume(struct pci_dev *pci) return 0; /* restore all our config */ + pci_set_power_state(pci, PCI_D0); pci_restore_state(pci); - pci_enable_device(pci); + if (pci_enable_device(pci) < 0) { + printk(KERN_ERR "es1968: pci_enable_device failed, " + "disabling device\n"); + snd_card_disconnect(card); + return -EIO; + } pci_set_master(pci); + snd_es1968_chip_init(chip); /* need to restore the base pointers.. */ @@ -2514,7 +2464,6 @@ static int snd_es1968_free(struct es1968 *chip) if (chip->irq >= 0) free_irq(chip->irq, (void *)chip); snd_es1968_free_gameport(chip); - snd_es1968_set_acpi(chip, ACPI_D3); chip->master_switch = NULL; chip->master_volume = NULL; pci_release_regions(chip->pci); diff --git a/sound/pci/fm801.c b/sound/pci/fm801.c index 3ec7d7ee04d..77e3d5c1830 100644 --- a/sound/pci/fm801.c +++ b/sound/pci/fm801.c @@ -1531,9 +1531,9 @@ static int snd_fm801_suspend(struct pci_dev *pci, pm_message_t state) chip->saved_regs[i] = inw(chip->port + saved_regs[i]); /* FIXME: tea575x suspend */ - pci_set_power_state(pci, PCI_D3hot); pci_disable_device(pci); pci_save_state(pci); + pci_set_power_state(pci, pci_choose_state(pci, state)); return 0; } @@ -1543,9 +1543,14 @@ static int snd_fm801_resume(struct pci_dev *pci) struct fm801 *chip = card->private_data; int i; - pci_restore_state(pci); - pci_enable_device(pci); pci_set_power_state(pci, PCI_D0); + pci_restore_state(pci); + if (pci_enable_device(pci) < 0) { + printk(KERN_ERR "fm801: pci_enable_device failed, " + "disabling device\n"); + snd_card_disconnect(card); + return -EIO; + } pci_set_master(pci); snd_fm801_chip_init(chip, 1); diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c index 9c3d7ac0806..71482c15a85 100644 --- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c @@ -272,10 +272,11 @@ EXPORT_SYMBOL(snd_hda_queue_unsol_event); /* * process queueud unsolicited events */ -static void process_unsol_events(void *data) +static void process_unsol_events(struct work_struct *work) { - struct hda_bus *bus = data; - struct hda_bus_unsolicited *unsol = bus->unsol; + struct hda_bus_unsolicited *unsol = + container_of(work, struct hda_bus_unsolicited, work); + struct hda_bus *bus = unsol->bus; struct hda_codec *codec; unsigned int rp, caddr, res; @@ -314,7 +315,8 @@ static int init_unsol_queue(struct hda_bus *bus) kfree(unsol); return -ENOMEM; } - INIT_WORK(&unsol->work, process_unsol_events, bus); + INIT_WORK(&unsol->work, process_unsol_events); + unsol->bus = bus; bus->unsol = unsol; return 0; } diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c index feeed12920b..e35cfd326df 100644 --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c @@ -55,7 +55,7 @@ static char *model; static int position_fix; static int probe_mask = -1; static int single_cmd; -static int disable_msi; +static int enable_msi; module_param(index, int, 0444); MODULE_PARM_DESC(index, "Index value for Intel HD audio interface."); @@ -69,8 +69,8 @@ module_param(probe_mask, int, 0444); MODULE_PARM_DESC(probe_mask, "Bitmask to probe codecs (default = -1)."); module_param(single_cmd, bool, 0444); MODULE_PARM_DESC(single_cmd, "Use single command to communicate with codecs (for debugging only)."); -module_param(disable_msi, int, 0); -MODULE_PARM_DESC(disable_msi, "Disable Message Signaled Interrupt (MSI)"); +module_param(enable_msi, int, 0); +MODULE_PARM_DESC(enable_msi, "Enable Message Signaled Interrupt (MSI)"); /* just for backward compatibility */ @@ -86,6 +86,7 @@ MODULE_SUPPORTED_DEVICE("{{Intel, ICH6}," "{ATI, SB450}," "{ATI, SB600}," "{ATI, RS600}," + "{ATI, RS690}," "{VIA, VT8251}," "{VIA, VT8237A}," "{SiS, SIS966}," @@ -336,6 +337,7 @@ struct azx { unsigned int initialized :1; unsigned int single_cmd :1; unsigned int polling_mode :1; + unsigned int msi :1; }; /* driver types */ @@ -396,6 +398,7 @@ static char *driver_short_names[] __devinitdata = { */ #define upper_32bit(addr) (sizeof(addr) > 4 ? (u32)((addr) >> 32) : (u32)0) +static int azx_acquire_irq(struct azx *chip, int do_disconnect); /* * Interface for HD codec @@ -535,6 +538,18 @@ static unsigned int azx_rirb_get_response(struct hda_codec *codec) schedule_timeout_interruptible(1); } while (time_after_eq(timeout, jiffies)); + if (chip->msi) { + snd_printk(KERN_WARNING "hda_intel: No response from codec, " + "disabling MSI...\n"); + free_irq(chip->irq, chip); + chip->irq = -1; + pci_disable_msi(chip->pci); + chip->msi = 0; + if (azx_acquire_irq(chip, 1) < 0) + return -1; + goto again; + } + if (!chip->polling_mode) { snd_printk(KERN_WARNING "hda_intel: azx_get_response timeout, " "switching to polling mode...\n"); @@ -1363,6 +1378,20 @@ static int __devinit azx_init_stream(struct azx *chip) return 0; } +static int azx_acquire_irq(struct azx *chip, int do_disconnect) +{ + if (request_irq(chip->pci->irq, azx_interrupt, IRQF_DISABLED|IRQF_SHARED, + "HDA Intel", chip)) { + printk(KERN_ERR "hda-intel: unable to grab IRQ %d, " + "disabling device\n", chip->pci->irq); + if (do_disconnect) + snd_card_disconnect(chip->card); + return -1; + } + chip->irq = chip->pci->irq; + return 0; +} + #ifdef CONFIG_PM /* @@ -1379,12 +1408,16 @@ static int azx_suspend(struct pci_dev *pci, pm_message_t state) snd_pcm_suspend_all(chip->pcm[i]); snd_hda_suspend(chip->bus, state); azx_free_cmd_io(chip); - if (chip->irq >= 0) + if (chip->irq >= 0) { + synchronize_irq(chip->irq); free_irq(chip->irq, chip); - if (!disable_msi) + chip->irq = -1; + } + if (chip->msi) pci_disable_msi(chip->pci); pci_disable_device(pci); pci_save_state(pci); + pci_set_power_state(pci, pci_choose_state(pci, state)); return 0; } @@ -1393,15 +1426,20 @@ static int azx_resume(struct pci_dev *pci) struct snd_card *card = pci_get_drvdata(pci); struct azx *chip = card->private_data; + pci_set_power_state(pci, PCI_D0); pci_restore_state(pci); - pci_enable_device(pci); - if (!disable_msi) - pci_enable_msi(pci); - /* FIXME: need proper error handling */ - request_irq(pci->irq, azx_interrupt, IRQF_DISABLED|IRQF_SHARED, - "HDA Intel", chip); - chip->irq = pci->irq; + if (pci_enable_device(pci) < 0) { + printk(KERN_ERR "hda-intel: pci_enable_device failed, " + "disabling device\n"); + snd_card_disconnect(card); + return -EIO; + } pci_set_master(pci); + if (chip->msi) + if (pci_enable_msi(pci) < 0) + chip->msi = 0; + if (azx_acquire_irq(chip, 1) < 0) + return -EIO; azx_init_chip(chip); snd_hda_resume(chip->bus); snd_power_change_state(card, SNDRV_CTL_POWER_D0); @@ -1431,15 +1469,14 @@ static int azx_free(struct azx *chip) /* disable position buffer */ azx_writel(chip, DPLBASE, 0); azx_writel(chip, DPUBASE, 0); - - synchronize_irq(chip->irq); } if (chip->irq >= 0) { + synchronize_irq(chip->irq); free_irq(chip->irq, (void*)chip); - if (!disable_msi) - pci_disable_msi(chip->pci); } + if (chip->msi) + pci_disable_msi(chip->pci); if (chip->remap_addr) iounmap(chip->remap_addr); @@ -1494,6 +1531,7 @@ static int __devinit azx_create(struct snd_card *card, struct pci_dev *pci, chip->pci = pci; chip->irq = -1; chip->driver_type = driver_type; + chip->msi = enable_msi; chip->position_fix = position_fix; chip->single_cmd = single_cmd; @@ -1523,16 +1561,14 @@ static int __devinit azx_create(struct snd_card *card, struct pci_dev *pci, goto errout; } - if (!disable_msi) - pci_enable_msi(pci); + if (chip->msi) + if (pci_enable_msi(pci) < 0) + chip->msi = 0; - if (request_irq(pci->irq, azx_interrupt, IRQF_DISABLED|IRQF_SHARED, - "HDA Intel", (void*)chip)) { - snd_printk(KERN_ERR SFX "unable to grab IRQ %d\n", pci->irq); + if (azx_acquire_irq(chip, 0) < 0) { err = -EBUSY; goto errout; } - chip->irq = pci->irq; pci_set_master(pci); synchronize_irq(chip->irq); @@ -1677,6 +1713,7 @@ static struct pci_device_id azx_ids[] = { { 0x1002, 0x437b, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_ATI }, /* ATI SB450 */ { 0x1002, 0x4383, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_ATI }, /* ATI SB600 */ { 0x1002, 0x793b, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_ATIHDMI }, /* ATI RS600 HDMI */ + { 0x1002, 0x7919, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_ATIHDMI }, /* ATI RS690 HDMI */ { 0x1106, 0x3288, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_VIA }, /* VIA VT8251/VT8237A */ { 0x1039, 0x7502, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_SIS }, /* SIS966 */ { 0x10b9, 0x5461, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_ULI }, /* ULI M5461 */ diff --git a/sound/pci/hda/hda_local.h b/sound/pci/hda/hda_local.h index f9416c36396..9ca1baf860b 100644 --- a/sound/pci/hda/hda_local.h +++ b/sound/pci/hda/hda_local.h @@ -206,6 +206,7 @@ struct hda_bus_unsolicited { /* workqueue */ struct workqueue_struct *workq; struct work_struct work; + struct hda_bus *bus; }; /* diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c index 511df07fa2a..edd22dec828 100644 --- a/sound/pci/hda/patch_analog.c +++ b/sound/pci/hda/patch_analog.c @@ -818,6 +818,8 @@ static struct hda_board_config ad1986a_cfg_tbl[] = { .config = AD1986A_LAPTOP_EAPD }, /* ASUS A6J */ { .pci_subvendor = 0x1043, .pci_subdevice = 0x11f7, .config = AD1986A_LAPTOP_EAPD }, /* ASUS U5A */ + { .pci_subvendor = 0x1043, .pci_subdevice = 0x1263, + .config = AD1986A_LAPTOP_EAPD }, /* ASUS U5F */ { .pci_subvendor = 0x1043, .pci_subdevice = 0x1297, .config = AD1986A_LAPTOP_EAPD }, /* ASUS Z62F */ { .pci_subvendor = 0x103c, .pci_subdevice = 0x30af, diff --git a/sound/pci/hda/patch_atihdmi.c b/sound/pci/hda/patch_atihdmi.c index a27440ffd1c..7333f275dec 100644 --- a/sound/pci/hda/patch_atihdmi.c +++ b/sound/pci/hda/patch_atihdmi.c @@ -161,5 +161,6 @@ static int patch_atihdmi(struct hda_codec *codec) */ struct hda_codec_preset snd_hda_preset_atihdmi[] = { { .id = 0x1002793c, .name = "ATI RS600 HDMI", .patch = patch_atihdmi }, + { .id = 0x1002791a, .name = "ATI RS690 HDMI", .patch = patch_atihdmi }, {} /* terminator */ }; diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 84a3eb8aacc..fb961448db1 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -1799,7 +1799,7 @@ static int alc_build_pcms(struct hda_codec *codec) /* SPDIF for stream index #1 */ if (spec->multiout.dig_out_nid || spec->dig_in_nid) { codec->num_pcms = 2; - info++; + info = spec->pcm_rec + 1; info->name = spec->stream_name_digital; if (spec->multiout.dig_out_nid && spec->stream_digital_playback) { @@ -1820,7 +1820,7 @@ static int alc_build_pcms(struct hda_codec *codec) if (spec->num_adc_nids > 1 && spec->stream_analog_capture && spec->adc_nids) { codec->num_pcms = 3; - info++; + info = spec->pcm_rec + 2; info->name = spec->stream_name_analog; /* No playback stream for second PCM */ info->stream[SNDRV_PCM_STREAM_PLAYBACK] = alc_pcm_null_playback; @@ -5870,7 +5870,7 @@ static struct hda_board_config alc262_cfg_tbl[] = { { .pci_subvendor = 0x10cf, .pci_subdevice = 0x1397, .config = ALC262_FUJITSU }, { .modelname = "hp-bpc", .config = ALC262_HP_BPC }, - { .pci_subvendor = 0x103c, .pci_subdevice = 0x208c, + { .pci_subvendor = 0x103c, .pci_subdevice = 0x280c, .config = ALC262_HP_BPC }, /* xw4400 */ { .pci_subvendor = 0x103c, .pci_subdevice = 0x3014, .config = ALC262_HP_BPC }, /* xw6400 */ diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index 731b7b97ee7..fe51ef3e49d 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c @@ -336,6 +336,13 @@ static struct hda_board_config stac9200_cfg_tbl[] = { .pci_subvendor = PCI_VENDOR_ID_INTEL, .pci_subdevice = 0x2668, /* DFI LanParty */ .config = STAC_REF }, + /* Dell laptops have BIOS problem */ + { .pci_subvendor = PCI_VENDOR_ID_DELL, .pci_subdevice = 0x01b5, + .config = STAC_REF }, /* Dell Inspiron 630m */ + { .pci_subvendor = PCI_VENDOR_ID_DELL, .pci_subdevice = 0x01c2, + .config = STAC_REF }, /* Dell Latitude D620 */ + { .pci_subvendor = PCI_VENDOR_ID_DELL, .pci_subdevice = 0x01cb, + .config = STAC_REF }, /* Dell Latitude 120L */ {} /* terminator */ }; @@ -591,13 +598,6 @@ static struct hda_board_config stac9205_cfg_tbl[] = { .pci_subvendor = PCI_VENDOR_ID_INTEL, .pci_subdevice = 0x2668, /* DFI LanParty */ .config = STAC_REF }, /* SigmaTel reference board */ - /* Dell laptops have BIOS problem */ - { .pci_subvendor = PCI_VENDOR_ID_DELL, .pci_subdevice = 0x01b5, - .config = STAC_REF }, /* Dell Inspiron 630m */ - { .pci_subvendor = PCI_VENDOR_ID_DELL, .pci_subdevice = 0x01c2, - .config = STAC_REF }, /* Dell Latitude D620 */ - { .pci_subvendor = PCI_VENDOR_ID_DELL, .pci_subdevice = 0x01cb, - .config = STAC_REF }, /* Dell Latitude 120L */ {} /* terminator */ }; diff --git a/sound/pci/intel8x0.c b/sound/pci/intel8x0.c index f4319b8d464..9c1bce7afa8 100644 --- a/sound/pci/intel8x0.c +++ b/sound/pci/intel8x0.c @@ -1962,6 +1962,12 @@ static struct ac97_quirk ac97_quirks[] __devinitdata = { .type = AC97_TUNE_HP_ONLY }, { + .subvendor = 0x10f7, + .subdevice = 0x834c, + .name = "Panasonic CF-R4", + .type = AC97_TUNE_HP_ONLY, + }, + { .subvendor = 0x110a, .subdevice = 0x0056, .name = "Fujitsu-Siemens Scenic", /* AD1981? */ @@ -2476,10 +2482,14 @@ static int intel8x0_suspend(struct pci_dev *pci, pm_message_t state) if (chip->device_type == DEVICE_INTEL_ICH4) chip->sdm_saved = igetbyte(chip, ICHREG(SDM)); - if (chip->irq >= 0) + if (chip->irq >= 0) { + synchronize_irq(chip->irq); free_irq(chip->irq, chip); + chip->irq = -1; + } pci_disable_device(pci); pci_save_state(pci); + pci_set_power_state(pci, pci_choose_state(pci, state)); return 0; } @@ -2489,11 +2499,22 @@ static int intel8x0_resume(struct pci_dev *pci) struct intel8x0 *chip = card->private_data; int i; + pci_set_power_state(pci, PCI_D0); pci_restore_state(pci); - pci_enable_device(pci); + if (pci_enable_device(pci) < 0) { + printk(KERN_ERR "intel8x0: pci_enable_device failed, " + "disabling device\n"); + snd_card_disconnect(card); + return -EIO; + } pci_set_master(pci); - request_irq(pci->irq, snd_intel8x0_interrupt, IRQF_DISABLED|IRQF_SHARED, - card->shortname, chip); + if (request_irq(pci->irq, snd_intel8x0_interrupt, + IRQF_DISABLED|IRQF_SHARED, card->shortname, chip)) { + printk(KERN_ERR "intel8x0: unable to grab IRQ %d, " + "disabling device\n", pci->irq); + snd_card_disconnect(card); + return -EIO; + } chip->irq = pci->irq; synchronize_irq(chip->irq); snd_intel8x0_chip_init(chip, 0); diff --git a/sound/pci/intel8x0m.c b/sound/pci/intel8x0m.c index 6703f5cb556..bd467c50112 100644 --- a/sound/pci/intel8x0m.c +++ b/sound/pci/intel8x0m.c @@ -1045,10 +1045,14 @@ static int intel8x0m_suspend(struct pci_dev *pci, pm_message_t state) for (i = 0; i < chip->pcm_devs; i++) snd_pcm_suspend_all(chip->pcm[i]); snd_ac97_suspend(chip->ac97); - if (chip->irq >= 0) + if (chip->irq >= 0) { + synchronize_irq(chip->irq); free_irq(chip->irq, chip); + chip->irq = -1; + } pci_disable_device(pci); pci_save_state(pci); + pci_set_power_state(pci, pci_choose_state(pci, state)); return 0; } @@ -1057,11 +1061,22 @@ static int intel8x0m_resume(struct pci_dev *pci) struct snd_card *card = pci_get_drvdata(pci); struct intel8x0m *chip = card->private_data; + pci_set_power_state(pci, PCI_D0); pci_restore_state(pci); - pci_enable_device(pci); + if (pci_enable_device(pci) < 0) { + printk(KERN_ERR "intel8x0m: pci_enable_device failed, " + "disabling device\n"); + snd_card_disconnect(card); + return -EIO; + } pci_set_master(pci); - request_irq(pci->irq, snd_intel8x0_interrupt, IRQF_DISABLED|IRQF_SHARED, - card->shortname, chip); + if (request_irq(pci->irq, snd_intel8x0_interrupt, + IRQF_DISABLED|IRQF_SHARED, card->shortname, chip)) { + printk(KERN_ERR "intel8x0m: unable to grab IRQ %d, " + "disabling device\n", pci->irq); + snd_card_disconnect(card); + return -EIO; + } chip->irq = pci->irq; snd_intel8x0_chip_init(chip, 0); snd_ac97_resume(chip->ac97); diff --git a/sound/pci/maestro3.c b/sound/pci/maestro3.c index 05605f474a7..8cab342bbaa 100644 --- a/sound/pci/maestro3.c +++ b/sound/pci/maestro3.c @@ -2589,12 +2589,9 @@ static int m3_suspend(struct pci_dev *pci, pm_message_t state) chip->suspend_mem[index++] = snd_m3_assp_read(chip, MEMTYPE_INTERNAL_DATA, i); - /* power down apci registers */ - snd_m3_outw(chip, 0xffff, 0x54); - snd_m3_outw(chip, 0xffff, 0x56); - pci_disable_device(pci); pci_save_state(pci); + pci_set_power_state(pci, pci_choose_state(pci, state)); return 0; } @@ -2607,8 +2604,14 @@ static int m3_resume(struct pci_dev *pci) if (chip->suspend_mem == NULL) return 0; + pci_set_power_state(pci, PCI_D0); pci_restore_state(pci); - pci_enable_device(pci); + if (pci_enable_device(pci) < 0) { + printk(KERN_ERR "maestor3: pci_enable_device failed, " + "disabling device\n"); + snd_card_disconnect(card); + return -EIO; + } pci_set_master(pci); /* first lets just bring everything back. .*/ diff --git a/sound/pci/nm256/nm256.c b/sound/pci/nm256/nm256.c index b1bbdb9e3b7..945d21bf187 100644 --- a/sound/pci/nm256/nm256.c +++ b/sound/pci/nm256/nm256.c @@ -1390,6 +1390,7 @@ static int nm256_suspend(struct pci_dev *pci, pm_message_t state) chip->coeffs_current = 0; pci_disable_device(pci); pci_save_state(pci); + pci_set_power_state(pci, pci_choose_state(pci, state)); return 0; } @@ -1401,8 +1402,17 @@ static int nm256_resume(struct pci_dev *pci) /* Perform a full reset on the hardware */ chip->in_resume = 1; + + pci_set_power_state(pci, PCI_D0); pci_restore_state(pci); - pci_enable_device(pci); + if (pci_enable_device(pci) < 0) { + printk(KERN_ERR "nm256: pci_enable_device failed, " + "disabling device\n"); + snd_card_disconnect(card); + return -EIO; + } + pci_set_master(pci); + snd_nm256_init_chip(chip); /* restore ac97 */ diff --git a/sound/pci/riptide/riptide.c b/sound/pci/riptide/riptide.c index ec4899147e1..56e0c01123e 100644 --- a/sound/pci/riptide/riptide.c +++ b/sound/pci/riptide/riptide.c @@ -1178,9 +1178,9 @@ static int riptide_suspend(struct pci_dev *pci, pm_message_t state) snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); snd_pcm_suspend_all(chip->pcm); snd_ac97_suspend(chip->ac97); - pci_set_power_state(pci, PCI_D3hot); pci_disable_device(pci); pci_save_state(pci); + pci_set_power_state(pci, pci_choose_state(pci, state)); return 0; } @@ -1189,9 +1189,14 @@ static int riptide_resume(struct pci_dev *pci) struct snd_card *card = pci_get_drvdata(pci); struct snd_riptide *chip = card->private_data; - pci_restore_state(pci); - pci_enable_device(pci); pci_set_power_state(pci, PCI_D0); + pci_restore_state(pci); + if (pci_enable_device(pci) < 0) { + printk(KERN_ERR "riptide: pci_enable_device failed, " + "disabling device\n"); + snd_card_disconnect(card); + return -EIO; + } pci_set_master(pci); snd_riptide_initialize(chip); snd_ac97_resume(chip->ac97); diff --git a/sound/pci/trident/trident_main.c b/sound/pci/trident/trident_main.c index 0d478871808..1fbc4321122 100644 --- a/sound/pci/trident/trident_main.c +++ b/sound/pci/trident/trident_main.c @@ -3966,15 +3966,9 @@ int snd_trident_suspend(struct pci_dev *pci, pm_message_t state) snd_ac97_suspend(trident->ac97); snd_ac97_suspend(trident->ac97_sec); - switch (trident->device) { - case TRIDENT_DEVICE_ID_DX: - case TRIDENT_DEVICE_ID_NX: - break; /* TODO */ - case TRIDENT_DEVICE_ID_SI7018: - break; - } pci_disable_device(pci); pci_save_state(pci); + pci_set_power_state(pci, pci_choose_state(pci, state)); return 0; } @@ -3983,9 +3977,15 @@ int snd_trident_resume(struct pci_dev *pci) struct snd_card *card = pci_get_drvdata(pci); struct snd_trident *trident = card->private_data; + pci_set_power_state(pci, PCI_D0); pci_restore_state(pci); - pci_enable_device(pci); - pci_set_master(pci); /* to be sure */ + if (pci_enable_device(pci) < 0) { + printk(KERN_ERR "trident: pci_enable_device failed, " + "disabling device\n"); + snd_card_disconnect(card); + return -EIO; + } + pci_set_master(pci); switch (trident->device) { case TRIDENT_DEVICE_ID_DX: diff --git a/sound/pci/via82xx.c b/sound/pci/via82xx.c index e6990e0bbf2..92b0736c0fd 100644 --- a/sound/pci/via82xx.c +++ b/sound/pci/via82xx.c @@ -2185,9 +2185,9 @@ static int snd_via82xx_suspend(struct pci_dev *pci, pm_message_t state) chip->capture_src_saved[1] = inb(chip->port + VIA_REG_CAPTURE_CHANNEL + 0x10); } - pci_set_power_state(pci, PCI_D3hot); pci_disable_device(pci); pci_save_state(pci); + pci_set_power_state(pci, pci_choose_state(pci, state)); return 0; } @@ -2197,9 +2197,15 @@ static int snd_via82xx_resume(struct pci_dev *pci) struct via82xx *chip = card->private_data; int i; - pci_restore_state(pci); - pci_enable_device(pci); pci_set_power_state(pci, PCI_D0); + pci_restore_state(pci); + if (pci_enable_device(pci) < 0) { + printk(KERN_ERR "via82xx: pci_enable_device failed, " + "disabling device\n"); + snd_card_disconnect(card); + return -EIO; + } + pci_set_master(pci); snd_via82xx_chip_init(chip); diff --git a/sound/pci/via82xx_modem.c b/sound/pci/via82xx_modem.c index 5ab1cf3d434..feb27c96625 100644 --- a/sound/pci/via82xx_modem.c +++ b/sound/pci/via82xx_modem.c @@ -1032,9 +1032,10 @@ static int snd_via82xx_suspend(struct pci_dev *pci, pm_message_t state) snd_via82xx_channel_reset(chip, &chip->devs[i]); synchronize_irq(chip->irq); snd_ac97_suspend(chip->ac97); - pci_set_power_state(pci, PCI_D3hot); + pci_disable_device(pci); pci_save_state(pci); + pci_set_power_state(pci, pci_choose_state(pci, state)); return 0; } @@ -1044,9 +1045,14 @@ static int snd_via82xx_resume(struct pci_dev *pci) struct via82xx_modem *chip = card->private_data; int i; - pci_restore_state(pci); - pci_enable_device(pci); pci_set_power_state(pci, PCI_D0); + pci_restore_state(pci); + if (pci_enable_device(pci) < 0) { + printk(KERN_ERR "via82xx-modem: pci_enable_device failed, " + "disabling device\n"); + snd_card_disconnect(card); + return -EIO; + } pci_set_master(pci); snd_via82xx_chip_init(chip); diff --git a/sound/pci/vx222/vx222.c b/sound/pci/vx222/vx222.c index e7cd8acab59..af49e8aabf5 100644 --- a/sound/pci/vx222/vx222.c +++ b/sound/pci/vx222/vx222.c @@ -266,9 +266,9 @@ static int snd_vx222_suspend(struct pci_dev *pci, pm_message_t state) int err; err = snd_vx_suspend(&vx->core, state); - pci_set_power_state(pci, PCI_D3hot); pci_disable_device(pci); pci_save_state(pci); + pci_set_power_state(pci, pci_choose_state(pci, state)); return err; } @@ -277,9 +277,14 @@ static int snd_vx222_resume(struct pci_dev *pci) struct snd_card *card = pci_get_drvdata(pci); struct snd_vx222 *vx = card->private_data; - pci_restore_state(pci); - pci_enable_device(pci); pci_set_power_state(pci, PCI_D0); + pci_restore_state(pci); + if (pci_enable_device(pci) < 0) { + printk(KERN_ERR "vx222: pci_enable_device failed, " + "disabling device\n"); + snd_card_disconnect(card); + return -EIO; + } pci_set_master(pci); return snd_vx_resume(&vx->core); } diff --git a/sound/pci/ymfpci/ymfpci_main.c b/sound/pci/ymfpci/ymfpci_main.c index ebc6da89edf..a40c1085fd2 100644 --- a/sound/pci/ymfpci/ymfpci_main.c +++ b/sound/pci/ymfpci/ymfpci_main.c @@ -2218,6 +2218,7 @@ int snd_ymfpci_suspend(struct pci_dev *pci, pm_message_t state) snd_ymfpci_disable_dsp(chip); pci_disable_device(pci); pci_save_state(pci); + pci_set_power_state(pci, pci_choose_state(pci, state)); return 0; } @@ -2227,8 +2228,14 @@ int snd_ymfpci_resume(struct pci_dev *pci) struct snd_ymfpci *chip = card->private_data; unsigned int i; + pci_set_power_state(pci, PCI_D0); pci_restore_state(pci); - pci_enable_device(pci); + if (pci_enable_device(pci) < 0) { + printk(KERN_ERR "ymfpci: pci_enable_device failed, " + "disabling device\n"); + snd_card_disconnect(card); + return -EIO; + } pci_set_master(pci); snd_ymfpci_aclink_reset(pci); snd_ymfpci_codec_ready(chip, 0); diff --git a/sound/pcmcia/pdaudiocf/pdaudiocf.c b/sound/pcmcia/pdaudiocf/pdaudiocf.c index fd3590fcaed..2d40cc72f23 100644 --- a/sound/pcmcia/pdaudiocf/pdaudiocf.c +++ b/sound/pcmcia/pdaudiocf/pdaudiocf.c @@ -219,35 +219,15 @@ do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) static int pdacf_config(struct pcmcia_device *link) { struct snd_pdacf *pdacf = link->priv; - tuple_t tuple; - cisparse_t *parse = NULL; - u_short buf[32]; int last_fn, last_ret; snd_printdd(KERN_DEBUG "pdacf_config called\n"); - parse = kmalloc(sizeof(*parse), GFP_KERNEL); - if (! parse) { - snd_printk(KERN_ERR "pdacf_config: cannot allocate\n"); - return -ENOMEM; - } - tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; - tuple.Attributes = 0; - tuple.TupleData = (cisdata_t *)buf; - tuple.TupleDataMax = sizeof(buf); - tuple.TupleOffset = 0; - tuple.DesiredTuple = CISTPL_CONFIG; - CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple)); - CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple)); - CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, parse)); - link->conf.ConfigBase = parse->config.base; link->conf.ConfigIndex = 0x5; CS_CHECK(RequestIO, pcmcia_request_io(link, &link->io)); CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq)); CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf)); - kfree(parse); - if (snd_pdacf_assign_resources(pdacf, link->io.BasePort1, link->irq.AssignedIRQ) < 0) goto failed; @@ -255,7 +235,6 @@ static int pdacf_config(struct pcmcia_device *link) return 0; cs_failed: - kfree(parse); cs_error(link, last_fn, last_ret); failed: pcmcia_disable_device(link); @@ -299,7 +278,8 @@ static int pdacf_resume(struct pcmcia_device *link) * Module entry points */ static struct pcmcia_device_id snd_pdacf_ids[] = { - PCMCIA_DEVICE_MANF_CARD(0x015d, 0x4c45), + /* this is too general PCMCIA_DEVICE_MANF_CARD(0x015d, 0x4c45), */ + PCMCIA_DEVICE_PROD_ID12("Core Sound","PDAudio-CF",0x396d19d2,0x71717b49), PCMCIA_DEVICE_NULL }; MODULE_DEVICE_TABLE(pcmcia, snd_pdacf_ids); diff --git a/sound/pcmcia/vx/vxpocket.c b/sound/pcmcia/vx/vxpocket.c index 3089fcca800..d7df59e9c64 100644 --- a/sound/pcmcia/vx/vxpocket.c +++ b/sound/pcmcia/vx/vxpocket.c @@ -217,34 +217,12 @@ static int vxpocket_config(struct pcmcia_device *link) { struct vx_core *chip = link->priv; struct snd_vxpocket *vxp = (struct snd_vxpocket *)chip; - tuple_t tuple; - cisparse_t *parse; - u_short buf[32]; int last_fn, last_ret; snd_printdd(KERN_DEBUG "vxpocket_config called\n"); - parse = kmalloc(sizeof(*parse), GFP_KERNEL); - if (! parse) { - snd_printk(KERN_ERR "vx: cannot allocate\n"); - return -ENOMEM; - } - tuple.Attributes = 0; - tuple.TupleData = (cisdata_t *)buf; - tuple.TupleDataMax = sizeof(buf); - tuple.TupleOffset = 0; - tuple.DesiredTuple = CISTPL_CONFIG; - CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple)); - CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple)); - CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, parse)); - link->conf.ConfigBase = parse->config.base; - link->conf.Present = parse->config.rmask[0]; /* redefine hardware record according to the VERSION1 string */ - tuple.DesiredTuple = CISTPL_VERS_1; - CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple)); - CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple)); - CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, parse)); - if (! strcmp(parse->version_1.str + parse->version_1.ofs[1], "VX-POCKET")) { + if (!strcmp(link->prod_id[1], "VX-POCKET")) { snd_printdd("VX-pocket is detected\n"); } else { snd_printdd("VX-pocket 440 is detected\n"); @@ -265,14 +243,12 @@ static int vxpocket_config(struct pcmcia_device *link) goto failed; link->dev_node = &vxp->node; - kfree(parse); return 0; cs_failed: cs_error(link, last_fn, last_ret); failed: pcmcia_disable_device(link); - kfree(parse); return -ENODEV; } diff --git a/sound/ppc/tumbler.c b/sound/ppc/tumbler.c index 2fbe1d183fc..8f074c7936e 100644 --- a/sound/ppc/tumbler.c +++ b/sound/ppc/tumbler.c @@ -942,10 +942,11 @@ static void check_mute(struct snd_pmac *chip, struct pmac_gpio *gp, int val, int } static struct work_struct device_change; +static struct snd_pmac *device_change_chip; -static void device_change_handler(void *self) +static void device_change_handler(struct work_struct *work) { - struct snd_pmac *chip = self; + struct snd_pmac *chip = device_change_chip; struct pmac_tumbler *mix; int headphone, lineout; @@ -1417,7 +1418,8 @@ int __init snd_pmac_tumbler_init(struct snd_pmac *chip) chip->resume = tumbler_resume; #endif - INIT_WORK(&device_change, device_change_handler, (void *)chip); + INIT_WORK(&device_change, device_change_handler); + device_change_chip = chip; #ifdef PMAC_SUPPORT_AUTOMUTE if ((mix->headphone_irq >=0 || mix->lineout_irq >= 0) diff --git a/sound/sound_core.c b/sound/sound_core.c index 5322c50c961..8f1ced4ab34 100644 --- a/sound/sound_core.c +++ b/sound/sound_core.c @@ -170,8 +170,8 @@ static int sound_insert_unit(struct sound_unit **list, const struct file_operati else sprintf(s->name, "sound/%s%d", name, r / SOUND_STEP); - class_device_create(sound_class, NULL, MKDEV(SOUND_MAJOR, s->unit_minor), - dev, s->name+6); + device_create(sound_class, dev, MKDEV(SOUND_MAJOR, s->unit_minor), + s->name+6); return r; fail: @@ -193,7 +193,7 @@ static void sound_remove_unit(struct sound_unit **list, int unit) p = __sound_remove_unit(list, unit); spin_unlock(&sound_loader_lock); if (p) { - class_device_destroy(sound_class, MKDEV(SOUND_MAJOR, p->unit_minor)); + device_destroy(sound_class, MKDEV(SOUND_MAJOR, p->unit_minor)); kfree(p); } } diff --git a/sound/sound_firmware.c b/sound/sound_firmware.c index 3a181d4c0dc..3304344713a 100644 --- a/sound/sound_firmware.c +++ b/sound/sound_firmware.c @@ -19,7 +19,7 @@ static int do_mod_firmware_load(const char *fn, char **fp) printk(KERN_INFO "Unable to load '%s'.\n", fn); return 0; } - l = filp->f_dentry->d_inode->i_size; + l = filp->f_path.dentry->d_inode->i_size; if (l <= 0 || l > 131072) { printk(KERN_INFO "Invalid firmware '%s'\n", fn); diff --git a/sound/usb/usbaudio.c b/sound/usb/usbaudio.c index c82b01c7ad3..67202b9eeb7 100644 --- a/sound/usb/usbaudio.c +++ b/sound/usb/usbaudio.c @@ -1469,7 +1469,8 @@ static int snd_usb_hw_free(struct snd_pcm_substream *substream) subs->cur_audiofmt = NULL; subs->cur_rate = 0; subs->period_bytes = 0; - release_substream_urbs(subs, 0); + if (!subs->stream->chip->shutdown) + release_substream_urbs(subs, 0); return snd_pcm_free_vmalloc_buffer(substream); } diff --git a/sound/usb/usbmidi.c b/sound/usb/usbmidi.c index b7c5e59b229..24f5a26c5f0 100644 --- a/sound/usb/usbmidi.c +++ b/sound/usb/usbmidi.c @@ -981,7 +981,7 @@ void snd_usbmidi_disconnect(struct list_head* p) if (umidi->usb_protocol_ops->finish_out_endpoint) umidi->usb_protocol_ops->finish_out_endpoint(ep->out); } - if (ep->in && ep->in->urb) + if (ep->in) usb_kill_urb(ep->in->urb); } } diff --git a/sound/usb/usbmixer.c b/sound/usb/usbmixer.c index 1024c178f5c..e74eb1bc8d8 100644 --- a/sound/usb/usbmixer.c +++ b/sound/usb/usbmixer.c @@ -1620,8 +1620,7 @@ static void snd_usb_mixer_free(struct usb_mixer_interface *mixer) kfree(mixer->urb->transfer_buffer); usb_free_urb(mixer->urb); } - if (mixer->rc_urb) - usb_free_urb(mixer->rc_urb); + usb_free_urb(mixer->rc_urb); kfree(mixer->rc_setup_packet); kfree(mixer); } @@ -2056,8 +2055,6 @@ void snd_usb_mixer_disconnect(struct list_head *p) struct usb_mixer_interface *mixer; mixer = list_entry(p, struct usb_mixer_interface, list); - if (mixer->urb) - usb_kill_urb(mixer->urb); - if (mixer->rc_urb) - usb_kill_urb(mixer->rc_urb); + usb_kill_urb(mixer->urb); + usb_kill_urb(mixer->rc_urb); } diff --git a/sound/usb/usx2y/usX2Yhwdep.c b/sound/usb/usx2y/usX2Yhwdep.c index 4b52d18dcd5..b76b3dd9df2 100644 --- a/sound/usb/usx2y/usX2Yhwdep.c +++ b/sound/usb/usx2y/usX2Yhwdep.c @@ -48,7 +48,7 @@ static struct page * snd_us428ctls_vm_nopage(struct vm_area_struct *area, unsign offset = area->vm_pgoff << PAGE_SHIFT; offset += address - area->vm_start; - snd_assert((offset % PAGE_SIZE) == 0, return NOPAGE_OOM); + snd_assert((offset % PAGE_SIZE) == 0, return NOPAGE_SIGBUS); vaddr = (char*)((struct usX2Ydev *)area->vm_private_data)->us428ctls_sharedmem + offset; page = virt_to_page(vaddr); get_page(page); |