aboutsummaryrefslogtreecommitdiffstats
path: root/sound/core
diff options
context:
space:
mode:
Diffstat (limited to 'sound/core')
-rw-r--r--sound/core/Kconfig14
-rw-r--r--sound/core/control.c12
-rw-r--r--sound/core/control_compat.c8
-rw-r--r--sound/core/device.c2
-rw-r--r--sound/core/hwdep.c2
-rw-r--r--sound/core/info.c8
-rw-r--r--sound/core/init.c187
-rw-r--r--sound/core/memalloc.c3
-rw-r--r--sound/core/memory.c4
-rw-r--r--sound/core/oss/mixer_oss.c26
-rw-r--r--sound/core/oss/pcm_oss.c17
-rw-r--r--sound/core/oss/pcm_plugin.c2
-rw-r--r--sound/core/pcm.c6
-rw-r--r--sound/core/pcm_lib.c117
-rw-r--r--sound/core/pcm_memory.c4
-rw-r--r--sound/core/pcm_native.c11
-rw-r--r--sound/core/rawmidi.c16
-rw-r--r--sound/core/seq/instr/ainstr_gf1.c2
-rw-r--r--sound/core/seq/instr/ainstr_iw.c6
-rw-r--r--sound/core/seq/oss/seq_oss_init.c2
-rw-r--r--sound/core/seq/oss/seq_oss_midi.c6
-rw-r--r--sound/core/seq/oss/seq_oss_readq.c2
-rw-r--r--sound/core/seq/oss/seq_oss_synth.c4
-rw-r--r--sound/core/seq/oss/seq_oss_timer.c2
-rw-r--r--sound/core/seq/oss/seq_oss_writeq.c2
-rw-r--r--sound/core/seq/seq.c8
-rw-r--r--sound/core/seq/seq_clientmgr.c9
-rw-r--r--sound/core/seq/seq_device.c2
-rw-r--r--sound/core/seq/seq_dummy.c2
-rw-r--r--sound/core/seq/seq_fifo.c2
-rw-r--r--sound/core/seq/seq_instr.c4
-rw-r--r--sound/core/seq/seq_memory.c2
-rw-r--r--sound/core/seq/seq_midi.c2
-rw-r--r--sound/core/seq/seq_midi_event.c2
-rw-r--r--sound/core/seq/seq_ports.c4
-rw-r--r--sound/core/seq/seq_prioq.c2
-rw-r--r--sound/core/seq/seq_queue.c2
-rw-r--r--sound/core/seq/seq_system.c4
-rw-r--r--sound/core/seq/seq_timer.c2
-rw-r--r--sound/core/seq/seq_virmidi.c6
-rw-r--r--sound/core/sound.c15
-rw-r--r--sound/core/timer.c10
42 files changed, 363 insertions, 180 deletions
diff --git a/sound/core/Kconfig b/sound/core/Kconfig
index d1e800b9866d..48cf45cfd0b7 100644
--- a/sound/core/Kconfig
+++ b/sound/core/Kconfig
@@ -99,6 +99,18 @@ config SND_RTCTIMER
99 To compile this driver as a module, choose M here: the module 99 To compile this driver as a module, choose M here: the module
100 will be called snd-rtctimer. 100 will be called snd-rtctimer.
101 101
102config SND_SEQ_RTCTIMER_DEFAULT
103 bool "Use RTC as default sequencer timer"
104 depends on SND_RTCTIMER && SND_SEQUENCER
105 default y
106 help
107 Say Y here to use the RTC timer as the default sequencer
108 timer. This is strongly recommended because it ensures
109 precise MIDI timing even when the system timer runs at less
110 than 1000 Hz.
111
112 If in doubt, say Y.
113
102config SND_VERBOSE_PRINTK 114config SND_VERBOSE_PRINTK
103 bool "Verbose printk" 115 bool "Verbose printk"
104 depends on SND 116 depends on SND
@@ -128,6 +140,6 @@ config SND_DEBUG_DETECT
128 Say Y here to enable extra-verbose log messages printed when 140 Say Y here to enable extra-verbose log messages printed when
129 detecting devices. 141 detecting devices.
130 142
131config SND_GENERIC_PM 143config SND_GENERIC_DRIVER
132 bool 144 bool
133 depends on SND 145 depends on SND
diff --git a/sound/core/control.c b/sound/core/control.c
index 227f3cf02771..736edf358e05 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)
69 err = -EFAULT; 69 err = -EFAULT;
70 goto __error2; 70 goto __error2;
71 } 71 }
72 ctl = kcalloc(1, sizeof(*ctl), GFP_KERNEL); 72 ctl = kzalloc(sizeof(*ctl), GFP_KERNEL);
73 if (ctl == NULL) { 73 if (ctl == NULL) {
74 err = -ENOMEM; 74 err = -ENOMEM;
75 goto __error; 75 goto __error;
@@ -162,7 +162,7 @@ void snd_ctl_notify(snd_card_t *card, unsigned int mask, snd_ctl_elem_id_t *id)
162 goto _found; 162 goto _found;
163 } 163 }
164 } 164 }
165 ev = kcalloc(1, sizeof(*ev), GFP_ATOMIC); 165 ev = kzalloc(sizeof(*ev), GFP_ATOMIC);
166 if (ev) { 166 if (ev) {
167 ev->id = *id; 167 ev->id = *id;
168 ev->mask = mask; 168 ev->mask = mask;
@@ -195,7 +195,7 @@ snd_kcontrol_t *snd_ctl_new(snd_kcontrol_t * control, unsigned int access)
195 195
196 snd_runtime_check(control != NULL, return NULL); 196 snd_runtime_check(control != NULL, return NULL);
197 snd_runtime_check(control->count > 0, return NULL); 197 snd_runtime_check(control->count > 0, return NULL);
198 kctl = kcalloc(1, sizeof(*kctl) + sizeof(snd_kcontrol_volatile_t) * control->count, GFP_KERNEL); 198 kctl = kzalloc(sizeof(*kctl) + sizeof(snd_kcontrol_volatile_t) * control->count, GFP_KERNEL);
199 if (kctl == NULL) 199 if (kctl == NULL)
200 return NULL; 200 return NULL;
201 *kctl = *control; 201 *kctl = *control;
@@ -521,7 +521,7 @@ static int snd_ctl_card_info(snd_card_t * card, snd_ctl_file_t * ctl,
521{ 521{
522 snd_ctl_card_info_t *info; 522 snd_ctl_card_info_t *info;
523 523
524 info = kcalloc(1, sizeof(*info), GFP_KERNEL); 524 info = kzalloc(sizeof(*info), GFP_KERNEL);
525 if (! info) 525 if (! info)
526 return -ENOMEM; 526 return -ENOMEM;
527 down_read(&snd_ioctl_rwsem); 527 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
929 return -EINVAL; 929 return -EINVAL;
930 } 930 }
931 private_size *= info->count; 931 private_size *= info->count;
932 ue = kcalloc(1, sizeof(struct user_element) + private_size, GFP_KERNEL); 932 ue = kzalloc(sizeof(struct user_element) + private_size, GFP_KERNEL);
933 if (ue == NULL) 933 if (ue == NULL)
934 return -ENOMEM; 934 return -ENOMEM;
935 ue->info = *info; 935 ue->info = *info;
@@ -1185,7 +1185,7 @@ static int _snd_ctl_register_ioctl(snd_kctl_ioctl_func_t fcn, struct list_head *
1185{ 1185{
1186 snd_kctl_ioctl_t *pn; 1186 snd_kctl_ioctl_t *pn;
1187 1187
1188 pn = kcalloc(1, sizeof(snd_kctl_ioctl_t), GFP_KERNEL); 1188 pn = kzalloc(sizeof(snd_kctl_ioctl_t), GFP_KERNEL);
1189 if (pn == NULL) 1189 if (pn == NULL)
1190 return -ENOMEM; 1190 return -ENOMEM;
1191 pn->fioctl = fcn; 1191 pn->fioctl = fcn;
diff --git a/sound/core/control_compat.c b/sound/core/control_compat.c
index 7fdabea4bfc8..207c7de5129c 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
92 struct sndrv_ctl_elem_info *data; 92 struct sndrv_ctl_elem_info *data;
93 int err; 93 int err;
94 94
95 data = kcalloc(1, sizeof(*data), GFP_KERNEL); 95 data = kzalloc(sizeof(*data), GFP_KERNEL);
96 if (! data) 96 if (! data)
97 return -ENOMEM; 97 return -ENOMEM;
98 98
@@ -271,7 +271,7 @@ static int snd_ctl_elem_read_user_compat(snd_card_t *card,
271 struct sndrv_ctl_elem_value *data; 271 struct sndrv_ctl_elem_value *data;
272 int err, type, count; 272 int err, type, count;
273 273
274 data = kcalloc(1, sizeof(*data), GFP_KERNEL); 274 data = kzalloc(sizeof(*data), GFP_KERNEL);
275 if (data == NULL) 275 if (data == NULL)
276 return -ENOMEM; 276 return -ENOMEM;
277 277
@@ -291,7 +291,7 @@ static int snd_ctl_elem_write_user_compat(snd_ctl_file_t *file,
291 struct sndrv_ctl_elem_value *data; 291 struct sndrv_ctl_elem_value *data;
292 int err, type, count; 292 int err, type, count;
293 293
294 data = kcalloc(1, sizeof(*data), GFP_KERNEL); 294 data = kzalloc(sizeof(*data), GFP_KERNEL);
295 if (data == NULL) 295 if (data == NULL)
296 return -ENOMEM; 296 return -ENOMEM;
297 297
@@ -313,7 +313,7 @@ static int snd_ctl_elem_add_compat(snd_ctl_file_t *file,
313 struct sndrv_ctl_elem_info *data; 313 struct sndrv_ctl_elem_info *data;
314 int err; 314 int err;
315 315
316 data = kcalloc(1, sizeof(*data), GFP_KERNEL); 316 data = kzalloc(sizeof(*data), GFP_KERNEL);
317 if (! data) 317 if (! data)
318 return -ENOMEM; 318 return -ENOMEM;
319 319
diff --git a/sound/core/device.c b/sound/core/device.c
index ca00ad7740c9..1f509f56e60c 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,
49 snd_assert(card != NULL, return -ENXIO); 49 snd_assert(card != NULL, return -ENXIO);
50 snd_assert(device_data != NULL, return -ENXIO); 50 snd_assert(device_data != NULL, return -ENXIO);
51 snd_assert(ops != NULL, return -ENXIO); 51 snd_assert(ops != NULL, return -ENXIO);
52 dev = kcalloc(1, sizeof(*dev), GFP_KERNEL); 52 dev = kzalloc(sizeof(*dev), GFP_KERNEL);
53 if (dev == NULL) 53 if (dev == NULL)
54 return -ENOMEM; 54 return -ENOMEM;
55 dev->card = card; 55 dev->card = card;
diff --git a/sound/core/hwdep.c b/sound/core/hwdep.c
index 997dd41c584e..9383f1294fb5 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
359 snd_assert(rhwdep != NULL, return -EINVAL); 359 snd_assert(rhwdep != NULL, return -EINVAL);
360 *rhwdep = NULL; 360 *rhwdep = NULL;
361 snd_assert(card != NULL, return -ENXIO); 361 snd_assert(card != NULL, return -ENXIO);
362 hwdep = kcalloc(1, sizeof(*hwdep), GFP_KERNEL); 362 hwdep = kzalloc(sizeof(*hwdep), GFP_KERNEL);
363 if (hwdep == NULL) 363 if (hwdep == NULL)
364 return -ENOMEM; 364 return -ENOMEM;
365 hwdep->card = card; 365 hwdep->card = card;
diff --git a/sound/core/info.c b/sound/core/info.c
index 7f8bdf7b0058..37024d68a26e 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)
295 goto __error; 295 goto __error;
296 } 296 }
297 } 297 }
298 data = kcalloc(1, sizeof(*data), GFP_KERNEL); 298 data = kzalloc(sizeof(*data), GFP_KERNEL);
299 if (data == NULL) { 299 if (data == NULL) {
300 err = -ENOMEM; 300 err = -ENOMEM;
301 goto __error; 301 goto __error;
@@ -304,7 +304,7 @@ static int snd_info_entry_open(struct inode *inode, struct file *file)
304 switch (entry->content) { 304 switch (entry->content) {
305 case SNDRV_INFO_CONTENT_TEXT: 305 case SNDRV_INFO_CONTENT_TEXT:
306 if (mode == O_RDONLY || mode == O_RDWR) { 306 if (mode == O_RDONLY || mode == O_RDWR) {
307 buffer = kcalloc(1, sizeof(*buffer), GFP_KERNEL); 307 buffer = kzalloc(sizeof(*buffer), GFP_KERNEL);
308 if (buffer == NULL) { 308 if (buffer == NULL) {
309 kfree(data); 309 kfree(data);
310 err = -ENOMEM; 310 err = -ENOMEM;
@@ -323,7 +323,7 @@ static int snd_info_entry_open(struct inode *inode, struct file *file)
323 data->rbuffer = buffer; 323 data->rbuffer = buffer;
324 } 324 }
325 if (mode == O_WRONLY || mode == O_RDWR) { 325 if (mode == O_WRONLY || mode == O_RDWR) {
326 buffer = kcalloc(1, sizeof(*buffer), GFP_KERNEL); 326 buffer = kzalloc(sizeof(*buffer), GFP_KERNEL);
327 if (buffer == NULL) { 327 if (buffer == NULL) {
328 if (mode == O_RDWR) { 328 if (mode == O_RDWR) {
329 vfree(data->rbuffer->buffer); 329 vfree(data->rbuffer->buffer);
@@ -752,7 +752,7 @@ char *snd_info_get_str(char *dest, char *src, int len)
752static snd_info_entry_t *snd_info_create_entry(const char *name) 752static snd_info_entry_t *snd_info_create_entry(const char *name)
753{ 753{
754 snd_info_entry_t *entry; 754 snd_info_entry_t *entry;
755 entry = kcalloc(1, sizeof(*entry), GFP_KERNEL); 755 entry = kzalloc(sizeof(*entry), GFP_KERNEL);
756 if (entry == NULL) 756 if (entry == NULL)
757 return NULL; 757 return NULL;
758 entry->name = kstrdup(name, GFP_KERNEL); 758 entry->name = kstrdup(name, GFP_KERNEL);
diff --git a/sound/core/init.c b/sound/core/init.c
index d72f58f450ce..a5702014a704 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,
72 72
73 if (extra_size < 0) 73 if (extra_size < 0)
74 extra_size = 0; 74 extra_size = 0;
75 card = kcalloc(1, sizeof(*card) + extra_size, GFP_KERNEL); 75 card = kzalloc(sizeof(*card) + extra_size, GFP_KERNEL);
76 if (card == NULL) 76 if (card == NULL)
77 return NULL; 77 return NULL;
78 if (xid) { 78 if (xid) {
@@ -226,8 +226,10 @@ int snd_card_disconnect(snd_card_t * card)
226 return 0; 226 return 0;
227} 227}
228 228
229#if defined(CONFIG_PM) && defined(CONFIG_SND_GENERIC_PM) 229#ifdef CONFIG_SND_GENERIC_DRIVER
230static void snd_generic_device_unregister(struct snd_generic_device *dev); 230static void snd_generic_device_unregister(snd_card_t *card);
231#else
232#define snd_generic_device_unregister(x) /*NOP*/
231#endif 233#endif
232 234
233/** 235/**
@@ -253,14 +255,7 @@ int snd_card_free(snd_card_t * card)
253 255
254#ifdef CONFIG_PM 256#ifdef CONFIG_PM
255 wake_up(&card->power_sleep); 257 wake_up(&card->power_sleep);
256#ifdef CONFIG_SND_GENERIC_PM
257 if (card->pm_dev) {
258 snd_generic_device_unregister(card->pm_dev);
259 card->pm_dev = NULL;
260 }
261#endif
262#endif 258#endif
263
264 /* wait, until all devices are ready for the free operation */ 259 /* wait, until all devices are ready for the free operation */
265 wait_event(card->shutdown_sleep, card->files == NULL); 260 wait_event(card->shutdown_sleep, card->files == NULL);
266 261
@@ -288,6 +283,7 @@ int snd_card_free(snd_card_t * card)
288 snd_printk(KERN_WARNING "unable to free card info\n"); 283 snd_printk(KERN_WARNING "unable to free card info\n");
289 /* Not fatal error */ 284 /* Not fatal error */
290 } 285 }
286 snd_generic_device_unregister(card);
291 while (card->s_f_ops) { 287 while (card->s_f_ops) {
292 s_f_ops = card->s_f_ops; 288 s_f_ops = card->s_f_ops;
293 card->s_f_ops = s_f_ops->next; 289 card->s_f_ops = s_f_ops->next;
@@ -665,6 +661,96 @@ int snd_card_file_remove(snd_card_t *card, struct file *file)
665 return 0; 661 return 0;
666} 662}
667 663
664#ifdef CONFIG_SND_GENERIC_DRIVER
665/*
666 * generic device without a proper bus using platform_device
667 * (e.g. ISA)
668 */
669struct snd_generic_device {
670 struct platform_device pdev;
671 snd_card_t *card;
672};
673
674#define get_snd_generic_card(dev) container_of(to_platform_device(dev), struct snd_generic_device, pdev)->card
675
676#define SND_GENERIC_NAME "snd_generic"
677
678#ifdef CONFIG_PM
679static int snd_generic_suspend(struct device *dev, pm_message_t state, u32 level);
680static int snd_generic_resume(struct device *dev, u32 level);
681#endif
682
683/* initialized in sound.c */
684struct device_driver snd_generic_driver = {
685 .name = SND_GENERIC_NAME,
686 .bus = &platform_bus_type,
687#ifdef CONFIG_PM
688 .suspend = snd_generic_suspend,
689 .resume = snd_generic_resume,
690#endif
691};
692
693void snd_generic_device_release(struct device *dev)
694{
695}
696
697static int snd_generic_device_register(snd_card_t *card)
698{
699 struct snd_generic_device *dev;
700 int err;
701
702 if (card->generic_dev)
703 return 0; /* already registered */
704
705 dev = kzalloc(sizeof(*dev), GFP_KERNEL);
706 if (! dev) {
707 snd_printk(KERN_ERR "can't allocate generic_device\n");
708 return -ENOMEM;
709 }
710
711 dev->pdev.name = SND_GENERIC_NAME;
712 dev->pdev.id = card->number;
713 dev->pdev.dev.release = snd_generic_device_release;
714 dev->card = card;
715 if ((err = platform_device_register(&dev->pdev)) < 0) {
716 kfree(dev);
717 return err;
718 }
719 card->generic_dev = dev;
720 return 0;
721}
722
723static void snd_generic_device_unregister(snd_card_t *card)
724{
725 struct snd_generic_device *dev = card->generic_dev;
726 if (dev) {
727 platform_device_unregister(&dev->pdev);
728 kfree(dev);
729 card->generic_dev = NULL;
730 }
731}
732
733/**
734 * snd_card_set_generic_dev - assign the generic device to the card
735 * @card: soundcard structure
736 *
737 * Assigns a generic device to the card. This function is provided as the
738 * last resort, for devices without any proper bus. Thus this won't override
739 * the device already assigned to the card.
740 *
741 * Returns zero if successful, or a negative error code.
742 */
743int snd_card_set_generic_dev(snd_card_t *card)
744{
745 int err;
746 if ((err = snd_generic_device_register(card)) < 0)
747 return err;
748 if (! card->dev)
749 snd_card_set_dev(card, &card->generic_dev->pdev.dev);
750 return 0;
751}
752#endif /* CONFIG_SND_GENERIC_DRIVER */
753
668#ifdef CONFIG_PM 754#ifdef CONFIG_PM
669/** 755/**
670 * snd_power_wait - wait until the power-state is changed. 756 * snd_power_wait - wait until the power-state is changed.
@@ -730,75 +816,7 @@ int snd_card_set_pm_callback(snd_card_t *card,
730 return 0; 816 return 0;
731} 817}
732 818
733#ifdef CONFIG_SND_GENERIC_PM 819#ifdef CONFIG_SND_GENERIC_DRIVER
734/*
735 * use platform_device for generic power-management without a proper bus
736 * (e.g. ISA)
737 */
738struct snd_generic_device {
739 struct platform_device pdev;
740 snd_card_t *card;
741};
742
743#define get_snd_generic_card(dev) container_of(to_platform_device(dev), struct snd_generic_device, pdev)->card
744
745#define SND_GENERIC_NAME "snd_generic_pm"
746
747static int snd_generic_suspend(struct device *dev, pm_message_t state, u32 level);
748static int snd_generic_resume(struct device *dev, u32 level);
749
750static struct device_driver snd_generic_driver = {
751 .name = SND_GENERIC_NAME,
752 .bus = &platform_bus_type,
753 .suspend = snd_generic_suspend,
754 .resume = snd_generic_resume,
755};
756
757static int generic_driver_registered;
758
759static void generic_driver_unregister(void)
760{
761 if (generic_driver_registered) {
762 generic_driver_registered--;
763 if (! generic_driver_registered)
764 driver_unregister(&snd_generic_driver);
765 }
766}
767
768static struct snd_generic_device *snd_generic_device_register(snd_card_t *card)
769{
770 struct snd_generic_device *dev;
771
772 if (! generic_driver_registered) {
773 if (driver_register(&snd_generic_driver) < 0)
774 return NULL;
775 }
776 generic_driver_registered++;
777
778 dev = kcalloc(1, sizeof(*dev), GFP_KERNEL);
779 if (! dev) {
780 generic_driver_unregister();
781 return NULL;
782 }
783
784 dev->pdev.name = SND_GENERIC_NAME;
785 dev->pdev.id = card->number;
786 dev->card = card;
787 if (platform_device_register(&dev->pdev) < 0) {
788 kfree(dev);
789 generic_driver_unregister();
790 return NULL;
791 }
792 return dev;
793}
794
795static void snd_generic_device_unregister(struct snd_generic_device *dev)
796{
797 platform_device_unregister(&dev->pdev);
798 kfree(dev);
799 generic_driver_unregister();
800}
801
802/* suspend/resume callbacks for snd_generic platform device */ 820/* suspend/resume callbacks for snd_generic platform device */
803static int snd_generic_suspend(struct device *dev, pm_message_t state, u32 level) 821static int snd_generic_suspend(struct device *dev, pm_message_t state, u32 level)
804{ 822{
@@ -846,13 +864,12 @@ int snd_card_set_generic_pm_callback(snd_card_t *card,
846 int (*resume)(snd_card_t *), 864 int (*resume)(snd_card_t *),
847 void *private_data) 865 void *private_data)
848{ 866{
849 card->pm_dev = snd_generic_device_register(card); 867 int err;
850 if (! card->pm_dev) 868 if ((err = snd_generic_device_register(card)) < 0)
851 return -ENOMEM; 869 return err;
852 snd_card_set_pm_callback(card, suspend, resume, private_data); 870 return snd_card_set_pm_callback(card, suspend, resume, private_data);
853 return 0;
854} 871}
855#endif /* CONFIG_SND_GENERIC_PM */ 872#endif /* CONFIG_SND_GENERIC_DRIVER */
856 873
857#ifdef CONFIG_PCI 874#ifdef CONFIG_PCI
858int snd_card_pci_suspend(struct pci_dev *dev, pm_message_t state) 875int 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 39a54a415528..91124ddbdda9 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,
590 590
591 alloced = 0; 591 alloced = 0;
592 pci = NULL; 592 pci = NULL;
593 while ((pci = pci_find_device(vendor, device, pci)) != NULL) { 593 while ((pci = pci_get_device(vendor, device, pci)) != NULL) {
594 if (mask > 0 && mask < 0xffffffff) { 594 if (mask > 0 && mask < 0xffffffff) {
595 if (pci_set_dma_mask(pci, mask) < 0 || 595 if (pci_set_dma_mask(pci, mask) < 0 ||
596 pci_set_consistent_dma_mask(pci, mask) < 0) { 596 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,
604 if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(pci), 604 if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(pci),
605 size, &dmab) < 0) { 605 size, &dmab) < 0) {
606 printk(KERN_ERR "snd-page-alloc: cannot allocate buffer pages (size = %d)\n", size); 606 printk(KERN_ERR "snd-page-alloc: cannot allocate buffer pages (size = %d)\n", size);
607 pci_dev_put(pci);
607 return (int)count; 608 return (int)count;
608 } 609 }
609 snd_dma_reserve_buf(&dmab, snd_dma_pci_buf_id(pci)); 610 snd_dma_reserve_buf(&dmab, snd_dma_pci_buf_id(pci));
diff --git a/sound/core/memory.c b/sound/core/memory.c
index 291b4769bde3..8fa888fc53a0 100644
--- a/sound/core/memory.c
+++ b/sound/core/memory.c
@@ -249,7 +249,7 @@ int __exit snd_memory_info_done(void)
249int copy_to_user_fromio(void __user *dst, const volatile void __iomem *src, size_t count) 249int copy_to_user_fromio(void __user *dst, const volatile void __iomem *src, size_t count)
250{ 250{
251#if defined(__i386__) || defined(CONFIG_SPARC32) 251#if defined(__i386__) || defined(CONFIG_SPARC32)
252 return copy_to_user(dst, (const void*)src, count) ? -EFAULT : 0; 252 return copy_to_user(dst, (const void __force*)src, count) ? -EFAULT : 0;
253#else 253#else
254 char buf[256]; 254 char buf[256];
255 while (count) { 255 while (count) {
@@ -280,7 +280,7 @@ int copy_to_user_fromio(void __user *dst, const volatile void __iomem *src, size
280int copy_from_user_toio(volatile void __iomem *dst, const void __user *src, size_t count) 280int copy_from_user_toio(volatile void __iomem *dst, const void __user *src, size_t count)
281{ 281{
282#if defined(__i386__) || defined(CONFIG_SPARC32) 282#if defined(__i386__) || defined(CONFIG_SPARC32)
283 return copy_from_user((void*)dst, src, count) ? -EFAULT : 0; 283 return copy_from_user((void __force *)dst, src, count) ? -EFAULT : 0;
284#else 284#else
285 char buf[256]; 285 char buf[256];
286 while (count) { 286 while (count) {
diff --git a/sound/core/oss/mixer_oss.c b/sound/core/oss/mixer_oss.c
index 98fc0766f885..69e1059112d1 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)
53 err = snd_card_file_add(card, file); 53 err = snd_card_file_add(card, file);
54 if (err < 0) 54 if (err < 0)
55 return err; 55 return err;
56 fmixer = kcalloc(1, sizeof(*fmixer), GFP_KERNEL); 56 fmixer = kzalloc(sizeof(*fmixer), GFP_KERNEL);
57 if (fmixer == NULL) { 57 if (fmixer == NULL) {
58 snd_card_file_remove(card, file); 58 snd_card_file_remove(card, file);
59 return -ENOMEM; 59 return -ENOMEM;
@@ -517,8 +517,8 @@ static void snd_mixer_oss_get_volume1_vol(snd_mixer_oss_file_t *fmixer,
517 up_read(&card->controls_rwsem); 517 up_read(&card->controls_rwsem);
518 return; 518 return;
519 } 519 }
520 uinfo = kcalloc(1, sizeof(*uinfo), GFP_KERNEL); 520 uinfo = kzalloc(sizeof(*uinfo), GFP_KERNEL);
521 uctl = kcalloc(1, sizeof(*uctl), GFP_KERNEL); 521 uctl = kzalloc(sizeof(*uctl), GFP_KERNEL);
522 if (uinfo == NULL || uctl == NULL) 522 if (uinfo == NULL || uctl == NULL)
523 goto __unalloc; 523 goto __unalloc;
524 snd_runtime_check(!kctl->info(kctl, uinfo), goto __unalloc); 524 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,
551 up_read(&card->controls_rwsem); 551 up_read(&card->controls_rwsem);
552 return; 552 return;
553 } 553 }
554 uinfo = kcalloc(1, sizeof(*uinfo), GFP_KERNEL); 554 uinfo = kzalloc(sizeof(*uinfo), GFP_KERNEL);
555 uctl = kcalloc(1, sizeof(*uctl), GFP_KERNEL); 555 uctl = kzalloc(sizeof(*uctl), GFP_KERNEL);
556 if (uinfo == NULL || uctl == NULL) 556 if (uinfo == NULL || uctl == NULL)
557 goto __unalloc; 557 goto __unalloc;
558 snd_runtime_check(!kctl->info(kctl, uinfo), goto __unalloc); 558 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,
612 down_read(&card->controls_rwsem); 612 down_read(&card->controls_rwsem);
613 if ((kctl = snd_ctl_find_numid(card, numid)) == NULL) 613 if ((kctl = snd_ctl_find_numid(card, numid)) == NULL)
614 return; 614 return;
615 uinfo = kcalloc(1, sizeof(*uinfo), GFP_KERNEL); 615 uinfo = kzalloc(sizeof(*uinfo), GFP_KERNEL);
616 uctl = kcalloc(1, sizeof(*uctl), GFP_KERNEL); 616 uctl = kzalloc(sizeof(*uctl), GFP_KERNEL);
617 if (uinfo == NULL || uctl == NULL) 617 if (uinfo == NULL || uctl == NULL)
618 goto __unalloc; 618 goto __unalloc;
619 snd_runtime_check(!kctl->info(kctl, uinfo), goto __unalloc); 619 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,
649 up_read(&fmixer->card->controls_rwsem); 649 up_read(&fmixer->card->controls_rwsem);
650 return; 650 return;
651 } 651 }
652 uinfo = kcalloc(1, sizeof(*uinfo), GFP_KERNEL); 652 uinfo = kzalloc(sizeof(*uinfo), GFP_KERNEL);
653 uctl = kcalloc(1, sizeof(*uctl), GFP_KERNEL); 653 uctl = kzalloc(sizeof(*uctl), GFP_KERNEL);
654 if (uinfo == NULL || uctl == NULL) 654 if (uinfo == NULL || uctl == NULL)
655 goto __unalloc; 655 goto __unalloc;
656 snd_runtime_check(!kctl->info(kctl, uinfo), goto __unalloc); 656 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
768 snd_ctl_elem_value_t *uctl; 768 snd_ctl_elem_value_t *uctl;
769 int err, idx; 769 int err, idx;
770 770
771 uinfo = kcalloc(1, sizeof(*uinfo), GFP_KERNEL); 771 uinfo = kzalloc(sizeof(*uinfo), GFP_KERNEL);
772 uctl = kcalloc(1, sizeof(*uctl), GFP_KERNEL); 772 uctl = kzalloc(sizeof(*uctl), GFP_KERNEL);
773 if (uinfo == NULL || uctl == NULL) { 773 if (uinfo == NULL || uctl == NULL) {
774 err = -ENOMEM; 774 err = -ENOMEM;
775 goto __unlock; 775 goto __unlock;
@@ -813,8 +813,8 @@ static int snd_mixer_oss_put_recsrc2(snd_mixer_oss_file_t *fmixer, unsigned int
813 int err; 813 int err;
814 unsigned int idx; 814 unsigned int idx;
815 815
816 uinfo = kcalloc(1, sizeof(*uinfo), GFP_KERNEL); 816 uinfo = kzalloc(sizeof(*uinfo), GFP_KERNEL);
817 uctl = kcalloc(1, sizeof(*uctl), GFP_KERNEL); 817 uctl = kzalloc(sizeof(*uctl), GFP_KERNEL);
818 if (uinfo == NULL || uctl == NULL) { 818 if (uinfo == NULL || uctl == NULL) {
819 err = -ENOMEM; 819 err = -ENOMEM;
820 goto __unlock; 820 goto __unlock;
diff --git a/sound/core/oss/pcm_oss.c b/sound/core/oss/pcm_oss.c
index a13bd7bb4c9f..842c28b2ed55 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
850 return xfer > 0 ? xfer : -EAGAIN; 850 return xfer > 0 ? xfer : -EAGAIN;
851 } 851 }
852 } else { 852 } else {
853 tmp = snd_pcm_oss_write2(substream, (const char *)buf, runtime->oss.period_bytes, 0); 853 tmp = snd_pcm_oss_write2(substream,
854 (const char __force *)buf,
855 runtime->oss.period_bytes, 0);
854 if (tmp <= 0) 856 if (tmp <= 0)
855 return xfer > 0 ? (snd_pcm_sframes_t)xfer : tmp; 857 return xfer > 0 ? (snd_pcm_sframes_t)xfer : tmp;
856 runtime->oss.bytes += tmp; 858 runtime->oss.bytes += tmp;
@@ -926,7 +928,8 @@ static ssize_t snd_pcm_oss_read1(snd_pcm_substream_t *substream, char __user *bu
926 xfer += tmp; 928 xfer += tmp;
927 runtime->oss.buffer_used -= tmp; 929 runtime->oss.buffer_used -= tmp;
928 } else { 930 } else {
929 tmp = snd_pcm_oss_read2(substream, (char *)buf, runtime->oss.period_bytes, 0); 931 tmp = snd_pcm_oss_read2(substream, (char __force *)buf,
932 runtime->oss.period_bytes, 0);
930 if (tmp <= 0) 933 if (tmp <= 0)
931 return xfer > 0 ? (snd_pcm_sframes_t)xfer : tmp; 934 return xfer > 0 ? (snd_pcm_sframes_t)xfer : tmp;
932 runtime->oss.bytes += tmp; 935 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
1540 } else { 1543 } else {
1541 delay = snd_pcm_oss_bytes(substream, delay); 1544 delay = snd_pcm_oss_bytes(substream, delay);
1542 if (stream == SNDRV_PCM_STREAM_PLAYBACK) { 1545 if (stream == SNDRV_PCM_STREAM_PLAYBACK) {
1543 info.blocks = (runtime->oss.buffer_bytes - delay - fixup) / runtime->oss.period_bytes; 1546 snd_pcm_oss_setup_t *setup = substream->oss.setup;
1547 if (setup && setup->buggyptr)
1548 info.blocks = (runtime->oss.buffer_bytes - delay - fixup) / runtime->oss.period_bytes;
1549 else
1550 info.blocks = (delay + fixup) / runtime->oss.period_bytes;
1544 info.bytes = (runtime->oss.bytes - delay) & INT_MAX; 1551 info.bytes = (runtime->oss.bytes - delay) & INT_MAX;
1545 } else { 1552 } else {
1546 delay += fixup; 1553 delay += fixup;
@@ -1733,7 +1740,7 @@ static int snd_pcm_oss_open_file(struct file *file,
1733 snd_assert(rpcm_oss_file != NULL, return -EINVAL); 1740 snd_assert(rpcm_oss_file != NULL, return -EINVAL);
1734 *rpcm_oss_file = NULL; 1741 *rpcm_oss_file = NULL;
1735 1742
1736 pcm_oss_file = kcalloc(1, sizeof(*pcm_oss_file), GFP_KERNEL); 1743 pcm_oss_file = kzalloc(sizeof(*pcm_oss_file), GFP_KERNEL);
1737 if (pcm_oss_file == NULL) 1744 if (pcm_oss_file == NULL)
1738 return -ENOMEM; 1745 return -ENOMEM;
1739 1746
@@ -2347,6 +2354,8 @@ static void snd_pcm_oss_proc_write(snd_info_entry_t *entry,
2347 template.partialfrag = 1; 2354 template.partialfrag = 1;
2348 } else if (!strcmp(str, "no-silence")) { 2355 } else if (!strcmp(str, "no-silence")) {
2349 template.nosilence = 1; 2356 template.nosilence = 1;
2357 } else if (!strcmp(str, "buggy-ptr")) {
2358 template.buggyptr = 1;
2350 } 2359 }
2351 } while (*str); 2360 } while (*str);
2352 if (setup == NULL) { 2361 if (setup == NULL) {
diff --git a/sound/core/oss/pcm_plugin.c b/sound/core/oss/pcm_plugin.c
index 6430410c6c04..fc23373c000d 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,
171 171
172 snd_assert(plug != NULL, return -ENXIO); 172 snd_assert(plug != NULL, return -ENXIO);
173 snd_assert(src_format != NULL && dst_format != NULL, return -ENXIO); 173 snd_assert(src_format != NULL && dst_format != NULL, return -ENXIO);
174 plugin = kcalloc(1, sizeof(*plugin) + extra, GFP_KERNEL); 174 plugin = kzalloc(sizeof(*plugin) + extra, GFP_KERNEL);
175 if (plugin == NULL) 175 if (plugin == NULL)
176 return -ENOMEM; 176 return -ENOMEM;
177 plugin->name = name; 177 plugin->name = name;
diff --git a/sound/core/pcm.c b/sound/core/pcm.c
index 9f4c9209b271..1be470e942ef 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)
597 } 597 }
598 prev = NULL; 598 prev = NULL;
599 for (idx = 0, prev = NULL; idx < substream_count; idx++) { 599 for (idx = 0, prev = NULL; idx < substream_count; idx++) {
600 substream = kcalloc(1, sizeof(*substream), GFP_KERNEL); 600 substream = kzalloc(sizeof(*substream), GFP_KERNEL);
601 if (substream == NULL) 601 if (substream == NULL)
602 return -ENOMEM; 602 return -ENOMEM;
603 substream->pcm = pcm; 603 substream->pcm = pcm;
@@ -657,7 +657,7 @@ int snd_pcm_new(snd_card_t * card, char *id, int device,
657 snd_assert(rpcm != NULL, return -EINVAL); 657 snd_assert(rpcm != NULL, return -EINVAL);
658 *rpcm = NULL; 658 *rpcm = NULL;
659 snd_assert(card != NULL, return -ENXIO); 659 snd_assert(card != NULL, return -ENXIO);
660 pcm = kcalloc(1, sizeof(*pcm), GFP_KERNEL); 660 pcm = kzalloc(sizeof(*pcm), GFP_KERNEL);
661 if (pcm == NULL) 661 if (pcm == NULL)
662 return -ENOMEM; 662 return -ENOMEM;
663 pcm->card = card; 663 pcm->card = card;
@@ -795,7 +795,7 @@ int snd_pcm_open_substream(snd_pcm_t *pcm, int stream,
795 if (substream == NULL) 795 if (substream == NULL)
796 return -EAGAIN; 796 return -EAGAIN;
797 797
798 runtime = kcalloc(1, sizeof(*runtime), GFP_KERNEL); 798 runtime = kzalloc(sizeof(*runtime), GFP_KERNEL);
799 if (runtime == NULL) 799 if (runtime == NULL)
800 return -ENOMEM; 800 return -ENOMEM;
801 801
diff --git a/sound/core/pcm_lib.c b/sound/core/pcm_lib.c
index 0082914a7e33..0503980c23d9 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
524 524
525/** 525/**
526 * snd_interval_div - refine the interval value with division 526 * snd_interval_div - refine the interval value with division
527 * @a: dividend
528 * @b: divisor
529 * @c: quotient
527 * 530 *
528 * c = a / b 531 * c = a / b
529 * 532 *
@@ -555,7 +558,11 @@ void snd_interval_div(const snd_interval_t *a, const snd_interval_t *b, snd_inte
555 558
556/** 559/**
557 * snd_interval_muldivk - refine the interval value 560 * snd_interval_muldivk - refine the interval value
558 * 561 * @a: dividend 1
562 * @b: dividend 2
563 * @k: divisor (as integer)
564 * @c: result
565 *
559 * c = a * b / k 566 * c = a * b / k
560 * 567 *
561 * Returns non-zero if the value is changed, zero if not changed. 568 * 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,
582 589
583/** 590/**
584 * snd_interval_mulkdiv - refine the interval value 591 * snd_interval_mulkdiv - refine the interval value
592 * @a: dividend 1
593 * @k: dividend 2 (as integer)
594 * @b: divisor
595 * @c: result
585 * 596 *
586 * c = a * k / b 597 * c = a * k / b
587 * 598 *
@@ -618,6 +629,11 @@ void snd_interval_mulkdiv(const snd_interval_t *a, unsigned int k,
618 629
619/** 630/**
620 * snd_interval_ratnum - refine the interval value 631 * snd_interval_ratnum - refine the interval value
632 * @i: interval to refine
633 * @rats_count: number of ratnum_t
634 * @rats: ratnum_t array
635 * @nump: pointer to store the resultant numerator
636 * @denp: pointer to store the resultant denominator
621 * 637 *
622 * Returns non-zero if the value is changed, zero if not changed. 638 * Returns non-zero if the value is changed, zero if not changed.
623 */ 639 */
@@ -715,6 +731,11 @@ int snd_interval_ratnum(snd_interval_t *i,
715 731
716/** 732/**
717 * snd_interval_ratden - refine the interval value 733 * snd_interval_ratden - refine the interval value
734 * @i: interval to refine
735 * @rats_count: number of ratden_t
736 * @rats: ratden_t array
737 * @nump: pointer to store the resultant numerator
738 * @denp: pointer to store the resultant denominator
718 * 739 *
719 * Returns non-zero if the value is changed, zero if not changed. 740 * Returns non-zero if the value is changed, zero if not changed.
720 */ 741 */
@@ -936,6 +957,11 @@ int snd_pcm_hw_rule_add(snd_pcm_runtime_t *runtime, unsigned int cond,
936 957
937/** 958/**
938 * snd_pcm_hw_constraint_mask 959 * snd_pcm_hw_constraint_mask
960 * @runtime: PCM runtime instance
961 * @var: hw_params variable to apply the mask
962 * @mask: the bitmap mask
963 *
964 * Apply the constraint of the given bitmap mask to a mask parameter.
939 */ 965 */
940int snd_pcm_hw_constraint_mask(snd_pcm_runtime_t *runtime, snd_pcm_hw_param_t var, 966int snd_pcm_hw_constraint_mask(snd_pcm_runtime_t *runtime, snd_pcm_hw_param_t var,
941 u_int32_t mask) 967 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
951 977
952/** 978/**
953 * snd_pcm_hw_constraint_mask64 979 * snd_pcm_hw_constraint_mask64
980 * @runtime: PCM runtime instance
981 * @var: hw_params variable to apply the mask
982 * @mask: the 64bit bitmap mask
983 *
984 * Apply the constraint of the given bitmap mask to a mask parameter.
954 */ 985 */
955int snd_pcm_hw_constraint_mask64(snd_pcm_runtime_t *runtime, snd_pcm_hw_param_t var, 986int snd_pcm_hw_constraint_mask64(snd_pcm_runtime_t *runtime, snd_pcm_hw_param_t var,
956 u_int64_t mask) 987 u_int64_t mask)
@@ -967,6 +998,10 @@ int snd_pcm_hw_constraint_mask64(snd_pcm_runtime_t *runtime, snd_pcm_hw_param_t
967 998
968/** 999/**
969 * snd_pcm_hw_constraint_integer 1000 * snd_pcm_hw_constraint_integer
1001 * @runtime: PCM runtime instance
1002 * @var: hw_params variable to apply the integer constraint
1003 *
1004 * Apply the constraint of integer to an interval parameter.
970 */ 1005 */
971int snd_pcm_hw_constraint_integer(snd_pcm_runtime_t *runtime, snd_pcm_hw_param_t var) 1006int snd_pcm_hw_constraint_integer(snd_pcm_runtime_t *runtime, snd_pcm_hw_param_t var)
972{ 1007{
@@ -976,6 +1011,12 @@ int snd_pcm_hw_constraint_integer(snd_pcm_runtime_t *runtime, snd_pcm_hw_param_t
976 1011
977/** 1012/**
978 * snd_pcm_hw_constraint_minmax 1013 * snd_pcm_hw_constraint_minmax
1014 * @runtime: PCM runtime instance
1015 * @var: hw_params variable to apply the range
1016 * @min: the minimal value
1017 * @max: the maximal value
1018 *
1019 * Apply the min/max range constraint to an interval parameter.
979 */ 1020 */
980int snd_pcm_hw_constraint_minmax(snd_pcm_runtime_t *runtime, snd_pcm_hw_param_t var, 1021int snd_pcm_hw_constraint_minmax(snd_pcm_runtime_t *runtime, snd_pcm_hw_param_t var,
981 unsigned int min, unsigned int max) 1022 unsigned int min, unsigned int max)
@@ -999,6 +1040,12 @@ static int snd_pcm_hw_rule_list(snd_pcm_hw_params_t *params,
999 1040
1000/** 1041/**
1001 * snd_pcm_hw_constraint_list 1042 * snd_pcm_hw_constraint_list
1043 * @runtime: PCM runtime instance
1044 * @cond: condition bits
1045 * @var: hw_params variable to apply the list constraint
1046 * @l: list
1047 *
1048 * Apply the list of constraints to an interval parameter.
1002 */ 1049 */
1003int snd_pcm_hw_constraint_list(snd_pcm_runtime_t *runtime, 1050int snd_pcm_hw_constraint_list(snd_pcm_runtime_t *runtime,
1004 unsigned int cond, 1051 unsigned int cond,
@@ -1027,6 +1074,10 @@ static int snd_pcm_hw_rule_ratnums(snd_pcm_hw_params_t *params,
1027 1074
1028/** 1075/**
1029 * snd_pcm_hw_constraint_ratnums 1076 * snd_pcm_hw_constraint_ratnums
1077 * @runtime: PCM runtime instance
1078 * @cond: condition bits
1079 * @var: hw_params variable to apply the ratnums constraint
1080 * @r: ratnums_t constriants
1030 */ 1081 */
1031int snd_pcm_hw_constraint_ratnums(snd_pcm_runtime_t *runtime, 1082int snd_pcm_hw_constraint_ratnums(snd_pcm_runtime_t *runtime,
1032 unsigned int cond, 1083 unsigned int cond,
@@ -1054,6 +1105,10 @@ static int snd_pcm_hw_rule_ratdens(snd_pcm_hw_params_t *params,
1054 1105
1055/** 1106/**
1056 * snd_pcm_hw_constraint_ratdens 1107 * snd_pcm_hw_constraint_ratdens
1108 * @runtime: PCM runtime instance
1109 * @cond: condition bits
1110 * @var: hw_params variable to apply the ratdens constraint
1111 * @r: ratdens_t constriants
1057 */ 1112 */
1058int snd_pcm_hw_constraint_ratdens(snd_pcm_runtime_t *runtime, 1113int snd_pcm_hw_constraint_ratdens(snd_pcm_runtime_t *runtime,
1059 unsigned int cond, 1114 unsigned int cond,
@@ -1079,6 +1134,10 @@ static int snd_pcm_hw_rule_msbits(snd_pcm_hw_params_t *params,
1079 1134
1080/** 1135/**
1081 * snd_pcm_hw_constraint_msbits 1136 * snd_pcm_hw_constraint_msbits
1137 * @runtime: PCM runtime instance
1138 * @cond: condition bits
1139 * @width: sample bits width
1140 * @msbits: msbits width
1082 */ 1141 */
1083int snd_pcm_hw_constraint_msbits(snd_pcm_runtime_t *runtime, 1142int snd_pcm_hw_constraint_msbits(snd_pcm_runtime_t *runtime,
1084 unsigned int cond, 1143 unsigned int cond,
@@ -1101,6 +1160,10 @@ static int snd_pcm_hw_rule_step(snd_pcm_hw_params_t *params,
1101 1160
1102/** 1161/**
1103 * snd_pcm_hw_constraint_step 1162 * snd_pcm_hw_constraint_step
1163 * @runtime: PCM runtime instance
1164 * @cond: condition bits
1165 * @var: hw_params variable to apply the step constraint
1166 * @step: step size
1104 */ 1167 */
1105int snd_pcm_hw_constraint_step(snd_pcm_runtime_t *runtime, 1168int snd_pcm_hw_constraint_step(snd_pcm_runtime_t *runtime,
1106 unsigned int cond, 1169 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 *
1126 1189
1127/** 1190/**
1128 * snd_pcm_hw_constraint_pow2 1191 * snd_pcm_hw_constraint_pow2
1192 * @runtime: PCM runtime instance
1193 * @cond: condition bits
1194 * @var: hw_params variable to apply the power-of-2 constraint
1129 */ 1195 */
1130int snd_pcm_hw_constraint_pow2(snd_pcm_runtime_t *runtime, 1196int snd_pcm_hw_constraint_pow2(snd_pcm_runtime_t *runtime,
1131 unsigned int cond, 1197 unsigned int cond,
@@ -1162,7 +1228,7 @@ static void _snd_pcm_hw_param_any(snd_pcm_hw_params_t *params,
1162} 1228}
1163 1229
1164#if 0 1230#if 0
1165/** 1231/*
1166 * snd_pcm_hw_param_any 1232 * snd_pcm_hw_param_any
1167 */ 1233 */
1168int snd_pcm_hw_param_any(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, 1234int 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)
1185} 1251}
1186 1252
1187#if 0 1253#if 0
1188/** 1254/*
1189 * snd_pcm_hw_params_any 1255 * snd_pcm_hw_params_any
1190 * 1256 *
1191 * Fill PARAMS with full configuration space boundaries 1257 * 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)
1199 1265
1200/** 1266/**
1201 * snd_pcm_hw_param_value 1267 * snd_pcm_hw_param_value
1268 * @params: the hw_params instance
1269 * @var: parameter to retrieve
1270 * @dir: pointer to the direction (-1,0,1) or NULL
1202 * 1271 *
1203 * Return the value for field PAR if it's fixed in configuration space 1272 * Return the value for field PAR if it's fixed in configuration space
1204 * defined by PARAMS. Return -EINVAL otherwise 1273 * defined by PARAMS. Return -EINVAL otherwise
@@ -1228,6 +1297,9 @@ static int snd_pcm_hw_param_value(const snd_pcm_hw_params_t *params,
1228 1297
1229/** 1298/**
1230 * snd_pcm_hw_param_value_min 1299 * snd_pcm_hw_param_value_min
1300 * @params: the hw_params instance
1301 * @var: parameter to retrieve
1302 * @dir: pointer to the direction (-1,0,1) or NULL
1231 * 1303 *
1232 * Return the minimum value for field PAR. 1304 * Return the minimum value for field PAR.
1233 */ 1305 */
@@ -1251,6 +1323,9 @@ unsigned int snd_pcm_hw_param_value_min(const snd_pcm_hw_params_t *params,
1251 1323
1252/** 1324/**
1253 * snd_pcm_hw_param_value_max 1325 * snd_pcm_hw_param_value_max
1326 * @params: the hw_params instance
1327 * @var: parameter to retrieve
1328 * @dir: pointer to the direction (-1,0,1) or NULL
1254 * 1329 *
1255 * Return the maximum value for field PAR. 1330 * Return the maximum value for field PAR.
1256 */ 1331 */
@@ -1302,7 +1377,7 @@ int _snd_pcm_hw_param_setinteger(snd_pcm_hw_params_t *params,
1302} 1377}
1303 1378
1304#if 0 1379#if 0
1305/** 1380/*
1306 * snd_pcm_hw_param_setinteger 1381 * snd_pcm_hw_param_setinteger
1307 * 1382 *
1308 * Inside configuration space defined by PARAMS remove from PAR all 1383 * 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,
1347 1422
1348/** 1423/**
1349 * snd_pcm_hw_param_first 1424 * snd_pcm_hw_param_first
1425 * @pcm: PCM instance
1426 * @params: the hw_params instance
1427 * @var: parameter to retrieve
1428 * @dir: pointer to the direction (-1,0,1) or NULL
1350 * 1429 *
1351 * Inside configuration space defined by PARAMS remove from PAR all 1430 * Inside configuration space defined by PARAMS remove from PAR all
1352 * values > minimum. Reduce configuration space accordingly. 1431 * values > minimum. Reduce configuration space accordingly.
@@ -1388,6 +1467,10 @@ static int _snd_pcm_hw_param_last(snd_pcm_hw_params_t *params,
1388 1467
1389/** 1468/**
1390 * snd_pcm_hw_param_last 1469 * snd_pcm_hw_param_last
1470 * @pcm: PCM instance
1471 * @params: the hw_params instance
1472 * @var: parameter to retrieve
1473 * @dir: pointer to the direction (-1,0,1) or NULL
1391 * 1474 *
1392 * Inside configuration space defined by PARAMS remove from PAR all 1475 * Inside configuration space defined by PARAMS remove from PAR all
1393 * values < maximum. Reduce configuration space accordingly. 1476 * values < maximum. Reduce configuration space accordingly.
@@ -1439,6 +1522,11 @@ int _snd_pcm_hw_param_min(snd_pcm_hw_params_t *params,
1439 1522
1440/** 1523/**
1441 * snd_pcm_hw_param_min 1524 * snd_pcm_hw_param_min
1525 * @pcm: PCM instance
1526 * @params: the hw_params instance
1527 * @var: parameter to retrieve
1528 * @val: minimal value
1529 * @dir: pointer to the direction (-1,0,1) or NULL
1442 * 1530 *
1443 * Inside configuration space defined by PARAMS remove from PAR all 1531 * Inside configuration space defined by PARAMS remove from PAR all
1444 * values < VAL. Reduce configuration space accordingly. 1532 * values < VAL. Reduce configuration space accordingly.
@@ -1494,6 +1582,11 @@ static int _snd_pcm_hw_param_max(snd_pcm_hw_params_t *params,
1494 1582
1495/** 1583/**
1496 * snd_pcm_hw_param_max 1584 * snd_pcm_hw_param_max
1585 * @pcm: PCM instance
1586 * @params: the hw_params instance
1587 * @var: parameter to retrieve
1588 * @val: maximal value
1589 * @dir: pointer to the direction (-1,0,1) or NULL
1497 * 1590 *
1498 * Inside configuration space defined by PARAMS remove from PAR all 1591 * Inside configuration space defined by PARAMS remove from PAR all
1499 * values >= VAL + 1. Reduce configuration space accordingly. 1592 * values >= VAL + 1. Reduce configuration space accordingly.
@@ -1565,6 +1658,11 @@ int _snd_pcm_hw_param_set(snd_pcm_hw_params_t *params,
1565 1658
1566/** 1659/**
1567 * snd_pcm_hw_param_set 1660 * snd_pcm_hw_param_set
1661 * @pcm: PCM instance
1662 * @params: the hw_params instance
1663 * @var: parameter to retrieve
1664 * @val: value to set
1665 * @dir: pointer to the direction (-1,0,1) or NULL
1568 * 1666 *
1569 * Inside configuration space defined by PARAMS remove from PAR all 1667 * Inside configuration space defined by PARAMS remove from PAR all
1570 * values != VAL. Reduce configuration space accordingly. 1668 * values != VAL. Reduce configuration space accordingly.
@@ -1599,6 +1697,10 @@ static int _snd_pcm_hw_param_mask(snd_pcm_hw_params_t *params,
1599 1697
1600/** 1698/**
1601 * snd_pcm_hw_param_mask 1699 * snd_pcm_hw_param_mask
1700 * @pcm: PCM instance
1701 * @params: the hw_params instance
1702 * @var: parameter to retrieve
1703 * @val: mask to apply
1602 * 1704 *
1603 * Inside configuration space defined by PARAMS remove from PAR all values 1705 * Inside configuration space defined by PARAMS remove from PAR all values
1604 * not contained in MASK. Reduce configuration space accordingly. 1706 * not contained in MASK. Reduce configuration space accordingly.
@@ -1671,6 +1773,11 @@ static int boundary_nearer(int min, int mindir,
1671 1773
1672/** 1774/**
1673 * snd_pcm_hw_param_near 1775 * snd_pcm_hw_param_near
1776 * @pcm: PCM instance
1777 * @params: the hw_params instance
1778 * @var: parameter to retrieve
1779 * @best: value to set
1780 * @dir: pointer to the direction (-1,0,1) or NULL
1674 * 1781 *
1675 * Inside configuration space defined by PARAMS set PAR to the available value 1782 * Inside configuration space defined by PARAMS set PAR to the available value
1676 * nearest to VAL. Reduce configuration space accordingly. 1783 * 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,
1747 1854
1748/** 1855/**
1749 * snd_pcm_hw_param_choose 1856 * snd_pcm_hw_param_choose
1857 * @pcm: PCM instance
1858 * @params: the hw_params instance
1750 * 1859 *
1751 * Choose one configuration from configuration space defined by PARAMS 1860 * Choose one configuration from configuration space defined by PARAMS
1752 * The configuration chosen is that obtained fixing in this order: 1861 * 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 9a174fb96565..b3f5344f60be 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,
244 244
245/** 245/**
246 * snd_pcm_lib_preallocate_pages_for_all - pre-allocation for continous memory type (all substreams) 246 * snd_pcm_lib_preallocate_pages_for_all - pre-allocation for continous memory type (all substreams)
247 * @substream: the pcm substream instance 247 * @pcm: the pcm instance
248 * @type: DMA type (SNDRV_DMA_TYPE_*) 248 * @type: DMA type (SNDRV_DMA_TYPE_*)
249 * @data: DMA type dependant data 249 * @data: DMA type dependant data
250 * @size: the requested pre-allocation size in bytes 250 * @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)
321 if (substream->dma_buffer.area != NULL && substream->dma_buffer.bytes >= size) { 321 if (substream->dma_buffer.area != NULL && substream->dma_buffer.bytes >= size) {
322 dmab = &substream->dma_buffer; /* use the pre-allocated buffer */ 322 dmab = &substream->dma_buffer; /* use the pre-allocated buffer */
323 } else { 323 } else {
324 dmab = kcalloc(1, sizeof(*dmab), GFP_KERNEL); 324 dmab = kzalloc(sizeof(*dmab), GFP_KERNEL);
325 if (! dmab) 325 if (! dmab)
326 return -ENOMEM; 326 return -ENOMEM;
327 dmab->dev = substream->dma_buffer.dev; 327 dmab->dev = substream->dma_buffer.dev;
diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c
index 03c17159dd8e..67abebabf83e 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 = {
859 859
860/** 860/**
861 * snd_pcm_start 861 * snd_pcm_start
862 * @substream: the PCM substream instance
862 * 863 *
863 * Start all linked streams. 864 * Start all linked streams.
864 */ 865 */
@@ -908,6 +909,8 @@ static struct action_ops snd_pcm_action_stop = {
908 909
909/** 910/**
910 * snd_pcm_stop 911 * snd_pcm_stop
912 * @substream: the PCM substream instance
913 * @state: PCM state after stopping the stream
911 * 914 *
912 * Try to stop all running streams in the substream group. 915 * Try to stop all running streams in the substream group.
913 * The state of each stream is changed to the given value after that unconditionally. 916 * 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)
919 922
920/** 923/**
921 * snd_pcm_drain_done 924 * snd_pcm_drain_done
925 * @substream: the PCM substream
922 * 926 *
923 * Stop the DMA only when the given stream is playback. 927 * Stop the DMA only when the given stream is playback.
924 * The state is changed to SETUP. 928 * The state is changed to SETUP.
@@ -1040,6 +1044,7 @@ static struct action_ops snd_pcm_action_suspend = {
1040 1044
1041/** 1045/**
1042 * snd_pcm_suspend 1046 * snd_pcm_suspend
1047 * @substream: the PCM substream
1043 * 1048 *
1044 * Trigger SUSPEND to all linked streams. 1049 * Trigger SUSPEND to all linked streams.
1045 * After this call, all streams are changed to SUSPENDED state. 1050 * After this call, all streams are changed to SUSPENDED state.
@@ -1057,6 +1062,7 @@ int snd_pcm_suspend(snd_pcm_substream_t *substream)
1057 1062
1058/** 1063/**
1059 * snd_pcm_suspend_all 1064 * snd_pcm_suspend_all
1065 * @pcm: the PCM instance
1060 * 1066 *
1061 * Trigger SUSPEND to all substreams in the given pcm. 1067 * Trigger SUSPEND to all substreams in the given pcm.
1062 * After this call, all streams are changed to SUSPENDED state. 1068 * After this call, all streams are changed to SUSPENDED state.
@@ -1272,6 +1278,9 @@ static struct action_ops snd_pcm_action_prepare = {
1272 1278
1273/** 1279/**
1274 * snd_pcm_prepare 1280 * snd_pcm_prepare
1281 * @substream: the PCM substream instance
1282 *
1283 * Prepare the PCM substream to be triggerable.
1275 */ 1284 */
1276int snd_pcm_prepare(snd_pcm_substream_t *substream) 1285int snd_pcm_prepare(snd_pcm_substream_t *substream)
1277{ 1286{
@@ -1992,7 +2001,7 @@ static int snd_pcm_open_file(struct file *file,
1992 snd_assert(rpcm_file != NULL, return -EINVAL); 2001 snd_assert(rpcm_file != NULL, return -EINVAL);
1993 *rpcm_file = NULL; 2002 *rpcm_file = NULL;
1994 2003
1995 pcm_file = kcalloc(1, sizeof(*pcm_file), GFP_KERNEL); 2004 pcm_file = kzalloc(sizeof(*pcm_file), GFP_KERNEL);
1996 if (pcm_file == NULL) { 2005 if (pcm_file == NULL) {
1997 return -ENOMEM; 2006 return -ENOMEM;
1998 } 2007 }
diff --git a/sound/core/rawmidi.c b/sound/core/rawmidi.c
index edba4118271c..7c20eafecb8a 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)
101{ 101{
102 snd_rawmidi_runtime_t *runtime; 102 snd_rawmidi_runtime_t *runtime;
103 103
104 if ((runtime = kcalloc(1, sizeof(*runtime), GFP_KERNEL)) == NULL) 104 if ((runtime = kzalloc(sizeof(*runtime), GFP_KERNEL)) == NULL)
105 return -ENOMEM; 105 return -ENOMEM;
106 spin_lock_init(&runtime->lock); 106 spin_lock_init(&runtime->lock);
107 init_waitqueue_head(&runtime->sleep); 107 init_waitqueue_head(&runtime->sleep);
@@ -984,7 +984,9 @@ static ssize_t snd_rawmidi_read(struct file *file, char __user *buf, size_t coun
984 spin_lock_irq(&runtime->lock); 984 spin_lock_irq(&runtime->lock);
985 } 985 }
986 spin_unlock_irq(&runtime->lock); 986 spin_unlock_irq(&runtime->lock);
987 count1 = snd_rawmidi_kernel_read1(substream, (unsigned char *)buf, count, 0); 987 count1 = snd_rawmidi_kernel_read1(substream,
988 (unsigned char __force *)buf,
989 count, 0);
988 if (count1 < 0) 990 if (count1 < 0)
989 return result > 0 ? result : count1; 991 return result > 0 ? result : count1;
990 result += count1; 992 result += count1;
@@ -1107,7 +1109,7 @@ int snd_rawmidi_transmit_ack(snd_rawmidi_substream_t * substream, int count)
1107/** 1109/**
1108 * snd_rawmidi_transmit - copy from the buffer to the device 1110 * snd_rawmidi_transmit - copy from the buffer to the device
1109 * @substream: the rawmidi substream 1111 * @substream: the rawmidi substream
1110 * @buf: the buffer pointer 1112 * @buffer: the buffer pointer
1111 * @count: the data size to transfer 1113 * @count: the data size to transfer
1112 * 1114 *
1113 * Copies data from the buffer to the device and advances the pointer. 1115 * 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
1213 spin_lock_irq(&runtime->lock); 1215 spin_lock_irq(&runtime->lock);
1214 } 1216 }
1215 spin_unlock_irq(&runtime->lock); 1217 spin_unlock_irq(&runtime->lock);
1216 count1 = snd_rawmidi_kernel_write1(substream, (unsigned char *)buf, count, 0); 1218 count1 = snd_rawmidi_kernel_write1(substream,
1219 (unsigned char __force *)buf,
1220 count, 0);
1217 if (count1 < 0) 1221 if (count1 < 0)
1218 return result > 0 ? result : count1; 1222 return result > 0 ? result : count1;
1219 result += count1; 1223 result += count1;
@@ -1370,7 +1374,7 @@ static int snd_rawmidi_alloc_substreams(snd_rawmidi_t *rmidi,
1370 1374
1371 INIT_LIST_HEAD(&stream->substreams); 1375 INIT_LIST_HEAD(&stream->substreams);
1372 for (idx = 0; idx < count; idx++) { 1376 for (idx = 0; idx < count; idx++) {
1373 substream = kcalloc(1, sizeof(*substream), GFP_KERNEL); 1377 substream = kzalloc(sizeof(*substream), GFP_KERNEL);
1374 if (substream == NULL) 1378 if (substream == NULL)
1375 return -ENOMEM; 1379 return -ENOMEM;
1376 substream->stream = direction; 1380 substream->stream = direction;
@@ -1413,7 +1417,7 @@ int snd_rawmidi_new(snd_card_t * card, char *id, int device,
1413 snd_assert(rrawmidi != NULL, return -EINVAL); 1417 snd_assert(rrawmidi != NULL, return -EINVAL);
1414 *rrawmidi = NULL; 1418 *rrawmidi = NULL;
1415 snd_assert(card != NULL, return -ENXIO); 1419 snd_assert(card != NULL, return -ENXIO);
1416 rmidi = kcalloc(1, sizeof(*rmidi), GFP_KERNEL); 1420 rmidi = kzalloc(sizeof(*rmidi), GFP_KERNEL);
1417 if (rmidi == NULL) 1421 if (rmidi == NULL)
1418 return -ENOMEM; 1422 return -ENOMEM;
1419 rmidi->card = card; 1423 rmidi->card = card;
diff --git a/sound/core/seq/instr/ainstr_gf1.c b/sound/core/seq/instr/ainstr_gf1.c
index 32e91c6b25fe..207c2c54bf1d 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,
61 return -EFAULT; 61 return -EFAULT;
62 *data += sizeof(xp); 62 *data += sizeof(xp);
63 *len -= sizeof(xp); 63 *len -= sizeof(xp);
64 wp = kcalloc(1, sizeof(*wp), gfp_mask); 64 wp = kzalloc(sizeof(*wp), gfp_mask);
65 if (wp == NULL) 65 if (wp == NULL)
66 return -ENOMEM; 66 return -ENOMEM;
67 wp->share_id[0] = le32_to_cpu(xp.share_id[0]); 67 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 2622b8679ca7..b3cee092b1a4 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,
92 points_size = (le16_to_cpu(rx.nattack) + le16_to_cpu(rx.nrelease)) * 2 * sizeof(__u16); 92 points_size = (le16_to_cpu(rx.nattack) + le16_to_cpu(rx.nrelease)) * 2 * sizeof(__u16);
93 if (points_size > *len) 93 if (points_size > *len)
94 return -EINVAL; 94 return -EINVAL;
95 rp = kcalloc(1, sizeof(*rp) + points_size, gfp_mask); 95 rp = kzalloc(sizeof(*rp) + points_size, gfp_mask);
96 if (rp == NULL) 96 if (rp == NULL)
97 return -ENOMEM; 97 return -ENOMEM;
98 rp->nattack = le16_to_cpu(rx.nattack); 98 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,
139 return -EFAULT; 139 return -EFAULT;
140 *data += sizeof(xp); 140 *data += sizeof(xp);
141 *len -= sizeof(xp); 141 *len -= sizeof(xp);
142 wp = kcalloc(1, sizeof(*wp), gfp_mask); 142 wp = kzalloc(sizeof(*wp), gfp_mask);
143 if (wp == NULL) 143 if (wp == NULL)
144 return -ENOMEM; 144 return -ENOMEM;
145 wp->share_id[0] = le32_to_cpu(xp.share_id[0]); 145 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,
273 snd_seq_iwffff_instr_free(ops, ip, atomic); 273 snd_seq_iwffff_instr_free(ops, ip, atomic);
274 return -EINVAL; 274 return -EINVAL;
275 } 275 }
276 lp = kcalloc(1, sizeof(*lp), gfp_mask); 276 lp = kzalloc(sizeof(*lp), gfp_mask);
277 if (lp == NULL) { 277 if (lp == NULL) {
278 snd_seq_iwffff_instr_free(ops, ip, atomic); 278 snd_seq_iwffff_instr_free(ops, ip, atomic);
279 return -ENOMEM; 279 return -ENOMEM;
diff --git a/sound/core/seq/oss/seq_oss_init.c b/sound/core/seq/oss/seq_oss_init.c
index bac4b4f1a94e..1ab1cf8158c8 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)
193 int i, rc; 193 int i, rc;
194 seq_oss_devinfo_t *dp; 194 seq_oss_devinfo_t *dp;
195 195
196 if ((dp = kcalloc(1, sizeof(*dp), GFP_KERNEL)) == NULL) { 196 if ((dp = kzalloc(sizeof(*dp), GFP_KERNEL)) == NULL) {
197 snd_printk(KERN_ERR "can't malloc device info\n"); 197 snd_printk(KERN_ERR "can't malloc device info\n");
198 return -ENOMEM; 198 return -ENOMEM;
199 } 199 }
diff --git a/sound/core/seq/oss/seq_oss_midi.c b/sound/core/seq/oss/seq_oss_midi.c
index 9aece6c65dbc..f0e95c8f2eef 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)
76 snd_seq_client_info_t *clinfo; 76 snd_seq_client_info_t *clinfo;
77 snd_seq_port_info_t *pinfo; 77 snd_seq_port_info_t *pinfo;
78 78
79 clinfo = kcalloc(1, sizeof(*clinfo), GFP_KERNEL); 79 clinfo = kzalloc(sizeof(*clinfo), GFP_KERNEL);
80 pinfo = kcalloc(1, sizeof(*pinfo), GFP_KERNEL); 80 pinfo = kzalloc(sizeof(*pinfo), GFP_KERNEL);
81 if (! clinfo || ! pinfo) { 81 if (! clinfo || ! pinfo) {
82 kfree(clinfo); 82 kfree(clinfo);
83 kfree(pinfo); 83 kfree(pinfo);
@@ -172,7 +172,7 @@ snd_seq_oss_midi_check_new_port(snd_seq_port_info_t *pinfo)
172 /* 172 /*
173 * allocate midi info record 173 * allocate midi info record
174 */ 174 */
175 if ((mdev = kcalloc(1, sizeof(*mdev), GFP_KERNEL)) == NULL) { 175 if ((mdev = kzalloc(sizeof(*mdev), GFP_KERNEL)) == NULL) {
176 snd_printk(KERN_ERR "can't malloc midi info\n"); 176 snd_printk(KERN_ERR "can't malloc midi info\n");
177 return -ENOMEM; 177 return -ENOMEM;
178 } 178 }
diff --git a/sound/core/seq/oss/seq_oss_readq.c b/sound/core/seq/oss/seq_oss_readq.c
index 0a6f2a64f692..55571e15cd38 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)
46{ 46{
47 seq_oss_readq_t *q; 47 seq_oss_readq_t *q;
48 48
49 if ((q = kcalloc(1, sizeof(*q), GFP_KERNEL)) == NULL) { 49 if ((q = kzalloc(sizeof(*q), GFP_KERNEL)) == NULL) {
50 snd_printk(KERN_ERR "can't malloc read queue\n"); 50 snd_printk(KERN_ERR "can't malloc read queue\n");
51 return NULL; 51 return NULL;
52 } 52 }
diff --git a/sound/core/seq/oss/seq_oss_synth.c b/sound/core/seq/oss/seq_oss_synth.c
index 1a7736cbf3a4..8257fce2ca1b 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)
103 snd_seq_oss_reg_t *reg = SNDRV_SEQ_DEVICE_ARGPTR(dev); 103 snd_seq_oss_reg_t *reg = SNDRV_SEQ_DEVICE_ARGPTR(dev);
104 unsigned long flags; 104 unsigned long flags;
105 105
106 if ((rec = kcalloc(1, sizeof(*rec), GFP_KERNEL)) == NULL) { 106 if ((rec = kzalloc(sizeof(*rec), GFP_KERNEL)) == NULL) {
107 snd_printk(KERN_ERR "can't malloc synth info\n"); 107 snd_printk(KERN_ERR "can't malloc synth info\n");
108 return -ENOMEM; 108 return -ENOMEM;
109 } 109 }
@@ -499,7 +499,7 @@ snd_seq_oss_synth_sysex(seq_oss_devinfo_t *dp, int dev, unsigned char *buf, snd_
499 499
500 sysex = dp->synths[dev].sysex; 500 sysex = dp->synths[dev].sysex;
501 if (sysex == NULL) { 501 if (sysex == NULL) {
502 sysex = kcalloc(1, sizeof(*sysex), GFP_KERNEL); 502 sysex = kzalloc(sizeof(*sysex), GFP_KERNEL);
503 if (sysex == NULL) 503 if (sysex == NULL)
504 return -ENOMEM; 504 return -ENOMEM;
505 dp->synths[dev].sysex = sysex; 505 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 42ca9493fa60..64d594b3170f 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)
46{ 46{
47 seq_oss_timer_t *rec; 47 seq_oss_timer_t *rec;
48 48
49 rec = kcalloc(1, sizeof(*rec), GFP_KERNEL); 49 rec = kzalloc(sizeof(*rec), GFP_KERNEL);
50 if (rec == NULL) 50 if (rec == NULL)
51 return NULL; 51 return NULL;
52 52
diff --git a/sound/core/seq/oss/seq_oss_writeq.c b/sound/core/seq/oss/seq_oss_writeq.c
index 87f85f7ee814..b20378024547 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)
38 seq_oss_writeq_t *q; 38 seq_oss_writeq_t *q;
39 snd_seq_client_pool_t pool; 39 snd_seq_client_pool_t pool;
40 40
41 if ((q = kcalloc(1, sizeof(*q), GFP_KERNEL)) == NULL) 41 if ((q = kzalloc(sizeof(*q), GFP_KERNEL)) == NULL)
42 return NULL; 42 return NULL;
43 q->dp = dp; 43 q->dp = dp;
44 q->maxlen = maxlen; 44 q->maxlen = maxlen;
diff --git a/sound/core/seq/seq.c b/sound/core/seq/seq.c
index 7449d2a62629..24644150f24b 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};
43int seq_default_timer_class = SNDRV_TIMER_CLASS_GLOBAL; 43int seq_default_timer_class = SNDRV_TIMER_CLASS_GLOBAL;
44int seq_default_timer_sclass = SNDRV_TIMER_SCLASS_NONE; 44int seq_default_timer_sclass = SNDRV_TIMER_SCLASS_NONE;
45int seq_default_timer_card = -1; 45int seq_default_timer_card = -1;
46int seq_default_timer_device = SNDRV_TIMER_GLOBAL_SYSTEM; 46int seq_default_timer_device =
47#ifdef CONFIG_SND_SEQ_RTCTIMER_DEFAULT
48 SNDRV_TIMER_GLOBAL_RTC
49#else
50 SNDRV_TIMER_GLOBAL_SYSTEM
51#endif
52 ;
47int seq_default_timer_subdevice = 0; 53int seq_default_timer_subdevice = 0;
48int seq_default_timer_resolution = 0; /* Hz */ 54int seq_default_timer_resolution = 0; /* Hz */
49 55
diff --git a/sound/core/seq/seq_clientmgr.c b/sound/core/seq/seq_clientmgr.c
index d8f76afd284b..a886db94b1fa 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)
203 client_t *client; 203 client_t *client;
204 204
205 /* init client data */ 205 /* init client data */
206 client = kcalloc(1, sizeof(*client), GFP_KERNEL); 206 client = kzalloc(sizeof(*client), GFP_KERNEL);
207 if (client == NULL) 207 if (client == NULL)
208 return NULL; 208 return NULL;
209 client->pool = snd_seq_pool_new(poolsize); 209 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
413 } 413 }
414 count -= sizeof(snd_seq_event_t); 414 count -= sizeof(snd_seq_event_t);
415 buf += sizeof(snd_seq_event_t); 415 buf += sizeof(snd_seq_event_t);
416 err = snd_seq_expand_var_event(&cell->event, count, (char *)buf, 0, sizeof(snd_seq_event_t)); 416 err = snd_seq_expand_var_event(&cell->event, count,
417 (char __force *)buf, 0,
418 sizeof(snd_seq_event_t));
417 if (err < 0) 419 if (err < 0)
418 break; 420 break;
419 result += err; 421 result += err;
@@ -1009,7 +1011,8 @@ static ssize_t snd_seq_write(struct file *file, const char __user *buf, size_t c
1009 } 1011 }
1010 /* set user space pointer */ 1012 /* set user space pointer */
1011 event.data.ext.len = extlen | SNDRV_SEQ_EXT_USRPTR; 1013 event.data.ext.len = extlen | SNDRV_SEQ_EXT_USRPTR;
1012 event.data.ext.ptr = (char*)buf + sizeof(snd_seq_event_t); 1014 event.data.ext.ptr = (char __force *)buf
1015 + sizeof(snd_seq_event_t);
1013 len += extlen; /* increment data length */ 1016 len += extlen; /* increment data length */
1014 } else { 1017 } else {
1015#ifdef CONFIG_COMPAT 1018#ifdef CONFIG_COMPAT
diff --git a/sound/core/seq/seq_device.c b/sound/core/seq/seq_device.c
index 4d80f39612e8..252b52731003 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,
200 if (ops == NULL) 200 if (ops == NULL)
201 return -ENOMEM; 201 return -ENOMEM;
202 202
203 dev = kcalloc(1, sizeof(*dev)*2 + argsize, GFP_KERNEL); 203 dev = kzalloc(sizeof(*dev)*2 + argsize, GFP_KERNEL);
204 if (dev == NULL) { 204 if (dev == NULL) {
205 unlock_driver(ops); 205 unlock_driver(ops);
206 return -ENOMEM; 206 return -ENOMEM;
diff --git a/sound/core/seq/seq_dummy.c b/sound/core/seq/seq_dummy.c
index ea945a5d2a0b..5dd0e6a19e50 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)
153 snd_seq_port_callback_t pcb; 153 snd_seq_port_callback_t pcb;
154 snd_seq_dummy_port_t *rec; 154 snd_seq_dummy_port_t *rec;
155 155
156 if ((rec = kcalloc(1, sizeof(*rec), GFP_KERNEL)) == NULL) 156 if ((rec = kzalloc(sizeof(*rec), GFP_KERNEL)) == NULL)
157 return NULL; 157 return NULL;
158 158
159 rec->client = my_client; 159 rec->client = my_client;
diff --git a/sound/core/seq/seq_fifo.c b/sound/core/seq/seq_fifo.c
index 3b7647ca7ad9..4767cfdc361f 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)
33{ 33{
34 fifo_t *f; 34 fifo_t *f;
35 35
36 f = kcalloc(1, sizeof(*f), GFP_KERNEL); 36 f = kzalloc(sizeof(*f), GFP_KERNEL);
37 if (f == NULL) { 37 if (f == NULL) {
38 snd_printd("malloc failed for snd_seq_fifo_new() \n"); 38 snd_printd("malloc failed for snd_seq_fifo_new() \n");
39 return NULL; 39 return NULL;
diff --git a/sound/core/seq/seq_instr.c b/sound/core/seq/seq_instr.c
index 5b40ea2ba8f4..019d43a462d7 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)
53{ 53{
54 snd_seq_kinstr_t *instr; 54 snd_seq_kinstr_t *instr;
55 55
56 instr = kcalloc(1, sizeof(snd_seq_kinstr_t) + add_len, atomic ? GFP_ATOMIC : GFP_KERNEL); 56 instr = kzalloc(sizeof(snd_seq_kinstr_t) + add_len, atomic ? GFP_ATOMIC : GFP_KERNEL);
57 if (instr == NULL) 57 if (instr == NULL)
58 return NULL; 58 return NULL;
59 instr->add_len = add_len; 59 instr->add_len = add_len;
@@ -77,7 +77,7 @@ snd_seq_kinstr_list_t *snd_seq_instr_list_new(void)
77{ 77{
78 snd_seq_kinstr_list_t *list; 78 snd_seq_kinstr_list_t *list;
79 79
80 list = kcalloc(1, sizeof(snd_seq_kinstr_list_t), GFP_KERNEL); 80 list = kzalloc(sizeof(snd_seq_kinstr_list_t), GFP_KERNEL);
81 if (list == NULL) 81 if (list == NULL)
82 return NULL; 82 return NULL;
83 spin_lock_init(&list->lock); 83 spin_lock_init(&list->lock);
diff --git a/sound/core/seq/seq_memory.c b/sound/core/seq/seq_memory.c
index 03acb2d519ba..d4d7d326c4b1 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)
452 pool_t *pool; 452 pool_t *pool;
453 453
454 /* create pool block */ 454 /* create pool block */
455 pool = kcalloc(1, sizeof(*pool), GFP_KERNEL); 455 pool = kzalloc(sizeof(*pool), GFP_KERNEL);
456 if (pool == NULL) { 456 if (pool == NULL) {
457 snd_printd("seq: malloc failed for pool\n"); 457 snd_printd("seq: malloc failed for pool\n");
458 return NULL; 458 return NULL;
diff --git a/sound/core/seq/seq_midi.c b/sound/core/seq/seq_midi.c
index 4374829ea770..b4674ae3bc30 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)
322 client = synths[card->number]; 322 client = synths[card->number];
323 if (client == NULL) { 323 if (client == NULL) {
324 newclient = 1; 324 newclient = 1;
325 client = kcalloc(1, sizeof(*client), GFP_KERNEL); 325 client = kzalloc(sizeof(*client), GFP_KERNEL);
326 if (client == NULL) { 326 if (client == NULL) {
327 up(&register_mutex); 327 up(&register_mutex);
328 kfree(info); 328 kfree(info);
diff --git a/sound/core/seq/seq_midi_event.c b/sound/core/seq/seq_midi_event.c
index 603b63716db6..2dc1aecfb426 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)
118 snd_midi_event_t *dev; 118 snd_midi_event_t *dev;
119 119
120 *rdev = NULL; 120 *rdev = NULL;
121 dev = kcalloc(1, sizeof(*dev), GFP_KERNEL); 121 dev = kzalloc(sizeof(*dev), GFP_KERNEL);
122 if (dev == NULL) 122 if (dev == NULL)
123 return -ENOMEM; 123 return -ENOMEM;
124 if (bufsize > 0) { 124 if (bufsize > 0) {
diff --git a/sound/core/seq/seq_ports.c b/sound/core/seq/seq_ports.c
index b976951fc100..57ec31df0d15 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)
141 } 141 }
142 142
143 /* create a new port */ 143 /* create a new port */
144 new_port = kcalloc(1, sizeof(*new_port), GFP_KERNEL); 144 new_port = kzalloc(sizeof(*new_port), GFP_KERNEL);
145 if (! new_port) { 145 if (! new_port) {
146 snd_printd("malloc failed for registering client port\n"); 146 snd_printd("malloc failed for registering client port\n");
147 return NULL; /* failure, out of memory */ 147 return NULL; /* failure, out of memory */
@@ -488,7 +488,7 @@ int snd_seq_port_connect(client_t *connector,
488 unsigned long flags; 488 unsigned long flags;
489 int exclusive; 489 int exclusive;
490 490
491 subs = kcalloc(1, sizeof(*subs), GFP_KERNEL); 491 subs = kzalloc(sizeof(*subs), GFP_KERNEL);
492 if (! subs) 492 if (! subs)
493 return -ENOMEM; 493 return -ENOMEM;
494 494
diff --git a/sound/core/seq/seq_prioq.c b/sound/core/seq/seq_prioq.c
index a519732ed833..cd641bca9945 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)
59{ 59{
60 prioq_t *f; 60 prioq_t *f;
61 61
62 f = kcalloc(1, sizeof(*f), GFP_KERNEL); 62 f = kzalloc(sizeof(*f), GFP_KERNEL);
63 if (f == NULL) { 63 if (f == NULL) {
64 snd_printd("oops: malloc failed for snd_seq_prioq_new()\n"); 64 snd_printd("oops: malloc failed for snd_seq_prioq_new()\n");
65 return NULL; 65 return NULL;
diff --git a/sound/core/seq/seq_queue.c b/sound/core/seq/seq_queue.c
index 98de2e711fde..5f5c3cb37cbf 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)
111{ 111{
112 queue_t *q; 112 queue_t *q;
113 113
114 q = kcalloc(1, sizeof(*q), GFP_KERNEL); 114 q = kzalloc(sizeof(*q), GFP_KERNEL);
115 if (q == NULL) { 115 if (q == NULL) {
116 snd_printd("malloc failed for snd_seq_queue_new()\n"); 116 snd_printd("malloc failed for snd_seq_queue_new()\n");
117 return NULL; 117 return NULL;
diff --git a/sound/core/seq/seq_system.c b/sound/core/seq/seq_system.c
index e8f0a6683d50..0d9eff85ab88 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)
126 snd_seq_client_info_t *inf; 126 snd_seq_client_info_t *inf;
127 snd_seq_port_info_t *port; 127 snd_seq_port_info_t *port;
128 128
129 inf = kcalloc(1, sizeof(*inf), GFP_KERNEL); 129 inf = kzalloc(sizeof(*inf), GFP_KERNEL);
130 port = kcalloc(1, sizeof(*port), GFP_KERNEL); 130 port = kzalloc(sizeof(*port), GFP_KERNEL);
131 if (! inf || ! port) { 131 if (! inf || ! port) {
132 kfree(inf); 132 kfree(inf);
133 kfree(port); 133 kfree(port);
diff --git a/sound/core/seq/seq_timer.c b/sound/core/seq/seq_timer.c
index a7f76fc95280..b57a3c07ff6f 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)
60{ 60{
61 seq_timer_t *tmr; 61 seq_timer_t *tmr;
62 62
63 tmr = kcalloc(1, sizeof(*tmr), GFP_KERNEL); 63 tmr = kzalloc(sizeof(*tmr), GFP_KERNEL);
64 if (tmr == NULL) { 64 if (tmr == NULL) {
65 snd_printd("malloc failed for snd_seq_timer_new() \n"); 65 snd_printd("malloc failed for snd_seq_timer_new() \n");
66 return NULL; 66 return NULL;
diff --git a/sound/core/seq/seq_virmidi.c b/sound/core/seq/seq_virmidi.c
index a66484b5cf0e..e4f512aa7426 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)
205 snd_virmidi_t *vmidi; 205 snd_virmidi_t *vmidi;
206 unsigned long flags; 206 unsigned long flags;
207 207
208 vmidi = kcalloc(1, sizeof(*vmidi), GFP_KERNEL); 208 vmidi = kzalloc(sizeof(*vmidi), GFP_KERNEL);
209 if (vmidi == NULL) 209 if (vmidi == NULL)
210 return -ENOMEM; 210 return -ENOMEM;
211 vmidi->substream = substream; 211 vmidi->substream = substream;
@@ -233,7 +233,7 @@ static int snd_virmidi_output_open(snd_rawmidi_substream_t * substream)
233 snd_rawmidi_runtime_t *runtime = substream->runtime; 233 snd_rawmidi_runtime_t *runtime = substream->runtime;
234 snd_virmidi_t *vmidi; 234 snd_virmidi_t *vmidi;
235 235
236 vmidi = kcalloc(1, sizeof(*vmidi), GFP_KERNEL); 236 vmidi = kzalloc(sizeof(*vmidi), GFP_KERNEL);
237 if (vmidi == NULL) 237 if (vmidi == NULL)
238 return -ENOMEM; 238 return -ENOMEM;
239 vmidi->substream = substream; 239 vmidi->substream = substream;
@@ -508,7 +508,7 @@ int snd_virmidi_new(snd_card_t *card, int device, snd_rawmidi_t **rrmidi)
508 &rmidi)) < 0) 508 &rmidi)) < 0)
509 return err; 509 return err;
510 strcpy(rmidi->name, rmidi->id); 510 strcpy(rmidi->name, rmidi->id);
511 rdev = kcalloc(1, sizeof(*rdev), GFP_KERNEL); 511 rdev = kzalloc(sizeof(*rdev), GFP_KERNEL);
512 if (rdev == NULL) { 512 if (rdev == NULL) {
513 snd_device_free(card, rmidi); 513 snd_device_free(card, rmidi);
514 return -ENOMEM; 514 return -ENOMEM;
diff --git a/sound/core/sound.c b/sound/core/sound.c
index 3271e9245490..9e76bddb2c0b 100644
--- a/sound/core/sound.c
+++ b/sound/core/sound.c
@@ -328,6 +328,10 @@ int __exit snd_minor_info_done(void)
328 * INIT PART 328 * INIT PART
329 */ 329 */
330 330
331#ifdef CONFIG_SND_GENERIC_DRIVER
332extern struct device_driver snd_generic_driver;
333#endif
334
331static int __init alsa_sound_init(void) 335static int __init alsa_sound_init(void)
332{ 336{
333 short controlnum; 337 short controlnum;
@@ -354,6 +358,9 @@ static int __init alsa_sound_init(void)
354 return -ENOMEM; 358 return -ENOMEM;
355 } 359 }
356 snd_info_minor_register(); 360 snd_info_minor_register();
361#ifdef CONFIG_SND_GENERIC_DRIVER
362 driver_register(&snd_generic_driver);
363#endif
357 for (controlnum = 0; controlnum < cards_limit; controlnum++) 364 for (controlnum = 0; controlnum < cards_limit; controlnum++)
358 devfs_mk_cdev(MKDEV(major, controlnum<<5), S_IFCHR | device_mode, "snd/controlC%d", controlnum); 365 devfs_mk_cdev(MKDEV(major, controlnum<<5), S_IFCHR | device_mode, "snd/controlC%d", controlnum);
359#ifndef MODULE 366#ifndef MODULE
@@ -369,6 +376,9 @@ static void __exit alsa_sound_exit(void)
369 for (controlnum = 0; controlnum < cards_limit; controlnum++) 376 for (controlnum = 0; controlnum < cards_limit; controlnum++)
370 devfs_remove("snd/controlC%d", controlnum); 377 devfs_remove("snd/controlC%d", controlnum);
371 378
379#ifdef CONFIG_SND_GENERIC_DRIVER
380 driver_unregister(&snd_generic_driver);
381#endif
372 snd_info_minor_unregister(); 382 snd_info_minor_unregister();
373 snd_info_done(); 383 snd_info_done();
374 snd_memory_done(); 384 snd_memory_done();
@@ -416,10 +426,13 @@ EXPORT_SYMBOL(snd_card_register);
416EXPORT_SYMBOL(snd_component_add); 426EXPORT_SYMBOL(snd_component_add);
417EXPORT_SYMBOL(snd_card_file_add); 427EXPORT_SYMBOL(snd_card_file_add);
418EXPORT_SYMBOL(snd_card_file_remove); 428EXPORT_SYMBOL(snd_card_file_remove);
429#ifdef CONFIG_SND_GENERIC_DRIVER
430EXPORT_SYMBOL(snd_card_set_generic_dev);
431#endif
419#ifdef CONFIG_PM 432#ifdef CONFIG_PM
420EXPORT_SYMBOL(snd_power_wait); 433EXPORT_SYMBOL(snd_power_wait);
421EXPORT_SYMBOL(snd_card_set_pm_callback); 434EXPORT_SYMBOL(snd_card_set_pm_callback);
422#if defined(CONFIG_PM) && defined(CONFIG_SND_GENERIC_PM) 435#ifdef CONFIG_SND_GENERIC_DRIVER
423EXPORT_SYMBOL(snd_card_set_generic_pm_callback); 436EXPORT_SYMBOL(snd_card_set_generic_pm_callback);
424#endif 437#endif
425#ifdef CONFIG_PCI 438#ifdef CONFIG_PCI
diff --git a/sound/core/timer.c b/sound/core/timer.c
index 4104f6e292e9..22b104624084 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);
98static snd_timer_instance_t *snd_timer_instance_new(char *owner, snd_timer_t *timer) 98static snd_timer_instance_t *snd_timer_instance_new(char *owner, snd_timer_t *timer)
99{ 99{
100 snd_timer_instance_t *timeri; 100 snd_timer_instance_t *timeri;
101 timeri = kcalloc(1, sizeof(*timeri), GFP_KERNEL); 101 timeri = kzalloc(sizeof(*timeri), GFP_KERNEL);
102 if (timeri == NULL) 102 if (timeri == NULL)
103 return NULL; 103 return NULL;
104 timeri->owner = kstrdup(owner, GFP_KERNEL); 104 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 *
764 snd_assert(tid != NULL, return -EINVAL); 764 snd_assert(tid != NULL, return -EINVAL);
765 snd_assert(rtimer != NULL, return -EINVAL); 765 snd_assert(rtimer != NULL, return -EINVAL);
766 *rtimer = NULL; 766 *rtimer = NULL;
767 timer = kcalloc(1, sizeof(*timer), GFP_KERNEL); 767 timer = kzalloc(sizeof(*timer), GFP_KERNEL);
768 if (timer == NULL) 768 if (timer == NULL)
769 return -ENOMEM; 769 return -ENOMEM;
770 timer->tmr_class = tid->dev_class; 770 timer->tmr_class = tid->dev_class;
@@ -1017,7 +1017,7 @@ static int snd_timer_register_system(void)
1017 return err; 1017 return err;
1018 strcpy(timer->name, "system timer"); 1018 strcpy(timer->name, "system timer");
1019 timer->hw = snd_timer_system; 1019 timer->hw = snd_timer_system;
1020 priv = kcalloc(1, sizeof(*priv), GFP_KERNEL); 1020 priv = kzalloc(sizeof(*priv), GFP_KERNEL);
1021 if (priv == NULL) { 1021 if (priv == NULL) {
1022 snd_timer_free(timer); 1022 snd_timer_free(timer);
1023 return -ENOMEM; 1023 return -ENOMEM;
@@ -1202,7 +1202,7 @@ static int snd_timer_user_open(struct inode *inode, struct file *file)
1202{ 1202{
1203 snd_timer_user_t *tu; 1203 snd_timer_user_t *tu;
1204 1204
1205 tu = kcalloc(1, sizeof(*tu), GFP_KERNEL); 1205 tu = kzalloc(sizeof(*tu), GFP_KERNEL);
1206 if (tu == NULL) 1206 if (tu == NULL)
1207 return -ENOMEM; 1207 return -ENOMEM;
1208 spin_lock_init(&tu->qlock); 1208 spin_lock_init(&tu->qlock);
@@ -1513,7 +1513,7 @@ static int snd_timer_user_info(struct file *file, snd_timer_info_t __user *_info
1513 t = tu->timeri->timer; 1513 t = tu->timeri->timer;
1514 snd_assert(t != NULL, return -ENXIO); 1514 snd_assert(t != NULL, return -ENXIO);
1515 1515
1516 info = kcalloc(1, sizeof(*info), GFP_KERNEL); 1516 info = kzalloc(sizeof(*info), GFP_KERNEL);
1517 if (! info) 1517 if (! info)
1518 return -ENOMEM; 1518 return -ENOMEM;
1519 info->card = t->card ? t->card->number : -1; 1519 info->card = t->card ? t->card->number : -1;