diff options
Diffstat (limited to 'sound/core')
42 files changed, 363 insertions, 180 deletions
diff --git a/sound/core/Kconfig b/sound/core/Kconfig index d1e800b..48cf45c 100644 --- a/sound/core/Kconfig +++ b/sound/core/Kconfig @@ -99,6 +99,18 @@ config SND_RTCTIMER To compile this driver as a module, choose M here: the module will be called snd-rtctimer. +config SND_SEQ_RTCTIMER_DEFAULT + bool "Use RTC as default sequencer timer" + depends on SND_RTCTIMER && SND_SEQUENCER + default y + help + Say Y here to use the RTC timer as the default sequencer + timer. This is strongly recommended because it ensures + precise MIDI timing even when the system timer runs at less + than 1000 Hz. + + If in doubt, say Y. + config SND_VERBOSE_PRINTK bool "Verbose printk" depends on SND @@ -128,6 +140,6 @@ config SND_DEBUG_DETECT Say Y here to enable extra-verbose log messages printed when detecting devices. -config SND_GENERIC_PM +config SND_GENERIC_DRIVER bool depends on SND diff --git a/sound/core/control.c b/sound/core/control.c index 227f3cf..736edf3 100644 --- a/sound/core/control.c +++ b/sound/core/control.c @@ -69,7 +69,7 @@ static int snd_ctl_open(struct inode *inode, struct file *file) err = -EFAULT; goto __error2; } - ctl = kcalloc(1, sizeof(*ctl), GFP_KERNEL); + ctl = kzalloc(sizeof(*ctl), GFP_KERNEL); if (ctl == NULL) { err = -ENOMEM; goto __error; @@ -162,7 +162,7 @@ void snd_ctl_notify(snd_card_t *card, unsigned int mask, snd_ctl_elem_id_t *id) goto _found; } } - ev = kcalloc(1, sizeof(*ev), GFP_ATOMIC); + ev = kzalloc(sizeof(*ev), GFP_ATOMIC); if (ev) { ev->id = *id; ev->mask = mask; @@ -195,7 +195,7 @@ snd_kcontrol_t *snd_ctl_new(snd_kcontrol_t * control, unsigned int access) snd_runtime_check(control != NULL, return NULL); snd_runtime_check(control->count > 0, return NULL); - kctl = kcalloc(1, sizeof(*kctl) + sizeof(snd_kcontrol_volatile_t) * control->count, GFP_KERNEL); + kctl = kzalloc(sizeof(*kctl) + sizeof(snd_kcontrol_volatile_t) * control->count, GFP_KERNEL); if (kctl == NULL) return NULL; *kctl = *control; @@ -521,7 +521,7 @@ static int snd_ctl_card_info(snd_card_t * card, snd_ctl_file_t * ctl, { snd_ctl_card_info_t *info; - info = kcalloc(1, sizeof(*info), GFP_KERNEL); + info = kzalloc(sizeof(*info), GFP_KERNEL); if (! info) return -ENOMEM; down_read(&snd_ioctl_rwsem); @@ -929,7 +929,7 @@ static int snd_ctl_elem_add(snd_ctl_file_t *file, snd_ctl_elem_info_t *info, int return -EINVAL; } private_size *= info->count; - ue = kcalloc(1, sizeof(struct user_element) + private_size, GFP_KERNEL); + ue = kzalloc(sizeof(struct user_element) + private_size, GFP_KERNEL); if (ue == NULL) return -ENOMEM; ue->info = *info; @@ -1185,7 +1185,7 @@ static int _snd_ctl_register_ioctl(snd_kctl_ioctl_func_t fcn, struct list_head * { snd_kctl_ioctl_t *pn; - pn = kcalloc(1, sizeof(snd_kctl_ioctl_t), GFP_KERNEL); + pn = kzalloc(sizeof(snd_kctl_ioctl_t), GFP_KERNEL); if (pn == NULL) return -ENOMEM; pn->fioctl = fcn; diff --git a/sound/core/control_compat.c b/sound/core/control_compat.c index 7fdabea..207c7de 100644 --- a/sound/core/control_compat.c +++ b/sound/core/control_compat.c @@ -92,7 +92,7 @@ static int snd_ctl_elem_info_compat(snd_ctl_file_t *ctl, struct sndrv_ctl_elem_i struct sndrv_ctl_elem_info *data; int err; - data = kcalloc(1, sizeof(*data), GFP_KERNEL); + data = kzalloc(sizeof(*data), GFP_KERNEL); if (! data) return -ENOMEM; @@ -271,7 +271,7 @@ static int snd_ctl_elem_read_user_compat(snd_card_t *card, struct sndrv_ctl_elem_value *data; int err, type, count; - data = kcalloc(1, sizeof(*data), GFP_KERNEL); + data = kzalloc(sizeof(*data), GFP_KERNEL); if (data == NULL) return -ENOMEM; @@ -291,7 +291,7 @@ static int snd_ctl_elem_write_user_compat(snd_ctl_file_t *file, struct sndrv_ctl_elem_value *data; int err, type, count; - data = kcalloc(1, sizeof(*data), GFP_KERNEL); + data = kzalloc(sizeof(*data), GFP_KERNEL); if (data == NULL) return -ENOMEM; @@ -313,7 +313,7 @@ static int snd_ctl_elem_add_compat(snd_ctl_file_t *file, struct sndrv_ctl_elem_info *data; int err; - data = kcalloc(1, sizeof(*data), GFP_KERNEL); + data = kzalloc(sizeof(*data), GFP_KERNEL); if (! data) return -ENOMEM; diff --git a/sound/core/device.c b/sound/core/device.c index ca00ad7..1f509f5 100644 --- a/sound/core/device.c +++ b/sound/core/device.c @@ -49,7 +49,7 @@ int snd_device_new(snd_card_t *card, snd_device_type_t type, snd_assert(card != NULL, return -ENXIO); snd_assert(device_data != NULL, return -ENXIO); snd_assert(ops != NULL, return -ENXIO); - dev = kcalloc(1, sizeof(*dev), GFP_KERNEL); + dev = kzalloc(sizeof(*dev), GFP_KERNEL); if (dev == NULL) return -ENOMEM; dev->card = card; diff --git a/sound/core/hwdep.c b/sound/core/hwdep.c index 997dd41..9383f12 100644 --- a/sound/core/hwdep.c +++ b/sound/core/hwdep.c @@ -359,7 +359,7 @@ int snd_hwdep_new(snd_card_t * card, char *id, int device, snd_hwdep_t ** rhwdep snd_assert(rhwdep != NULL, return -EINVAL); *rhwdep = NULL; snd_assert(card != NULL, return -ENXIO); - hwdep = kcalloc(1, sizeof(*hwdep), GFP_KERNEL); + hwdep = kzalloc(sizeof(*hwdep), GFP_KERNEL); if (hwdep == NULL) return -ENOMEM; hwdep->card = card; diff --git a/sound/core/info.c b/sound/core/info.c index 7f8bdf7..37024d6 100644 --- a/sound/core/info.c +++ b/sound/core/info.c @@ -295,7 +295,7 @@ static int snd_info_entry_open(struct inode *inode, struct file *file) goto __error; } } - data = kcalloc(1, sizeof(*data), GFP_KERNEL); + data = kzalloc(sizeof(*data), GFP_KERNEL); if (data == NULL) { err = -ENOMEM; goto __error; @@ -304,7 +304,7 @@ static int snd_info_entry_open(struct inode *inode, struct file *file) switch (entry->content) { case SNDRV_INFO_CONTENT_TEXT: if (mode == O_RDONLY || mode == O_RDWR) { - buffer = kcalloc(1, sizeof(*buffer), GFP_KERNEL); + buffer = kzalloc(sizeof(*buffer), GFP_KERNEL); if (buffer == NULL) { kfree(data); err = -ENOMEM; @@ -323,7 +323,7 @@ static int snd_info_entry_open(struct inode *inode, struct file *file) data->rbuffer = buffer; } if (mode == O_WRONLY || mode == O_RDWR) { - buffer = kcalloc(1, sizeof(*buffer), GFP_KERNEL); + buffer = kzalloc(sizeof(*buffer), GFP_KERNEL); if (buffer == NULL) { if (mode == O_RDWR) { vfree(data->rbuffer->buffer); @@ -752,7 +752,7 @@ char *snd_info_get_str(char *dest, char *src, int len) static snd_info_entry_t *snd_info_create_entry(const char *name) { snd_info_entry_t *entry; - entry = kcalloc(1, sizeof(*entry), GFP_KERNEL); + entry = kzalloc(sizeof(*entry), GFP_KERNEL); if (entry == NULL) return NULL; entry->name = kstrdup(name, GFP_KERNEL); diff --git a/sound/core/init.c b/sound/core/init.c index d72f58f..a570201 100644 --- a/sound/core/init.c +++ b/sound/core/init.c @@ -72,7 +72,7 @@ snd_card_t *snd_card_new(int idx, const char *xid, if (extra_size < 0) extra_size = 0; - card = kcalloc(1, sizeof(*card) + extra_size, GFP_KERNEL); + card = kzalloc(sizeof(*card) + extra_size, GFP_KERNEL); if (card == NULL) return NULL; if (xid) { @@ -226,8 +226,10 @@ int snd_card_disconnect(snd_card_t * card) return 0; } -#if defined(CONFIG_PM) && defined(CONFIG_SND_GENERIC_PM) -static void snd_generic_device_unregister(struct snd_generic_device *dev); +#ifdef CONFIG_SND_GENERIC_DRIVER +static void snd_generic_device_unregister(snd_card_t *card); +#else +#define snd_generic_device_unregister(x) /*NOP*/ #endif /** @@ -253,14 +255,7 @@ int snd_card_free(snd_card_t * card) #ifdef CONFIG_PM wake_up(&card->power_sleep); -#ifdef CONFIG_SND_GENERIC_PM - if (card->pm_dev) { - snd_generic_device_unregister(card->pm_dev); - card->pm_dev = NULL; - } -#endif #endif - /* wait, until all devices are ready for the free operation */ wait_event(card->shutdown_sleep, card->files == NULL); @@ -288,6 +283,7 @@ int snd_card_free(snd_card_t * card) snd_printk(KERN_WARNING "unable to free card info\n"); /* Not fatal error */ } + snd_generic_device_unregister(card); while (card->s_f_ops) { s_f_ops = card->s_f_ops; card->s_f_ops = s_f_ops->next; @@ -665,6 +661,96 @@ int snd_card_file_remove(snd_card_t *card, struct file *file) return 0; } +#ifdef CONFIG_SND_GENERIC_DRIVER +/* + * generic device without a proper bus using platform_device + * (e.g. ISA) + */ +struct snd_generic_device { + struct platform_device pdev; + snd_card_t *card; +}; + +#define get_snd_generic_card(dev) container_of(to_platform_device(dev), struct snd_generic_device, pdev)->card + +#define SND_GENERIC_NAME "snd_generic" + +#ifdef CONFIG_PM +static int snd_generic_suspend(struct device *dev, pm_message_t state, u32 level); +static int snd_generic_resume(struct device *dev, u32 level); +#endif + +/* initialized in sound.c */ +struct device_driver snd_generic_driver = { + .name = SND_GENERIC_NAME, + .bus = &platform_bus_type, +#ifdef CONFIG_PM + .suspend = snd_generic_suspend, + .resume = snd_generic_resume, +#endif +}; + +void snd_generic_device_release(struct device *dev) +{ +} + +static int snd_generic_device_register(snd_card_t *card) +{ + struct snd_generic_device *dev; + int err; + + if (card->generic_dev) + return 0; /* already registered */ + + dev = kzalloc(sizeof(*dev), GFP_KERNEL); + if (! dev) { + snd_printk(KERN_ERR "can't allocate generic_device\n"); + return -ENOMEM; + } + + dev->pdev.name = SND_GENERIC_NAME; + dev->pdev.id = card->number; + dev->pdev.dev.release = snd_generic_device_release; + dev->card = card; + if ((err = platform_device_register(&dev->pdev)) < 0) { + kfree(dev); + return err; + } + card->generic_dev = dev; + return 0; +} + +static void snd_generic_device_unregister(snd_card_t *card) +{ + struct snd_generic_device *dev = card->generic_dev; + if (dev) { + platform_device_unregister(&dev->pdev); + kfree(dev); + card->generic_dev = NULL; + } +} + +/** + * snd_card_set_generic_dev - assign the generic device to the card + * @card: soundcard structure + * + * Assigns a generic device to the card. This function is provided as the + * last resort, for devices without any proper bus. Thus this won't override + * the device already assigned to the card. + * + * Returns zero if successful, or a negative error code. + */ +int snd_card_set_generic_dev(snd_card_t *card) +{ + int err; + if ((err = snd_generic_device_register(card)) < 0) + return err; + if (! card->dev) + snd_card_set_dev(card, &card->generic_dev->pdev.dev); + return 0; +} +#endif /* CONFIG_SND_GENERIC_DRIVER */ + #ifdef CONFIG_PM /** * snd_power_wait - wait until the power-state is changed. @@ -730,75 +816,7 @@ int snd_card_set_pm_callback(snd_card_t *card, return 0; } -#ifdef CONFIG_SND_GENERIC_PM -/* - * use platform_device for generic power-management without a proper bus - * (e.g. ISA) - */ -struct snd_generic_device { - struct platform_device pdev; - snd_card_t *card; -}; - -#define get_snd_generic_card(dev) container_of(to_platform_device(dev), struct snd_generic_device, pdev)->card - -#define SND_GENERIC_NAME "snd_generic_pm" - -static int snd_generic_suspend(struct device *dev, pm_message_t state, u32 level); -static int snd_generic_resume(struct device *dev, u32 level); - -static struct device_driver snd_generic_driver = { - .name = SND_GENERIC_NAME, - .bus = &platform_bus_type, - .suspend = snd_generic_suspend, - .resume = snd_generic_resume, -}; - -static int generic_driver_registered; - -static void generic_driver_unregister(void) -{ - if (generic_driver_registered) { - generic_driver_registered--; - if (! generic_driver_registered) - driver_unregister(&snd_generic_driver); - } -} - -static struct snd_generic_device *snd_generic_device_register(snd_card_t *card) -{ - struct snd_generic_device *dev; - - if (! generic_driver_registered) { - if (driver_register(&snd_generic_driver) < 0) - return NULL; - } - generic_driver_registered++; - - dev = kcalloc(1, sizeof(*dev), GFP_KERNEL); - if (! dev) { - generic_driver_unregister(); - return NULL; - } - - dev->pdev.name = SND_GENERIC_NAME; - dev->pdev.id = card->number; - dev->card = card; - if (platform_device_register(&dev->pdev) < 0) { - kfree(dev); - generic_driver_unregister(); - return NULL; - } - return dev; -} - -static void snd_generic_device_unregister(struct snd_generic_device *dev) -{ - platform_device_unregister(&dev->pdev); - kfree(dev); - generic_driver_unregister(); -} - +#ifdef CONFIG_SND_GENERIC_DRIVER /* suspend/resume callbacks for snd_generic platform device */ static int snd_generic_suspend(struct device *dev, pm_message_t state, u32 level) { @@ -846,13 +864,12 @@ int snd_card_set_generic_pm_callback(snd_card_t *card, int (*resume)(snd_card_t *), void *private_data) { - card->pm_dev = snd_generic_device_register(card); - if (! card->pm_dev) - return -ENOMEM; - snd_card_set_pm_callback(card, suspend, resume, private_data); - return 0; + int err; + if ((err = snd_generic_device_register(card)) < 0) + return err; + return snd_card_set_pm_callback(card, suspend, resume, private_data); } -#endif /* CONFIG_SND_GENERIC_PM */ +#endif /* CONFIG_SND_GENERIC_DRIVER */ #ifdef CONFIG_PCI int snd_card_pci_suspend(struct pci_dev *dev, pm_message_t state) diff --git a/sound/core/memalloc.c b/sound/core/memalloc.c index 39a54a4..91124dd 100644 --- a/sound/core/memalloc.c +++ b/sound/core/memalloc.c @@ -590,7 +590,7 @@ static int snd_mem_proc_write(struct file *file, const char __user *buffer, alloced = 0; pci = NULL; - while ((pci = pci_find_device(vendor, device, pci)) != NULL) { + while ((pci = pci_get_device(vendor, device, pci)) != NULL) { if (mask > 0 && mask < 0xffffffff) { if (pci_set_dma_mask(pci, mask) < 0 || pci_set_consistent_dma_mask(pci, mask) < 0) { @@ -604,6 +604,7 @@ static int snd_mem_proc_write(struct file *file, const char __user *buffer, if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(pci), size, &dmab) < 0) { printk(KERN_ERR "snd-page-alloc: cannot allocate buffer pages (size = %d)\n", size); + pci_dev_put(pci); return (int)count; } snd_dma_reserve_buf(&dmab, snd_dma_pci_buf_id(pci)); diff --git a/sound/core/memory.c b/sound/core/memory.c index 291b476..8fa888f 100644 --- a/sound/core/memory.c +++ b/sound/core/memory.c @@ -249,7 +249,7 @@ int __exit snd_memory_info_done(void) int copy_to_user_fromio(void __user *dst, const volatile void __iomem *src, size_t count) { #if defined(__i386__) || defined(CONFIG_SPARC32) - return copy_to_user(dst, (const void*)src, count) ? -EFAULT : 0; + return copy_to_user(dst, (const void __force*)src, count) ? -EFAULT : 0; #else char buf[256]; while (count) { @@ -280,7 +280,7 @@ int copy_to_user_fromio(void __user *dst, const volatile void __iomem *src, size int copy_from_user_toio(volatile void __iomem *dst, const void __user *src, size_t count) { #if defined(__i386__) || defined(CONFIG_SPARC32) - return copy_from_user((void*)dst, src, count) ? -EFAULT : 0; + return copy_from_user((void __force *)dst, src, count) ? -EFAULT : 0; #else char buf[256]; while (count) { diff --git a/sound/core/oss/mixer_oss.c b/sound/core/oss/mixer_oss.c index 98fc076..69e1059 100644 --- a/sound/core/oss/mixer_oss.c +++ b/sound/core/oss/mixer_oss.c @@ -53,7 +53,7 @@ static int snd_mixer_oss_open(struct inode *inode, struct file *file) err = snd_card_file_add(card, file); if (err < 0) return err; - fmixer = kcalloc(1, sizeof(*fmixer), GFP_KERNEL); + fmixer = kzalloc(sizeof(*fmixer), GFP_KERNEL); if (fmixer == NULL) { snd_card_file_remove(card, file); return -ENOMEM; @@ -517,8 +517,8 @@ static void snd_mixer_oss_get_volume1_vol(snd_mixer_oss_file_t *fmixer, up_read(&card->controls_rwsem); return; } - uinfo = kcalloc(1, sizeof(*uinfo), GFP_KERNEL); - uctl = kcalloc(1, sizeof(*uctl), GFP_KERNEL); + uinfo = kzalloc(sizeof(*uinfo), GFP_KERNEL); + uctl = kzalloc(sizeof(*uctl), GFP_KERNEL); if (uinfo == NULL || uctl == NULL) goto __unalloc; snd_runtime_check(!kctl->info(kctl, uinfo), goto __unalloc); @@ -551,8 +551,8 @@ static void snd_mixer_oss_get_volume1_sw(snd_mixer_oss_file_t *fmixer, up_read(&card->controls_rwsem); return; } - uinfo = kcalloc(1, sizeof(*uinfo), GFP_KERNEL); - uctl = kcalloc(1, sizeof(*uctl), GFP_KERNEL); + uinfo = kzalloc(sizeof(*uinfo), GFP_KERNEL); + uctl = kzalloc(sizeof(*uctl), GFP_KERNEL); if (uinfo == NULL || uctl == NULL) goto __unalloc; snd_runtime_check(!kctl->info(kctl, uinfo), goto __unalloc); @@ -612,8 +612,8 @@ static void snd_mixer_oss_put_volume1_vol(snd_mixer_oss_file_t *fmixer, down_read(&card->controls_rwsem); if ((kctl = snd_ctl_find_numid(card, numid)) == NULL) return; - uinfo = kcalloc(1, sizeof(*uinfo), GFP_KERNEL); - uctl = kcalloc(1, sizeof(*uctl), GFP_KERNEL); + uinfo = kzalloc(sizeof(*uinfo), GFP_KERNEL); + uctl = kzalloc(sizeof(*uctl), GFP_KERNEL); if (uinfo == NULL || uctl == NULL) goto __unalloc; snd_runtime_check(!kctl->info(kctl, uinfo), goto __unalloc); @@ -649,8 +649,8 @@ static void snd_mixer_oss_put_volume1_sw(snd_mixer_oss_file_t *fmixer, up_read(&fmixer->card->controls_rwsem); return; } - uinfo = kcalloc(1, sizeof(*uinfo), GFP_KERNEL); - uctl = kcalloc(1, sizeof(*uctl), GFP_KERNEL); + uinfo = kzalloc(sizeof(*uinfo), GFP_KERNEL); + uctl = kzalloc(sizeof(*uctl), GFP_KERNEL); if (uinfo == NULL || uctl == NULL) goto __unalloc; snd_runtime_check(!kctl->info(kctl, uinfo), goto __unalloc); @@ -768,8 +768,8 @@ static int snd_mixer_oss_get_recsrc2(snd_mixer_oss_file_t *fmixer, unsigned int snd_ctl_elem_value_t *uctl; int err, idx; - uinfo = kcalloc(1, sizeof(*uinfo), GFP_KERNEL); - uctl = kcalloc(1, sizeof(*uctl), GFP_KERNEL); + uinfo = kzalloc(sizeof(*uinfo), GFP_KERNEL); + uctl = kzalloc(sizeof(*uctl), GFP_KERNEL); if (uinfo == NULL || uctl == NULL) { err = -ENOMEM; goto __unlock; @@ -813,8 +813,8 @@ static int snd_mixer_oss_put_recsrc2(snd_mixer_oss_file_t *fmixer, unsigned int int err; unsigned int idx; - uinfo = kcalloc(1, sizeof(*uinfo), GFP_KERNEL); - uctl = kcalloc(1, sizeof(*uctl), GFP_KERNEL); + uinfo = kzalloc(sizeof(*uinfo), GFP_KERNEL); + uctl = kzalloc(sizeof(*uctl), GFP_KERNEL); if (uinfo == NULL || uctl == NULL) { err = -ENOMEM; goto __unlock; diff --git a/sound/core/oss/pcm_oss.c b/sound/core/oss/pcm_oss.c index a13bd7b..842c28b 100644 --- a/sound/core/oss/pcm_oss.c +++ b/sound/core/oss/pcm_oss.c @@ -850,7 +850,9 @@ static ssize_t snd_pcm_oss_write1(snd_pcm_substream_t *substream, const char __u return xfer > 0 ? xfer : -EAGAIN; } } else { - tmp = snd_pcm_oss_write2(substream, (const char *)buf, runtime->oss.period_bytes, 0); + tmp = snd_pcm_oss_write2(substream, + (const char __force *)buf, + runtime->oss.period_bytes, 0); if (tmp <= 0) return xfer > 0 ? (snd_pcm_sframes_t)xfer : tmp; runtime->oss.bytes += tmp; @@ -926,7 +928,8 @@ static ssize_t snd_pcm_oss_read1(snd_pcm_substream_t *substream, char __user *bu xfer += tmp; runtime->oss.buffer_used -= tmp; } else { - tmp = snd_pcm_oss_read2(substream, (char *)buf, runtime->oss.period_bytes, 0); + tmp = snd_pcm_oss_read2(substream, (char __force *)buf, + runtime->oss.period_bytes, 0); if (tmp <= 0) return xfer > 0 ? (snd_pcm_sframes_t)xfer : tmp; runtime->oss.bytes += tmp; @@ -1540,7 +1543,11 @@ static int snd_pcm_oss_get_ptr(snd_pcm_oss_file_t *pcm_oss_file, int stream, str } else { delay = snd_pcm_oss_bytes(substream, delay); if (stream == SNDRV_PCM_STREAM_PLAYBACK) { - info.blocks = (runtime->oss.buffer_bytes - delay - fixup) / runtime->oss.period_bytes; + snd_pcm_oss_setup_t *setup = substream->oss.setup; + if (setup && setup->buggyptr) + info.blocks = (runtime->oss.buffer_bytes - delay - fixup) / runtime->oss.period_bytes; + else + info.blocks = (delay + fixup) / runtime->oss.period_bytes; info.bytes = (runtime->oss.bytes - delay) & INT_MAX; } else { delay += fixup; @@ -1733,7 +1740,7 @@ static int snd_pcm_oss_open_file(struct file *file, snd_assert(rpcm_oss_file != NULL, return -EINVAL); *rpcm_oss_file = NULL; - pcm_oss_file = kcalloc(1, sizeof(*pcm_oss_file), GFP_KERNEL); + pcm_oss_file = kzalloc(sizeof(*pcm_oss_file), GFP_KERNEL); if (pcm_oss_file == NULL) return -ENOMEM; @@ -2347,6 +2354,8 @@ static void snd_pcm_oss_proc_write(snd_info_entry_t *entry, template.partialfrag = 1; } else if (!strcmp(str, "no-silence")) { template.nosilence = 1; + } else if (!strcmp(str, "buggy-ptr")) { + template.buggyptr = 1; } } while (*str); if (setup == NULL) { diff --git a/sound/core/oss/pcm_plugin.c b/sound/core/oss/pcm_plugin.c index 6430410..fc23373 100644 --- a/sound/core/oss/pcm_plugin.c +++ b/sound/core/oss/pcm_plugin.c @@ -171,7 +171,7 @@ int snd_pcm_plugin_build(snd_pcm_plug_t *plug, snd_assert(plug != NULL, return -ENXIO); snd_assert(src_format != NULL && dst_format != NULL, return -ENXIO); - plugin = kcalloc(1, sizeof(*plugin) + extra, GFP_KERNEL); + plugin = kzalloc(sizeof(*plugin) + extra, GFP_KERNEL); if (plugin == NULL) return -ENOMEM; plugin->name = name; diff --git a/sound/core/pcm.c b/sound/core/pcm.c index 9f4c920..1be470e 100644 --- a/sound/core/pcm.c +++ b/sound/core/pcm.c @@ -597,7 +597,7 @@ int snd_pcm_new_stream(snd_pcm_t *pcm, int stream, int substream_count) } prev = NULL; for (idx = 0, prev = NULL; idx < substream_count; idx++) { - substream = kcalloc(1, sizeof(*substream), GFP_KERNEL); + substream = kzalloc(sizeof(*substream), GFP_KERNEL); if (substream == NULL) return -ENOMEM; substream->pcm = pcm; @@ -657,7 +657,7 @@ int snd_pcm_new(snd_card_t * card, char *id, int device, snd_assert(rpcm != NULL, return -EINVAL); *rpcm = NULL; snd_assert(card != NULL, return -ENXIO); - pcm = kcalloc(1, sizeof(*pcm), GFP_KERNEL); + pcm = kzalloc(sizeof(*pcm), GFP_KERNEL); if (pcm == NULL) return -ENOMEM; pcm->card = card; @@ -795,7 +795,7 @@ int snd_pcm_open_substream(snd_pcm_t *pcm, int stream, if (substream == NULL) return -EAGAIN; - runtime = kcalloc(1, sizeof(*runtime), GFP_KERNEL); + runtime = kzalloc(sizeof(*runtime), GFP_KERNEL); if (runtime == NULL) return -ENOMEM; diff --git a/sound/core/pcm_lib.c b/sound/core/pcm_lib.c index 0082914..0503980 100644 --- a/sound/core/pcm_lib.c +++ b/sound/core/pcm_lib.c @@ -524,6 +524,9 @@ void snd_interval_mul(const snd_interval_t *a, const snd_interval_t *b, snd_inte /** * snd_interval_div - refine the interval value with division + * @a: dividend + * @b: divisor + * @c: quotient * * c = a / b * @@ -555,7 +558,11 @@ void snd_interval_div(const snd_interval_t *a, const snd_interval_t *b, snd_inte /** * snd_interval_muldivk - refine the interval value - * + * @a: dividend 1 + * @b: dividend 2 + * @k: divisor (as integer) + * @c: result + * * c = a * b / k * * Returns non-zero if the value is changed, zero if not changed. @@ -582,6 +589,10 @@ void snd_interval_muldivk(const snd_interval_t *a, const snd_interval_t *b, /** * snd_interval_mulkdiv - refine the interval value + * @a: dividend 1 + * @k: dividend 2 (as integer) + * @b: divisor + * @c: result * * c = a * k / b * @@ -618,6 +629,11 @@ void snd_interval_mulkdiv(const snd_interval_t *a, unsigned int k, /** * snd_interval_ratnum - refine the interval value + * @i: interval to refine + * @rats_count: number of ratnum_t + * @rats: ratnum_t array + * @nump: pointer to store the resultant numerator + * @denp: pointer to store the resultant denominator * * Returns non-zero if the value is changed, zero if not changed. */ @@ -715,6 +731,11 @@ int snd_interval_ratnum(snd_interval_t *i, /** * snd_interval_ratden - refine the interval value + * @i: interval to refine + * @rats_count: number of ratden_t + * @rats: ratden_t array + * @nump: pointer to store the resultant numerator + * @denp: pointer to store the resultant denominator * * Returns non-zero if the value is changed, zero if not changed. */ @@ -936,6 +957,11 @@ int snd_pcm_hw_rule_add(snd_pcm_runtime_t *runtime, unsigned int cond, /** * snd_pcm_hw_constraint_mask + * @runtime: PCM runtime instance + * @var: hw_params variable to apply the mask + * @mask: the bitmap mask + * + * Apply the constraint of the given bitmap mask to a mask parameter. */ int snd_pcm_hw_constraint_mask(snd_pcm_runtime_t *runtime, snd_pcm_hw_param_t var, u_int32_t mask) @@ -951,6 +977,11 @@ int snd_pcm_hw_constraint_mask(snd_pcm_runtime_t *runtime, snd_pcm_hw_param_t va /** * snd_pcm_hw_constraint_mask64 + * @runtime: PCM runtime instance + * @var: hw_params variable to apply the mask + * @mask: the 64bit bitmap mask + * + * Apply the constraint of the given bitmap mask to a mask parameter. */ int snd_pcm_hw_constraint_mask64(snd_pcm_runtime_t *runtime, snd_pcm_hw_param_t var, u_int64_t mask) @@ -967,6 +998,10 @@ int snd_pcm_hw_constraint_mask64(snd_pcm_runtime_t *runtime, snd_pcm_hw_param_t /** * snd_pcm_hw_constraint_integer + * @runtime: PCM runtime instance + * @var: hw_params variable to apply the integer constraint + * + * Apply the constraint of integer to an interval parameter. */ int snd_pcm_hw_constraint_integer(snd_pcm_runtime_t *runtime, snd_pcm_hw_param_t var) { @@ -976,6 +1011,12 @@ int snd_pcm_hw_constraint_integer(snd_pcm_runtime_t *runtime, snd_pcm_hw_param_t /** * snd_pcm_hw_constraint_minmax + * @runtime: PCM runtime instance + * @var: hw_params variable to apply the range + * @min: the minimal value + * @max: the maximal value + * + * Apply the min/max range constraint to an interval parameter. */ int snd_pcm_hw_constraint_minmax(snd_pcm_runtime_t *runtime, snd_pcm_hw_param_t var, unsigned int min, unsigned int max) @@ -999,6 +1040,12 @@ static int snd_pcm_hw_rule_list(snd_pcm_hw_params_t *params, /** * snd_pcm_hw_constraint_list + * @runtime: PCM runtime instance + * @cond: condition bits + * @var: hw_params variable to apply the list constraint + * @l: list + * + * Apply the list of constraints to an interval parameter. */ int snd_pcm_hw_constraint_list(snd_pcm_runtime_t *runtime, unsigned int cond, @@ -1027,6 +1074,10 @@ static int snd_pcm_hw_rule_ratnums(snd_pcm_hw_params_t *params, /** * snd_pcm_hw_constraint_ratnums + * @runtime: PCM runtime instance + * @cond: condition bits + * @var: hw_params variable to apply the ratnums constraint + * @r: ratnums_t constriants */ int snd_pcm_hw_constraint_ratnums(snd_pcm_runtime_t *runtime, unsigned int cond, @@ -1054,6 +1105,10 @@ static int snd_pcm_hw_rule_ratdens(snd_pcm_hw_params_t *params, /** * snd_pcm_hw_constraint_ratdens + * @runtime: PCM runtime instance + * @cond: condition bits + * @var: hw_params variable to apply the ratdens constraint + * @r: ratdens_t constriants */ int snd_pcm_hw_constraint_ratdens(snd_pcm_runtime_t *runtime, unsigned int cond, @@ -1079,6 +1134,10 @@ static int snd_pcm_hw_rule_msbits(snd_pcm_hw_params_t *params, /** * snd_pcm_hw_constraint_msbits + * @runtime: PCM runtime instance + * @cond: condition bits + * @width: sample bits width + * @msbits: msbits width */ int snd_pcm_hw_constraint_msbits(snd_pcm_runtime_t *runtime, unsigned int cond, @@ -1101,6 +1160,10 @@ static int snd_pcm_hw_rule_step(snd_pcm_hw_params_t *params, /** * snd_pcm_hw_constraint_step + * @runtime: PCM runtime instance + * @cond: condition bits + * @var: hw_params variable to apply the step constraint + * @step: step size */ int snd_pcm_hw_constraint_step(snd_pcm_runtime_t *runtime, unsigned int cond, @@ -1126,6 +1189,9 @@ static int snd_pcm_hw_rule_pow2(snd_pcm_hw_params_t *params, snd_pcm_hw_rule_t * /** * snd_pcm_hw_constraint_pow2 + * @runtime: PCM runtime instance + * @cond: condition bits + * @var: hw_params variable to apply the power-of-2 constraint */ int snd_pcm_hw_constraint_pow2(snd_pcm_runtime_t *runtime, unsigned int cond, @@ -1162,7 +1228,7 @@ static void _snd_pcm_hw_param_any(snd_pcm_hw_params_t *params, } #if 0 -/** +/* * snd_pcm_hw_param_any */ int snd_pcm_hw_param_any(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, @@ -1185,7 +1251,7 @@ void _snd_pcm_hw_params_any(snd_pcm_hw_params_t *params) } #if 0 -/** +/* * snd_pcm_hw_params_any * * Fill PARAMS with full configuration space boundaries @@ -1199,6 +1265,9 @@ int snd_pcm_hw_params_any(snd_pcm_t *pcm, snd_pcm_hw_params_t *params) /** * snd_pcm_hw_param_value + * @params: the hw_params instance + * @var: parameter to retrieve + * @dir: pointer to the direction (-1,0,1) or NULL * * Return the value for field PAR if it's fixed in configuration space * defined by PARAMS. Return -EINVAL otherwise @@ -1228,6 +1297,9 @@ static int snd_pcm_hw_param_value(const snd_pcm_hw_params_t *params, /** * snd_pcm_hw_param_value_min + * @params: the hw_params instance + * @var: parameter to retrieve + * @dir: pointer to the direction (-1,0,1) or NULL * * Return the minimum value for field PAR. */ @@ -1251,6 +1323,9 @@ unsigned int snd_pcm_hw_param_value_min(const snd_pcm_hw_params_t *params, /** * snd_pcm_hw_param_value_max + * @params: the hw_params instance + * @var: parameter to retrieve + * @dir: pointer to the direction (-1,0,1) or NULL * * Return the maximum value for field PAR. */ @@ -1302,7 +1377,7 @@ int _snd_pcm_hw_param_setinteger(snd_pcm_hw_params_t *params, } #if 0 -/** +/* * snd_pcm_hw_param_setinteger * * Inside configuration space defined by PARAMS remove from PAR all @@ -1347,6 +1422,10 @@ static int _snd_pcm_hw_param_first(snd_pcm_hw_params_t *params, /** * snd_pcm_hw_param_first + * @pcm: PCM instance + * @params: the hw_params instance + * @var: parameter to retrieve + * @dir: pointer to the direction (-1,0,1) or NULL * * Inside configuration space defined by PARAMS remove from PAR all * values > minimum. Reduce configuration space accordingly. @@ -1388,6 +1467,10 @@ static int _snd_pcm_hw_param_last(snd_pcm_hw_params_t *params, /** * snd_pcm_hw_param_last + * @pcm: PCM instance + * @params: the hw_params instance + * @var: parameter to retrieve + * @dir: pointer to the direction (-1,0,1) or NULL * * Inside configuration space defined by PARAMS remove from PAR all * values < maximum. Reduce configuration space accordingly. @@ -1439,6 +1522,11 @@ int _snd_pcm_hw_param_min(snd_pcm_hw_params_t *params, /** * snd_pcm_hw_param_min + * @pcm: PCM instance + * @params: the hw_params instance + * @var: parameter to retrieve + * @val: minimal value + * @dir: pointer to the direction (-1,0,1) or NULL * * Inside configuration space defined by PARAMS remove from PAR all * values < VAL. Reduce configuration space accordingly. @@ -1494,6 +1582,11 @@ static int _snd_pcm_hw_param_max(snd_pcm_hw_params_t *params, /** * snd_pcm_hw_param_max + * @pcm: PCM instance + * @params: the hw_params instance + * @var: parameter to retrieve + * @val: maximal value + * @dir: pointer to the direction (-1,0,1) or NULL * * Inside configuration space defined by PARAMS remove from PAR all * values >= VAL + 1. Reduce configuration space accordingly. @@ -1565,6 +1658,11 @@ int _snd_pcm_hw_param_set(snd_pcm_hw_params_t *params, /** * snd_pcm_hw_param_set + * @pcm: PCM instance + * @params: the hw_params instance + * @var: parameter to retrieve + * @val: value to set + * @dir: pointer to the direction (-1,0,1) or NULL * * Inside configuration space defined by PARAMS remove from PAR all * values != VAL. Reduce configuration space accordingly. @@ -1599,6 +1697,10 @@ static int _snd_pcm_hw_param_mask(snd_pcm_hw_params_t *params, /** * snd_pcm_hw_param_mask + * @pcm: PCM instance + * @params: the hw_params instance + * @var: parameter to retrieve + * @val: mask to apply * * Inside configuration space defined by PARAMS remove from PAR all values * not contained in MASK. Reduce configuration space accordingly. @@ -1671,6 +1773,11 @@ static int boundary_nearer(int min, int mindir, /** * snd_pcm_hw_param_near + * @pcm: PCM instance + * @params: the hw_params instance + * @var: parameter to retrieve + * @best: value to set + * @dir: pointer to the direction (-1,0,1) or NULL * * Inside configuration space defined by PARAMS set PAR to the available value * nearest to VAL. Reduce configuration space accordingly. @@ -1747,6 +1854,8 @@ int snd_pcm_hw_param_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, /** * snd_pcm_hw_param_choose + * @pcm: PCM instance + * @params: the hw_params instance * * Choose one configuration from configuration space defined by PARAMS * The configuration chosen is that obtained fixing in this order: diff --git a/sound/core/pcm_memory.c b/sound/core/pcm_memory.c index 9a174fb..b3f5344 100644 --- a/sound/core/pcm_memory.c +++ b/sound/core/pcm_memory.c @@ -244,7 +244,7 @@ int snd_pcm_lib_preallocate_pages(snd_pcm_substream_t *substream, /** * snd_pcm_lib_preallocate_pages_for_all - pre-allocation for continous memory type (all substreams) - * @substream: the pcm substream instance + * @pcm: the pcm instance * @type: DMA type (SNDRV_DMA_TYPE_*) * @data: DMA type dependant data * @size: the requested pre-allocation size in bytes @@ -321,7 +321,7 @@ int snd_pcm_lib_malloc_pages(snd_pcm_substream_t *substream, size_t size) if (substream->dma_buffer.area != NULL && substream->dma_buffer.bytes >= size) { dmab = &substream->dma_buffer; /* use the pre-allocated buffer */ } else { - dmab = kcalloc(1, sizeof(*dmab), GFP_KERNEL); + dmab = kzalloc(sizeof(*dmab), GFP_KERNEL); if (! dmab) return -ENOMEM; dmab->dev = substream->dma_buffer.dev; diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c index 03c1715..67abeba 100644 --- a/sound/core/pcm_native.c +++ b/sound/core/pcm_native.c @@ -859,6 +859,7 @@ static struct action_ops snd_pcm_action_start = { /** * snd_pcm_start + * @substream: the PCM substream instance * * Start all linked streams. */ @@ -908,6 +909,8 @@ static struct action_ops snd_pcm_action_stop = { /** * snd_pcm_stop + * @substream: the PCM substream instance + * @state: PCM state after stopping the stream * * Try to stop all running streams in the substream group. * The state of each stream is changed to the given value after that unconditionally. @@ -919,6 +922,7 @@ int snd_pcm_stop(snd_pcm_substream_t *substream, int state) /** * snd_pcm_drain_done + * @substream: the PCM substream * * Stop the DMA only when the given stream is playback. * The state is changed to SETUP. @@ -1040,6 +1044,7 @@ static struct action_ops snd_pcm_action_suspend = { /** * snd_pcm_suspend + * @substream: the PCM substream * * Trigger SUSPEND to all linked streams. * After this call, all streams are changed to SUSPENDED state. @@ -1057,6 +1062,7 @@ int snd_pcm_suspend(snd_pcm_substream_t *substream) /** * snd_pcm_suspend_all + * @pcm: the PCM instance * * Trigger SUSPEND to all substreams in the given pcm. * After this call, all streams are changed to SUSPENDED state. @@ -1272,6 +1278,9 @@ static struct action_ops snd_pcm_action_prepare = { /** * snd_pcm_prepare + * @substream: the PCM substream instance + * + * Prepare the PCM substream to be triggerable. */ int snd_pcm_prepare(snd_pcm_substream_t *substream) { @@ -1992,7 +2001,7 @@ static int snd_pcm_open_file(struct file *file, snd_assert(rpcm_file != NULL, return -EINVAL); *rpcm_file = NULL; - pcm_file = kcalloc(1, sizeof(*pcm_file), GFP_KERNEL); + pcm_file = kzalloc(sizeof(*pcm_file), GFP_KERNEL); if (pcm_file == NULL) { return -ENOMEM; } diff --git a/sound/core/rawmidi.c b/sound/core/rawmidi.c index edba411..7c20eaf 100644 --- a/sound/core/rawmidi.c +++ b/sound/core/rawmidi.c @@ -101,7 +101,7 @@ static int snd_rawmidi_runtime_create(snd_rawmidi_substream_t * substream) { snd_rawmidi_runtime_t *runtime; - if ((runtime = kcalloc(1, sizeof(*runtime), GFP_KERNEL)) == NULL) + if ((runtime = kzalloc(sizeof(*runtime), GFP_KERNEL)) == NULL) return -ENOMEM; spin_lock_init(&runtime->lock); init_waitqueue_head(&runtime->sleep); @@ -984,7 +984,9 @@ static ssize_t snd_rawmidi_read(struct file *file, char __user *buf, size_t coun spin_lock_irq(&runtime->lock); } spin_unlock_irq(&runtime->lock); - count1 = snd_rawmidi_kernel_read1(substream, (unsigned char *)buf, count, 0); + count1 = snd_rawmidi_kernel_read1(substream, + (unsigned char __force *)buf, + count, 0); if (count1 < 0) return result > 0 ? result : count1; result += count1; @@ -1107,7 +1109,7 @@ int snd_rawmidi_transmit_ack(snd_rawmidi_substream_t * substream, int count) /** * snd_rawmidi_transmit - copy from the buffer to the device * @substream: the rawmidi substream - * @buf: the buffer pointer + * @buffer: the buffer pointer * @count: the data size to transfer * * Copies data from the buffer to the device and advances the pointer. @@ -1213,7 +1215,9 @@ static ssize_t snd_rawmidi_write(struct file *file, const char __user *buf, size spin_lock_irq(&runtime->lock); } spin_unlock_irq(&runtime->lock); - count1 = snd_rawmidi_kernel_write1(substream, (unsigned char *)buf, count, 0); + count1 = snd_rawmidi_kernel_write1(substream, + (unsigned char __force *)buf, + count, 0); if (count1 < 0) return result > 0 ? result : count1; result += count1; @@ -1370,7 +1374,7 @@ static int snd_rawmidi_alloc_substreams(snd_rawmidi_t *rmidi, INIT_LIST_HEAD(&stream->substreams); for (idx = 0; idx < count; idx++) { - substream = kcalloc(1, sizeof(*substream), GFP_KERNEL); + substream = kzalloc(sizeof(*substream), GFP_KERNEL); if (substream == NULL) return -ENOMEM; substream->stream = direction; @@ -1413,7 +1417,7 @@ int snd_rawmidi_new(snd_card_t * card, char *id, int device, snd_assert(rrawmidi != NULL, return -EINVAL); *rrawmidi = NULL; snd_assert(card != NULL, return -ENXIO); - rmidi = kcalloc(1, sizeof(*rmidi), GFP_KERNEL); + rmidi = kzalloc(sizeof(*rmidi), GFP_KERNEL); if (rmidi == NULL) return -ENOMEM; rmidi->card = card; diff --git a/sound/core/seq/instr/ainstr_gf1.c b/sound/core/seq/instr/ainstr_gf1.c index 32e91c6..207c2c5 100644 --- a/sound/core/seq/instr/ainstr_gf1.c +++ b/sound/core/seq/instr/ainstr_gf1.c @@ -61,7 +61,7 @@ static int snd_seq_gf1_copy_wave_from_stream(snd_gf1_ops_t *ops, return -EFAULT; *data += sizeof(xp); *len -= sizeof(xp); - wp = kcalloc(1, sizeof(*wp), gfp_mask); + wp = kzalloc(sizeof(*wp), gfp_mask); if (wp == NULL) return -ENOMEM; wp->share_id[0] = le32_to_cpu(xp.share_id[0]); diff --git a/sound/core/seq/instr/ainstr_iw.c b/sound/core/seq/instr/ainstr_iw.c index 2622b86..b3cee09 100644 --- a/sound/core/seq/instr/ainstr_iw.c +++ b/sound/core/seq/instr/ainstr_iw.c @@ -92,7 +92,7 @@ static int snd_seq_iwffff_copy_env_from_stream(__u32 req_stype, points_size = (le16_to_cpu(rx.nattack) + le16_to_cpu(rx.nrelease)) * 2 * sizeof(__u16); if (points_size > *len) return -EINVAL; - rp = kcalloc(1, sizeof(*rp) + points_size, gfp_mask); + rp = kzalloc(sizeof(*rp) + points_size, gfp_mask); if (rp == NULL) return -ENOMEM; rp->nattack = le16_to_cpu(rx.nattack); @@ -139,7 +139,7 @@ static int snd_seq_iwffff_copy_wave_from_stream(snd_iwffff_ops_t *ops, return -EFAULT; *data += sizeof(xp); *len -= sizeof(xp); - wp = kcalloc(1, sizeof(*wp), gfp_mask); + wp = kzalloc(sizeof(*wp), gfp_mask); if (wp == NULL) return -ENOMEM; wp->share_id[0] = le32_to_cpu(xp.share_id[0]); @@ -273,7 +273,7 @@ static int snd_seq_iwffff_put(void *private_data, snd_seq_kinstr_t *instr, snd_seq_iwffff_instr_free(ops, ip, atomic); return -EINVAL; } - lp = kcalloc(1, sizeof(*lp), gfp_mask); + lp = kzalloc(sizeof(*lp), gfp_mask); if (lp == NULL) { snd_seq_iwffff_instr_free(ops, ip, atomic); return -ENOMEM; diff --git a/sound/core/seq/oss/seq_oss_init.c b/sound/core/seq/oss/seq_oss_init.c index bac4b4f..1ab1cf8 100644 --- a/sound/core/seq/oss/seq_oss_init.c +++ b/sound/core/seq/oss/seq_oss_init.c @@ -193,7 +193,7 @@ snd_seq_oss_open(struct file *file, int level) int i, rc; seq_oss_devinfo_t *dp; - if ((dp = kcalloc(1, sizeof(*dp), GFP_KERNEL)) == NULL) { + if ((dp = kzalloc(sizeof(*dp), GFP_KERNEL)) == NULL) { snd_printk(KERN_ERR "can't malloc device info\n"); return -ENOMEM; } diff --git a/sound/core/seq/oss/seq_oss_midi.c b/sound/core/seq/oss/seq_oss_midi.c index 9aece6c..f0e95c8 100644 --- a/sound/core/seq/oss/seq_oss_midi.c +++ b/sound/core/seq/oss/seq_oss_midi.c @@ -76,8 +76,8 @@ snd_seq_oss_midi_lookup_ports(int client) snd_seq_client_info_t *clinfo; snd_seq_port_info_t *pinfo; - clinfo = kcalloc(1, sizeof(*clinfo), GFP_KERNEL); - pinfo = kcalloc(1, sizeof(*pinfo), GFP_KERNEL); + clinfo = kzalloc(sizeof(*clinfo), GFP_KERNEL); + pinfo = kzalloc(sizeof(*pinfo), GFP_KERNEL); if (! clinfo || ! pinfo) { kfree(clinfo); kfree(pinfo); @@ -172,7 +172,7 @@ snd_seq_oss_midi_check_new_port(snd_seq_port_info_t *pinfo) /* * allocate midi info record */ - if ((mdev = kcalloc(1, sizeof(*mdev), GFP_KERNEL)) == NULL) { + if ((mdev = kzalloc(sizeof(*mdev), GFP_KERNEL)) == NULL) { snd_printk(KERN_ERR "can't malloc midi info\n"); return -ENOMEM; } diff --git a/sound/core/seq/oss/seq_oss_readq.c b/sound/core/seq/oss/seq_oss_readq.c index 0a6f2a6..55571e1 100644 --- a/sound/core/seq/oss/seq_oss_readq.c +++ b/sound/core/seq/oss/seq_oss_readq.c @@ -46,7 +46,7 @@ snd_seq_oss_readq_new(seq_oss_devinfo_t *dp, int maxlen) { seq_oss_readq_t *q; - if ((q = kcalloc(1, sizeof(*q), GFP_KERNEL)) == NULL) { + if ((q = kzalloc(sizeof(*q), GFP_KERNEL)) == NULL) { snd_printk(KERN_ERR "can't malloc read queue\n"); return NULL; } diff --git a/sound/core/seq/oss/seq_oss_synth.c b/sound/core/seq/oss/seq_oss_synth.c index 1a7736c..8257fce 100644 --- a/sound/core/seq/oss/seq_oss_synth.c +++ b/sound/core/seq/oss/seq_oss_synth.c @@ -103,7 +103,7 @@ snd_seq_oss_synth_register(snd_seq_device_t *dev) snd_seq_oss_reg_t *reg = SNDRV_SEQ_DEVICE_ARGPTR(dev); unsigned long flags; - if ((rec = kcalloc(1, sizeof(*rec), GFP_KERNEL)) == NULL) { + if ((rec = kzalloc(sizeof(*rec), GFP_KERNEL)) == NULL) { snd_printk(KERN_ERR "can't malloc synth info\n"); return -ENOMEM; } @@ -499,7 +499,7 @@ snd_seq_oss_synth_sysex(seq_oss_devinfo_t *dp, int dev, unsigned char *buf, snd_ sysex = dp->synths[dev].sysex; if (sysex == NULL) { - sysex = kcalloc(1, sizeof(*sysex), GFP_KERNEL); + sysex = kzalloc(sizeof(*sysex), GFP_KERNEL); if (sysex == NULL) return -ENOMEM; dp->synths[dev].sysex = sysex; diff --git a/sound/core/seq/oss/seq_oss_timer.c b/sound/core/seq/oss/seq_oss_timer.c index 42ca949..64d594b 100644 --- a/sound/core/seq/oss/seq_oss_timer.c +++ b/sound/core/seq/oss/seq_oss_timer.c @@ -46,7 +46,7 @@ snd_seq_oss_timer_new(seq_oss_devinfo_t *dp) { seq_oss_timer_t *rec; - rec = kcalloc(1, sizeof(*rec), GFP_KERNEL); + rec = kzalloc(sizeof(*rec), GFP_KERNEL); if (rec == NULL) return NULL; diff --git a/sound/core/seq/oss/seq_oss_writeq.c b/sound/core/seq/oss/seq_oss_writeq.c index 87f85f7..b203780 100644 --- a/sound/core/seq/oss/seq_oss_writeq.c +++ b/sound/core/seq/oss/seq_oss_writeq.c @@ -38,7 +38,7 @@ snd_seq_oss_writeq_new(seq_oss_devinfo_t *dp, int maxlen) seq_oss_writeq_t *q; snd_seq_client_pool_t pool; - if ((q = kcalloc(1, sizeof(*q), GFP_KERNEL)) == NULL) + if ((q = kzalloc(sizeof(*q), GFP_KERNEL)) == NULL) return NULL; q->dp = dp; q->maxlen = maxlen; diff --git a/sound/core/seq/seq.c b/sound/core/seq/seq.c index 7449d2a..24644150 100644 --- a/sound/core/seq/seq.c +++ b/sound/core/seq/seq.c @@ -43,7 +43,13 @@ int seq_client_load[64] = {[0 ... 63] = -1}; int seq_default_timer_class = SNDRV_TIMER_CLASS_GLOBAL; int seq_default_timer_sclass = SNDRV_TIMER_SCLASS_NONE; int seq_default_timer_card = -1; -int seq_default_timer_device = SNDRV_TIMER_GLOBAL_SYSTEM; +int seq_default_timer_device = +#ifdef CONFIG_SND_SEQ_RTCTIMER_DEFAULT + SNDRV_TIMER_GLOBAL_RTC +#else + SNDRV_TIMER_GLOBAL_SYSTEM +#endif + ; int seq_default_timer_subdevice = 0; int seq_default_timer_resolution = 0; /* Hz */ diff --git a/sound/core/seq/seq_clientmgr.c b/sound/core/seq/seq_clientmgr.c index d8f76af..a886db9 100644 --- a/sound/core/seq/seq_clientmgr.c +++ b/sound/core/seq/seq_clientmgr.c @@ -203,7 +203,7 @@ static client_t *seq_create_client1(int client_index, int poolsize) client_t *client; /* init client data */ - client = kcalloc(1, sizeof(*client), GFP_KERNEL); + client = kzalloc(sizeof(*client), GFP_KERNEL); if (client == NULL) return NULL; client->pool = snd_seq_pool_new(poolsize); @@ -413,7 +413,9 @@ static ssize_t snd_seq_read(struct file *file, char __user *buf, size_t count, l } count -= sizeof(snd_seq_event_t); buf += sizeof(snd_seq_event_t); - err = snd_seq_expand_var_event(&cell->event, count, (char *)buf, 0, sizeof(snd_seq_event_t)); + err = snd_seq_expand_var_event(&cell->event, count, + (char __force *)buf, 0, + sizeof(snd_seq_event_t)); if (err < 0) break; result += err; @@ -1009,7 +1011,8 @@ static ssize_t snd_seq_write(struct file *file, const char __user *buf, size_t c } /* set user space pointer */ event.data.ext.len = extlen | SNDRV_SEQ_EXT_USRPTR; - event.data.ext.ptr = (char*)buf + sizeof(snd_seq_event_t); + event.data.ext.ptr = (char __force *)buf + + sizeof(snd_seq_event_t); len += extlen; /* increment data length */ } else { #ifdef CONFIG_COMPAT diff --git a/sound/core/seq/seq_device.c b/sound/core/seq/seq_device.c index 4d80f39..252b527 100644 --- a/sound/core/seq/seq_device.c +++ b/sound/core/seq/seq_device.c @@ -200,7 +200,7 @@ int snd_seq_device_new(snd_card_t *card, int device, char *id, int argsize, if (ops == NULL) return -ENOMEM; - dev = kcalloc(1, sizeof(*dev)*2 + argsize, GFP_KERNEL); + dev = kzalloc(sizeof(*dev)*2 + argsize, GFP_KERNEL); if (dev == NULL) { unlock_driver(ops); return -ENOMEM; diff --git a/sound/core/seq/seq_dummy.c b/sound/core/seq/seq_dummy.c index ea945a5..5dd0e6a 100644 --- a/sound/core/seq/seq_dummy.c +++ b/sound/core/seq/seq_dummy.c @@ -153,7 +153,7 @@ create_port(int idx, int type) snd_seq_port_callback_t pcb; snd_seq_dummy_port_t *rec; - if ((rec = kcalloc(1, sizeof(*rec), GFP_KERNEL)) == NULL) + if ((rec = kzalloc(sizeof(*rec), GFP_KERNEL)) == NULL) return NULL; rec->client = my_client; diff --git a/sound/core/seq/seq_fifo.c b/sound/core/seq/seq_fifo.c index 3b7647c..4767cfd 100644 --- a/sound/core/seq/seq_fifo.c +++ b/sound/core/seq/seq_fifo.c @@ -33,7 +33,7 @@ fifo_t *snd_seq_fifo_new(int poolsize) { fifo_t *f; - f = kcalloc(1, sizeof(*f), GFP_KERNEL); + f = kzalloc(sizeof(*f), GFP_KERNEL); if (f == NULL) { snd_printd("malloc failed for snd_seq_fifo_new() \n"); return NULL; diff --git a/sound/core/seq/seq_instr.c b/sound/core/seq/seq_instr.c index 5b40ea2..019d43a 100644 --- a/sound/core/seq/seq_instr.c +++ b/sound/core/seq/seq_instr.c @@ -53,7 +53,7 @@ static snd_seq_kinstr_t *snd_seq_instr_new(int add_len, int atomic) { snd_seq_kinstr_t *instr; - instr = kcalloc(1, sizeof(snd_seq_kinstr_t) + add_len, atomic ? GFP_ATOMIC : GFP_KERNEL); + instr = kzalloc(sizeof(snd_seq_kinstr_t) + add_len, atomic ? GFP_ATOMIC : GFP_KERNEL); if (instr == NULL) return NULL; instr->add_len = add_len; @@ -77,7 +77,7 @@ snd_seq_kinstr_list_t *snd_seq_instr_list_new(void) { snd_seq_kinstr_list_t *list; - list = kcalloc(1, sizeof(snd_seq_kinstr_list_t), GFP_KERNEL); + list = kzalloc(sizeof(snd_seq_kinstr_list_t), GFP_KERNEL); if (list == NULL) return NULL; spin_lock_init(&list->lock); diff --git a/sound/core/seq/seq_memory.c b/sound/core/seq/seq_memory.c index 03acb2d..d4d7d32 100644 --- a/sound/core/seq/seq_memory.c +++ b/sound/core/seq/seq_memory.c @@ -452,7 +452,7 @@ pool_t *snd_seq_pool_new(int poolsize) pool_t *pool; /* create pool block */ - pool = kcalloc(1, sizeof(*pool), GFP_KERNEL); + pool = kzalloc(sizeof(*pool), GFP_KERNEL); if (pool == NULL) { snd_printd("seq: malloc failed for pool\n"); return NULL; diff --git a/sound/core/seq/seq_midi.c b/sound/core/seq/seq_midi.c index 4374829..b4674ae 100644 --- a/sound/core/seq/seq_midi.c +++ b/sound/core/seq/seq_midi.c @@ -322,7 +322,7 @@ snd_seq_midisynth_register_port(snd_seq_device_t *dev) client = synths[card->number]; if (client == NULL) { newclient = 1; - client = kcalloc(1, sizeof(*client), GFP_KERNEL); + client = kzalloc(sizeof(*client), GFP_KERNEL); if (client == NULL) { up(®ister_mutex); kfree(info); diff --git a/sound/core/seq/seq_midi_event.c b/sound/core/seq/seq_midi_event.c index 603b637..2dc1aec 100644 --- a/sound/core/seq/seq_midi_event.c +++ b/sound/core/seq/seq_midi_event.c @@ -118,7 +118,7 @@ int snd_midi_event_new(int bufsize, snd_midi_event_t **rdev) snd_midi_event_t *dev; *rdev = NULL; - dev = kcalloc(1, sizeof(*dev), GFP_KERNEL); + dev = kzalloc(sizeof(*dev), GFP_KERNEL); if (dev == NULL) return -ENOMEM; if (bufsize > 0) { diff --git a/sound/core/seq/seq_ports.c b/sound/core/seq/seq_ports.c index b976951..57ec31d 100644 --- a/sound/core/seq/seq_ports.c +++ b/sound/core/seq/seq_ports.c @@ -141,7 +141,7 @@ client_port_t *snd_seq_create_port(client_t *client, int port) } /* create a new port */ - new_port = kcalloc(1, sizeof(*new_port), GFP_KERNEL); + new_port = kzalloc(sizeof(*new_port), GFP_KERNEL); if (! new_port) { snd_printd("malloc failed for registering client port\n"); return NULL; /* failure, out of memory */ @@ -488,7 +488,7 @@ int snd_seq_port_connect(client_t *connector, unsigned long flags; int exclusive; - subs = kcalloc(1, sizeof(*subs), GFP_KERNEL); + subs = kzalloc(sizeof(*subs), GFP_KERNEL); if (! subs) return -ENOMEM; diff --git a/sound/core/seq/seq_prioq.c b/sound/core/seq/seq_prioq.c index a519732e..cd641bc 100644 --- a/sound/core/seq/seq_prioq.c +++ b/sound/core/seq/seq_prioq.c @@ -59,7 +59,7 @@ prioq_t *snd_seq_prioq_new(void) { prioq_t *f; - f = kcalloc(1, sizeof(*f), GFP_KERNEL); + f = kzalloc(sizeof(*f), GFP_KERNEL); if (f == NULL) { snd_printd("oops: malloc failed for snd_seq_prioq_new()\n"); return NULL; diff --git a/sound/core/seq/seq_queue.c b/sound/core/seq/seq_queue.c index 98de2e7..5f5c3cb 100644 --- a/sound/core/seq/seq_queue.c +++ b/sound/core/seq/seq_queue.c @@ -111,7 +111,7 @@ static queue_t *queue_new(int owner, int locked) { queue_t *q; - q = kcalloc(1, sizeof(*q), GFP_KERNEL); + q = kzalloc(sizeof(*q), GFP_KERNEL); if (q == NULL) { snd_printd("malloc failed for snd_seq_queue_new()\n"); return NULL; diff --git a/sound/core/seq/seq_system.c b/sound/core/seq/seq_system.c index e8f0a66..0d9eff8 100644 --- a/sound/core/seq/seq_system.c +++ b/sound/core/seq/seq_system.c @@ -126,8 +126,8 @@ int __init snd_seq_system_client_init(void) snd_seq_client_info_t *inf; snd_seq_port_info_t *port; - inf = kcalloc(1, sizeof(*inf), GFP_KERNEL); - port = kcalloc(1, sizeof(*port), GFP_KERNEL); + inf = kzalloc(sizeof(*inf), GFP_KERNEL); + port = kzalloc(sizeof(*port), GFP_KERNEL); if (! inf || ! port) { kfree(inf); kfree(port); diff --git a/sound/core/seq/seq_timer.c b/sound/core/seq/seq_timer.c index a7f76fc..b57a3c0 100644 --- a/sound/core/seq/seq_timer.c +++ b/sound/core/seq/seq_timer.c @@ -60,7 +60,7 @@ seq_timer_t *snd_seq_timer_new(void) { seq_timer_t *tmr; - tmr = kcalloc(1, sizeof(*tmr), GFP_KERNEL); + tmr = kzalloc(sizeof(*tmr), GFP_KERNEL); if (tmr == NULL) { snd_printd("malloc failed for snd_seq_timer_new() \n"); return NULL; diff --git a/sound/core/seq/seq_virmidi.c b/sound/core/seq/seq_virmidi.c index a66484b5..e4f512a 100644 --- a/sound/core/seq/seq_virmidi.c +++ b/sound/core/seq/seq_virmidi.c @@ -205,7 +205,7 @@ static int snd_virmidi_input_open(snd_rawmidi_substream_t * substream) snd_virmidi_t *vmidi; unsigned long flags; - vmidi = kcalloc(1, sizeof(*vmidi), GFP_KERNEL); + vmidi = kzalloc(sizeof(*vmidi), GFP_KERNEL); if (vmidi == NULL) return -ENOMEM; vmidi->substream = substream; @@ -233,7 +233,7 @@ static int snd_virmidi_output_open(snd_rawmidi_substream_t * substream) snd_rawmidi_runtime_t *runtime = substream->runtime; snd_virmidi_t *vmidi; - vmidi = kcalloc(1, sizeof(*vmidi), GFP_KERNEL); + vmidi = kzalloc(sizeof(*vmidi), GFP_KERNEL); if (vmidi == NULL) return -ENOMEM; vmidi->substream = substream; @@ -508,7 +508,7 @@ int snd_virmidi_new(snd_card_t *card, int device, snd_rawmidi_t **rrmidi) &rmidi)) < 0) return err; strcpy(rmidi->name, rmidi->id); - rdev = kcalloc(1, sizeof(*rdev), GFP_KERNEL); + rdev = kzalloc(sizeof(*rdev), GFP_KERNEL); if (rdev == NULL) { snd_device_free(card, rmidi); return -ENOMEM; diff --git a/sound/core/sound.c b/sound/core/sound.c index 3271e92..9e76bdd 100644 --- a/sound/core/sound.c +++ b/sound/core/sound.c @@ -328,6 +328,10 @@ int __exit snd_minor_info_done(void) * INIT PART */ +#ifdef CONFIG_SND_GENERIC_DRIVER +extern struct device_driver snd_generic_driver; +#endif + static int __init alsa_sound_init(void) { short controlnum; @@ -354,6 +358,9 @@ static int __init alsa_sound_init(void) return -ENOMEM; } snd_info_minor_register(); +#ifdef CONFIG_SND_GENERIC_DRIVER + driver_register(&snd_generic_driver); +#endif for (controlnum = 0; controlnum < cards_limit; controlnum++) devfs_mk_cdev(MKDEV(major, controlnum<<5), S_IFCHR | device_mode, "snd/controlC%d", controlnum); #ifndef MODULE @@ -369,6 +376,9 @@ static void __exit alsa_sound_exit(void) for (controlnum = 0; controlnum < cards_limit; controlnum++) devfs_remove("snd/controlC%d", controlnum); +#ifdef CONFIG_SND_GENERIC_DRIVER + driver_unregister(&snd_generic_driver); +#endif snd_info_minor_unregister(); snd_info_done(); snd_memory_done(); @@ -416,10 +426,13 @@ EXPORT_SYMBOL(snd_card_register); EXPORT_SYMBOL(snd_component_add); EXPORT_SYMBOL(snd_card_file_add); EXPORT_SYMBOL(snd_card_file_remove); +#ifdef CONFIG_SND_GENERIC_DRIVER +EXPORT_SYMBOL(snd_card_set_generic_dev); +#endif #ifdef CONFIG_PM EXPORT_SYMBOL(snd_power_wait); EXPORT_SYMBOL(snd_card_set_pm_callback); -#if defined(CONFIG_PM) && defined(CONFIG_SND_GENERIC_PM) +#ifdef CONFIG_SND_GENERIC_DRIVER EXPORT_SYMBOL(snd_card_set_generic_pm_callback); #endif #ifdef CONFIG_PCI diff --git a/sound/core/timer.c b/sound/core/timer.c index 4104f6e..22b1046 100644 --- a/sound/core/timer.c +++ b/sound/core/timer.c @@ -98,7 +98,7 @@ static void snd_timer_reschedule(snd_timer_t * timer, unsigned long ticks_left); static snd_timer_instance_t *snd_timer_instance_new(char *owner, snd_timer_t *timer) { snd_timer_instance_t *timeri; - timeri = kcalloc(1, sizeof(*timeri), GFP_KERNEL); + timeri = kzalloc(sizeof(*timeri), GFP_KERNEL); if (timeri == NULL) return NULL; timeri->owner = kstrdup(owner, GFP_KERNEL); @@ -764,7 +764,7 @@ int snd_timer_new(snd_card_t *card, char *id, snd_timer_id_t *tid, snd_timer_t * snd_assert(tid != NULL, return -EINVAL); snd_assert(rtimer != NULL, return -EINVAL); *rtimer = NULL; - timer = kcalloc(1, sizeof(*timer), GFP_KERNEL); + timer = kzalloc(sizeof(*timer), GFP_KERNEL); if (timer == NULL) return -ENOMEM; timer->tmr_class = tid->dev_class; @@ -1017,7 +1017,7 @@ static int snd_timer_register_system(void) return err; strcpy(timer->name, "system timer"); timer->hw = snd_timer_system; - priv = kcalloc(1, sizeof(*priv), GFP_KERNEL); + priv = kzalloc(sizeof(*priv), GFP_KERNEL); if (priv == NULL) { snd_timer_free(timer); return -ENOMEM; @@ -1202,7 +1202,7 @@ static int snd_timer_user_open(struct inode *inode, struct file *file) { snd_timer_user_t *tu; - tu = kcalloc(1, sizeof(*tu), GFP_KERNEL); + tu = kzalloc(sizeof(*tu), GFP_KERNEL); if (tu == NULL) return -ENOMEM; spin_lock_init(&tu->qlock); @@ -1513,7 +1513,7 @@ static int snd_timer_user_info(struct file *file, snd_timer_info_t __user *_info t = tu->timeri->timer; snd_assert(t != NULL, return -ENXIO); - info = kcalloc(1, sizeof(*info), GFP_KERNEL); + info = kzalloc(sizeof(*info), GFP_KERNEL); if (! info) return -ENOMEM; info->card = t->card ? t->card->number : -1; |