diff options
Diffstat (limited to 'sound')
145 files changed, 1189 insertions, 1046 deletions
diff --git a/sound/aoa/core/alsa.c b/sound/aoa/core/alsa.c index 617850463582..0fa3855b4790 100644 --- a/sound/aoa/core/alsa.c +++ b/sound/aoa/core/alsa.c | |||
@@ -23,9 +23,10 @@ int aoa_alsa_init(char *name, struct module *mod, struct device *dev) | |||
23 | /* cannot be EEXIST due to usage in aoa_fabric_register */ | 23 | /* cannot be EEXIST due to usage in aoa_fabric_register */ |
24 | return -EBUSY; | 24 | return -EBUSY; |
25 | 25 | ||
26 | alsa_card = snd_card_new(index, name, mod, sizeof(struct aoa_card)); | 26 | err = snd_card_create(index, name, mod, sizeof(struct aoa_card), |
27 | if (!alsa_card) | 27 | &alsa_card); |
28 | return -ENOMEM; | 28 | if (err < 0) |
29 | return err; | ||
29 | aoa_card = alsa_card->private_data; | 30 | aoa_card = alsa_card->private_data; |
30 | aoa_card->alsa_card = alsa_card; | 31 | aoa_card->alsa_card = alsa_card; |
31 | alsa_card->dev = dev; | 32 | alsa_card->dev = dev; |
diff --git a/sound/arm/aaci.c b/sound/arm/aaci.c index 89096e811a4b..7fbd68fab944 100644 --- a/sound/arm/aaci.c +++ b/sound/arm/aaci.c | |||
@@ -90,7 +90,7 @@ static void aaci_ac97_write(struct snd_ac97 *ac97, unsigned short reg, | |||
90 | */ | 90 | */ |
91 | do { | 91 | do { |
92 | v = readl(aaci->base + AACI_SLFR); | 92 | v = readl(aaci->base + AACI_SLFR); |
93 | } while ((v & (SLFR_1TXB|SLFR_2TXB)) && timeout--); | 93 | } while ((v & (SLFR_1TXB|SLFR_2TXB)) && --timeout); |
94 | 94 | ||
95 | if (!timeout) | 95 | if (!timeout) |
96 | dev_err(&aaci->dev->dev, | 96 | dev_err(&aaci->dev->dev, |
@@ -126,7 +126,7 @@ static unsigned short aaci_ac97_read(struct snd_ac97 *ac97, unsigned short reg) | |||
126 | */ | 126 | */ |
127 | do { | 127 | do { |
128 | v = readl(aaci->base + AACI_SLFR); | 128 | v = readl(aaci->base + AACI_SLFR); |
129 | } while ((v & SLFR_1TXB) && timeout--); | 129 | } while ((v & SLFR_1TXB) && --timeout); |
130 | 130 | ||
131 | if (!timeout) { | 131 | if (!timeout) { |
132 | dev_err(&aaci->dev->dev, "timeout on slot 1 TX busy\n"); | 132 | dev_err(&aaci->dev->dev, "timeout on slot 1 TX busy\n"); |
@@ -147,7 +147,7 @@ static unsigned short aaci_ac97_read(struct snd_ac97 *ac97, unsigned short reg) | |||
147 | do { | 147 | do { |
148 | cond_resched(); | 148 | cond_resched(); |
149 | v = readl(aaci->base + AACI_SLFR) & (SLFR_1RXV|SLFR_2RXV); | 149 | v = readl(aaci->base + AACI_SLFR) & (SLFR_1RXV|SLFR_2RXV); |
150 | } while ((v != (SLFR_1RXV|SLFR_2RXV)) && timeout--); | 150 | } while ((v != (SLFR_1RXV|SLFR_2RXV)) && --timeout); |
151 | 151 | ||
152 | if (!timeout) { | 152 | if (!timeout) { |
153 | dev_err(&aaci->dev->dev, "timeout on RX valid\n"); | 153 | dev_err(&aaci->dev->dev, "timeout on RX valid\n"); |
@@ -995,10 +995,11 @@ static struct aaci * __devinit aaci_init_card(struct amba_device *dev) | |||
995 | { | 995 | { |
996 | struct aaci *aaci; | 996 | struct aaci *aaci; |
997 | struct snd_card *card; | 997 | struct snd_card *card; |
998 | int err; | ||
998 | 999 | ||
999 | card = snd_card_new(SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1, | 1000 | err = snd_card_create(SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1, |
1000 | THIS_MODULE, sizeof(struct aaci)); | 1001 | THIS_MODULE, sizeof(struct aaci), &card); |
1001 | if (card == NULL) | 1002 | if (err < 0) |
1002 | return NULL; | 1003 | return NULL; |
1003 | 1004 | ||
1004 | card->private_free = aaci_free_card; | 1005 | card->private_free = aaci_free_card; |
diff --git a/sound/arm/pxa2xx-ac97.c b/sound/arm/pxa2xx-ac97.c index 85cf591d4e11..7ed100c80a5f 100644 --- a/sound/arm/pxa2xx-ac97.c +++ b/sound/arm/pxa2xx-ac97.c | |||
@@ -173,10 +173,9 @@ static int __devinit pxa2xx_ac97_probe(struct platform_device *dev) | |||
173 | struct snd_ac97_template ac97_template; | 173 | struct snd_ac97_template ac97_template; |
174 | int ret; | 174 | int ret; |
175 | 175 | ||
176 | ret = -ENOMEM; | 176 | ret = snd_card_create(SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1, |
177 | card = snd_card_new(SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1, | 177 | THIS_MODULE, 0, &card); |
178 | THIS_MODULE, 0); | 178 | if (ret < 0) |
179 | if (!card) | ||
180 | goto err; | 179 | goto err; |
181 | 180 | ||
182 | card->dev = &dev->dev; | 181 | card->dev = &dev->dev; |
diff --git a/sound/arm/sa11xx-uda1341.c b/sound/arm/sa11xx-uda1341.c index ed481a866a3e..7101d3d8bae6 100644 --- a/sound/arm/sa11xx-uda1341.c +++ b/sound/arm/sa11xx-uda1341.c | |||
@@ -887,9 +887,10 @@ static int __devinit sa11xx_uda1341_probe(struct platform_device *devptr) | |||
887 | struct sa11xx_uda1341 *chip; | 887 | struct sa11xx_uda1341 *chip; |
888 | 888 | ||
889 | /* register the soundcard */ | 889 | /* register the soundcard */ |
890 | card = snd_card_new(-1, id, THIS_MODULE, sizeof(struct sa11xx_uda1341)); | 890 | err = snd_card_create(-1, id, THIS_MODULE, |
891 | if (card == NULL) | 891 | sizeof(struct sa11xx_uda1341), &card); |
892 | return -ENOMEM; | 892 | if (err < 0) |
893 | return err; | ||
893 | 894 | ||
894 | chip = card->private_data; | 895 | chip = card->private_data; |
895 | spin_lock_init(&chip->s[0].dma_lock); | 896 | spin_lock_init(&chip->s[0].dma_lock); |
diff --git a/sound/core/hwdep.c b/sound/core/hwdep.c index 195cafc5a553..a70ee7f1ed98 100644 --- a/sound/core/hwdep.c +++ b/sound/core/hwdep.c | |||
@@ -99,9 +99,6 @@ static int snd_hwdep_open(struct inode *inode, struct file * file) | |||
99 | if (hw == NULL) | 99 | if (hw == NULL) |
100 | return -ENODEV; | 100 | return -ENODEV; |
101 | 101 | ||
102 | if (!hw->ops.open) | ||
103 | return -ENXIO; | ||
104 | |||
105 | if (!try_module_get(hw->card->module)) | 102 | if (!try_module_get(hw->card->module)) |
106 | return -EFAULT; | 103 | return -EFAULT; |
107 | 104 | ||
@@ -113,6 +110,10 @@ static int snd_hwdep_open(struct inode *inode, struct file * file) | |||
113 | err = -EBUSY; | 110 | err = -EBUSY; |
114 | break; | 111 | break; |
115 | } | 112 | } |
113 | if (!hw->ops.open) { | ||
114 | err = 0; | ||
115 | break; | ||
116 | } | ||
116 | err = hw->ops.open(hw, file); | 117 | err = hw->ops.open(hw, file); |
117 | if (err >= 0) | 118 | if (err >= 0) |
118 | break; | 119 | break; |
@@ -151,7 +152,7 @@ static int snd_hwdep_open(struct inode *inode, struct file * file) | |||
151 | 152 | ||
152 | static int snd_hwdep_release(struct inode *inode, struct file * file) | 153 | static int snd_hwdep_release(struct inode *inode, struct file * file) |
153 | { | 154 | { |
154 | int err = -ENXIO; | 155 | int err = 0; |
155 | struct snd_hwdep *hw = file->private_data; | 156 | struct snd_hwdep *hw = file->private_data; |
156 | struct module *mod = hw->card->module; | 157 | struct module *mod = hw->card->module; |
157 | 158 | ||
diff --git a/sound/core/init.c b/sound/core/init.c index 0d5520c415d3..fd56afe846ed 100644 --- a/sound/core/init.c +++ b/sound/core/init.c | |||
@@ -121,31 +121,44 @@ static inline int init_info_for_card(struct snd_card *card) | |||
121 | #endif | 121 | #endif |
122 | 122 | ||
123 | /** | 123 | /** |
124 | * snd_card_new - create and initialize a soundcard structure | 124 | * snd_card_create - create and initialize a soundcard structure |
125 | * @idx: card index (address) [0 ... (SNDRV_CARDS-1)] | 125 | * @idx: card index (address) [0 ... (SNDRV_CARDS-1)] |
126 | * @xid: card identification (ASCII string) | 126 | * @xid: card identification (ASCII string) |
127 | * @module: top level module for locking | 127 | * @module: top level module for locking |
128 | * @extra_size: allocate this extra size after the main soundcard structure | 128 | * @extra_size: allocate this extra size after the main soundcard structure |
129 | * @card_ret: the pointer to store the created card instance | ||
129 | * | 130 | * |
130 | * Creates and initializes a soundcard structure. | 131 | * Creates and initializes a soundcard structure. |
131 | * | 132 | * |
132 | * Returns kmallocated snd_card structure. Creates the ALSA control interface | 133 | * The function allocates snd_card instance via kzalloc with the given |
133 | * (which is blocked until snd_card_register function is called). | 134 | * space for the driver to use freely. The allocated struct is stored |
135 | * in the given card_ret pointer. | ||
136 | * | ||
137 | * Returns zero if successful or a negative error code. | ||
134 | */ | 138 | */ |
135 | struct snd_card *snd_card_new(int idx, const char *xid, | 139 | int snd_card_create(int idx, const char *xid, |
136 | struct module *module, int extra_size) | 140 | struct module *module, int extra_size, |
141 | struct snd_card **card_ret) | ||
137 | { | 142 | { |
138 | struct snd_card *card; | 143 | struct snd_card *card; |
139 | int err, idx2; | 144 | int err, idx2; |
140 | 145 | ||
146 | if (snd_BUG_ON(!card_ret)) | ||
147 | return -EINVAL; | ||
148 | *card_ret = NULL; | ||
149 | |||
141 | if (extra_size < 0) | 150 | if (extra_size < 0) |
142 | extra_size = 0; | 151 | extra_size = 0; |
143 | card = kzalloc(sizeof(*card) + extra_size, GFP_KERNEL); | 152 | card = kzalloc(sizeof(*card) + extra_size, GFP_KERNEL); |
144 | if (card == NULL) | 153 | if (!card) |
145 | return NULL; | 154 | return -ENOMEM; |
146 | if (xid) { | 155 | if (xid) { |
147 | if (!snd_info_check_reserved_words(xid)) | 156 | if (!snd_info_check_reserved_words(xid)) { |
157 | snd_printk(KERN_ERR | ||
158 | "given id string '%s' is reserved.\n", xid); | ||
159 | err = -EBUSY; | ||
148 | goto __error; | 160 | goto __error; |
161 | } | ||
149 | strlcpy(card->id, xid, sizeof(card->id)); | 162 | strlcpy(card->id, xid, sizeof(card->id)); |
150 | } | 163 | } |
151 | err = 0; | 164 | err = 0; |
@@ -195,6 +208,7 @@ struct snd_card *snd_card_new(int idx, const char *xid, | |||
195 | INIT_LIST_HEAD(&card->controls); | 208 | INIT_LIST_HEAD(&card->controls); |
196 | INIT_LIST_HEAD(&card->ctl_files); | 209 | INIT_LIST_HEAD(&card->ctl_files); |
197 | spin_lock_init(&card->files_lock); | 210 | spin_lock_init(&card->files_lock); |
211 | INIT_LIST_HEAD(&card->files_list); | ||
198 | init_waitqueue_head(&card->shutdown_sleep); | 212 | init_waitqueue_head(&card->shutdown_sleep); |
199 | #ifdef CONFIG_PM | 213 | #ifdef CONFIG_PM |
200 | mutex_init(&card->power_lock); | 214 | mutex_init(&card->power_lock); |
@@ -202,26 +216,28 @@ struct snd_card *snd_card_new(int idx, const char *xid, | |||
202 | #endif | 216 | #endif |
203 | /* the control interface cannot be accessed from the user space until */ | 217 | /* the control interface cannot be accessed from the user space until */ |
204 | /* snd_cards_bitmask and snd_cards are set with snd_card_register */ | 218 | /* snd_cards_bitmask and snd_cards are set with snd_card_register */ |
205 | if ((err = snd_ctl_create(card)) < 0) { | 219 | err = snd_ctl_create(card); |
206 | snd_printd("unable to register control minors\n"); | 220 | if (err < 0) { |
221 | snd_printk(KERN_ERR "unable to register control minors\n"); | ||
207 | goto __error; | 222 | goto __error; |
208 | } | 223 | } |
209 | if ((err = snd_info_card_create(card)) < 0) { | 224 | err = snd_info_card_create(card); |
210 | snd_printd("unable to create card info\n"); | 225 | if (err < 0) { |
226 | snd_printk(KERN_ERR "unable to create card info\n"); | ||
211 | goto __error_ctl; | 227 | goto __error_ctl; |
212 | } | 228 | } |
213 | if (extra_size > 0) | 229 | if (extra_size > 0) |
214 | card->private_data = (char *)card + sizeof(struct snd_card); | 230 | card->private_data = (char *)card + sizeof(struct snd_card); |
215 | return card; | 231 | *card_ret = card; |
232 | return 0; | ||
216 | 233 | ||
217 | __error_ctl: | 234 | __error_ctl: |
218 | snd_device_free_all(card, SNDRV_DEV_CMD_PRE); | 235 | snd_device_free_all(card, SNDRV_DEV_CMD_PRE); |
219 | __error: | 236 | __error: |
220 | kfree(card); | 237 | kfree(card); |
221 | return NULL; | 238 | return err; |
222 | } | 239 | } |
223 | 240 | EXPORT_SYMBOL(snd_card_create); | |
224 | EXPORT_SYMBOL(snd_card_new); | ||
225 | 241 | ||
226 | /* return non-zero if a card is already locked */ | 242 | /* return non-zero if a card is already locked */ |
227 | int snd_card_locked(int card) | 243 | int snd_card_locked(int card) |
@@ -259,6 +275,7 @@ static int snd_disconnect_release(struct inode *inode, struct file *file) | |||
259 | list_for_each_entry(_df, &shutdown_files, shutdown_list) { | 275 | list_for_each_entry(_df, &shutdown_files, shutdown_list) { |
260 | if (_df->file == file) { | 276 | if (_df->file == file) { |
261 | df = _df; | 277 | df = _df; |
278 | list_del_init(&df->shutdown_list); | ||
262 | break; | 279 | break; |
263 | } | 280 | } |
264 | } | 281 | } |
@@ -347,8 +364,7 @@ int snd_card_disconnect(struct snd_card *card) | |||
347 | /* phase 2: replace file->f_op with special dummy operations */ | 364 | /* phase 2: replace file->f_op with special dummy operations */ |
348 | 365 | ||
349 | spin_lock(&card->files_lock); | 366 | spin_lock(&card->files_lock); |
350 | mfile = card->files; | 367 | list_for_each_entry(mfile, &card->files_list, list) { |
351 | while (mfile) { | ||
352 | file = mfile->file; | 368 | file = mfile->file; |
353 | 369 | ||
354 | /* it's critical part, use endless loop */ | 370 | /* it's critical part, use endless loop */ |
@@ -361,8 +377,6 @@ int snd_card_disconnect(struct snd_card *card) | |||
361 | 377 | ||
362 | mfile->file->f_op = &snd_shutdown_f_ops; | 378 | mfile->file->f_op = &snd_shutdown_f_ops; |
363 | fops_get(mfile->file->f_op); | 379 | fops_get(mfile->file->f_op); |
364 | |||
365 | mfile = mfile->next; | ||
366 | } | 380 | } |
367 | spin_unlock(&card->files_lock); | 381 | spin_unlock(&card->files_lock); |
368 | 382 | ||
@@ -442,7 +456,7 @@ int snd_card_free_when_closed(struct snd_card *card) | |||
442 | return ret; | 456 | return ret; |
443 | 457 | ||
444 | spin_lock(&card->files_lock); | 458 | spin_lock(&card->files_lock); |
445 | if (card->files == NULL) | 459 | if (list_empty(&card->files_list)) |
446 | free_now = 1; | 460 | free_now = 1; |
447 | else | 461 | else |
448 | card->free_on_last_close = 1; | 462 | card->free_on_last_close = 1; |
@@ -462,7 +476,7 @@ int snd_card_free(struct snd_card *card) | |||
462 | return ret; | 476 | return ret; |
463 | 477 | ||
464 | /* wait, until all devices are ready for the free operation */ | 478 | /* wait, until all devices are ready for the free operation */ |
465 | wait_event(card->shutdown_sleep, card->files == NULL); | 479 | wait_event(card->shutdown_sleep, list_empty(&card->files_list)); |
466 | snd_card_do_free(card); | 480 | snd_card_do_free(card); |
467 | return 0; | 481 | return 0; |
468 | } | 482 | } |
@@ -809,15 +823,13 @@ int snd_card_file_add(struct snd_card *card, struct file *file) | |||
809 | return -ENOMEM; | 823 | return -ENOMEM; |
810 | mfile->file = file; | 824 | mfile->file = file; |
811 | mfile->disconnected_f_op = NULL; | 825 | mfile->disconnected_f_op = NULL; |
812 | mfile->next = NULL; | ||
813 | spin_lock(&card->files_lock); | 826 | spin_lock(&card->files_lock); |
814 | if (card->shutdown) { | 827 | if (card->shutdown) { |
815 | spin_unlock(&card->files_lock); | 828 | spin_unlock(&card->files_lock); |
816 | kfree(mfile); | 829 | kfree(mfile); |
817 | return -ENODEV; | 830 | return -ENODEV; |
818 | } | 831 | } |
819 | mfile->next = card->files; | 832 | list_add(&mfile->list, &card->files_list); |
820 | card->files = mfile; | ||
821 | spin_unlock(&card->files_lock); | 833 | spin_unlock(&card->files_lock); |
822 | return 0; | 834 | return 0; |
823 | } | 835 | } |
@@ -839,29 +851,20 @@ EXPORT_SYMBOL(snd_card_file_add); | |||
839 | */ | 851 | */ |
840 | int snd_card_file_remove(struct snd_card *card, struct file *file) | 852 | int snd_card_file_remove(struct snd_card *card, struct file *file) |
841 | { | 853 | { |
842 | struct snd_monitor_file *mfile, *pfile = NULL; | 854 | struct snd_monitor_file *mfile, *found = NULL; |
843 | int last_close = 0; | 855 | int last_close = 0; |
844 | 856 | ||
845 | spin_lock(&card->files_lock); | 857 | spin_lock(&card->files_lock); |
846 | mfile = card->files; | 858 | list_for_each_entry(mfile, &card->files_list, list) { |
847 | while (mfile) { | ||
848 | if (mfile->file == file) { | 859 | if (mfile->file == file) { |
849 | if (pfile) | 860 | list_del(&mfile->list); |
850 | pfile->next = mfile->next; | 861 | if (mfile->disconnected_f_op) |
851 | else | 862 | fops_put(mfile->disconnected_f_op); |
852 | card->files = mfile->next; | 863 | found = mfile; |
853 | break; | 864 | break; |
854 | } | 865 | } |
855 | pfile = mfile; | ||
856 | mfile = mfile->next; | ||
857 | } | ||
858 | if (mfile && mfile->disconnected_f_op) { | ||
859 | fops_put(mfile->disconnected_f_op); | ||
860 | spin_lock(&shutdown_lock); | ||
861 | list_del(&mfile->shutdown_list); | ||
862 | spin_unlock(&shutdown_lock); | ||
863 | } | 866 | } |
864 | if (card->files == NULL) | 867 | if (list_empty(&card->files_list)) |
865 | last_close = 1; | 868 | last_close = 1; |
866 | spin_unlock(&card->files_lock); | 869 | spin_unlock(&card->files_lock); |
867 | if (last_close) { | 870 | if (last_close) { |
@@ -869,11 +872,11 @@ int snd_card_file_remove(struct snd_card *card, struct file *file) | |||
869 | if (card->free_on_last_close) | 872 | if (card->free_on_last_close) |
870 | snd_card_do_free(card); | 873 | snd_card_do_free(card); |
871 | } | 874 | } |
872 | if (!mfile) { | 875 | if (!found) { |
873 | snd_printk(KERN_ERR "ALSA card file remove problem (%p)\n", file); | 876 | snd_printk(KERN_ERR "ALSA card file remove problem (%p)\n", file); |
874 | return -ENOENT; | 877 | return -ENOENT; |
875 | } | 878 | } |
876 | kfree(mfile); | 879 | kfree(found); |
877 | return 0; | 880 | return 0; |
878 | } | 881 | } |
879 | 882 | ||
diff --git a/sound/core/jack.c b/sound/core/jack.c index dd4a12dc09aa..c8254c667c62 100644 --- a/sound/core/jack.c +++ b/sound/core/jack.c | |||
@@ -23,6 +23,14 @@ | |||
23 | #include <sound/jack.h> | 23 | #include <sound/jack.h> |
24 | #include <sound/core.h> | 24 | #include <sound/core.h> |
25 | 25 | ||
26 | static int jack_types[] = { | ||
27 | SW_HEADPHONE_INSERT, | ||
28 | SW_MICROPHONE_INSERT, | ||
29 | SW_LINEOUT_INSERT, | ||
30 | SW_JACK_PHYSICAL_INSERT, | ||
31 | SW_VIDEOOUT_INSERT, | ||
32 | }; | ||
33 | |||
26 | static int snd_jack_dev_free(struct snd_device *device) | 34 | static int snd_jack_dev_free(struct snd_device *device) |
27 | { | 35 | { |
28 | struct snd_jack *jack = device->device_data; | 36 | struct snd_jack *jack = device->device_data; |
@@ -47,7 +55,7 @@ static int snd_jack_dev_register(struct snd_device *device) | |||
47 | int err; | 55 | int err; |
48 | 56 | ||
49 | snprintf(jack->name, sizeof(jack->name), "%s %s", | 57 | snprintf(jack->name, sizeof(jack->name), "%s %s", |
50 | card->longname, jack->id); | 58 | card->shortname, jack->id); |
51 | jack->input_dev->name = jack->name; | 59 | jack->input_dev->name = jack->name; |
52 | 60 | ||
53 | /* Default to the sound card device. */ | 61 | /* Default to the sound card device. */ |
@@ -79,6 +87,7 @@ int snd_jack_new(struct snd_card *card, const char *id, int type, | |||
79 | { | 87 | { |
80 | struct snd_jack *jack; | 88 | struct snd_jack *jack; |
81 | int err; | 89 | int err; |
90 | int i; | ||
82 | static struct snd_device_ops ops = { | 91 | static struct snd_device_ops ops = { |
83 | .dev_free = snd_jack_dev_free, | 92 | .dev_free = snd_jack_dev_free, |
84 | .dev_register = snd_jack_dev_register, | 93 | .dev_register = snd_jack_dev_register, |
@@ -100,18 +109,10 @@ int snd_jack_new(struct snd_card *card, const char *id, int type, | |||
100 | 109 | ||
101 | jack->type = type; | 110 | jack->type = type; |
102 | 111 | ||
103 | if (type & SND_JACK_HEADPHONE) | 112 | for (i = 0; i < ARRAY_SIZE(jack_types); i++) |
104 | input_set_capability(jack->input_dev, EV_SW, | 113 | if (type & (1 << i)) |
105 | SW_HEADPHONE_INSERT); | 114 | input_set_capability(jack->input_dev, EV_SW, |
106 | if (type & SND_JACK_LINEOUT) | 115 | jack_types[i]); |
107 | input_set_capability(jack->input_dev, EV_SW, | ||
108 | SW_LINEOUT_INSERT); | ||
109 | if (type & SND_JACK_MICROPHONE) | ||
110 | input_set_capability(jack->input_dev, EV_SW, | ||
111 | SW_MICROPHONE_INSERT); | ||
112 | if (type & SND_JACK_MECHANICAL) | ||
113 | input_set_capability(jack->input_dev, EV_SW, | ||
114 | SW_JACK_PHYSICAL_INSERT); | ||
115 | 116 | ||
116 | err = snd_device_new(card, SNDRV_DEV_JACK, jack, &ops); | 117 | err = snd_device_new(card, SNDRV_DEV_JACK, jack, &ops); |
117 | if (err < 0) | 118 | if (err < 0) |
@@ -154,21 +155,17 @@ EXPORT_SYMBOL(snd_jack_set_parent); | |||
154 | */ | 155 | */ |
155 | void snd_jack_report(struct snd_jack *jack, int status) | 156 | void snd_jack_report(struct snd_jack *jack, int status) |
156 | { | 157 | { |
158 | int i; | ||
159 | |||
157 | if (!jack) | 160 | if (!jack) |
158 | return; | 161 | return; |
159 | 162 | ||
160 | if (jack->type & SND_JACK_HEADPHONE) | 163 | for (i = 0; i < ARRAY_SIZE(jack_types); i++) { |
161 | input_report_switch(jack->input_dev, SW_HEADPHONE_INSERT, | 164 | int testbit = 1 << i; |
162 | status & SND_JACK_HEADPHONE); | 165 | if (jack->type & testbit) |
163 | if (jack->type & SND_JACK_LINEOUT) | 166 | input_report_switch(jack->input_dev, jack_types[i], |
164 | input_report_switch(jack->input_dev, SW_LINEOUT_INSERT, | 167 | status & testbit); |
165 | status & SND_JACK_LINEOUT); | 168 | } |
166 | if (jack->type & SND_JACK_MICROPHONE) | ||
167 | input_report_switch(jack->input_dev, SW_MICROPHONE_INSERT, | ||
168 | status & SND_JACK_MICROPHONE); | ||
169 | if (jack->type & SND_JACK_MECHANICAL) | ||
170 | input_report_switch(jack->input_dev, SW_JACK_PHYSICAL_INSERT, | ||
171 | status & SND_JACK_MECHANICAL); | ||
172 | 169 | ||
173 | input_sync(jack->input_dev); | 170 | input_sync(jack->input_dev); |
174 | } | 171 | } |
diff --git a/sound/core/oss/mixer_oss.c b/sound/core/oss/mixer_oss.c index 4690b8b5681f..e570649184e2 100644 --- a/sound/core/oss/mixer_oss.c +++ b/sound/core/oss/mixer_oss.c | |||
@@ -692,6 +692,9 @@ static int snd_mixer_oss_put_volume1(struct snd_mixer_oss_file *fmixer, | |||
692 | snd_mixer_oss_put_volume1_vol(fmixer, pslot, slot->numid[SNDRV_MIXER_OSS_ITEM_PVOLUME], left, right); | 692 | snd_mixer_oss_put_volume1_vol(fmixer, pslot, slot->numid[SNDRV_MIXER_OSS_ITEM_PVOLUME], left, right); |
693 | if (slot->present & SNDRV_MIXER_OSS_PRESENT_CVOLUME) | 693 | if (slot->present & SNDRV_MIXER_OSS_PRESENT_CVOLUME) |
694 | snd_mixer_oss_put_volume1_vol(fmixer, pslot, slot->numid[SNDRV_MIXER_OSS_ITEM_CVOLUME], left, right); | 694 | snd_mixer_oss_put_volume1_vol(fmixer, pslot, slot->numid[SNDRV_MIXER_OSS_ITEM_CVOLUME], left, right); |
695 | } else if (slot->present & SNDRV_MIXER_OSS_PRESENT_CVOLUME) { | ||
696 | snd_mixer_oss_put_volume1_vol(fmixer, pslot, | ||
697 | slot->numid[SNDRV_MIXER_OSS_ITEM_CVOLUME], left, right); | ||
695 | } else if (slot->present & SNDRV_MIXER_OSS_PRESENT_GVOLUME) { | 698 | } else if (slot->present & SNDRV_MIXER_OSS_PRESENT_GVOLUME) { |
696 | snd_mixer_oss_put_volume1_vol(fmixer, pslot, slot->numid[SNDRV_MIXER_OSS_ITEM_GVOLUME], left, right); | 699 | snd_mixer_oss_put_volume1_vol(fmixer, pslot, slot->numid[SNDRV_MIXER_OSS_ITEM_GVOLUME], left, right); |
697 | } else if (slot->present & SNDRV_MIXER_OSS_PRESENT_GLOBAL) { | 700 | } else if (slot->present & SNDRV_MIXER_OSS_PRESENT_GLOBAL) { |
diff --git a/sound/core/oss/pcm_oss.c b/sound/core/oss/pcm_oss.c index 4b883595a85a..2864cefb773c 100644 --- a/sound/core/oss/pcm_oss.c +++ b/sound/core/oss/pcm_oss.c | |||
@@ -1775,7 +1775,7 @@ static int snd_pcm_oss_get_formats(struct snd_pcm_oss_file *pcm_oss_file) | |||
1775 | AFMT_S8 | AFMT_U16_LE | | 1775 | AFMT_S8 | AFMT_U16_LE | |
1776 | AFMT_U16_BE | | 1776 | AFMT_U16_BE | |
1777 | AFMT_S32_LE | AFMT_S32_BE | | 1777 | AFMT_S32_LE | AFMT_S32_BE | |
1778 | AFMT_S24_LE | AFMT_S24_LE | | 1778 | AFMT_S24_LE | AFMT_S24_BE | |
1779 | AFMT_S24_PACKED; | 1779 | AFMT_S24_PACKED; |
1780 | params = kmalloc(sizeof(*params), GFP_KERNEL); | 1780 | params = kmalloc(sizeof(*params), GFP_KERNEL); |
1781 | if (!params) | 1781 | if (!params) |
@@ -2885,7 +2885,7 @@ static void snd_pcm_oss_proc_write(struct snd_info_entry *entry, | |||
2885 | setup = kmalloc(sizeof(*setup), GFP_KERNEL); | 2885 | setup = kmalloc(sizeof(*setup), GFP_KERNEL); |
2886 | if (! setup) { | 2886 | if (! setup) { |
2887 | buffer->error = -ENOMEM; | 2887 | buffer->error = -ENOMEM; |
2888 | mutex_lock(&pstr->oss.setup_mutex); | 2888 | mutex_unlock(&pstr->oss.setup_mutex); |
2889 | return; | 2889 | return; |
2890 | } | 2890 | } |
2891 | if (pstr->oss.setup_list == NULL) | 2891 | if (pstr->oss.setup_list == NULL) |
@@ -2899,7 +2899,7 @@ static void snd_pcm_oss_proc_write(struct snd_info_entry *entry, | |||
2899 | if (! template.task_name) { | 2899 | if (! template.task_name) { |
2900 | kfree(setup); | 2900 | kfree(setup); |
2901 | buffer->error = -ENOMEM; | 2901 | buffer->error = -ENOMEM; |
2902 | mutex_lock(&pstr->oss.setup_mutex); | 2902 | mutex_unlock(&pstr->oss.setup_mutex); |
2903 | return; | 2903 | return; |
2904 | } | 2904 | } |
2905 | } | 2905 | } |
diff --git a/sound/core/oss/rate.c b/sound/core/oss/rate.c index a466443c4a26..2fa9299a440d 100644 --- a/sound/core/oss/rate.c +++ b/sound/core/oss/rate.c | |||
@@ -157,7 +157,7 @@ static void resample_shrink(struct snd_pcm_plugin *plugin, | |||
157 | while (dst_frames1 > 0) { | 157 | while (dst_frames1 > 0) { |
158 | S1 = S2; | 158 | S1 = S2; |
159 | if (src_frames1-- > 0) { | 159 | if (src_frames1-- > 0) { |
160 | S1 = *src; | 160 | S2 = *src; |
161 | src += src_step; | 161 | src += src_step; |
162 | } | 162 | } |
163 | if (pos & ~R_MASK) { | 163 | if (pos & ~R_MASK) { |
diff --git a/sound/core/pcm.c b/sound/core/pcm.c index 583453e2355c..145931a9ff30 100644 --- a/sound/core/pcm.c +++ b/sound/core/pcm.c | |||
@@ -667,7 +667,6 @@ int snd_pcm_new_stream(struct snd_pcm *pcm, int stream, int substream_count) | |||
667 | spin_lock_init(&substream->self_group.lock); | 667 | spin_lock_init(&substream->self_group.lock); |
668 | INIT_LIST_HEAD(&substream->self_group.substreams); | 668 | INIT_LIST_HEAD(&substream->self_group.substreams); |
669 | list_add_tail(&substream->link_list, &substream->self_group.substreams); | 669 | list_add_tail(&substream->link_list, &substream->self_group.substreams); |
670 | spin_lock_init(&substream->timer_lock); | ||
671 | atomic_set(&substream->mmap_count, 0); | 670 | atomic_set(&substream->mmap_count, 0); |
672 | prev = substream; | 671 | prev = substream; |
673 | } | 672 | } |
diff --git a/sound/core/pcm_lib.c b/sound/core/pcm_lib.c index 921691080f35..fbb2e391591e 100644 --- a/sound/core/pcm_lib.c +++ b/sound/core/pcm_lib.c | |||
@@ -125,23 +125,32 @@ void snd_pcm_playback_silence(struct snd_pcm_substream *substream, snd_pcm_ufram | |||
125 | } | 125 | } |
126 | } | 126 | } |
127 | 127 | ||
128 | #ifdef CONFIG_SND_PCM_XRUN_DEBUG | ||
129 | #define xrun_debug(substream) ((substream)->pstr->xrun_debug) | ||
130 | #else | ||
131 | #define xrun_debug(substream) 0 | ||
132 | #endif | ||
133 | |||
134 | #define dump_stack_on_xrun(substream) do { \ | ||
135 | if (xrun_debug(substream) > 1) \ | ||
136 | dump_stack(); \ | ||
137 | } while (0) | ||
138 | |||
128 | static void xrun(struct snd_pcm_substream *substream) | 139 | static void xrun(struct snd_pcm_substream *substream) |
129 | { | 140 | { |
130 | snd_pcm_stop(substream, SNDRV_PCM_STATE_XRUN); | 141 | snd_pcm_stop(substream, SNDRV_PCM_STATE_XRUN); |
131 | #ifdef CONFIG_SND_PCM_XRUN_DEBUG | 142 | if (xrun_debug(substream)) { |
132 | if (substream->pstr->xrun_debug) { | ||
133 | snd_printd(KERN_DEBUG "XRUN: pcmC%dD%d%c\n", | 143 | snd_printd(KERN_DEBUG "XRUN: pcmC%dD%d%c\n", |
134 | substream->pcm->card->number, | 144 | substream->pcm->card->number, |
135 | substream->pcm->device, | 145 | substream->pcm->device, |
136 | substream->stream ? 'c' : 'p'); | 146 | substream->stream ? 'c' : 'p'); |
137 | if (substream->pstr->xrun_debug > 1) | 147 | dump_stack_on_xrun(substream); |
138 | dump_stack(); | ||
139 | } | 148 | } |
140 | #endif | ||
141 | } | 149 | } |
142 | 150 | ||
143 | static inline snd_pcm_uframes_t snd_pcm_update_hw_ptr_pos(struct snd_pcm_substream *substream, | 151 | static snd_pcm_uframes_t |
144 | struct snd_pcm_runtime *runtime) | 152 | snd_pcm_update_hw_ptr_pos(struct snd_pcm_substream *substream, |
153 | struct snd_pcm_runtime *runtime) | ||
145 | { | 154 | { |
146 | snd_pcm_uframes_t pos; | 155 | snd_pcm_uframes_t pos; |
147 | 156 | ||
@@ -150,17 +159,21 @@ static inline snd_pcm_uframes_t snd_pcm_update_hw_ptr_pos(struct snd_pcm_substre | |||
150 | pos = substream->ops->pointer(substream); | 159 | pos = substream->ops->pointer(substream); |
151 | if (pos == SNDRV_PCM_POS_XRUN) | 160 | if (pos == SNDRV_PCM_POS_XRUN) |
152 | return pos; /* XRUN */ | 161 | return pos; /* XRUN */ |
153 | #ifdef CONFIG_SND_DEBUG | ||
154 | if (pos >= runtime->buffer_size) { | 162 | if (pos >= runtime->buffer_size) { |
155 | snd_printk(KERN_ERR "BUG: stream = %i, pos = 0x%lx, buffer size = 0x%lx, period size = 0x%lx\n", substream->stream, pos, runtime->buffer_size, runtime->period_size); | 163 | if (printk_ratelimit()) { |
164 | snd_printd(KERN_ERR "BUG: stream = %i, pos = 0x%lx, " | ||
165 | "buffer size = 0x%lx, period size = 0x%lx\n", | ||
166 | substream->stream, pos, runtime->buffer_size, | ||
167 | runtime->period_size); | ||
168 | } | ||
169 | pos = 0; | ||
156 | } | 170 | } |
157 | #endif | ||
158 | pos -= pos % runtime->min_align; | 171 | pos -= pos % runtime->min_align; |
159 | return pos; | 172 | return pos; |
160 | } | 173 | } |
161 | 174 | ||
162 | static inline int snd_pcm_update_hw_ptr_post(struct snd_pcm_substream *substream, | 175 | static int snd_pcm_update_hw_ptr_post(struct snd_pcm_substream *substream, |
163 | struct snd_pcm_runtime *runtime) | 176 | struct snd_pcm_runtime *runtime) |
164 | { | 177 | { |
165 | snd_pcm_uframes_t avail; | 178 | snd_pcm_uframes_t avail; |
166 | 179 | ||
@@ -182,11 +195,21 @@ static inline int snd_pcm_update_hw_ptr_post(struct snd_pcm_substream *substream | |||
182 | return 0; | 195 | return 0; |
183 | } | 196 | } |
184 | 197 | ||
185 | static inline int snd_pcm_update_hw_ptr_interrupt(struct snd_pcm_substream *substream) | 198 | #define hw_ptr_error(substream, fmt, args...) \ |
199 | do { \ | ||
200 | if (xrun_debug(substream)) { \ | ||
201 | if (printk_ratelimit()) { \ | ||
202 | snd_printd("PCM: " fmt, ##args); \ | ||
203 | } \ | ||
204 | dump_stack_on_xrun(substream); \ | ||
205 | } \ | ||
206 | } while (0) | ||
207 | |||
208 | static int snd_pcm_update_hw_ptr_interrupt(struct snd_pcm_substream *substream) | ||
186 | { | 209 | { |
187 | struct snd_pcm_runtime *runtime = substream->runtime; | 210 | struct snd_pcm_runtime *runtime = substream->runtime; |
188 | snd_pcm_uframes_t pos; | 211 | snd_pcm_uframes_t pos; |
189 | snd_pcm_uframes_t new_hw_ptr, hw_ptr_interrupt; | 212 | snd_pcm_uframes_t new_hw_ptr, hw_ptr_interrupt, hw_base; |
190 | snd_pcm_sframes_t delta; | 213 | snd_pcm_sframes_t delta; |
191 | 214 | ||
192 | pos = snd_pcm_update_hw_ptr_pos(substream, runtime); | 215 | pos = snd_pcm_update_hw_ptr_pos(substream, runtime); |
@@ -194,36 +217,53 @@ static inline int snd_pcm_update_hw_ptr_interrupt(struct snd_pcm_substream *subs | |||
194 | xrun(substream); | 217 | xrun(substream); |
195 | return -EPIPE; | 218 | return -EPIPE; |
196 | } | 219 | } |
197 | if (runtime->period_size == runtime->buffer_size) | 220 | hw_base = runtime->hw_ptr_base; |
198 | goto __next_buf; | 221 | new_hw_ptr = hw_base + pos; |
199 | new_hw_ptr = runtime->hw_ptr_base + pos; | ||
200 | hw_ptr_interrupt = runtime->hw_ptr_interrupt + runtime->period_size; | 222 | hw_ptr_interrupt = runtime->hw_ptr_interrupt + runtime->period_size; |
201 | 223 | delta = new_hw_ptr - hw_ptr_interrupt; | |
202 | delta = hw_ptr_interrupt - new_hw_ptr; | 224 | if (hw_ptr_interrupt >= runtime->boundary) { |
203 | if (delta > 0) { | 225 | hw_ptr_interrupt -= runtime->boundary; |
204 | if ((snd_pcm_uframes_t)delta < runtime->buffer_size / 2) { | 226 | if (hw_base < runtime->boundary / 2) |
205 | #ifdef CONFIG_SND_PCM_XRUN_DEBUG | 227 | /* hw_base was already lapped; recalc delta */ |
206 | if (runtime->periods > 1 && substream->pstr->xrun_debug) { | 228 | delta = new_hw_ptr - hw_ptr_interrupt; |
207 | snd_printd(KERN_ERR "Unexpected hw_pointer value [1] (stream = %i, delta: -%ld, max jitter = %ld): wrong interrupt acknowledge?\n", substream->stream, (long) delta, runtime->buffer_size / 2); | 229 | } |
208 | if (substream->pstr->xrun_debug > 1) | 230 | if (delta < 0) { |
209 | dump_stack(); | 231 | delta += runtime->buffer_size; |
210 | } | 232 | if (delta < 0) { |
211 | #endif | 233 | hw_ptr_error(substream, |
212 | return 0; | 234 | "Unexpected hw_pointer value " |
235 | "(stream=%i, pos=%ld, intr_ptr=%ld)\n", | ||
236 | substream->stream, (long)pos, | ||
237 | (long)hw_ptr_interrupt); | ||
238 | /* rebase to interrupt position */ | ||
239 | hw_base = new_hw_ptr = hw_ptr_interrupt; | ||
240 | /* align hw_base to buffer_size */ | ||
241 | hw_base -= hw_base % runtime->buffer_size; | ||
242 | delta = 0; | ||
243 | } else { | ||
244 | hw_base += runtime->buffer_size; | ||
245 | if (hw_base >= runtime->boundary) | ||
246 | hw_base = 0; | ||
247 | new_hw_ptr = hw_base + pos; | ||
213 | } | 248 | } |
214 | __next_buf: | ||
215 | runtime->hw_ptr_base += runtime->buffer_size; | ||
216 | if (runtime->hw_ptr_base == runtime->boundary) | ||
217 | runtime->hw_ptr_base = 0; | ||
218 | new_hw_ptr = runtime->hw_ptr_base + pos; | ||
219 | } | 249 | } |
220 | 250 | if (delta > runtime->period_size) { | |
251 | hw_ptr_error(substream, | ||
252 | "Lost interrupts? " | ||
253 | "(stream=%i, delta=%ld, intr_ptr=%ld)\n", | ||
254 | substream->stream, (long)delta, | ||
255 | (long)hw_ptr_interrupt); | ||
256 | /* rebase hw_ptr_interrupt */ | ||
257 | hw_ptr_interrupt = | ||
258 | new_hw_ptr - new_hw_ptr % runtime->period_size; | ||
259 | } | ||
221 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK && | 260 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK && |
222 | runtime->silence_size > 0) | 261 | runtime->silence_size > 0) |
223 | snd_pcm_playback_silence(substream, new_hw_ptr); | 262 | snd_pcm_playback_silence(substream, new_hw_ptr); |
224 | 263 | ||
264 | runtime->hw_ptr_base = hw_base; | ||
225 | runtime->status->hw_ptr = new_hw_ptr; | 265 | runtime->status->hw_ptr = new_hw_ptr; |
226 | runtime->hw_ptr_interrupt = new_hw_ptr - new_hw_ptr % runtime->period_size; | 266 | runtime->hw_ptr_interrupt = hw_ptr_interrupt; |
227 | 267 | ||
228 | return snd_pcm_update_hw_ptr_post(substream, runtime); | 268 | return snd_pcm_update_hw_ptr_post(substream, runtime); |
229 | } | 269 | } |
@@ -233,7 +273,7 @@ int snd_pcm_update_hw_ptr(struct snd_pcm_substream *substream) | |||
233 | { | 273 | { |
234 | struct snd_pcm_runtime *runtime = substream->runtime; | 274 | struct snd_pcm_runtime *runtime = substream->runtime; |
235 | snd_pcm_uframes_t pos; | 275 | snd_pcm_uframes_t pos; |
236 | snd_pcm_uframes_t old_hw_ptr, new_hw_ptr; | 276 | snd_pcm_uframes_t old_hw_ptr, new_hw_ptr, hw_base; |
237 | snd_pcm_sframes_t delta; | 277 | snd_pcm_sframes_t delta; |
238 | 278 | ||
239 | old_hw_ptr = runtime->status->hw_ptr; | 279 | old_hw_ptr = runtime->status->hw_ptr; |
@@ -242,29 +282,38 @@ int snd_pcm_update_hw_ptr(struct snd_pcm_substream *substream) | |||
242 | xrun(substream); | 282 | xrun(substream); |
243 | return -EPIPE; | 283 | return -EPIPE; |
244 | } | 284 | } |
245 | new_hw_ptr = runtime->hw_ptr_base + pos; | 285 | hw_base = runtime->hw_ptr_base; |
246 | 286 | new_hw_ptr = hw_base + pos; | |
247 | delta = old_hw_ptr - new_hw_ptr; | 287 | |
248 | if (delta > 0) { | 288 | delta = new_hw_ptr - old_hw_ptr; |
249 | if ((snd_pcm_uframes_t)delta < runtime->buffer_size / 2) { | 289 | if (delta < 0) { |
250 | #ifdef CONFIG_SND_PCM_XRUN_DEBUG | 290 | delta += runtime->buffer_size; |
251 | if (runtime->periods > 2 && substream->pstr->xrun_debug) { | 291 | if (delta < 0) { |
252 | snd_printd(KERN_ERR "Unexpected hw_pointer value [2] (stream = %i, delta: -%ld, max jitter = %ld): wrong interrupt acknowledge?\n", substream->stream, (long) delta, runtime->buffer_size / 2); | 292 | hw_ptr_error(substream, |
253 | if (substream->pstr->xrun_debug > 1) | 293 | "Unexpected hw_pointer value [2] " |
254 | dump_stack(); | 294 | "(stream=%i, pos=%ld, old_ptr=%ld)\n", |
255 | } | 295 | substream->stream, (long)pos, |
256 | #endif | 296 | (long)old_hw_ptr); |
257 | return 0; | 297 | return 0; |
258 | } | 298 | } |
259 | runtime->hw_ptr_base += runtime->buffer_size; | 299 | hw_base += runtime->buffer_size; |
260 | if (runtime->hw_ptr_base == runtime->boundary) | 300 | if (hw_base >= runtime->boundary) |
261 | runtime->hw_ptr_base = 0; | 301 | hw_base = 0; |
262 | new_hw_ptr = runtime->hw_ptr_base + pos; | 302 | new_hw_ptr = hw_base + pos; |
303 | } | ||
304 | if (delta > runtime->period_size && runtime->periods > 1) { | ||
305 | hw_ptr_error(substream, | ||
306 | "hw_ptr skipping! " | ||
307 | "(pos=%ld, delta=%ld, period=%ld)\n", | ||
308 | (long)pos, (long)delta, | ||
309 | (long)runtime->period_size); | ||
310 | return 0; | ||
263 | } | 311 | } |
264 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK && | 312 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK && |
265 | runtime->silence_size > 0) | 313 | runtime->silence_size > 0) |
266 | snd_pcm_playback_silence(substream, new_hw_ptr); | 314 | snd_pcm_playback_silence(substream, new_hw_ptr); |
267 | 315 | ||
316 | runtime->hw_ptr_base = hw_base; | ||
268 | runtime->status->hw_ptr = new_hw_ptr; | 317 | runtime->status->hw_ptr = new_hw_ptr; |
269 | 318 | ||
270 | return snd_pcm_update_hw_ptr_post(substream, runtime); | 319 | return snd_pcm_update_hw_ptr_post(substream, runtime); |
diff --git a/sound/core/pcm_timer.c b/sound/core/pcm_timer.c index 2c89c04f2916..ca8068b63d6c 100644 --- a/sound/core/pcm_timer.c +++ b/sound/core/pcm_timer.c | |||
@@ -85,25 +85,19 @@ static unsigned long snd_pcm_timer_resolution(struct snd_timer * timer) | |||
85 | 85 | ||
86 | static int snd_pcm_timer_start(struct snd_timer * timer) | 86 | static int snd_pcm_timer_start(struct snd_timer * timer) |
87 | { | 87 | { |
88 | unsigned long flags; | ||
89 | struct snd_pcm_substream *substream; | 88 | struct snd_pcm_substream *substream; |
90 | 89 | ||
91 | substream = snd_timer_chip(timer); | 90 | substream = snd_timer_chip(timer); |
92 | spin_lock_irqsave(&substream->timer_lock, flags); | ||
93 | substream->timer_running = 1; | 91 | substream->timer_running = 1; |
94 | spin_unlock_irqrestore(&substream->timer_lock, flags); | ||
95 | return 0; | 92 | return 0; |
96 | } | 93 | } |
97 | 94 | ||
98 | static int snd_pcm_timer_stop(struct snd_timer * timer) | 95 | static int snd_pcm_timer_stop(struct snd_timer * timer) |
99 | { | 96 | { |
100 | unsigned long flags; | ||
101 | struct snd_pcm_substream *substream; | 97 | struct snd_pcm_substream *substream; |
102 | 98 | ||
103 | substream = snd_timer_chip(timer); | 99 | substream = snd_timer_chip(timer); |
104 | spin_lock_irqsave(&substream->timer_lock, flags); | ||
105 | substream->timer_running = 0; | 100 | substream->timer_running = 0; |
106 | spin_unlock_irqrestore(&substream->timer_lock, flags); | ||
107 | return 0; | 101 | return 0; |
108 | } | 102 | } |
109 | 103 | ||
diff --git a/sound/core/rawmidi.c b/sound/core/rawmidi.c index 002777ba336a..473247c8e6d3 100644 --- a/sound/core/rawmidi.c +++ b/sound/core/rawmidi.c | |||
@@ -224,156 +224,143 @@ int snd_rawmidi_drain_input(struct snd_rawmidi_substream *substream) | |||
224 | return 0; | 224 | return 0; |
225 | } | 225 | } |
226 | 226 | ||
227 | int snd_rawmidi_kernel_open(struct snd_card *card, int device, int subdevice, | 227 | /* look for an available substream for the given stream direction; |
228 | int mode, struct snd_rawmidi_file * rfile) | 228 | * if a specific subdevice is given, try to assign it |
229 | */ | ||
230 | static int assign_substream(struct snd_rawmidi *rmidi, int subdevice, | ||
231 | int stream, int mode, | ||
232 | struct snd_rawmidi_substream **sub_ret) | ||
233 | { | ||
234 | struct snd_rawmidi_substream *substream; | ||
235 | struct snd_rawmidi_str *s = &rmidi->streams[stream]; | ||
236 | static unsigned int info_flags[2] = { | ||
237 | [SNDRV_RAWMIDI_STREAM_OUTPUT] = SNDRV_RAWMIDI_INFO_OUTPUT, | ||
238 | [SNDRV_RAWMIDI_STREAM_INPUT] = SNDRV_RAWMIDI_INFO_INPUT, | ||
239 | }; | ||
240 | |||
241 | if (!(rmidi->info_flags & info_flags[stream])) | ||
242 | return -ENXIO; | ||
243 | if (subdevice >= 0 && subdevice >= s->substream_count) | ||
244 | return -ENODEV; | ||
245 | if (s->substream_opened >= s->substream_count) | ||
246 | return -EAGAIN; | ||
247 | |||
248 | list_for_each_entry(substream, &s->substreams, list) { | ||
249 | if (substream->opened) { | ||
250 | if (stream == SNDRV_RAWMIDI_STREAM_INPUT || | ||
251 | !(mode & SNDRV_RAWMIDI_LFLG_APPEND)) | ||
252 | continue; | ||
253 | } | ||
254 | if (subdevice < 0 || subdevice == substream->number) { | ||
255 | *sub_ret = substream; | ||
256 | return 0; | ||
257 | } | ||
258 | } | ||
259 | return -EAGAIN; | ||
260 | } | ||
261 | |||
262 | /* open and do ref-counting for the given substream */ | ||
263 | static int open_substream(struct snd_rawmidi *rmidi, | ||
264 | struct snd_rawmidi_substream *substream, | ||
265 | int mode) | ||
266 | { | ||
267 | int err; | ||
268 | |||
269 | err = snd_rawmidi_runtime_create(substream); | ||
270 | if (err < 0) | ||
271 | return err; | ||
272 | err = substream->ops->open(substream); | ||
273 | if (err < 0) | ||
274 | return err; | ||
275 | substream->opened = 1; | ||
276 | if (substream->use_count++ == 0) | ||
277 | substream->active_sensing = 1; | ||
278 | if (mode & SNDRV_RAWMIDI_LFLG_APPEND) | ||
279 | substream->append = 1; | ||
280 | rmidi->streams[substream->stream].substream_opened++; | ||
281 | return 0; | ||
282 | } | ||
283 | |||
284 | static void close_substream(struct snd_rawmidi *rmidi, | ||
285 | struct snd_rawmidi_substream *substream, | ||
286 | int cleanup); | ||
287 | |||
288 | static int rawmidi_open_priv(struct snd_rawmidi *rmidi, int subdevice, int mode, | ||
289 | struct snd_rawmidi_file *rfile) | ||
229 | { | 290 | { |
230 | struct snd_rawmidi *rmidi; | ||
231 | struct list_head *list1, *list2; | ||
232 | struct snd_rawmidi_substream *sinput = NULL, *soutput = NULL; | 291 | struct snd_rawmidi_substream *sinput = NULL, *soutput = NULL; |
233 | struct snd_rawmidi_runtime *input = NULL, *output = NULL; | ||
234 | int err; | 292 | int err; |
235 | 293 | ||
236 | if (rfile) | 294 | rfile->input = rfile->output = NULL; |
237 | rfile->input = rfile->output = NULL; | ||
238 | mutex_lock(®ister_mutex); | ||
239 | rmidi = snd_rawmidi_search(card, device); | ||
240 | mutex_unlock(®ister_mutex); | ||
241 | if (rmidi == NULL) { | ||
242 | err = -ENODEV; | ||
243 | goto __error1; | ||
244 | } | ||
245 | if (!try_module_get(rmidi->card->module)) { | ||
246 | err = -EFAULT; | ||
247 | goto __error1; | ||
248 | } | ||
249 | if (!(mode & SNDRV_RAWMIDI_LFLG_NOOPENLOCK)) | ||
250 | mutex_lock(&rmidi->open_mutex); | ||
251 | if (mode & SNDRV_RAWMIDI_LFLG_INPUT) { | 295 | if (mode & SNDRV_RAWMIDI_LFLG_INPUT) { |
252 | if (!(rmidi->info_flags & SNDRV_RAWMIDI_INFO_INPUT)) { | 296 | err = assign_substream(rmidi, subdevice, |
253 | err = -ENXIO; | 297 | SNDRV_RAWMIDI_STREAM_INPUT, |
254 | goto __error; | 298 | mode, &sinput); |
255 | } | 299 | if (err < 0) |
256 | if (subdevice >= 0 && (unsigned int)subdevice >= rmidi->streams[SNDRV_RAWMIDI_STREAM_INPUT].substream_count) { | ||
257 | err = -ENODEV; | ||
258 | goto __error; | ||
259 | } | ||
260 | if (rmidi->streams[SNDRV_RAWMIDI_STREAM_INPUT].substream_opened >= | ||
261 | rmidi->streams[SNDRV_RAWMIDI_STREAM_INPUT].substream_count) { | ||
262 | err = -EAGAIN; | ||
263 | goto __error; | 300 | goto __error; |
264 | } | ||
265 | } | 301 | } |
266 | if (mode & SNDRV_RAWMIDI_LFLG_OUTPUT) { | 302 | if (mode & SNDRV_RAWMIDI_LFLG_OUTPUT) { |
267 | if (!(rmidi->info_flags & SNDRV_RAWMIDI_INFO_OUTPUT)) { | 303 | err = assign_substream(rmidi, subdevice, |
268 | err = -ENXIO; | 304 | SNDRV_RAWMIDI_STREAM_OUTPUT, |
269 | goto __error; | 305 | mode, &soutput); |
270 | } | 306 | if (err < 0) |
271 | if (subdevice >= 0 && (unsigned int)subdevice >= rmidi->streams[SNDRV_RAWMIDI_STREAM_OUTPUT].substream_count) { | ||
272 | err = -ENODEV; | ||
273 | goto __error; | ||
274 | } | ||
275 | if (rmidi->streams[SNDRV_RAWMIDI_STREAM_OUTPUT].substream_opened >= | ||
276 | rmidi->streams[SNDRV_RAWMIDI_STREAM_OUTPUT].substream_count) { | ||
277 | err = -EAGAIN; | ||
278 | goto __error; | 307 | goto __error; |
279 | } | ||
280 | } | ||
281 | list1 = rmidi->streams[SNDRV_RAWMIDI_STREAM_INPUT].substreams.next; | ||
282 | while (1) { | ||
283 | if (list1 == &rmidi->streams[SNDRV_RAWMIDI_STREAM_INPUT].substreams) { | ||
284 | sinput = NULL; | ||
285 | if (mode & SNDRV_RAWMIDI_LFLG_INPUT) { | ||
286 | err = -EAGAIN; | ||
287 | goto __error; | ||
288 | } | ||
289 | break; | ||
290 | } | ||
291 | sinput = list_entry(list1, struct snd_rawmidi_substream, list); | ||
292 | if ((mode & SNDRV_RAWMIDI_LFLG_INPUT) && sinput->opened) | ||
293 | goto __nexti; | ||
294 | if (subdevice < 0 || (subdevice >= 0 && subdevice == sinput->number)) | ||
295 | break; | ||
296 | __nexti: | ||
297 | list1 = list1->next; | ||
298 | } | 308 | } |
299 | list2 = rmidi->streams[SNDRV_RAWMIDI_STREAM_OUTPUT].substreams.next; | 309 | |
300 | while (1) { | 310 | if (sinput) { |
301 | if (list2 == &rmidi->streams[SNDRV_RAWMIDI_STREAM_OUTPUT].substreams) { | 311 | err = open_substream(rmidi, sinput, mode); |
302 | soutput = NULL; | 312 | if (err < 0) |
303 | if (mode & SNDRV_RAWMIDI_LFLG_OUTPUT) { | ||
304 | err = -EAGAIN; | ||
305 | goto __error; | ||
306 | } | ||
307 | break; | ||
308 | } | ||
309 | soutput = list_entry(list2, struct snd_rawmidi_substream, list); | ||
310 | if (mode & SNDRV_RAWMIDI_LFLG_OUTPUT) { | ||
311 | if (mode & SNDRV_RAWMIDI_LFLG_APPEND) { | ||
312 | if (soutput->opened && !soutput->append) | ||
313 | goto __nexto; | ||
314 | } else { | ||
315 | if (soutput->opened) | ||
316 | goto __nexto; | ||
317 | } | ||
318 | } | ||
319 | if (subdevice < 0 || (subdevice >= 0 && subdevice == soutput->number)) | ||
320 | break; | ||
321 | __nexto: | ||
322 | list2 = list2->next; | ||
323 | } | ||
324 | if (mode & SNDRV_RAWMIDI_LFLG_INPUT) { | ||
325 | if ((err = snd_rawmidi_runtime_create(sinput)) < 0) | ||
326 | goto __error; | ||
327 | input = sinput->runtime; | ||
328 | if ((err = sinput->ops->open(sinput)) < 0) | ||
329 | goto __error; | 313 | goto __error; |
330 | sinput->opened = 1; | ||
331 | rmidi->streams[SNDRV_RAWMIDI_STREAM_INPUT].substream_opened++; | ||
332 | } else { | ||
333 | sinput = NULL; | ||
334 | } | 314 | } |
335 | if (mode & SNDRV_RAWMIDI_LFLG_OUTPUT) { | 315 | if (soutput) { |
336 | if (soutput->opened) | 316 | err = open_substream(rmidi, soutput, mode); |
337 | goto __skip_output; | 317 | if (err < 0) { |
338 | if ((err = snd_rawmidi_runtime_create(soutput)) < 0) { | 318 | if (sinput) |
339 | if (mode & SNDRV_RAWMIDI_LFLG_INPUT) | 319 | close_substream(rmidi, sinput, 0); |
340 | sinput->ops->close(sinput); | ||
341 | goto __error; | ||
342 | } | ||
343 | output = soutput->runtime; | ||
344 | if ((err = soutput->ops->open(soutput)) < 0) { | ||
345 | if (mode & SNDRV_RAWMIDI_LFLG_INPUT) | ||
346 | sinput->ops->close(sinput); | ||
347 | goto __error; | 320 | goto __error; |
348 | } | 321 | } |
349 | __skip_output: | ||
350 | soutput->opened = 1; | ||
351 | if (mode & SNDRV_RAWMIDI_LFLG_APPEND) | ||
352 | soutput->append = 1; | ||
353 | if (soutput->use_count++ == 0) | ||
354 | soutput->active_sensing = 1; | ||
355 | rmidi->streams[SNDRV_RAWMIDI_STREAM_OUTPUT].substream_opened++; | ||
356 | } else { | ||
357 | soutput = NULL; | ||
358 | } | ||
359 | if (!(mode & SNDRV_RAWMIDI_LFLG_NOOPENLOCK)) | ||
360 | mutex_unlock(&rmidi->open_mutex); | ||
361 | if (rfile) { | ||
362 | rfile->rmidi = rmidi; | ||
363 | rfile->input = sinput; | ||
364 | rfile->output = soutput; | ||
365 | } | 322 | } |
323 | |||
324 | rfile->rmidi = rmidi; | ||
325 | rfile->input = sinput; | ||
326 | rfile->output = soutput; | ||
366 | return 0; | 327 | return 0; |
367 | 328 | ||
368 | __error: | 329 | __error: |
369 | if (input != NULL) | 330 | if (sinput && sinput->runtime) |
370 | snd_rawmidi_runtime_free(sinput); | 331 | snd_rawmidi_runtime_free(sinput); |
371 | if (output != NULL) | 332 | if (soutput && soutput->runtime) |
372 | snd_rawmidi_runtime_free(soutput); | 333 | snd_rawmidi_runtime_free(soutput); |
373 | module_put(rmidi->card->module); | 334 | return err; |
374 | if (!(mode & SNDRV_RAWMIDI_LFLG_NOOPENLOCK)) | 335 | } |
375 | mutex_unlock(&rmidi->open_mutex); | 336 | |
376 | __error1: | 337 | /* called from sound/core/seq/seq_midi.c */ |
338 | int snd_rawmidi_kernel_open(struct snd_card *card, int device, int subdevice, | ||
339 | int mode, struct snd_rawmidi_file * rfile) | ||
340 | { | ||
341 | struct snd_rawmidi *rmidi; | ||
342 | int err; | ||
343 | |||
344 | if (snd_BUG_ON(!rfile)) | ||
345 | return -EINVAL; | ||
346 | |||
347 | mutex_lock(®ister_mutex); | ||
348 | rmidi = snd_rawmidi_search(card, device); | ||
349 | if (rmidi == NULL) { | ||
350 | mutex_unlock(®ister_mutex); | ||
351 | return -ENODEV; | ||
352 | } | ||
353 | if (!try_module_get(rmidi->card->module)) { | ||
354 | mutex_unlock(®ister_mutex); | ||
355 | return -ENXIO; | ||
356 | } | ||
357 | mutex_unlock(®ister_mutex); | ||
358 | |||
359 | mutex_lock(&rmidi->open_mutex); | ||
360 | err = rawmidi_open_priv(rmidi, subdevice, mode, rfile); | ||
361 | mutex_unlock(&rmidi->open_mutex); | ||
362 | if (err < 0) | ||
363 | module_put(rmidi->card->module); | ||
377 | return err; | 364 | return err; |
378 | } | 365 | } |
379 | 366 | ||
@@ -385,10 +372,13 @@ static int snd_rawmidi_open(struct inode *inode, struct file *file) | |||
385 | unsigned short fflags; | 372 | unsigned short fflags; |
386 | int err; | 373 | int err; |
387 | struct snd_rawmidi *rmidi; | 374 | struct snd_rawmidi *rmidi; |
388 | struct snd_rawmidi_file *rawmidi_file; | 375 | struct snd_rawmidi_file *rawmidi_file = NULL; |
389 | wait_queue_t wait; | 376 | wait_queue_t wait; |
390 | struct snd_ctl_file *kctl; | 377 | struct snd_ctl_file *kctl; |
391 | 378 | ||
379 | if ((file->f_flags & O_APPEND) && !(file->f_flags & O_NONBLOCK)) | ||
380 | return -EINVAL; /* invalid combination */ | ||
381 | |||
392 | if (maj == snd_major) { | 382 | if (maj == snd_major) { |
393 | rmidi = snd_lookup_minor_data(iminor(inode), | 383 | rmidi = snd_lookup_minor_data(iminor(inode), |
394 | SNDRV_DEVICE_TYPE_RAWMIDI); | 384 | SNDRV_DEVICE_TYPE_RAWMIDI); |
@@ -402,24 +392,25 @@ static int snd_rawmidi_open(struct inode *inode, struct file *file) | |||
402 | 392 | ||
403 | if (rmidi == NULL) | 393 | if (rmidi == NULL) |
404 | return -ENODEV; | 394 | return -ENODEV; |
405 | if ((file->f_flags & O_APPEND) && !(file->f_flags & O_NONBLOCK)) | 395 | |
406 | return -EINVAL; /* invalid combination */ | 396 | if (!try_module_get(rmidi->card->module)) |
397 | return -ENXIO; | ||
398 | |||
399 | mutex_lock(&rmidi->open_mutex); | ||
407 | card = rmidi->card; | 400 | card = rmidi->card; |
408 | err = snd_card_file_add(card, file); | 401 | err = snd_card_file_add(card, file); |
409 | if (err < 0) | 402 | if (err < 0) |
410 | return -ENODEV; | 403 | goto __error_card; |
411 | fflags = snd_rawmidi_file_flags(file); | 404 | fflags = snd_rawmidi_file_flags(file); |
412 | if ((file->f_flags & O_APPEND) || maj == SOUND_MAJOR) /* OSS emul? */ | 405 | if ((file->f_flags & O_APPEND) || maj == SOUND_MAJOR) /* OSS emul? */ |
413 | fflags |= SNDRV_RAWMIDI_LFLG_APPEND; | 406 | fflags |= SNDRV_RAWMIDI_LFLG_APPEND; |
414 | fflags |= SNDRV_RAWMIDI_LFLG_NOOPENLOCK; | ||
415 | rawmidi_file = kmalloc(sizeof(*rawmidi_file), GFP_KERNEL); | 407 | rawmidi_file = kmalloc(sizeof(*rawmidi_file), GFP_KERNEL); |
416 | if (rawmidi_file == NULL) { | 408 | if (rawmidi_file == NULL) { |
417 | snd_card_file_remove(card, file); | 409 | err = -ENOMEM; |
418 | return -ENOMEM; | 410 | goto __error; |
419 | } | 411 | } |
420 | init_waitqueue_entry(&wait, current); | 412 | init_waitqueue_entry(&wait, current); |
421 | add_wait_queue(&rmidi->open_wait, &wait); | 413 | add_wait_queue(&rmidi->open_wait, &wait); |
422 | mutex_lock(&rmidi->open_mutex); | ||
423 | while (1) { | 414 | while (1) { |
424 | subdevice = -1; | 415 | subdevice = -1; |
425 | read_lock(&card->ctl_files_rwlock); | 416 | read_lock(&card->ctl_files_rwlock); |
@@ -431,8 +422,7 @@ static int snd_rawmidi_open(struct inode *inode, struct file *file) | |||
431 | } | 422 | } |
432 | } | 423 | } |
433 | read_unlock(&card->ctl_files_rwlock); | 424 | read_unlock(&card->ctl_files_rwlock); |
434 | err = snd_rawmidi_kernel_open(rmidi->card, rmidi->device, | 425 | err = rawmidi_open_priv(rmidi, subdevice, fflags, rawmidi_file); |
435 | subdevice, fflags, rawmidi_file); | ||
436 | if (err >= 0) | 426 | if (err >= 0) |
437 | break; | 427 | break; |
438 | if (err == -EAGAIN) { | 428 | if (err == -EAGAIN) { |
@@ -451,67 +441,89 @@ static int snd_rawmidi_open(struct inode *inode, struct file *file) | |||
451 | break; | 441 | break; |
452 | } | 442 | } |
453 | } | 443 | } |
444 | remove_wait_queue(&rmidi->open_wait, &wait); | ||
445 | if (err < 0) { | ||
446 | kfree(rawmidi_file); | ||
447 | goto __error; | ||
448 | } | ||
454 | #ifdef CONFIG_SND_OSSEMUL | 449 | #ifdef CONFIG_SND_OSSEMUL |
455 | if (rawmidi_file->input && rawmidi_file->input->runtime) | 450 | if (rawmidi_file->input && rawmidi_file->input->runtime) |
456 | rawmidi_file->input->runtime->oss = (maj == SOUND_MAJOR); | 451 | rawmidi_file->input->runtime->oss = (maj == SOUND_MAJOR); |
457 | if (rawmidi_file->output && rawmidi_file->output->runtime) | 452 | if (rawmidi_file->output && rawmidi_file->output->runtime) |
458 | rawmidi_file->output->runtime->oss = (maj == SOUND_MAJOR); | 453 | rawmidi_file->output->runtime->oss = (maj == SOUND_MAJOR); |
459 | #endif | 454 | #endif |
460 | remove_wait_queue(&rmidi->open_wait, &wait); | 455 | file->private_data = rawmidi_file; |
461 | if (err >= 0) { | 456 | mutex_unlock(&rmidi->open_mutex); |
462 | file->private_data = rawmidi_file; | 457 | return 0; |
463 | } else { | 458 | |
464 | snd_card_file_remove(card, file); | 459 | __error: |
465 | kfree(rawmidi_file); | 460 | snd_card_file_remove(card, file); |
466 | } | 461 | __error_card: |
467 | mutex_unlock(&rmidi->open_mutex); | 462 | mutex_unlock(&rmidi->open_mutex); |
463 | module_put(rmidi->card->module); | ||
468 | return err; | 464 | return err; |
469 | } | 465 | } |
470 | 466 | ||
471 | int snd_rawmidi_kernel_release(struct snd_rawmidi_file * rfile) | 467 | static void close_substream(struct snd_rawmidi *rmidi, |
468 | struct snd_rawmidi_substream *substream, | ||
469 | int cleanup) | ||
472 | { | 470 | { |
473 | struct snd_rawmidi *rmidi; | 471 | rmidi->streams[substream->stream].substream_opened--; |
474 | struct snd_rawmidi_substream *substream; | 472 | if (--substream->use_count) |
475 | struct snd_rawmidi_runtime *runtime; | 473 | return; |
476 | 474 | ||
477 | if (snd_BUG_ON(!rfile)) | 475 | if (cleanup) { |
478 | return -ENXIO; | 476 | if (substream->stream == SNDRV_RAWMIDI_STREAM_INPUT) |
479 | rmidi = rfile->rmidi; | 477 | snd_rawmidi_input_trigger(substream, 0); |
480 | mutex_lock(&rmidi->open_mutex); | 478 | else { |
481 | if (rfile->input != NULL) { | ||
482 | substream = rfile->input; | ||
483 | rfile->input = NULL; | ||
484 | runtime = substream->runtime; | ||
485 | snd_rawmidi_input_trigger(substream, 0); | ||
486 | substream->ops->close(substream); | ||
487 | if (runtime->private_free != NULL) | ||
488 | runtime->private_free(substream); | ||
489 | snd_rawmidi_runtime_free(substream); | ||
490 | substream->opened = 0; | ||
491 | rmidi->streams[SNDRV_RAWMIDI_STREAM_INPUT].substream_opened--; | ||
492 | } | ||
493 | if (rfile->output != NULL) { | ||
494 | substream = rfile->output; | ||
495 | rfile->output = NULL; | ||
496 | if (--substream->use_count == 0) { | ||
497 | runtime = substream->runtime; | ||
498 | if (substream->active_sensing) { | 479 | if (substream->active_sensing) { |
499 | unsigned char buf = 0xfe; | 480 | unsigned char buf = 0xfe; |
500 | /* sending single active sensing message to shut the device up */ | 481 | /* sending single active sensing message |
482 | * to shut the device up | ||
483 | */ | ||
501 | snd_rawmidi_kernel_write(substream, &buf, 1); | 484 | snd_rawmidi_kernel_write(substream, &buf, 1); |
502 | } | 485 | } |
503 | if (snd_rawmidi_drain_output(substream) == -ERESTARTSYS) | 486 | if (snd_rawmidi_drain_output(substream) == -ERESTARTSYS) |
504 | snd_rawmidi_output_trigger(substream, 0); | 487 | snd_rawmidi_output_trigger(substream, 0); |
505 | substream->ops->close(substream); | ||
506 | if (runtime->private_free != NULL) | ||
507 | runtime->private_free(substream); | ||
508 | snd_rawmidi_runtime_free(substream); | ||
509 | substream->opened = 0; | ||
510 | substream->append = 0; | ||
511 | } | 488 | } |
512 | rmidi->streams[SNDRV_RAWMIDI_STREAM_OUTPUT].substream_opened--; | ||
513 | } | 489 | } |
490 | substream->ops->close(substream); | ||
491 | if (substream->runtime->private_free) | ||
492 | substream->runtime->private_free(substream); | ||
493 | snd_rawmidi_runtime_free(substream); | ||
494 | substream->opened = 0; | ||
495 | substream->append = 0; | ||
496 | } | ||
497 | |||
498 | static void rawmidi_release_priv(struct snd_rawmidi_file *rfile) | ||
499 | { | ||
500 | struct snd_rawmidi *rmidi; | ||
501 | |||
502 | rmidi = rfile->rmidi; | ||
503 | mutex_lock(&rmidi->open_mutex); | ||
504 | if (rfile->input) { | ||
505 | close_substream(rmidi, rfile->input, 1); | ||
506 | rfile->input = NULL; | ||
507 | } | ||
508 | if (rfile->output) { | ||
509 | close_substream(rmidi, rfile->output, 1); | ||
510 | rfile->output = NULL; | ||
511 | } | ||
512 | rfile->rmidi = NULL; | ||
514 | mutex_unlock(&rmidi->open_mutex); | 513 | mutex_unlock(&rmidi->open_mutex); |
514 | wake_up(&rmidi->open_wait); | ||
515 | } | ||
516 | |||
517 | /* called from sound/core/seq/seq_midi.c */ | ||
518 | int snd_rawmidi_kernel_release(struct snd_rawmidi_file *rfile) | ||
519 | { | ||
520 | struct snd_rawmidi *rmidi; | ||
521 | |||
522 | if (snd_BUG_ON(!rfile)) | ||
523 | return -ENXIO; | ||
524 | |||
525 | rmidi = rfile->rmidi; | ||
526 | rawmidi_release_priv(rfile); | ||
515 | module_put(rmidi->card->module); | 527 | module_put(rmidi->card->module); |
516 | return 0; | 528 | return 0; |
517 | } | 529 | } |
@@ -520,15 +532,14 @@ static int snd_rawmidi_release(struct inode *inode, struct file *file) | |||
520 | { | 532 | { |
521 | struct snd_rawmidi_file *rfile; | 533 | struct snd_rawmidi_file *rfile; |
522 | struct snd_rawmidi *rmidi; | 534 | struct snd_rawmidi *rmidi; |
523 | int err; | ||
524 | 535 | ||
525 | rfile = file->private_data; | 536 | rfile = file->private_data; |
526 | err = snd_rawmidi_kernel_release(rfile); | ||
527 | rmidi = rfile->rmidi; | 537 | rmidi = rfile->rmidi; |
528 | wake_up(&rmidi->open_wait); | 538 | rawmidi_release_priv(rfile); |
529 | kfree(rfile); | 539 | kfree(rfile); |
530 | snd_card_file_remove(rmidi->card, file); | 540 | snd_card_file_remove(rmidi->card, file); |
531 | return err; | 541 | module_put(rmidi->card->module); |
542 | return 0; | ||
532 | } | 543 | } |
533 | 544 | ||
534 | static int snd_rawmidi_info(struct snd_rawmidi_substream *substream, | 545 | static int snd_rawmidi_info(struct snd_rawmidi_substream *substream, |
diff --git a/sound/core/sgbuf.c b/sound/core/sgbuf.c index d4564edd61d7..4e7ec2b49873 100644 --- a/sound/core/sgbuf.c +++ b/sound/core/sgbuf.c | |||
@@ -38,6 +38,10 @@ int snd_free_sgbuf_pages(struct snd_dma_buffer *dmab) | |||
38 | if (! sgbuf) | 38 | if (! sgbuf) |
39 | return -EINVAL; | 39 | return -EINVAL; |
40 | 40 | ||
41 | if (dmab->area) | ||
42 | vunmap(dmab->area); | ||
43 | dmab->area = NULL; | ||
44 | |||
41 | tmpb.dev.type = SNDRV_DMA_TYPE_DEV; | 45 | tmpb.dev.type = SNDRV_DMA_TYPE_DEV; |
42 | tmpb.dev.dev = sgbuf->dev; | 46 | tmpb.dev.dev = sgbuf->dev; |
43 | for (i = 0; i < sgbuf->pages; i++) { | 47 | for (i = 0; i < sgbuf->pages; i++) { |
@@ -48,9 +52,6 @@ int snd_free_sgbuf_pages(struct snd_dma_buffer *dmab) | |||
48 | tmpb.bytes = (sgbuf->table[i].addr & ~PAGE_MASK) << PAGE_SHIFT; | 52 | tmpb.bytes = (sgbuf->table[i].addr & ~PAGE_MASK) << PAGE_SHIFT; |
49 | snd_dma_free_pages(&tmpb); | 53 | snd_dma_free_pages(&tmpb); |
50 | } | 54 | } |
51 | if (dmab->area) | ||
52 | vunmap(dmab->area); | ||
53 | dmab->area = NULL; | ||
54 | 55 | ||
55 | kfree(sgbuf->table); | 56 | kfree(sgbuf->table); |
56 | kfree(sgbuf->page_table); | 57 | kfree(sgbuf->page_table); |
diff --git a/sound/core/vmaster.c b/sound/core/vmaster.c index 4cc57f902e2c..257624bd1997 100644 --- a/sound/core/vmaster.c +++ b/sound/core/vmaster.c | |||
@@ -50,18 +50,38 @@ struct link_slave { | |||
50 | struct link_master *master; | 50 | struct link_master *master; |
51 | struct link_ctl_info info; | 51 | struct link_ctl_info info; |
52 | int vals[2]; /* current values */ | 52 | int vals[2]; /* current values */ |
53 | unsigned int flags; | ||
53 | struct snd_kcontrol slave; /* the copy of original control entry */ | 54 | struct snd_kcontrol slave; /* the copy of original control entry */ |
54 | }; | 55 | }; |
55 | 56 | ||
57 | static int slave_update(struct link_slave *slave) | ||
58 | { | ||
59 | struct snd_ctl_elem_value *uctl; | ||
60 | int err, ch; | ||
61 | |||
62 | uctl = kmalloc(sizeof(*uctl), GFP_KERNEL); | ||
63 | if (!uctl) | ||
64 | return -ENOMEM; | ||
65 | uctl->id = slave->slave.id; | ||
66 | err = slave->slave.get(&slave->slave, uctl); | ||
67 | for (ch = 0; ch < slave->info.count; ch++) | ||
68 | slave->vals[ch] = uctl->value.integer.value[ch]; | ||
69 | kfree(uctl); | ||
70 | return 0; | ||
71 | } | ||
72 | |||
56 | /* get the slave ctl info and save the initial values */ | 73 | /* get the slave ctl info and save the initial values */ |
57 | static int slave_init(struct link_slave *slave) | 74 | static int slave_init(struct link_slave *slave) |
58 | { | 75 | { |
59 | struct snd_ctl_elem_info *uinfo; | 76 | struct snd_ctl_elem_info *uinfo; |
60 | struct snd_ctl_elem_value *uctl; | 77 | int err; |
61 | int err, ch; | ||
62 | 78 | ||
63 | if (slave->info.count) | 79 | if (slave->info.count) { |
64 | return 0; /* already initialized */ | 80 | /* already initialized */ |
81 | if (slave->flags & SND_CTL_SLAVE_NEED_UPDATE) | ||
82 | return slave_update(slave); | ||
83 | return 0; | ||
84 | } | ||
65 | 85 | ||
66 | uinfo = kmalloc(sizeof(*uinfo), GFP_KERNEL); | 86 | uinfo = kmalloc(sizeof(*uinfo), GFP_KERNEL); |
67 | if (!uinfo) | 87 | if (!uinfo) |
@@ -85,15 +105,7 @@ static int slave_init(struct link_slave *slave) | |||
85 | slave->info.max_val = uinfo->value.integer.max; | 105 | slave->info.max_val = uinfo->value.integer.max; |
86 | kfree(uinfo); | 106 | kfree(uinfo); |
87 | 107 | ||
88 | uctl = kmalloc(sizeof(*uctl), GFP_KERNEL); | 108 | return slave_update(slave); |
89 | if (!uctl) | ||
90 | return -ENOMEM; | ||
91 | uctl->id = slave->slave.id; | ||
92 | err = slave->slave.get(&slave->slave, uctl); | ||
93 | for (ch = 0; ch < slave->info.count; ch++) | ||
94 | slave->vals[ch] = uctl->value.integer.value[ch]; | ||
95 | kfree(uctl); | ||
96 | return 0; | ||
97 | } | 109 | } |
98 | 110 | ||
99 | /* initialize master volume */ | 111 | /* initialize master volume */ |
@@ -229,7 +241,8 @@ static void slave_free(struct snd_kcontrol *kcontrol) | |||
229 | * - logarithmic volume control (dB level), no linear volume | 241 | * - logarithmic volume control (dB level), no linear volume |
230 | * - master can only attenuate the volume, no gain | 242 | * - master can only attenuate the volume, no gain |
231 | */ | 243 | */ |
232 | int snd_ctl_add_slave(struct snd_kcontrol *master, struct snd_kcontrol *slave) | 244 | int _snd_ctl_add_slave(struct snd_kcontrol *master, struct snd_kcontrol *slave, |
245 | unsigned int flags) | ||
233 | { | 246 | { |
234 | struct link_master *master_link = snd_kcontrol_chip(master); | 247 | struct link_master *master_link = snd_kcontrol_chip(master); |
235 | struct link_slave *srec; | 248 | struct link_slave *srec; |
@@ -241,6 +254,7 @@ int snd_ctl_add_slave(struct snd_kcontrol *master, struct snd_kcontrol *slave) | |||
241 | srec->slave = *slave; | 254 | srec->slave = *slave; |
242 | memcpy(srec->slave.vd, slave->vd, slave->count * sizeof(*slave->vd)); | 255 | memcpy(srec->slave.vd, slave->vd, slave->count * sizeof(*slave->vd)); |
243 | srec->master = master_link; | 256 | srec->master = master_link; |
257 | srec->flags = flags; | ||
244 | 258 | ||
245 | /* override callbacks */ | 259 | /* override callbacks */ |
246 | slave->info = slave_info; | 260 | slave->info = slave_info; |
@@ -254,8 +268,7 @@ int snd_ctl_add_slave(struct snd_kcontrol *master, struct snd_kcontrol *slave) | |||
254 | list_add_tail(&srec->list, &master_link->slaves); | 268 | list_add_tail(&srec->list, &master_link->slaves); |
255 | return 0; | 269 | return 0; |
256 | } | 270 | } |
257 | 271 | EXPORT_SYMBOL(_snd_ctl_add_slave); | |
258 | EXPORT_SYMBOL(snd_ctl_add_slave); | ||
259 | 272 | ||
260 | /* | 273 | /* |
261 | * ctl callbacks for master controls | 274 | * ctl callbacks for master controls |
@@ -327,8 +340,20 @@ static void master_free(struct snd_kcontrol *kcontrol) | |||
327 | } | 340 | } |
328 | 341 | ||
329 | 342 | ||
330 | /* | 343 | /** |
331 | * Create a virtual master control with the given name | 344 | * snd_ctl_make_virtual_master - Create a virtual master control |
345 | * @name: name string of the control element to create | ||
346 | * @tlv: optional TLV int array for dB information | ||
347 | * | ||
348 | * Creates a virtual matster control with the given name string. | ||
349 | * Returns the created control element, or NULL for errors (ENOMEM). | ||
350 | * | ||
351 | * After creating a vmaster element, you can add the slave controls | ||
352 | * via snd_ctl_add_slave() or snd_ctl_add_slave_uncached(). | ||
353 | * | ||
354 | * The optional argument @tlv can be used to specify the TLV information | ||
355 | * for dB scale of the master control. It should be a single element | ||
356 | * with #SNDRV_CTL_TLVT_DB_SCALE type, and should be the max 0dB. | ||
332 | */ | 357 | */ |
333 | struct snd_kcontrol *snd_ctl_make_virtual_master(char *name, | 358 | struct snd_kcontrol *snd_ctl_make_virtual_master(char *name, |
334 | const unsigned int *tlv) | 359 | const unsigned int *tlv) |
@@ -367,5 +392,4 @@ struct snd_kcontrol *snd_ctl_make_virtual_master(char *name, | |||
367 | 392 | ||
368 | return kctl; | 393 | return kctl; |
369 | } | 394 | } |
370 | |||
371 | EXPORT_SYMBOL(snd_ctl_make_virtual_master); | 395 | EXPORT_SYMBOL(snd_ctl_make_virtual_master); |
diff --git a/sound/drivers/dummy.c b/sound/drivers/dummy.c index 73be7e14a603..54239d2e0997 100644 --- a/sound/drivers/dummy.c +++ b/sound/drivers/dummy.c | |||
@@ -588,10 +588,10 @@ static int __devinit snd_dummy_probe(struct platform_device *devptr) | |||
588 | int idx, err; | 588 | int idx, err; |
589 | int dev = devptr->id; | 589 | int dev = devptr->id; |
590 | 590 | ||
591 | card = snd_card_new(index[dev], id[dev], THIS_MODULE, | 591 | err = snd_card_create(index[dev], id[dev], THIS_MODULE, |
592 | sizeof(struct snd_dummy)); | 592 | sizeof(struct snd_dummy), &card); |
593 | if (card == NULL) | 593 | if (err < 0) |
594 | return -ENOMEM; | 594 | return err; |
595 | dummy = card->private_data; | 595 | dummy = card->private_data; |
596 | dummy->card = card; | 596 | dummy->card = card; |
597 | for (idx = 0; idx < MAX_PCM_DEVICES && idx < pcm_devs[dev]; idx++) { | 597 | for (idx = 0; idx < MAX_PCM_DEVICES && idx < pcm_devs[dev]; idx++) { |
diff --git a/sound/drivers/ml403-ac97cr.c b/sound/drivers/ml403-ac97cr.c index 7783843ca9ae..1950ffce2b54 100644 --- a/sound/drivers/ml403-ac97cr.c +++ b/sound/drivers/ml403-ac97cr.c | |||
@@ -1279,9 +1279,9 @@ static int __devinit snd_ml403_ac97cr_probe(struct platform_device *pfdev) | |||
1279 | if (!enable[dev]) | 1279 | if (!enable[dev]) |
1280 | return -ENOENT; | 1280 | return -ENOENT; |
1281 | 1281 | ||
1282 | card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); | 1282 | err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card); |
1283 | if (card == NULL) | 1283 | if (err < 0) |
1284 | return -ENOMEM; | 1284 | return err; |
1285 | err = snd_ml403_ac97cr_create(card, pfdev, &ml403_ac97cr); | 1285 | err = snd_ml403_ac97cr_create(card, pfdev, &ml403_ac97cr); |
1286 | if (err < 0) { | 1286 | if (err < 0) { |
1287 | PDEBUG(INIT_FAILURE, "probe(): create failed!\n"); | 1287 | PDEBUG(INIT_FAILURE, "probe(): create failed!\n"); |
diff --git a/sound/drivers/mpu401/mpu401.c b/sound/drivers/mpu401/mpu401.c index 5b996f3faba5..149d05a8202d 100644 --- a/sound/drivers/mpu401/mpu401.c +++ b/sound/drivers/mpu401/mpu401.c | |||
@@ -73,9 +73,9 @@ static int snd_mpu401_create(int dev, struct snd_card **rcard) | |||
73 | snd_printk(KERN_ERR "the uart_enter option is obsolete; remove it\n"); | 73 | snd_printk(KERN_ERR "the uart_enter option is obsolete; remove it\n"); |
74 | 74 | ||
75 | *rcard = NULL; | 75 | *rcard = NULL; |
76 | card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); | 76 | err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card); |
77 | if (card == NULL) | 77 | if (err < 0) |
78 | return -ENOMEM; | 78 | return err; |
79 | strcpy(card->driver, "MPU-401 UART"); | 79 | strcpy(card->driver, "MPU-401 UART"); |
80 | strcpy(card->shortname, card->driver); | 80 | strcpy(card->shortname, card->driver); |
81 | sprintf(card->longname, "%s at %#lx, ", card->shortname, port[dev]); | 81 | sprintf(card->longname, "%s at %#lx, ", card->shortname, port[dev]); |
diff --git a/sound/drivers/mtpav.c b/sound/drivers/mtpav.c index 6b26305ff0e6..2f8f295d6b0c 100644 --- a/sound/drivers/mtpav.c +++ b/sound/drivers/mtpav.c | |||
@@ -698,9 +698,9 @@ static int __devinit snd_mtpav_probe(struct platform_device *dev) | |||
698 | int err; | 698 | int err; |
699 | struct mtpav *mtp_card; | 699 | struct mtpav *mtp_card; |
700 | 700 | ||
701 | card = snd_card_new(index, id, THIS_MODULE, sizeof(*mtp_card)); | 701 | err = snd_card_create(index, id, THIS_MODULE, sizeof(*mtp_card), &card); |
702 | if (! card) | 702 | if (err < 0) |
703 | return -ENOMEM; | 703 | return err; |
704 | 704 | ||
705 | mtp_card = card->private_data; | 705 | mtp_card = card->private_data; |
706 | spin_lock_init(&mtp_card->spinlock); | 706 | spin_lock_init(&mtp_card->spinlock); |
@@ -708,7 +708,6 @@ static int __devinit snd_mtpav_probe(struct platform_device *dev) | |||
708 | mtp_card->card = card; | 708 | mtp_card->card = card; |
709 | mtp_card->irq = -1; | 709 | mtp_card->irq = -1; |
710 | mtp_card->share_irq = 0; | 710 | mtp_card->share_irq = 0; |
711 | mtp_card->inmidiport = 0xffffffff; | ||
712 | mtp_card->inmidistate = 0; | 711 | mtp_card->inmidistate = 0; |
713 | mtp_card->outmidihwport = 0xffffffff; | 712 | mtp_card->outmidihwport = 0xffffffff; |
714 | init_timer(&mtp_card->timer); | 713 | init_timer(&mtp_card->timer); |
@@ -721,6 +720,8 @@ static int __devinit snd_mtpav_probe(struct platform_device *dev) | |||
721 | if (err < 0) | 720 | if (err < 0) |
722 | goto __error; | 721 | goto __error; |
723 | 722 | ||
723 | mtp_card->inmidiport = mtp_card->num_ports + MTPAV_PIDX_BROADCAST; | ||
724 | |||
724 | err = snd_mtpav_get_ISA(mtp_card); | 725 | err = snd_mtpav_get_ISA(mtp_card); |
725 | if (err < 0) | 726 | if (err < 0) |
726 | goto __error; | 727 | goto __error; |
diff --git a/sound/drivers/mts64.c b/sound/drivers/mts64.c index 1a05b2d64c9b..9284829bf927 100644 --- a/sound/drivers/mts64.c +++ b/sound/drivers/mts64.c | |||
@@ -957,10 +957,10 @@ static int __devinit snd_mts64_probe(struct platform_device *pdev) | |||
957 | if ((err = snd_mts64_probe_port(p)) < 0) | 957 | if ((err = snd_mts64_probe_port(p)) < 0) |
958 | return err; | 958 | return err; |
959 | 959 | ||
960 | card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); | 960 | err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card); |
961 | if (card == NULL) { | 961 | if (err < 0) { |
962 | snd_printd("Cannot create card\n"); | 962 | snd_printd("Cannot create card\n"); |
963 | return -ENOMEM; | 963 | return err; |
964 | } | 964 | } |
965 | strcpy(card->driver, DRIVER_NAME); | 965 | strcpy(card->driver, DRIVER_NAME); |
966 | strcpy(card->shortname, "ESI " CARD_NAME); | 966 | strcpy(card->shortname, "ESI " CARD_NAME); |
diff --git a/sound/drivers/pcsp/pcsp.c b/sound/drivers/pcsp/pcsp.c index c7c744c6fc0b..b60cef257b58 100644 --- a/sound/drivers/pcsp/pcsp.c +++ b/sound/drivers/pcsp/pcsp.c | |||
@@ -98,9 +98,9 @@ static int __devinit snd_card_pcsp_probe(int devnum, struct device *dev) | |||
98 | hrtimer_init(&pcsp_chip.timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); | 98 | hrtimer_init(&pcsp_chip.timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); |
99 | pcsp_chip.timer.function = pcsp_do_timer; | 99 | pcsp_chip.timer.function = pcsp_do_timer; |
100 | 100 | ||
101 | card = snd_card_new(index, id, THIS_MODULE, 0); | 101 | err = snd_card_create(index, id, THIS_MODULE, 0, &card); |
102 | if (!card) | 102 | if (err < 0) |
103 | return -ENOMEM; | 103 | return err; |
104 | 104 | ||
105 | err = snd_pcsp_create(card); | 105 | err = snd_pcsp_create(card); |
106 | if (err < 0) { | 106 | if (err < 0) { |
diff --git a/sound/drivers/portman2x4.c b/sound/drivers/portman2x4.c index b1c047ec19af..60158e2e0eaf 100644 --- a/sound/drivers/portman2x4.c +++ b/sound/drivers/portman2x4.c | |||
@@ -746,10 +746,10 @@ static int __devinit snd_portman_probe(struct platform_device *pdev) | |||
746 | if ((err = snd_portman_probe_port(p)) < 0) | 746 | if ((err = snd_portman_probe_port(p)) < 0) |
747 | return err; | 747 | return err; |
748 | 748 | ||
749 | card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); | 749 | err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card); |
750 | if (card == NULL) { | 750 | if (err < 0) { |
751 | snd_printd("Cannot create card\n"); | 751 | snd_printd("Cannot create card\n"); |
752 | return -ENOMEM; | 752 | return err; |
753 | } | 753 | } |
754 | strcpy(card->driver, DRIVER_NAME); | 754 | strcpy(card->driver, DRIVER_NAME); |
755 | strcpy(card->shortname, CARD_NAME); | 755 | strcpy(card->shortname, CARD_NAME); |
diff --git a/sound/drivers/serial-u16550.c b/sound/drivers/serial-u16550.c index ff0a41510945..b2b6d50c9425 100644 --- a/sound/drivers/serial-u16550.c +++ b/sound/drivers/serial-u16550.c | |||
@@ -942,9 +942,9 @@ static int __devinit snd_serial_probe(struct platform_device *devptr) | |||
942 | return -ENODEV; | 942 | return -ENODEV; |
943 | } | 943 | } |
944 | 944 | ||
945 | card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); | 945 | err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card); |
946 | if (card == NULL) | 946 | if (err < 0) |
947 | return -ENOMEM; | 947 | return err; |
948 | 948 | ||
949 | strcpy(card->driver, "Serial"); | 949 | strcpy(card->driver, "Serial"); |
950 | strcpy(card->shortname, "Serial MIDI (UART16550A)"); | 950 | strcpy(card->shortname, "Serial MIDI (UART16550A)"); |
diff --git a/sound/drivers/virmidi.c b/sound/drivers/virmidi.c index 1022e365606f..0e631c3221e3 100644 --- a/sound/drivers/virmidi.c +++ b/sound/drivers/virmidi.c | |||
@@ -90,10 +90,10 @@ static int __devinit snd_virmidi_probe(struct platform_device *devptr) | |||
90 | int idx, err; | 90 | int idx, err; |
91 | int dev = devptr->id; | 91 | int dev = devptr->id; |
92 | 92 | ||
93 | card = snd_card_new(index[dev], id[dev], THIS_MODULE, | 93 | err = snd_card_create(index[dev], id[dev], THIS_MODULE, |
94 | sizeof(struct snd_card_virmidi)); | 94 | sizeof(struct snd_card_virmidi), &card); |
95 | if (card == NULL) | 95 | if (err < 0) |
96 | return -ENOMEM; | 96 | return err; |
97 | vmidi = (struct snd_card_virmidi *)card->private_data; | 97 | vmidi = (struct snd_card_virmidi *)card->private_data; |
98 | vmidi->card = card; | 98 | vmidi->card = card; |
99 | 99 | ||
diff --git a/sound/drivers/vx/vx_hwdep.c b/sound/drivers/vx/vx_hwdep.c index 8d6362e2d4c9..46df8817c18f 100644 --- a/sound/drivers/vx/vx_hwdep.c +++ b/sound/drivers/vx/vx_hwdep.c | |||
@@ -119,16 +119,6 @@ void snd_vx_free_firmware(struct vx_core *chip) | |||
119 | 119 | ||
120 | #else /* old style firmware loading */ | 120 | #else /* old style firmware loading */ |
121 | 121 | ||
122 | static int vx_hwdep_open(struct snd_hwdep *hw, struct file *file) | ||
123 | { | ||
124 | return 0; | ||
125 | } | ||
126 | |||
127 | static int vx_hwdep_release(struct snd_hwdep *hw, struct file *file) | ||
128 | { | ||
129 | return 0; | ||
130 | } | ||
131 | |||
132 | static int vx_hwdep_dsp_status(struct snd_hwdep *hw, | 122 | static int vx_hwdep_dsp_status(struct snd_hwdep *hw, |
133 | struct snd_hwdep_dsp_status *info) | 123 | struct snd_hwdep_dsp_status *info) |
134 | { | 124 | { |
@@ -243,8 +233,6 @@ int snd_vx_setup_firmware(struct vx_core *chip) | |||
243 | 233 | ||
244 | hw->iface = SNDRV_HWDEP_IFACE_VX; | 234 | hw->iface = SNDRV_HWDEP_IFACE_VX; |
245 | hw->private_data = chip; | 235 | hw->private_data = chip; |
246 | hw->ops.open = vx_hwdep_open; | ||
247 | hw->ops.release = vx_hwdep_release; | ||
248 | hw->ops.dsp_status = vx_hwdep_dsp_status; | 236 | hw->ops.dsp_status = vx_hwdep_dsp_status; |
249 | hw->ops.dsp_load = vx_hwdep_dsp_load; | 237 | hw->ops.dsp_load = vx_hwdep_dsp_load; |
250 | hw->exclusive = 1; | 238 | hw->exclusive = 1; |
diff --git a/sound/isa/ad1816a/ad1816a.c b/sound/isa/ad1816a/ad1816a.c index 77524244a846..9660e598232c 100644 --- a/sound/isa/ad1816a/ad1816a.c +++ b/sound/isa/ad1816a/ad1816a.c | |||
@@ -157,9 +157,10 @@ static int __devinit snd_card_ad1816a_probe(int dev, struct pnp_card_link *pcard | |||
157 | struct snd_ad1816a *chip; | 157 | struct snd_ad1816a *chip; |
158 | struct snd_opl3 *opl3; | 158 | struct snd_opl3 *opl3; |
159 | 159 | ||
160 | if ((card = snd_card_new(index[dev], id[dev], THIS_MODULE, | 160 | error = snd_card_create(index[dev], id[dev], THIS_MODULE, |
161 | sizeof(struct snd_card_ad1816a))) == NULL) | 161 | sizeof(struct snd_card_ad1816a), &card); |
162 | return -ENOMEM; | 162 | if (error < 0) |
163 | return error; | ||
163 | acard = (struct snd_card_ad1816a *)card->private_data; | 164 | acard = (struct snd_card_ad1816a *)card->private_data; |
164 | 165 | ||
165 | if ((error = snd_card_ad1816a_pnp(dev, acard, pcard, pid))) { | 166 | if ((error = snd_card_ad1816a_pnp(dev, acard, pcard, pid))) { |
diff --git a/sound/isa/ad1848/ad1848.c b/sound/isa/ad1848/ad1848.c index 223a6c038819..4beeb6f98e0e 100644 --- a/sound/isa/ad1848/ad1848.c +++ b/sound/isa/ad1848/ad1848.c | |||
@@ -91,9 +91,9 @@ static int __devinit snd_ad1848_probe(struct device *dev, unsigned int n) | |||
91 | struct snd_pcm *pcm; | 91 | struct snd_pcm *pcm; |
92 | int error; | 92 | int error; |
93 | 93 | ||
94 | card = snd_card_new(index[n], id[n], THIS_MODULE, 0); | 94 | error = snd_card_create(index[n], id[n], THIS_MODULE, 0, &card); |
95 | if (!card) | 95 | if (error < 0) |
96 | return -EINVAL; | 96 | return error; |
97 | 97 | ||
98 | error = snd_wss_create(card, port[n], -1, irq[n], dma1[n], -1, | 98 | error = snd_wss_create(card, port[n], -1, irq[n], dma1[n], -1, |
99 | thinkpad[n] ? WSS_HW_THINKPAD : WSS_HW_DETECT, | 99 | thinkpad[n] ? WSS_HW_THINKPAD : WSS_HW_DETECT, |
diff --git a/sound/isa/adlib.c b/sound/isa/adlib.c index 374b7177e111..7465ae036e0b 100644 --- a/sound/isa/adlib.c +++ b/sound/isa/adlib.c | |||
@@ -53,10 +53,10 @@ static int __devinit snd_adlib_probe(struct device *dev, unsigned int n) | |||
53 | struct snd_opl3 *opl3; | 53 | struct snd_opl3 *opl3; |
54 | int error; | 54 | int error; |
55 | 55 | ||
56 | card = snd_card_new(index[n], id[n], THIS_MODULE, 0); | 56 | error = snd_card_create(index[n], id[n], THIS_MODULE, 0, &card); |
57 | if (!card) { | 57 | if (error < 0) { |
58 | dev_err(dev, "could not create card\n"); | 58 | dev_err(dev, "could not create card\n"); |
59 | return -EINVAL; | 59 | return error; |
60 | } | 60 | } |
61 | 61 | ||
62 | card->private_data = request_region(port[n], 4, CRD_NAME); | 62 | card->private_data = request_region(port[n], 4, CRD_NAME); |
diff --git a/sound/isa/als100.c b/sound/isa/als100.c index f1ce30f379c9..5fd52e4d7079 100644 --- a/sound/isa/als100.c +++ b/sound/isa/als100.c | |||
@@ -163,9 +163,10 @@ static int __devinit snd_card_als100_probe(int dev, | |||
163 | struct snd_card_als100 *acard; | 163 | struct snd_card_als100 *acard; |
164 | struct snd_opl3 *opl3; | 164 | struct snd_opl3 *opl3; |
165 | 165 | ||
166 | if ((card = snd_card_new(index[dev], id[dev], THIS_MODULE, | 166 | error = snd_card_create(index[dev], id[dev], THIS_MODULE, |
167 | sizeof(struct snd_card_als100))) == NULL) | 167 | sizeof(struct snd_card_als100), &card); |
168 | return -ENOMEM; | 168 | if (error < 0) |
169 | return error; | ||
169 | acard = card->private_data; | 170 | acard = card->private_data; |
170 | 171 | ||
171 | if ((error = snd_card_als100_pnp(dev, acard, pcard, pid))) { | 172 | if ((error = snd_card_als100_pnp(dev, acard, pcard, pid))) { |
diff --git a/sound/isa/azt2320.c b/sound/isa/azt2320.c index 3e74d1a3928e..f7aa637b0d18 100644 --- a/sound/isa/azt2320.c +++ b/sound/isa/azt2320.c | |||
@@ -184,9 +184,10 @@ static int __devinit snd_card_azt2320_probe(int dev, | |||
184 | struct snd_wss *chip; | 184 | struct snd_wss *chip; |
185 | struct snd_opl3 *opl3; | 185 | struct snd_opl3 *opl3; |
186 | 186 | ||
187 | if ((card = snd_card_new(index[dev], id[dev], THIS_MODULE, | 187 | error = snd_card_create(index[dev], id[dev], THIS_MODULE, |
188 | sizeof(struct snd_card_azt2320))) == NULL) | 188 | sizeof(struct snd_card_azt2320), &card); |
189 | return -ENOMEM; | 189 | if (error < 0) |
190 | return error; | ||
190 | acard = (struct snd_card_azt2320 *)card->private_data; | 191 | acard = (struct snd_card_azt2320 *)card->private_data; |
191 | 192 | ||
192 | if ((error = snd_card_azt2320_pnp(dev, acard, pcard, pid))) { | 193 | if ((error = snd_card_azt2320_pnp(dev, acard, pcard, pid))) { |
diff --git a/sound/isa/cmi8330.c b/sound/isa/cmi8330.c index e49aec700a55..24e60902f8ca 100644 --- a/sound/isa/cmi8330.c +++ b/sound/isa/cmi8330.c | |||
@@ -467,20 +467,22 @@ static int snd_cmi8330_resume(struct snd_card *card) | |||
467 | 467 | ||
468 | #define PFX "cmi8330: " | 468 | #define PFX "cmi8330: " |
469 | 469 | ||
470 | static struct snd_card *snd_cmi8330_card_new(int dev) | 470 | static int snd_cmi8330_card_new(int dev, struct snd_card **cardp) |
471 | { | 471 | { |
472 | struct snd_card *card; | 472 | struct snd_card *card; |
473 | struct snd_cmi8330 *acard; | 473 | struct snd_cmi8330 *acard; |
474 | int err; | ||
474 | 475 | ||
475 | card = snd_card_new(index[dev], id[dev], THIS_MODULE, | 476 | err = snd_card_create(index[dev], id[dev], THIS_MODULE, |
476 | sizeof(struct snd_cmi8330)); | 477 | sizeof(struct snd_cmi8330), &card); |
477 | if (card == NULL) { | 478 | if (err < 0) { |
478 | snd_printk(KERN_ERR PFX "could not get a new card\n"); | 479 | snd_printk(KERN_ERR PFX "could not get a new card\n"); |
479 | return NULL; | 480 | return err; |
480 | } | 481 | } |
481 | acard = card->private_data; | 482 | acard = card->private_data; |
482 | acard->card = card; | 483 | acard->card = card; |
483 | return card; | 484 | *cardp = card; |
485 | return 0; | ||
484 | } | 486 | } |
485 | 487 | ||
486 | static int __devinit snd_cmi8330_probe(struct snd_card *card, int dev) | 488 | static int __devinit snd_cmi8330_probe(struct snd_card *card, int dev) |
@@ -564,9 +566,9 @@ static int __devinit snd_cmi8330_isa_probe(struct device *pdev, | |||
564 | struct snd_card *card; | 566 | struct snd_card *card; |
565 | int err; | 567 | int err; |
566 | 568 | ||
567 | card = snd_cmi8330_card_new(dev); | 569 | err = snd_cmi8330_card_new(dev, &card); |
568 | if (! card) | 570 | if (err < 0) |
569 | return -ENOMEM; | 571 | return err; |
570 | snd_card_set_dev(card, pdev); | 572 | snd_card_set_dev(card, pdev); |
571 | if ((err = snd_cmi8330_probe(card, dev)) < 0) { | 573 | if ((err = snd_cmi8330_probe(card, dev)) < 0) { |
572 | snd_card_free(card); | 574 | snd_card_free(card); |
@@ -628,9 +630,9 @@ static int __devinit snd_cmi8330_pnp_detect(struct pnp_card_link *pcard, | |||
628 | if (dev >= SNDRV_CARDS) | 630 | if (dev >= SNDRV_CARDS) |
629 | return -ENODEV; | 631 | return -ENODEV; |
630 | 632 | ||
631 | card = snd_cmi8330_card_new(dev); | 633 | res = snd_cmi8330_card_new(dev, &card); |
632 | if (! card) | 634 | if (res < 0) |
633 | return -ENOMEM; | 635 | return res; |
634 | if ((res = snd_cmi8330_pnp(dev, card->private_data, pcard, pid)) < 0) { | 636 | if ((res = snd_cmi8330_pnp(dev, card->private_data, pcard, pid)) < 0) { |
635 | snd_printk(KERN_ERR PFX "PnP detection failed\n"); | 637 | snd_printk(KERN_ERR PFX "PnP detection failed\n"); |
636 | snd_card_free(card); | 638 | snd_card_free(card); |
diff --git a/sound/isa/cs423x/cs4231.c b/sound/isa/cs423x/cs4231.c index f019d449e2d6..cb9153e75b82 100644 --- a/sound/isa/cs423x/cs4231.c +++ b/sound/isa/cs423x/cs4231.c | |||
@@ -95,9 +95,9 @@ static int __devinit snd_cs4231_probe(struct device *dev, unsigned int n) | |||
95 | struct snd_pcm *pcm; | 95 | struct snd_pcm *pcm; |
96 | int error; | 96 | int error; |
97 | 97 | ||
98 | card = snd_card_new(index[n], id[n], THIS_MODULE, 0); | 98 | error = snd_card_create(index[n], id[n], THIS_MODULE, 0, &card); |
99 | if (!card) | 99 | if (error < 0) |
100 | return -EINVAL; | 100 | return error; |
101 | 101 | ||
102 | error = snd_wss_create(card, port[n], -1, irq[n], dma1[n], dma2[n], | 102 | error = snd_wss_create(card, port[n], -1, irq[n], dma1[n], dma2[n], |
103 | WSS_HW_DETECT, 0, &chip); | 103 | WSS_HW_DETECT, 0, &chip); |
diff --git a/sound/isa/cs423x/cs4236.c b/sound/isa/cs423x/cs4236.c index 019c9401663e..f7845986f467 100644 --- a/sound/isa/cs423x/cs4236.c +++ b/sound/isa/cs423x/cs4236.c | |||
@@ -382,16 +382,18 @@ static void snd_card_cs4236_free(struct snd_card *card) | |||
382 | release_and_free_resource(acard->res_sb_port); | 382 | release_and_free_resource(acard->res_sb_port); |
383 | } | 383 | } |
384 | 384 | ||
385 | static struct snd_card *snd_cs423x_card_new(int dev) | 385 | static int snd_cs423x_card_new(int dev, struct snd_card **cardp) |
386 | { | 386 | { |
387 | struct snd_card *card; | 387 | struct snd_card *card; |
388 | int err; | ||
388 | 389 | ||
389 | card = snd_card_new(index[dev], id[dev], THIS_MODULE, | 390 | err = snd_card_create(index[dev], id[dev], THIS_MODULE, |
390 | sizeof(struct snd_card_cs4236)); | 391 | sizeof(struct snd_card_cs4236), &card); |
391 | if (card == NULL) | 392 | if (err < 0) |
392 | return NULL; | 393 | return err; |
393 | card->private_free = snd_card_cs4236_free; | 394 | card->private_free = snd_card_cs4236_free; |
394 | return card; | 395 | *cardp = card; |
396 | return 0; | ||
395 | } | 397 | } |
396 | 398 | ||
397 | static int __devinit snd_cs423x_probe(struct snd_card *card, int dev) | 399 | static int __devinit snd_cs423x_probe(struct snd_card *card, int dev) |
@@ -512,9 +514,9 @@ static int __devinit snd_cs423x_isa_probe(struct device *pdev, | |||
512 | struct snd_card *card; | 514 | struct snd_card *card; |
513 | int err; | 515 | int err; |
514 | 516 | ||
515 | card = snd_cs423x_card_new(dev); | 517 | err = snd_cs423x_card_new(dev, &card); |
516 | if (! card) | 518 | if (err < 0) |
517 | return -ENOMEM; | 519 | return err; |
518 | snd_card_set_dev(card, pdev); | 520 | snd_card_set_dev(card, pdev); |
519 | if ((err = snd_cs423x_probe(card, dev)) < 0) { | 521 | if ((err = snd_cs423x_probe(card, dev)) < 0) { |
520 | snd_card_free(card); | 522 | snd_card_free(card); |
@@ -594,9 +596,9 @@ static int __devinit snd_cs4232_pnpbios_detect(struct pnp_dev *pdev, | |||
594 | if (dev >= SNDRV_CARDS) | 596 | if (dev >= SNDRV_CARDS) |
595 | return -ENODEV; | 597 | return -ENODEV; |
596 | 598 | ||
597 | card = snd_cs423x_card_new(dev); | 599 | err = snd_cs423x_card_new(dev, &card); |
598 | if (! card) | 600 | if (err < 0) |
599 | return -ENOMEM; | 601 | return err; |
600 | if ((err = snd_card_cs4232_pnp(dev, card->private_data, pdev)) < 0) { | 602 | if ((err = snd_card_cs4232_pnp(dev, card->private_data, pdev)) < 0) { |
601 | printk(KERN_ERR "PnP BIOS detection failed for " IDENT "\n"); | 603 | printk(KERN_ERR "PnP BIOS detection failed for " IDENT "\n"); |
602 | snd_card_free(card); | 604 | snd_card_free(card); |
@@ -656,9 +658,9 @@ static int __devinit snd_cs423x_pnpc_detect(struct pnp_card_link *pcard, | |||
656 | if (dev >= SNDRV_CARDS) | 658 | if (dev >= SNDRV_CARDS) |
657 | return -ENODEV; | 659 | return -ENODEV; |
658 | 660 | ||
659 | card = snd_cs423x_card_new(dev); | 661 | res = snd_cs423x_card_new(dev, &card); |
660 | if (! card) | 662 | if (res < 0) |
661 | return -ENOMEM; | 663 | return res; |
662 | if ((res = snd_card_cs423x_pnpc(dev, card->private_data, pcard, pid)) < 0) { | 664 | if ((res = snd_card_cs423x_pnpc(dev, card->private_data, pcard, pid)) < 0) { |
663 | printk(KERN_ERR "isapnp detection failed and probing for " IDENT | 665 | printk(KERN_ERR "isapnp detection failed and probing for " IDENT |
664 | " is not supported\n"); | 666 | " is not supported\n"); |
diff --git a/sound/isa/dt019x.c b/sound/isa/dt019x.c index a0242c3b613e..80f5b1af9be8 100644 --- a/sound/isa/dt019x.c +++ b/sound/isa/dt019x.c | |||
@@ -150,9 +150,10 @@ static int __devinit snd_card_dt019x_probe(int dev, struct pnp_card_link *pcard, | |||
150 | struct snd_card_dt019x *acard; | 150 | struct snd_card_dt019x *acard; |
151 | struct snd_opl3 *opl3; | 151 | struct snd_opl3 *opl3; |
152 | 152 | ||
153 | if ((card = snd_card_new(index[dev], id[dev], THIS_MODULE, | 153 | error = snd_card_create(index[dev], id[dev], THIS_MODULE, |
154 | sizeof(struct snd_card_dt019x))) == NULL) | 154 | sizeof(struct snd_card_dt019x), &card); |
155 | return -ENOMEM; | 155 | if (error < 0) |
156 | return error; | ||
156 | acard = card->private_data; | 157 | acard = card->private_data; |
157 | 158 | ||
158 | snd_card_set_dev(card, &pcard->card->dev); | 159 | snd_card_set_dev(card, &pcard->card->dev); |
diff --git a/sound/isa/es1688/es1688.c b/sound/isa/es1688/es1688.c index b46377139cf8..d746750410ea 100644 --- a/sound/isa/es1688/es1688.c +++ b/sound/isa/es1688/es1688.c | |||
@@ -122,9 +122,9 @@ static int __devinit snd_es1688_probe(struct device *dev, unsigned int n) | |||
122 | struct snd_pcm *pcm; | 122 | struct snd_pcm *pcm; |
123 | int error; | 123 | int error; |
124 | 124 | ||
125 | card = snd_card_new(index[n], id[n], THIS_MODULE, 0); | 125 | error = snd_card_create(index[n], id[n], THIS_MODULE, 0, &card); |
126 | if (!card) | 126 | if (error < 0) |
127 | return -EINVAL; | 127 | return error; |
128 | 128 | ||
129 | error = snd_es1688_legacy_create(card, dev, n, &chip); | 129 | error = snd_es1688_legacy_create(card, dev, n, &chip); |
130 | if (error < 0) | 130 | if (error < 0) |
diff --git a/sound/isa/es18xx.c b/sound/isa/es18xx.c index 90498e4ca260..8cfbff73a835 100644 --- a/sound/isa/es18xx.c +++ b/sound/isa/es18xx.c | |||
@@ -2125,10 +2125,10 @@ static int __devinit snd_audiodrive_pnpc(int dev, struct snd_audiodrive *acard, | |||
2125 | #define is_isapnp_selected(dev) 0 | 2125 | #define is_isapnp_selected(dev) 0 |
2126 | #endif | 2126 | #endif |
2127 | 2127 | ||
2128 | static struct snd_card *snd_es18xx_card_new(int dev) | 2128 | static int snd_es18xx_card_new(int dev, struct snd_card **cardp) |
2129 | { | 2129 | { |
2130 | return snd_card_new(index[dev], id[dev], THIS_MODULE, | 2130 | return snd_card_create(index[dev], id[dev], THIS_MODULE, |
2131 | sizeof(struct snd_audiodrive)); | 2131 | sizeof(struct snd_audiodrive), cardp); |
2132 | } | 2132 | } |
2133 | 2133 | ||
2134 | static int __devinit snd_audiodrive_probe(struct snd_card *card, int dev) | 2134 | static int __devinit snd_audiodrive_probe(struct snd_card *card, int dev) |
@@ -2197,9 +2197,9 @@ static int __devinit snd_es18xx_isa_probe1(int dev, struct device *devptr) | |||
2197 | struct snd_card *card; | 2197 | struct snd_card *card; |
2198 | int err; | 2198 | int err; |
2199 | 2199 | ||
2200 | card = snd_es18xx_card_new(dev); | 2200 | err = snd_es18xx_card_new(dev, &card); |
2201 | if (! card) | 2201 | if (err < 0) |
2202 | return -ENOMEM; | 2202 | return err; |
2203 | snd_card_set_dev(card, devptr); | 2203 | snd_card_set_dev(card, devptr); |
2204 | if ((err = snd_audiodrive_probe(card, dev)) < 0) { | 2204 | if ((err = snd_audiodrive_probe(card, dev)) < 0) { |
2205 | snd_card_free(card); | 2205 | snd_card_free(card); |
@@ -2303,9 +2303,9 @@ static int __devinit snd_audiodrive_pnp_detect(struct pnp_dev *pdev, | |||
2303 | if (dev >= SNDRV_CARDS) | 2303 | if (dev >= SNDRV_CARDS) |
2304 | return -ENODEV; | 2304 | return -ENODEV; |
2305 | 2305 | ||
2306 | card = snd_es18xx_card_new(dev); | 2306 | err = snd_es18xx_card_new(dev, &card); |
2307 | if (! card) | 2307 | if (err < 0) |
2308 | return -ENOMEM; | 2308 | return err; |
2309 | if ((err = snd_audiodrive_pnp(dev, card->private_data, pdev)) < 0) { | 2309 | if ((err = snd_audiodrive_pnp(dev, card->private_data, pdev)) < 0) { |
2310 | snd_card_free(card); | 2310 | snd_card_free(card); |
2311 | return err; | 2311 | return err; |
@@ -2362,9 +2362,9 @@ static int __devinit snd_audiodrive_pnpc_detect(struct pnp_card_link *pcard, | |||
2362 | if (dev >= SNDRV_CARDS) | 2362 | if (dev >= SNDRV_CARDS) |
2363 | return -ENODEV; | 2363 | return -ENODEV; |
2364 | 2364 | ||
2365 | card = snd_es18xx_card_new(dev); | 2365 | res = snd_es18xx_card_new(dev, &card); |
2366 | if (! card) | 2366 | if (res < 0) |
2367 | return -ENOMEM; | 2367 | return res; |
2368 | 2368 | ||
2369 | if ((res = snd_audiodrive_pnpc(dev, card->private_data, pcard, pid)) < 0) { | 2369 | if ((res = snd_audiodrive_pnpc(dev, card->private_data, pcard, pid)) < 0) { |
2370 | snd_card_free(card); | 2370 | snd_card_free(card); |
diff --git a/sound/isa/gus/gusclassic.c b/sound/isa/gus/gusclassic.c index 426532a4d730..086b8f0e0f94 100644 --- a/sound/isa/gus/gusclassic.c +++ b/sound/isa/gus/gusclassic.c | |||
@@ -148,9 +148,9 @@ static int __devinit snd_gusclassic_probe(struct device *dev, unsigned int n) | |||
148 | struct snd_gus_card *gus; | 148 | struct snd_gus_card *gus; |
149 | int error; | 149 | int error; |
150 | 150 | ||
151 | card = snd_card_new(index[n], id[n], THIS_MODULE, 0); | 151 | error = snd_card_create(index[n], id[n], THIS_MODULE, 0, &card); |
152 | if (!card) | 152 | if (error < 0) |
153 | return -EINVAL; | 153 | return error; |
154 | 154 | ||
155 | if (pcm_channels[n] < 2) | 155 | if (pcm_channels[n] < 2) |
156 | pcm_channels[n] = 2; | 156 | pcm_channels[n] = 2; |
diff --git a/sound/isa/gus/gusextreme.c b/sound/isa/gus/gusextreme.c index 7ad4c3b41a84..180a8dea6bd9 100644 --- a/sound/isa/gus/gusextreme.c +++ b/sound/isa/gus/gusextreme.c | |||
@@ -241,9 +241,9 @@ static int __devinit snd_gusextreme_probe(struct device *dev, unsigned int n) | |||
241 | struct snd_opl3 *opl3; | 241 | struct snd_opl3 *opl3; |
242 | int error; | 242 | int error; |
243 | 243 | ||
244 | card = snd_card_new(index[n], id[n], THIS_MODULE, 0); | 244 | error = snd_card_create(index[n], id[n], THIS_MODULE, 0, &card); |
245 | if (!card) | 245 | if (error < 0) |
246 | return -EINVAL; | 246 | return error; |
247 | 247 | ||
248 | if (mpu_port[n] == SNDRV_AUTO_PORT) | 248 | if (mpu_port[n] == SNDRV_AUTO_PORT) |
249 | mpu_port[n] = 0; | 249 | mpu_port[n] = 0; |
diff --git a/sound/isa/gus/gusmax.c b/sound/isa/gus/gusmax.c index f94c1976e632..f26eac8d8110 100644 --- a/sound/isa/gus/gusmax.c +++ b/sound/isa/gus/gusmax.c | |||
@@ -214,10 +214,10 @@ static int __devinit snd_gusmax_probe(struct device *pdev, unsigned int dev) | |||
214 | struct snd_wss *wss; | 214 | struct snd_wss *wss; |
215 | struct snd_gusmax *maxcard; | 215 | struct snd_gusmax *maxcard; |
216 | 216 | ||
217 | card = snd_card_new(index[dev], id[dev], THIS_MODULE, | 217 | err = snd_card_create(index[dev], id[dev], THIS_MODULE, |
218 | sizeof(struct snd_gusmax)); | 218 | sizeof(struct snd_gusmax), &card); |
219 | if (card == NULL) | 219 | if (err < 0) |
220 | return -ENOMEM; | 220 | return err; |
221 | card->private_free = snd_gusmax_free; | 221 | card->private_free = snd_gusmax_free; |
222 | maxcard = (struct snd_gusmax *)card->private_data; | 222 | maxcard = (struct snd_gusmax *)card->private_data; |
223 | maxcard->card = card; | 223 | maxcard->card = card; |
diff --git a/sound/isa/gus/interwave.c b/sound/isa/gus/interwave.c index 5faecfb602d3..50e429a120da 100644 --- a/sound/isa/gus/interwave.c +++ b/sound/isa/gus/interwave.c | |||
@@ -626,20 +626,22 @@ static void snd_interwave_free(struct snd_card *card) | |||
626 | free_irq(iwcard->irq, (void *)iwcard); | 626 | free_irq(iwcard->irq, (void *)iwcard); |
627 | } | 627 | } |
628 | 628 | ||
629 | static struct snd_card *snd_interwave_card_new(int dev) | 629 | static int snd_interwave_card_new(int dev, struct snd_card **cardp) |
630 | { | 630 | { |
631 | struct snd_card *card; | 631 | struct snd_card *card; |
632 | struct snd_interwave *iwcard; | 632 | struct snd_interwave *iwcard; |
633 | int err; | ||
633 | 634 | ||
634 | card = snd_card_new(index[dev], id[dev], THIS_MODULE, | 635 | err = snd_card_create(index[dev], id[dev], THIS_MODULE, |
635 | sizeof(struct snd_interwave)); | 636 | sizeof(struct snd_interwave), &card); |
636 | if (card == NULL) | 637 | if (err < 0) |
637 | return NULL; | 638 | return err; |
638 | iwcard = card->private_data; | 639 | iwcard = card->private_data; |
639 | iwcard->card = card; | 640 | iwcard->card = card; |
640 | iwcard->irq = -1; | 641 | iwcard->irq = -1; |
641 | card->private_free = snd_interwave_free; | 642 | card->private_free = snd_interwave_free; |
642 | return card; | 643 | *cardp = card; |
644 | return 0; | ||
643 | } | 645 | } |
644 | 646 | ||
645 | static int __devinit snd_interwave_probe(struct snd_card *card, int dev) | 647 | static int __devinit snd_interwave_probe(struct snd_card *card, int dev) |
@@ -778,9 +780,9 @@ static int __devinit snd_interwave_isa_probe1(int dev, struct device *devptr) | |||
778 | struct snd_card *card; | 780 | struct snd_card *card; |
779 | int err; | 781 | int err; |
780 | 782 | ||
781 | card = snd_interwave_card_new(dev); | 783 | err = snd_interwave_card_new(dev, &card); |
782 | if (! card) | 784 | if (err < 0) |
783 | return -ENOMEM; | 785 | return err; |
784 | 786 | ||
785 | snd_card_set_dev(card, devptr); | 787 | snd_card_set_dev(card, devptr); |
786 | if ((err = snd_interwave_probe(card, dev)) < 0) { | 788 | if ((err = snd_interwave_probe(card, dev)) < 0) { |
@@ -876,9 +878,9 @@ static int __devinit snd_interwave_pnp_detect(struct pnp_card_link *pcard, | |||
876 | if (dev >= SNDRV_CARDS) | 878 | if (dev >= SNDRV_CARDS) |
877 | return -ENODEV; | 879 | return -ENODEV; |
878 | 880 | ||
879 | card = snd_interwave_card_new(dev); | 881 | res = snd_interwave_card_new(dev, &card); |
880 | if (! card) | 882 | if (res < 0) |
881 | return -ENOMEM; | 883 | return res; |
882 | 884 | ||
883 | if ((res = snd_interwave_pnp(dev, card->private_data, pcard, pid)) < 0) { | 885 | if ((res = snd_interwave_pnp(dev, card->private_data, pcard, pid)) < 0) { |
884 | snd_card_free(card); | 886 | snd_card_free(card); |
diff --git a/sound/isa/opl3sa2.c b/sound/isa/opl3sa2.c index 58c972b2af03..63e51373ddc7 100644 --- a/sound/isa/opl3sa2.c +++ b/sound/isa/opl3sa2.c | |||
@@ -550,21 +550,27 @@ static int __devinit snd_opl3sa2_mixer(struct snd_card *card) | |||
550 | #ifdef CONFIG_PM | 550 | #ifdef CONFIG_PM |
551 | static int snd_opl3sa2_suspend(struct snd_card *card, pm_message_t state) | 551 | static int snd_opl3sa2_suspend(struct snd_card *card, pm_message_t state) |
552 | { | 552 | { |
553 | struct snd_opl3sa2 *chip = card->private_data; | 553 | if (card) { |
554 | struct snd_opl3sa2 *chip = card->private_data; | ||
554 | 555 | ||
555 | snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); | 556 | snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); |
556 | chip->wss->suspend(chip->wss); | 557 | chip->wss->suspend(chip->wss); |
557 | /* power down */ | 558 | /* power down */ |
558 | snd_opl3sa2_write(chip, OPL3SA2_PM_CTRL, OPL3SA2_PM_D3); | 559 | snd_opl3sa2_write(chip, OPL3SA2_PM_CTRL, OPL3SA2_PM_D3); |
560 | } | ||
559 | 561 | ||
560 | return 0; | 562 | return 0; |
561 | } | 563 | } |
562 | 564 | ||
563 | static int snd_opl3sa2_resume(struct snd_card *card) | 565 | static int snd_opl3sa2_resume(struct snd_card *card) |
564 | { | 566 | { |
565 | struct snd_opl3sa2 *chip = card->private_data; | 567 | struct snd_opl3sa2 *chip; |
566 | int i; | 568 | int i; |
567 | 569 | ||
570 | if (!card) | ||
571 | return 0; | ||
572 | |||
573 | chip = card->private_data; | ||
568 | /* power up */ | 574 | /* power up */ |
569 | snd_opl3sa2_write(chip, OPL3SA2_PM_CTRL, OPL3SA2_PM_D0); | 575 | snd_opl3sa2_write(chip, OPL3SA2_PM_CTRL, OPL3SA2_PM_D0); |
570 | 576 | ||
@@ -617,21 +623,24 @@ static void snd_opl3sa2_free(struct snd_card *card) | |||
617 | release_and_free_resource(chip->res_port); | 623 | release_and_free_resource(chip->res_port); |
618 | } | 624 | } |
619 | 625 | ||
620 | static struct snd_card *snd_opl3sa2_card_new(int dev) | 626 | static int snd_opl3sa2_card_new(int dev, struct snd_card **cardp) |
621 | { | 627 | { |
622 | struct snd_card *card; | 628 | struct snd_card *card; |
623 | struct snd_opl3sa2 *chip; | 629 | struct snd_opl3sa2 *chip; |
630 | int err; | ||
624 | 631 | ||
625 | card = snd_card_new(index[dev], id[dev], THIS_MODULE, sizeof(struct snd_opl3sa2)); | 632 | err = snd_card_create(index[dev], id[dev], THIS_MODULE, |
626 | if (card == NULL) | 633 | sizeof(struct snd_opl3sa2), &card); |
627 | return NULL; | 634 | if (err < 0) |
635 | return err; | ||
628 | strcpy(card->driver, "OPL3SA2"); | 636 | strcpy(card->driver, "OPL3SA2"); |
629 | strcpy(card->shortname, "Yamaha OPL3-SA2"); | 637 | strcpy(card->shortname, "Yamaha OPL3-SA2"); |
630 | chip = card->private_data; | 638 | chip = card->private_data; |
631 | spin_lock_init(&chip->reg_lock); | 639 | spin_lock_init(&chip->reg_lock); |
632 | chip->irq = -1; | 640 | chip->irq = -1; |
633 | card->private_free = snd_opl3sa2_free; | 641 | card->private_free = snd_opl3sa2_free; |
634 | return card; | 642 | *cardp = card; |
643 | return 0; | ||
635 | } | 644 | } |
636 | 645 | ||
637 | static int __devinit snd_opl3sa2_probe(struct snd_card *card, int dev) | 646 | static int __devinit snd_opl3sa2_probe(struct snd_card *card, int dev) |
@@ -723,9 +732,9 @@ static int __devinit snd_opl3sa2_pnp_detect(struct pnp_dev *pdev, | |||
723 | if (dev >= SNDRV_CARDS) | 732 | if (dev >= SNDRV_CARDS) |
724 | return -ENODEV; | 733 | return -ENODEV; |
725 | 734 | ||
726 | card = snd_opl3sa2_card_new(dev); | 735 | err = snd_opl3sa2_card_new(dev, &card); |
727 | if (! card) | 736 | if (err < 0) |
728 | return -ENOMEM; | 737 | return err; |
729 | if ((err = snd_opl3sa2_pnp(dev, card->private_data, pdev)) < 0) { | 738 | if ((err = snd_opl3sa2_pnp(dev, card->private_data, pdev)) < 0) { |
730 | snd_card_free(card); | 739 | snd_card_free(card); |
731 | return err; | 740 | return err; |
@@ -789,9 +798,9 @@ static int __devinit snd_opl3sa2_pnp_cdetect(struct pnp_card_link *pcard, | |||
789 | if (dev >= SNDRV_CARDS) | 798 | if (dev >= SNDRV_CARDS) |
790 | return -ENODEV; | 799 | return -ENODEV; |
791 | 800 | ||
792 | card = snd_opl3sa2_card_new(dev); | 801 | err = snd_opl3sa2_card_new(dev, &card); |
793 | if (! card) | 802 | if (err < 0) |
794 | return -ENOMEM; | 803 | return err; |
795 | if ((err = snd_opl3sa2_pnp(dev, card->private_data, pdev)) < 0) { | 804 | if ((err = snd_opl3sa2_pnp(dev, card->private_data, pdev)) < 0) { |
796 | snd_card_free(card); | 805 | snd_card_free(card); |
797 | return err; | 806 | return err; |
@@ -870,9 +879,9 @@ static int __devinit snd_opl3sa2_isa_probe(struct device *pdev, | |||
870 | struct snd_card *card; | 879 | struct snd_card *card; |
871 | int err; | 880 | int err; |
872 | 881 | ||
873 | card = snd_opl3sa2_card_new(dev); | 882 | err = snd_opl3sa2_card_new(dev, &card); |
874 | if (! card) | 883 | if (err < 0) |
875 | return -ENOMEM; | 884 | return err; |
876 | snd_card_set_dev(card, pdev); | 885 | snd_card_set_dev(card, pdev); |
877 | if ((err = snd_opl3sa2_probe(card, dev)) < 0) { | 886 | if ((err = snd_opl3sa2_probe(card, dev)) < 0) { |
878 | snd_card_free(card); | 887 | snd_card_free(card); |
diff --git a/sound/isa/opti9xx/miro.c b/sound/isa/opti9xx/miro.c index 440755cc0013..02e30d7c6a93 100644 --- a/sound/isa/opti9xx/miro.c +++ b/sound/isa/opti9xx/miro.c | |||
@@ -1228,9 +1228,10 @@ static int __devinit snd_miro_probe(struct device *devptr, unsigned int n) | |||
1228 | struct snd_pcm *pcm; | 1228 | struct snd_pcm *pcm; |
1229 | struct snd_rawmidi *rmidi; | 1229 | struct snd_rawmidi *rmidi; |
1230 | 1230 | ||
1231 | if (!(card = snd_card_new(index, id, THIS_MODULE, | 1231 | error = snd_card_create(index, id, THIS_MODULE, |
1232 | sizeof(struct snd_miro)))) | 1232 | sizeof(struct snd_miro), &card); |
1233 | return -ENOMEM; | 1233 | if (error < 0) |
1234 | return error; | ||
1234 | 1235 | ||
1235 | card->private_free = snd_card_miro_free; | 1236 | card->private_free = snd_card_miro_free; |
1236 | miro = card->private_data; | 1237 | miro = card->private_data; |
diff --git a/sound/isa/opti9xx/opti92x-ad1848.c b/sound/isa/opti9xx/opti92x-ad1848.c index 19706b0d8497..cd6e60a6a4ea 100644 --- a/sound/isa/opti9xx/opti92x-ad1848.c +++ b/sound/isa/opti9xx/opti92x-ad1848.c | |||
@@ -830,15 +830,18 @@ static int __devinit snd_opti9xx_probe(struct snd_card *card) | |||
830 | return snd_card_register(card); | 830 | return snd_card_register(card); |
831 | } | 831 | } |
832 | 832 | ||
833 | static struct snd_card *snd_opti9xx_card_new(void) | 833 | static int snd_opti9xx_card_new(struct snd_card **cardp) |
834 | { | 834 | { |
835 | struct snd_card *card; | 835 | struct snd_card *card; |
836 | int err; | ||
836 | 837 | ||
837 | card = snd_card_new(index, id, THIS_MODULE, sizeof(struct snd_opti9xx)); | 838 | err = snd_card_create(index, id, THIS_MODULE, |
838 | if (! card) | 839 | sizeof(struct snd_opti9xx), &card); |
839 | return NULL; | 840 | if (err < 0) |
841 | return err; | ||
840 | card->private_free = snd_card_opti9xx_free; | 842 | card->private_free = snd_card_opti9xx_free; |
841 | return card; | 843 | *cardp = card; |
844 | return 0; | ||
842 | } | 845 | } |
843 | 846 | ||
844 | static int __devinit snd_opti9xx_isa_match(struct device *devptr, | 847 | static int __devinit snd_opti9xx_isa_match(struct device *devptr, |
@@ -903,9 +906,9 @@ static int __devinit snd_opti9xx_isa_probe(struct device *devptr, | |||
903 | } | 906 | } |
904 | #endif | 907 | #endif |
905 | 908 | ||
906 | card = snd_opti9xx_card_new(); | 909 | error = snd_opti9xx_card_new(&card); |
907 | if (! card) | 910 | if (error < 0) |
908 | return -ENOMEM; | 911 | return error; |
909 | 912 | ||
910 | if ((error = snd_card_opti9xx_detect(card, card->private_data)) < 0) { | 913 | if ((error = snd_card_opti9xx_detect(card, card->private_data)) < 0) { |
911 | snd_card_free(card); | 914 | snd_card_free(card); |
@@ -950,9 +953,9 @@ static int __devinit snd_opti9xx_pnp_probe(struct pnp_card_link *pcard, | |||
950 | return -EBUSY; | 953 | return -EBUSY; |
951 | if (! isapnp) | 954 | if (! isapnp) |
952 | return -ENODEV; | 955 | return -ENODEV; |
953 | card = snd_opti9xx_card_new(); | 956 | error = snd_opti9xx_card_new(&card); |
954 | if (! card) | 957 | if (error < 0) |
955 | return -ENOMEM; | 958 | return error; |
956 | chip = card->private_data; | 959 | chip = card->private_data; |
957 | 960 | ||
958 | hw = snd_card_opti9xx_pnp(chip, pcard, pid); | 961 | hw = snd_card_opti9xx_pnp(chip, pcard, pid); |
diff --git a/sound/isa/sb/es968.c b/sound/isa/sb/es968.c index c8c8e214c843..cafc3a7316a8 100644 --- a/sound/isa/sb/es968.c +++ b/sound/isa/sb/es968.c | |||
@@ -108,9 +108,10 @@ static int __devinit snd_card_es968_probe(int dev, | |||
108 | struct snd_card *card; | 108 | struct snd_card *card; |
109 | struct snd_card_es968 *acard; | 109 | struct snd_card_es968 *acard; |
110 | 110 | ||
111 | if ((card = snd_card_new(index[dev], id[dev], THIS_MODULE, | 111 | error = snd_card_create(index[dev], id[dev], THIS_MODULE, |
112 | sizeof(struct snd_card_es968))) == NULL) | 112 | sizeof(struct snd_card_es968), &card); |
113 | return -ENOMEM; | 113 | if (error < 0) |
114 | return error; | ||
114 | acard = card->private_data; | 115 | acard = card->private_data; |
115 | if ((error = snd_card_es968_pnp(dev, acard, pcard, pid))) { | 116 | if ((error = snd_card_es968_pnp(dev, acard, pcard, pid))) { |
116 | snd_card_free(card); | 117 | snd_card_free(card); |
diff --git a/sound/isa/sb/sb16.c b/sound/isa/sb/sb16.c index 2c201f78ce50..519c36346dec 100644 --- a/sound/isa/sb/sb16.c +++ b/sound/isa/sb/sb16.c | |||
@@ -324,14 +324,18 @@ static void snd_sb16_free(struct snd_card *card) | |||
324 | #define is_isapnp_selected(dev) 0 | 324 | #define is_isapnp_selected(dev) 0 |
325 | #endif | 325 | #endif |
326 | 326 | ||
327 | static struct snd_card *snd_sb16_card_new(int dev) | 327 | static int snd_sb16_card_new(int dev, struct snd_card **cardp) |
328 | { | 328 | { |
329 | struct snd_card *card = snd_card_new(index[dev], id[dev], THIS_MODULE, | 329 | struct snd_card *card; |
330 | sizeof(struct snd_card_sb16)); | 330 | int err; |
331 | if (card == NULL) | 331 | |
332 | return NULL; | 332 | err = snd_card_create(index[dev], id[dev], THIS_MODULE, |
333 | sizeof(struct snd_card_sb16), &card); | ||
334 | if (err < 0) | ||
335 | return err; | ||
333 | card->private_free = snd_sb16_free; | 336 | card->private_free = snd_sb16_free; |
334 | return card; | 337 | *cardp = card; |
338 | return 0; | ||
335 | } | 339 | } |
336 | 340 | ||
337 | static int __devinit snd_sb16_probe(struct snd_card *card, int dev) | 341 | static int __devinit snd_sb16_probe(struct snd_card *card, int dev) |
@@ -489,9 +493,9 @@ static int __devinit snd_sb16_isa_probe1(int dev, struct device *pdev) | |||
489 | struct snd_card *card; | 493 | struct snd_card *card; |
490 | int err; | 494 | int err; |
491 | 495 | ||
492 | card = snd_sb16_card_new(dev); | 496 | err = snd_sb16_card_new(dev, &card); |
493 | if (! card) | 497 | if (err < 0) |
494 | return -ENOMEM; | 498 | return err; |
495 | 499 | ||
496 | acard = card->private_data; | 500 | acard = card->private_data; |
497 | /* non-PnP FM port address is hardwired with base port address */ | 501 | /* non-PnP FM port address is hardwired with base port address */ |
@@ -610,9 +614,9 @@ static int __devinit snd_sb16_pnp_detect(struct pnp_card_link *pcard, | |||
610 | for ( ; dev < SNDRV_CARDS; dev++) { | 614 | for ( ; dev < SNDRV_CARDS; dev++) { |
611 | if (!enable[dev] || !isapnp[dev]) | 615 | if (!enable[dev] || !isapnp[dev]) |
612 | continue; | 616 | continue; |
613 | card = snd_sb16_card_new(dev); | 617 | res = snd_sb16_card_new(dev, &card); |
614 | if (! card) | 618 | if (res < 0) |
615 | return -ENOMEM; | 619 | return res; |
616 | snd_card_set_dev(card, &pcard->card->dev); | 620 | snd_card_set_dev(card, &pcard->card->dev); |
617 | if ((res = snd_card_sb16_pnp(dev, card->private_data, pcard, pid)) < 0 || | 621 | if ((res = snd_card_sb16_pnp(dev, card->private_data, pcard, pid)) < 0 || |
618 | (res = snd_sb16_probe(card, dev)) < 0) { | 622 | (res = snd_sb16_probe(card, dev)) < 0) { |
diff --git a/sound/isa/sb/sb8.c b/sound/isa/sb/sb8.c index ea06877be4b1..3cd57ee54660 100644 --- a/sound/isa/sb/sb8.c +++ b/sound/isa/sb/sb8.c | |||
@@ -103,10 +103,10 @@ static int __devinit snd_sb8_probe(struct device *pdev, unsigned int dev) | |||
103 | struct snd_opl3 *opl3; | 103 | struct snd_opl3 *opl3; |
104 | int err; | 104 | int err; |
105 | 105 | ||
106 | card = snd_card_new(index[dev], id[dev], THIS_MODULE, | 106 | err = snd_card_create(index[dev], id[dev], THIS_MODULE, |
107 | sizeof(struct snd_sb8)); | 107 | sizeof(struct snd_sb8), &card); |
108 | if (card == NULL) | 108 | if (err < 0) |
109 | return -ENOMEM; | 109 | return err; |
110 | acard = card->private_data; | 110 | acard = card->private_data; |
111 | card->private_free = snd_sb8_free; | 111 | card->private_free = snd_sb8_free; |
112 | 112 | ||
diff --git a/sound/isa/sc6000.c b/sound/isa/sc6000.c index ca35924dc3b3..7a1470376c6d 100644 --- a/sound/isa/sc6000.c +++ b/sound/isa/sc6000.c | |||
@@ -489,9 +489,9 @@ static int __devinit snd_sc6000_probe(struct device *devptr, unsigned int dev) | |||
489 | char __iomem *vmss_port; | 489 | char __iomem *vmss_port; |
490 | 490 | ||
491 | 491 | ||
492 | card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); | 492 | err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card); |
493 | if (!card) | 493 | if (err < 0) |
494 | return -ENOMEM; | 494 | return err; |
495 | 495 | ||
496 | if (xirq == SNDRV_AUTO_IRQ) { | 496 | if (xirq == SNDRV_AUTO_IRQ) { |
497 | xirq = snd_legacy_find_free_irq(possible_irqs); | 497 | xirq = snd_legacy_find_free_irq(possible_irqs); |
diff --git a/sound/isa/sgalaxy.c b/sound/isa/sgalaxy.c index 2c7503bf1271..6fe27b9d9440 100644 --- a/sound/isa/sgalaxy.c +++ b/sound/isa/sgalaxy.c | |||
@@ -243,9 +243,9 @@ static int __devinit snd_sgalaxy_probe(struct device *devptr, unsigned int dev) | |||
243 | struct snd_card *card; | 243 | struct snd_card *card; |
244 | struct snd_wss *chip; | 244 | struct snd_wss *chip; |
245 | 245 | ||
246 | card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); | 246 | err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card); |
247 | if (card == NULL) | 247 | if (err < 0) |
248 | return -ENOMEM; | 248 | return err; |
249 | 249 | ||
250 | xirq = irq[dev]; | 250 | xirq = irq[dev]; |
251 | if (xirq == SNDRV_AUTO_IRQ) { | 251 | if (xirq == SNDRV_AUTO_IRQ) { |
diff --git a/sound/isa/sscape.c b/sound/isa/sscape.c index 48a16d865834..4025fb558c50 100644 --- a/sound/isa/sscape.c +++ b/sound/isa/sscape.c | |||
@@ -1357,10 +1357,10 @@ static int __devinit snd_sscape_probe(struct device *pdev, unsigned int dev) | |||
1357 | struct soundscape *sscape; | 1357 | struct soundscape *sscape; |
1358 | int ret; | 1358 | int ret; |
1359 | 1359 | ||
1360 | card = snd_card_new(index[dev], id[dev], THIS_MODULE, | 1360 | ret = snd_card_create(index[dev], id[dev], THIS_MODULE, |
1361 | sizeof(struct soundscape)); | 1361 | sizeof(struct soundscape), &card); |
1362 | if (!card) | 1362 | if (ret < 0) |
1363 | return -ENOMEM; | 1363 | return ret; |
1364 | 1364 | ||
1365 | sscape = get_card_soundscape(card); | 1365 | sscape = get_card_soundscape(card); |
1366 | sscape->type = SSCAPE; | 1366 | sscape->type = SSCAPE; |
@@ -1462,10 +1462,10 @@ static int __devinit sscape_pnp_detect(struct pnp_card_link *pcard, | |||
1462 | * Create a new ALSA sound card entry, in anticipation | 1462 | * Create a new ALSA sound card entry, in anticipation |
1463 | * of detecting our hardware ... | 1463 | * of detecting our hardware ... |
1464 | */ | 1464 | */ |
1465 | card = snd_card_new(index[idx], id[idx], THIS_MODULE, | 1465 | ret = snd_card_create(index[idx], id[idx], THIS_MODULE, |
1466 | sizeof(struct soundscape)); | 1466 | sizeof(struct soundscape), &card); |
1467 | if (!card) | 1467 | if (ret < 0) |
1468 | return -ENOMEM; | 1468 | return ret; |
1469 | 1469 | ||
1470 | sscape = get_card_soundscape(card); | 1470 | sscape = get_card_soundscape(card); |
1471 | 1471 | ||
diff --git a/sound/isa/wavefront/wavefront.c b/sound/isa/wavefront/wavefront.c index 4c095bc7c729..95898b2b7b58 100644 --- a/sound/isa/wavefront/wavefront.c +++ b/sound/isa/wavefront/wavefront.c | |||
@@ -338,15 +338,16 @@ snd_wavefront_free(struct snd_card *card) | |||
338 | } | 338 | } |
339 | } | 339 | } |
340 | 340 | ||
341 | static struct snd_card *snd_wavefront_card_new(int dev) | 341 | static int snd_wavefront_card_new(int dev, struct snd_card **cardp) |
342 | { | 342 | { |
343 | struct snd_card *card; | 343 | struct snd_card *card; |
344 | snd_wavefront_card_t *acard; | 344 | snd_wavefront_card_t *acard; |
345 | int err; | ||
345 | 346 | ||
346 | card = snd_card_new (index[dev], id[dev], THIS_MODULE, | 347 | err = snd_card_create(index[dev], id[dev], THIS_MODULE, |
347 | sizeof(snd_wavefront_card_t)); | 348 | sizeof(snd_wavefront_card_t), &card); |
348 | if (card == NULL) | 349 | if (err < 0) |
349 | return NULL; | 350 | return err; |
350 | 351 | ||
351 | acard = card->private_data; | 352 | acard = card->private_data; |
352 | acard->wavefront.irq = -1; | 353 | acard->wavefront.irq = -1; |
@@ -357,7 +358,8 @@ static struct snd_card *snd_wavefront_card_new(int dev) | |||
357 | acard->wavefront.card = card; | 358 | acard->wavefront.card = card; |
358 | card->private_free = snd_wavefront_free; | 359 | card->private_free = snd_wavefront_free; |
359 | 360 | ||
360 | return card; | 361 | *cardp = card; |
362 | return 0; | ||
361 | } | 363 | } |
362 | 364 | ||
363 | static int __devinit | 365 | static int __devinit |
@@ -567,9 +569,9 @@ static int __devinit snd_wavefront_isa_probe(struct device *pdev, | |||
567 | struct snd_card *card; | 569 | struct snd_card *card; |
568 | int err; | 570 | int err; |
569 | 571 | ||
570 | card = snd_wavefront_card_new(dev); | 572 | err = snd_wavefront_card_new(dev, &card); |
571 | if (! card) | 573 | if (err < 0) |
572 | return -ENOMEM; | 574 | return err; |
573 | snd_card_set_dev(card, pdev); | 575 | snd_card_set_dev(card, pdev); |
574 | if ((err = snd_wavefront_probe(card, dev)) < 0) { | 576 | if ((err = snd_wavefront_probe(card, dev)) < 0) { |
575 | snd_card_free(card); | 577 | snd_card_free(card); |
@@ -616,9 +618,9 @@ static int __devinit snd_wavefront_pnp_detect(struct pnp_card_link *pcard, | |||
616 | if (dev >= SNDRV_CARDS) | 618 | if (dev >= SNDRV_CARDS) |
617 | return -ENODEV; | 619 | return -ENODEV; |
618 | 620 | ||
619 | card = snd_wavefront_card_new(dev); | 621 | res = snd_wavefront_card_new(dev, &card); |
620 | if (! card) | 622 | if (res < 0) |
621 | return -ENOMEM; | 623 | return res; |
622 | 624 | ||
623 | if (snd_wavefront_pnp (dev, card->private_data, pcard, pid) < 0) { | 625 | if (snd_wavefront_pnp (dev, card->private_data, pcard, pid) < 0) { |
624 | if (cs4232_pcm_port[dev] == SNDRV_AUTO_PORT) { | 626 | if (cs4232_pcm_port[dev] == SNDRV_AUTO_PORT) { |
diff --git a/sound/mips/au1x00.c b/sound/mips/au1x00.c index 7c1afc96ab87..3e763d6a5d67 100644 --- a/sound/mips/au1x00.c +++ b/sound/mips/au1x00.c | |||
@@ -636,9 +636,10 @@ au1000_init(void) | |||
636 | struct snd_card *card; | 636 | struct snd_card *card; |
637 | struct snd_au1000 *au1000; | 637 | struct snd_au1000 *au1000; |
638 | 638 | ||
639 | card = snd_card_new(-1, "AC97", THIS_MODULE, sizeof(struct snd_au1000)); | 639 | err = snd_card_create(-1, "AC97", THIS_MODULE, |
640 | if (card == NULL) | 640 | sizeof(struct snd_au1000), &card); |
641 | return -ENOMEM; | 641 | if (err < 0) |
642 | return err; | ||
642 | 643 | ||
643 | card->private_free = snd_au1000_free; | 644 | card->private_free = snd_au1000_free; |
644 | au1000 = card->private_data; | 645 | au1000 = card->private_data; |
diff --git a/sound/mips/hal2.c b/sound/mips/hal2.c index db495be01861..c52691c2fc46 100644 --- a/sound/mips/hal2.c +++ b/sound/mips/hal2.c | |||
@@ -878,9 +878,9 @@ static int __devinit hal2_probe(struct platform_device *pdev) | |||
878 | struct snd_hal2 *chip; | 878 | struct snd_hal2 *chip; |
879 | int err; | 879 | int err; |
880 | 880 | ||
881 | card = snd_card_new(index, id, THIS_MODULE, 0); | 881 | err = snd_card_create(index, id, THIS_MODULE, 0, &card); |
882 | if (card == NULL) | 882 | if (err < 0) |
883 | return -ENOMEM; | 883 | return err; |
884 | 884 | ||
885 | err = hal2_create(card, &chip); | 885 | err = hal2_create(card, &chip); |
886 | if (err < 0) { | 886 | if (err < 0) { |
diff --git a/sound/mips/sgio2audio.c b/sound/mips/sgio2audio.c index 4c63504348dc..66f3b48ceafc 100644 --- a/sound/mips/sgio2audio.c +++ b/sound/mips/sgio2audio.c | |||
@@ -936,9 +936,9 @@ static int __devinit snd_sgio2audio_probe(struct platform_device *pdev) | |||
936 | struct snd_sgio2audio *chip; | 936 | struct snd_sgio2audio *chip; |
937 | int err; | 937 | int err; |
938 | 938 | ||
939 | card = snd_card_new(index, id, THIS_MODULE, 0); | 939 | err = snd_card_create(index, id, THIS_MODULE, 0, &card); |
940 | if (card == NULL) | 940 | if (err < 0) |
941 | return -ENOMEM; | 941 | return err; |
942 | 942 | ||
943 | err = snd_sgio2audio_create(card, &chip); | 943 | err = snd_sgio2audio_create(card, &chip); |
944 | if (err < 0) { | 944 | if (err < 0) { |
diff --git a/sound/oss/dmasound/dmasound_atari.c b/sound/oss/dmasound/dmasound_atari.c index 57d9f154c88b..38931f2f6967 100644 --- a/sound/oss/dmasound/dmasound_atari.c +++ b/sound/oss/dmasound/dmasound_atari.c | |||
@@ -847,23 +847,23 @@ static int __init AtaIrqInit(void) | |||
847 | of events. So all we need to keep the music playing is | 847 | of events. So all we need to keep the music playing is |
848 | to provide the sound hardware with new data upon | 848 | to provide the sound hardware with new data upon |
849 | an interrupt from timer A. */ | 849 | an interrupt from timer A. */ |
850 | mfp.tim_ct_a = 0; /* ++roman: Stop timer before programming! */ | 850 | st_mfp.tim_ct_a = 0; /* ++roman: Stop timer before programming! */ |
851 | mfp.tim_dt_a = 1; /* Cause interrupt after first event. */ | 851 | st_mfp.tim_dt_a = 1; /* Cause interrupt after first event. */ |
852 | mfp.tim_ct_a = 8; /* Turn on event counting. */ | 852 | st_mfp.tim_ct_a = 8; /* Turn on event counting. */ |
853 | /* Register interrupt handler. */ | 853 | /* Register interrupt handler. */ |
854 | if (request_irq(IRQ_MFP_TIMA, AtaInterrupt, IRQ_TYPE_SLOW, "DMA sound", | 854 | if (request_irq(IRQ_MFP_TIMA, AtaInterrupt, IRQ_TYPE_SLOW, "DMA sound", |
855 | AtaInterrupt)) | 855 | AtaInterrupt)) |
856 | return 0; | 856 | return 0; |
857 | mfp.int_en_a |= 0x20; /* Turn interrupt on. */ | 857 | st_mfp.int_en_a |= 0x20; /* Turn interrupt on. */ |
858 | mfp.int_mk_a |= 0x20; | 858 | st_mfp.int_mk_a |= 0x20; |
859 | return 1; | 859 | return 1; |
860 | } | 860 | } |
861 | 861 | ||
862 | #ifdef MODULE | 862 | #ifdef MODULE |
863 | static void AtaIrqCleanUp(void) | 863 | static void AtaIrqCleanUp(void) |
864 | { | 864 | { |
865 | mfp.tim_ct_a = 0; /* stop timer */ | 865 | st_mfp.tim_ct_a = 0; /* stop timer */ |
866 | mfp.int_en_a &= ~0x20; /* turn interrupt off */ | 866 | st_mfp.int_en_a &= ~0x20; /* turn interrupt off */ |
867 | free_irq(IRQ_MFP_TIMA, AtaInterrupt); | 867 | free_irq(IRQ_MFP_TIMA, AtaInterrupt); |
868 | } | 868 | } |
869 | #endif /* MODULE */ | 869 | #endif /* MODULE */ |
@@ -1599,7 +1599,7 @@ static int __init dmasound_atari_init(void) | |||
1599 | is_falcon = 0; | 1599 | is_falcon = 0; |
1600 | } else | 1600 | } else |
1601 | return -ENODEV; | 1601 | return -ENODEV; |
1602 | if ((mfp.int_en_a & mfp.int_mk_a & 0x20) == 0) | 1602 | if ((st_mfp.int_en_a & st_mfp.int_mk_a & 0x20) == 0) |
1603 | return dmasound_init(); | 1603 | return dmasound_init(); |
1604 | else { | 1604 | else { |
1605 | printk("DMA sound driver: Timer A interrupt already in use\n"); | 1605 | printk("DMA sound driver: Timer A interrupt already in use\n"); |
diff --git a/sound/parisc/harmony.c b/sound/parisc/harmony.c index 41f870f8a11d..6055fd6d3b38 100644 --- a/sound/parisc/harmony.c +++ b/sound/parisc/harmony.c | |||
@@ -975,9 +975,9 @@ snd_harmony_probe(struct parisc_device *padev) | |||
975 | struct snd_card *card; | 975 | struct snd_card *card; |
976 | struct snd_harmony *h; | 976 | struct snd_harmony *h; |
977 | 977 | ||
978 | card = snd_card_new(index, id, THIS_MODULE, 0); | 978 | err = snd_card_create(index, id, THIS_MODULE, 0, &card); |
979 | if (card == NULL) | 979 | if (err < 0) |
980 | return -ENOMEM; | 980 | return err; |
981 | 981 | ||
982 | err = snd_harmony_create(card, padev, &h); | 982 | err = snd_harmony_create(card, padev, &h); |
983 | if (err < 0) | 983 | if (err < 0) |
diff --git a/sound/pci/ad1889.c b/sound/pci/ad1889.c index a7f38e63303f..d1f242bd0ac5 100644 --- a/sound/pci/ad1889.c +++ b/sound/pci/ad1889.c | |||
@@ -995,10 +995,10 @@ snd_ad1889_probe(struct pci_dev *pci, | |||
995 | } | 995 | } |
996 | 996 | ||
997 | /* (2) */ | 997 | /* (2) */ |
998 | card = snd_card_new(index[devno], id[devno], THIS_MODULE, 0); | 998 | err = snd_card_create(index[devno], id[devno], THIS_MODULE, 0, &card); |
999 | /* XXX REVISIT: we can probably allocate chip in this call */ | 999 | /* XXX REVISIT: we can probably allocate chip in this call */ |
1000 | if (card == NULL) | 1000 | if (err < 0) |
1001 | return -ENOMEM; | 1001 | return err; |
1002 | 1002 | ||
1003 | strcpy(card->driver, "AD1889"); | 1003 | strcpy(card->driver, "AD1889"); |
1004 | strcpy(card->shortname, "Analog Devices AD1889"); | 1004 | strcpy(card->shortname, "Analog Devices AD1889"); |
diff --git a/sound/pci/ali5451/ali5451.c b/sound/pci/ali5451/ali5451.c index 9069c78c2dc7..4edf270a7809 100644 --- a/sound/pci/ali5451/ali5451.c +++ b/sound/pci/ali5451/ali5451.c | |||
@@ -2307,9 +2307,9 @@ static int __devinit snd_ali_probe(struct pci_dev *pci, | |||
2307 | 2307 | ||
2308 | snd_ali_printk("probe ...\n"); | 2308 | snd_ali_printk("probe ...\n"); |
2309 | 2309 | ||
2310 | card = snd_card_new(index, id, THIS_MODULE, 0); | 2310 | err = snd_card_create(index, id, THIS_MODULE, 0, &card); |
2311 | if (!card) | 2311 | if (err < 0) |
2312 | return -ENOMEM; | 2312 | return err; |
2313 | 2313 | ||
2314 | err = snd_ali_create(card, pci, pcm_channels, spdif, &codec); | 2314 | err = snd_ali_create(card, pci, pcm_channels, spdif, &codec); |
2315 | if (err < 0) | 2315 | if (err < 0) |
diff --git a/sound/pci/als300.c b/sound/pci/als300.c index a2c35c1081c3..009b4c8225a5 100644 --- a/sound/pci/als300.c +++ b/sound/pci/als300.c | |||
@@ -812,10 +812,10 @@ static int __devinit snd_als300_probe(struct pci_dev *pci, | |||
812 | return -ENOENT; | 812 | return -ENOENT; |
813 | } | 813 | } |
814 | 814 | ||
815 | card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); | 815 | err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card); |
816 | 816 | ||
817 | if (card == NULL) | 817 | if (err < 0) |
818 | return -ENOMEM; | 818 | return err; |
819 | 819 | ||
820 | chip_type = pci_id->driver_data; | 820 | chip_type = pci_id->driver_data; |
821 | 821 | ||
diff --git a/sound/pci/als4000.c b/sound/pci/als4000.c index ba570053d4d5..542a0c65a92c 100644 --- a/sound/pci/als4000.c +++ b/sound/pci/als4000.c | |||
@@ -889,12 +889,13 @@ static int __devinit snd_card_als4000_probe(struct pci_dev *pci, | |||
889 | pci_write_config_word(pci, PCI_COMMAND, word | PCI_COMMAND_IO); | 889 | pci_write_config_word(pci, PCI_COMMAND, word | PCI_COMMAND_IO); |
890 | pci_set_master(pci); | 890 | pci_set_master(pci); |
891 | 891 | ||
892 | card = snd_card_new(index[dev], id[dev], THIS_MODULE, | 892 | err = snd_card_create(index[dev], id[dev], THIS_MODULE, |
893 | sizeof(*acard) /* private_data: acard */); | 893 | sizeof(*acard) /* private_data: acard */, |
894 | if (card == NULL) { | 894 | &card); |
895 | if (err < 0) { | ||
895 | pci_release_regions(pci); | 896 | pci_release_regions(pci); |
896 | pci_disable_device(pci); | 897 | pci_disable_device(pci); |
897 | return -ENOMEM; | 898 | return err; |
898 | } | 899 | } |
899 | 900 | ||
900 | acard = card->private_data; | 901 | acard = card->private_data; |
diff --git a/sound/pci/atiixp.c b/sound/pci/atiixp.c index 226fe8237d31..9ce8548c03e4 100644 --- a/sound/pci/atiixp.c +++ b/sound/pci/atiixp.c | |||
@@ -1645,9 +1645,9 @@ static int __devinit snd_atiixp_probe(struct pci_dev *pci, | |||
1645 | struct atiixp *chip; | 1645 | struct atiixp *chip; |
1646 | int err; | 1646 | int err; |
1647 | 1647 | ||
1648 | card = snd_card_new(index, id, THIS_MODULE, 0); | 1648 | err = snd_card_create(index, id, THIS_MODULE, 0, &card); |
1649 | if (card == NULL) | 1649 | if (err < 0) |
1650 | return -ENOMEM; | 1650 | return err; |
1651 | 1651 | ||
1652 | strcpy(card->driver, spdif_aclink ? "ATIIXP" : "ATIIXP-SPDMA"); | 1652 | strcpy(card->driver, spdif_aclink ? "ATIIXP" : "ATIIXP-SPDMA"); |
1653 | strcpy(card->shortname, "ATI IXP"); | 1653 | strcpy(card->shortname, "ATI IXP"); |
diff --git a/sound/pci/atiixp_modem.c b/sound/pci/atiixp_modem.c index 0e6e5cc1c501..c3136cccc559 100644 --- a/sound/pci/atiixp_modem.c +++ b/sound/pci/atiixp_modem.c | |||
@@ -1288,9 +1288,9 @@ static int __devinit snd_atiixp_probe(struct pci_dev *pci, | |||
1288 | struct atiixp_modem *chip; | 1288 | struct atiixp_modem *chip; |
1289 | int err; | 1289 | int err; |
1290 | 1290 | ||
1291 | card = snd_card_new(index, id, THIS_MODULE, 0); | 1291 | err = snd_card_create(index, id, THIS_MODULE, 0, &card); |
1292 | if (card == NULL) | 1292 | if (err < 0) |
1293 | return -ENOMEM; | 1293 | return err; |
1294 | 1294 | ||
1295 | strcpy(card->driver, "ATIIXP-MODEM"); | 1295 | strcpy(card->driver, "ATIIXP-MODEM"); |
1296 | strcpy(card->shortname, "ATI IXP Modem"); | 1296 | strcpy(card->shortname, "ATI IXP Modem"); |
diff --git a/sound/pci/au88x0/au88x0.c b/sound/pci/au88x0/au88x0.c index a36d4d1fd419..9ec122383eef 100644 --- a/sound/pci/au88x0/au88x0.c +++ b/sound/pci/au88x0/au88x0.c | |||
@@ -250,9 +250,9 @@ snd_vortex_probe(struct pci_dev *pci, const struct pci_device_id *pci_id) | |||
250 | return -ENOENT; | 250 | return -ENOENT; |
251 | } | 251 | } |
252 | // (2) | 252 | // (2) |
253 | card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); | 253 | err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card); |
254 | if (card == NULL) | 254 | if (err < 0) |
255 | return -ENOMEM; | 255 | return err; |
256 | 256 | ||
257 | // (3) | 257 | // (3) |
258 | if ((err = snd_vortex_create(card, pci, &chip)) < 0) { | 258 | if ((err = snd_vortex_create(card, pci, &chip)) < 0) { |
diff --git a/sound/pci/aw2/aw2-alsa.c b/sound/pci/aw2/aw2-alsa.c index 3f00ddf450f8..8eea29fc42fe 100644 --- a/sound/pci/aw2/aw2-alsa.c +++ b/sound/pci/aw2/aw2-alsa.c | |||
@@ -165,7 +165,7 @@ module_param_array(enable, bool, NULL, 0444); | |||
165 | MODULE_PARM_DESC(enable, "Enable Audiowerk2 soundcard."); | 165 | MODULE_PARM_DESC(enable, "Enable Audiowerk2 soundcard."); |
166 | 166 | ||
167 | static struct pci_device_id snd_aw2_ids[] = { | 167 | static struct pci_device_id snd_aw2_ids[] = { |
168 | {PCI_VENDOR_ID_SAA7146, PCI_DEVICE_ID_SAA7146, PCI_ANY_ID, PCI_ANY_ID, | 168 | {PCI_VENDOR_ID_SAA7146, PCI_DEVICE_ID_SAA7146, 0, 0, |
169 | 0, 0, 0}, | 169 | 0, 0, 0}, |
170 | {0} | 170 | {0} |
171 | }; | 171 | }; |
@@ -368,9 +368,9 @@ static int __devinit snd_aw2_probe(struct pci_dev *pci, | |||
368 | } | 368 | } |
369 | 369 | ||
370 | /* (2) Create card instance */ | 370 | /* (2) Create card instance */ |
371 | card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); | 371 | err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card); |
372 | if (card == NULL) | 372 | if (err < 0) |
373 | return -ENOMEM; | 373 | return err; |
374 | 374 | ||
375 | /* (3) Create main component */ | 375 | /* (3) Create main component */ |
376 | err = snd_aw2_create(card, pci, &chip); | 376 | err = snd_aw2_create(card, pci, &chip); |
diff --git a/sound/pci/azt3328.c b/sound/pci/azt3328.c index 8121763b0c10..e9e9b5821d41 100644 --- a/sound/pci/azt3328.c +++ b/sound/pci/azt3328.c | |||
@@ -2216,9 +2216,9 @@ snd_azf3328_probe(struct pci_dev *pci, const struct pci_device_id *pci_id) | |||
2216 | return -ENOENT; | 2216 | return -ENOENT; |
2217 | } | 2217 | } |
2218 | 2218 | ||
2219 | card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); | 2219 | err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card); |
2220 | if (card == NULL) | 2220 | if (err < 0) |
2221 | return -ENOMEM; | 2221 | return err; |
2222 | 2222 | ||
2223 | strcpy(card->driver, "AZF3328"); | 2223 | strcpy(card->driver, "AZF3328"); |
2224 | strcpy(card->shortname, "Aztech AZF3328 (PCI168)"); | 2224 | strcpy(card->shortname, "Aztech AZF3328 (PCI168)"); |
diff --git a/sound/pci/bt87x.c b/sound/pci/bt87x.c index 1aa1c0402540..a299340519df 100644 --- a/sound/pci/bt87x.c +++ b/sound/pci/bt87x.c | |||
@@ -888,9 +888,9 @@ static int __devinit snd_bt87x_probe(struct pci_dev *pci, | |||
888 | return -ENOENT; | 888 | return -ENOENT; |
889 | } | 889 | } |
890 | 890 | ||
891 | card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); | 891 | err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card); |
892 | if (!card) | 892 | if (err < 0) |
893 | return -ENOMEM; | 893 | return err; |
894 | 894 | ||
895 | err = snd_bt87x_create(card, pci, &chip); | 895 | err = snd_bt87x_create(card, pci, &chip); |
896 | if (err < 0) | 896 | if (err < 0) |
diff --git a/sound/pci/ca0106/ca0106_main.c b/sound/pci/ca0106/ca0106_main.c index f2f8fd17ea4d..a38ff9dd07eb 100644 --- a/sound/pci/ca0106/ca0106_main.c +++ b/sound/pci/ca0106/ca0106_main.c | |||
@@ -1758,9 +1758,9 @@ static int __devinit snd_ca0106_probe(struct pci_dev *pci, | |||
1758 | return -ENOENT; | 1758 | return -ENOENT; |
1759 | } | 1759 | } |
1760 | 1760 | ||
1761 | card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); | 1761 | err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card); |
1762 | if (card == NULL) | 1762 | if (err < 0) |
1763 | return -ENOMEM; | 1763 | return err; |
1764 | 1764 | ||
1765 | err = snd_ca0106_create(dev, card, pci, &chip); | 1765 | err = snd_ca0106_create(dev, card, pci, &chip); |
1766 | if (err < 0) | 1766 | if (err < 0) |
diff --git a/sound/pci/cmipci.c b/sound/pci/cmipci.c index 1a74ca62c314..c7899c32aba1 100644 --- a/sound/pci/cmipci.c +++ b/sound/pci/cmipci.c | |||
@@ -3272,9 +3272,9 @@ static int __devinit snd_cmipci_probe(struct pci_dev *pci, | |||
3272 | return -ENOENT; | 3272 | return -ENOENT; |
3273 | } | 3273 | } |
3274 | 3274 | ||
3275 | card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); | 3275 | err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card); |
3276 | if (card == NULL) | 3276 | if (err < 0) |
3277 | return -ENOMEM; | 3277 | return err; |
3278 | 3278 | ||
3279 | switch (pci->device) { | 3279 | switch (pci->device) { |
3280 | case PCI_DEVICE_ID_CMEDIA_CM8738: | 3280 | case PCI_DEVICE_ID_CMEDIA_CM8738: |
diff --git a/sound/pci/cs4281.c b/sound/pci/cs4281.c index 415e88f2c62f..f6286f84a221 100644 --- a/sound/pci/cs4281.c +++ b/sound/pci/cs4281.c | |||
@@ -1929,9 +1929,9 @@ static int __devinit snd_cs4281_probe(struct pci_dev *pci, | |||
1929 | return -ENOENT; | 1929 | return -ENOENT; |
1930 | } | 1930 | } |
1931 | 1931 | ||
1932 | card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); | 1932 | err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card); |
1933 | if (card == NULL) | 1933 | if (err < 0) |
1934 | return -ENOMEM; | 1934 | return err; |
1935 | 1935 | ||
1936 | if ((err = snd_cs4281_create(card, pci, &chip, dual_codec[dev])) < 0) { | 1936 | if ((err = snd_cs4281_create(card, pci, &chip, dual_codec[dev])) < 0) { |
1937 | snd_card_free(card); | 1937 | snd_card_free(card); |
diff --git a/sound/pci/cs46xx/cs46xx.c b/sound/pci/cs46xx/cs46xx.c index e876b3263e46..c9b3e3d48cbc 100644 --- a/sound/pci/cs46xx/cs46xx.c +++ b/sound/pci/cs46xx/cs46xx.c | |||
@@ -88,9 +88,9 @@ static int __devinit snd_card_cs46xx_probe(struct pci_dev *pci, | |||
88 | return -ENOENT; | 88 | return -ENOENT; |
89 | } | 89 | } |
90 | 90 | ||
91 | card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); | 91 | err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card); |
92 | if (card == NULL) | 92 | if (err < 0) |
93 | return -ENOMEM; | 93 | return err; |
94 | if ((err = snd_cs46xx_create(card, pci, | 94 | if ((err = snd_cs46xx_create(card, pci, |
95 | external_amp[dev], thinkpad[dev], | 95 | external_amp[dev], thinkpad[dev], |
96 | &chip)) < 0) { | 96 | &chip)) < 0) { |
diff --git a/sound/pci/cs5530.c b/sound/pci/cs5530.c index 6dea5b5cc774..dc464321d0f3 100644 --- a/sound/pci/cs5530.c +++ b/sound/pci/cs5530.c | |||
@@ -258,10 +258,10 @@ static int __devinit snd_cs5530_probe(struct pci_dev *pci, | |||
258 | return -ENOENT; | 258 | return -ENOENT; |
259 | } | 259 | } |
260 | 260 | ||
261 | card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); | 261 | err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card); |
262 | 262 | ||
263 | if (card == NULL) | 263 | if (err < 0) |
264 | return -ENOMEM; | 264 | return err; |
265 | 265 | ||
266 | err = snd_cs5530_create(card, pci, &chip); | 266 | err = snd_cs5530_create(card, pci, &chip); |
267 | if (err < 0) { | 267 | if (err < 0) { |
diff --git a/sound/pci/cs5535audio/cs5535audio.c b/sound/pci/cs5535audio/cs5535audio.c index 6506201d56f6..c89ed1f5bc2b 100644 --- a/sound/pci/cs5535audio/cs5535audio.c +++ b/sound/pci/cs5535audio/cs5535audio.c | |||
@@ -353,9 +353,9 @@ static int __devinit snd_cs5535audio_probe(struct pci_dev *pci, | |||
353 | return -ENOENT; | 353 | return -ENOENT; |
354 | } | 354 | } |
355 | 355 | ||
356 | card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); | 356 | err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card); |
357 | if (card == NULL) | 357 | if (err < 0) |
358 | return -ENOMEM; | 358 | return err; |
359 | 359 | ||
360 | if ((err = snd_cs5535audio_create(card, pci, &cs5535au)) < 0) | 360 | if ((err = snd_cs5535audio_create(card, pci, &cs5535au)) < 0) |
361 | goto probefail_out; | 361 | goto probefail_out; |
diff --git a/sound/pci/echoaudio/echoaudio.c b/sound/pci/echoaudio/echoaudio.c index 8dbc5c4ba421..9d015a76eb69 100644 --- a/sound/pci/echoaudio/echoaudio.c +++ b/sound/pci/echoaudio/echoaudio.c | |||
@@ -1997,9 +1997,9 @@ static int __devinit snd_echo_probe(struct pci_dev *pci, | |||
1997 | 1997 | ||
1998 | DE_INIT(("Echoaudio driver starting...\n")); | 1998 | DE_INIT(("Echoaudio driver starting...\n")); |
1999 | i = 0; | 1999 | i = 0; |
2000 | card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); | 2000 | err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card); |
2001 | if (card == NULL) | 2001 | if (err < 0) |
2002 | return -ENOMEM; | 2002 | return err; |
2003 | 2003 | ||
2004 | snd_card_set_dev(card, &pci->dev); | 2004 | snd_card_set_dev(card, &pci->dev); |
2005 | 2005 | ||
diff --git a/sound/pci/emu10k1/emu10k1.c b/sound/pci/emu10k1/emu10k1.c index 8354c1a83312..c7f3b994101c 100644 --- a/sound/pci/emu10k1/emu10k1.c +++ b/sound/pci/emu10k1/emu10k1.c | |||
@@ -114,9 +114,9 @@ static int __devinit snd_card_emu10k1_probe(struct pci_dev *pci, | |||
114 | return -ENOENT; | 114 | return -ENOENT; |
115 | } | 115 | } |
116 | 116 | ||
117 | card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); | 117 | err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card); |
118 | if (card == NULL) | 118 | if (err < 0) |
119 | return -ENOMEM; | 119 | return err; |
120 | if (max_buffer_size[dev] < 32) | 120 | if (max_buffer_size[dev] < 32) |
121 | max_buffer_size[dev] = 32; | 121 | max_buffer_size[dev] = 32; |
122 | else if (max_buffer_size[dev] > 1024) | 122 | else if (max_buffer_size[dev] > 1024) |
diff --git a/sound/pci/emu10k1/emu10k1_main.c b/sound/pci/emu10k1/emu10k1_main.c index 7958006a1d66..101a1c13a20d 100644 --- a/sound/pci/emu10k1/emu10k1_main.c +++ b/sound/pci/emu10k1/emu10k1_main.c | |||
@@ -1528,6 +1528,7 @@ static struct snd_emu_chip_details emu_chip_details[] = { | |||
1528 | .ca0151_chip = 1, | 1528 | .ca0151_chip = 1, |
1529 | .spk71 = 1, | 1529 | .spk71 = 1, |
1530 | .spdif_bug = 1, | 1530 | .spdif_bug = 1, |
1531 | .invert_shared_spdif = 1, /* digital/analog switch swapped */ | ||
1531 | .ac97_chip = 1} , | 1532 | .ac97_chip = 1} , |
1532 | {.vendor = 0x1102, .device = 0x0004, .subsystem = 0x10021102, | 1533 | {.vendor = 0x1102, .device = 0x0004, .subsystem = 0x10021102, |
1533 | .driver = "Audigy2", .name = "SB Audigy 2 Platinum [SB0240P]", | 1534 | .driver = "Audigy2", .name = "SB Audigy 2 Platinum [SB0240P]", |
diff --git a/sound/pci/emu10k1/emu10k1x.c b/sound/pci/emu10k1/emu10k1x.c index 5ff4dbb62dad..31542adc6b7e 100644 --- a/sound/pci/emu10k1/emu10k1x.c +++ b/sound/pci/emu10k1/emu10k1x.c | |||
@@ -1544,9 +1544,9 @@ static int __devinit snd_emu10k1x_probe(struct pci_dev *pci, | |||
1544 | return -ENOENT; | 1544 | return -ENOENT; |
1545 | } | 1545 | } |
1546 | 1546 | ||
1547 | card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); | 1547 | err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card); |
1548 | if (card == NULL) | 1548 | if (err < 0) |
1549 | return -ENOMEM; | 1549 | return err; |
1550 | 1550 | ||
1551 | if ((err = snd_emu10k1x_create(card, pci, &chip)) < 0) { | 1551 | if ((err = snd_emu10k1x_create(card, pci, &chip)) < 0) { |
1552 | snd_card_free(card); | 1552 | snd_card_free(card); |
diff --git a/sound/pci/ens1370.c b/sound/pci/ens1370.c index 17674b3406bd..18f4d1e98c46 100644 --- a/sound/pci/ens1370.c +++ b/sound/pci/ens1370.c | |||
@@ -2410,9 +2410,9 @@ static int __devinit snd_audiopci_probe(struct pci_dev *pci, | |||
2410 | return -ENOENT; | 2410 | return -ENOENT; |
2411 | } | 2411 | } |
2412 | 2412 | ||
2413 | card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); | 2413 | err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card); |
2414 | if (card == NULL) | 2414 | if (err < 0) |
2415 | return -ENOMEM; | 2415 | return err; |
2416 | 2416 | ||
2417 | if ((err = snd_ensoniq_create(card, pci, &ensoniq)) < 0) { | 2417 | if ((err = snd_ensoniq_create(card, pci, &ensoniq)) < 0) { |
2418 | snd_card_free(card); | 2418 | snd_card_free(card); |
diff --git a/sound/pci/es1938.c b/sound/pci/es1938.c index e4ba84bed4ad..dd63b132fb8e 100644 --- a/sound/pci/es1938.c +++ b/sound/pci/es1938.c | |||
@@ -1806,9 +1806,9 @@ static int __devinit snd_es1938_probe(struct pci_dev *pci, | |||
1806 | return -ENOENT; | 1806 | return -ENOENT; |
1807 | } | 1807 | } |
1808 | 1808 | ||
1809 | card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); | 1809 | err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card); |
1810 | if (card == NULL) | 1810 | if (err < 0) |
1811 | return -ENOMEM; | 1811 | return err; |
1812 | for (idx = 0; idx < 5; idx++) { | 1812 | for (idx = 0; idx < 5; idx++) { |
1813 | if (pci_resource_start(pci, idx) == 0 || | 1813 | if (pci_resource_start(pci, idx) == 0 || |
1814 | !(pci_resource_flags(pci, idx) & IORESOURCE_IO)) { | 1814 | !(pci_resource_flags(pci, idx) & IORESOURCE_IO)) { |
diff --git a/sound/pci/es1968.c b/sound/pci/es1968.c index e9c3794bbcb8..dc97e8116141 100644 --- a/sound/pci/es1968.c +++ b/sound/pci/es1968.c | |||
@@ -2645,9 +2645,9 @@ static int __devinit snd_es1968_probe(struct pci_dev *pci, | |||
2645 | return -ENOENT; | 2645 | return -ENOENT; |
2646 | } | 2646 | } |
2647 | 2647 | ||
2648 | card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); | 2648 | err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card); |
2649 | if (!card) | 2649 | if (err < 0) |
2650 | return -ENOMEM; | 2650 | return err; |
2651 | 2651 | ||
2652 | if (total_bufsize[dev] < 128) | 2652 | if (total_bufsize[dev] < 128) |
2653 | total_bufsize[dev] = 128; | 2653 | total_bufsize[dev] = 128; |
diff --git a/sound/pci/fm801.c b/sound/pci/fm801.c index c129f9e2072c..60cdb9e0b68d 100644 --- a/sound/pci/fm801.c +++ b/sound/pci/fm801.c | |||
@@ -1468,9 +1468,9 @@ static int __devinit snd_card_fm801_probe(struct pci_dev *pci, | |||
1468 | return -ENOENT; | 1468 | return -ENOENT; |
1469 | } | 1469 | } |
1470 | 1470 | ||
1471 | card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); | 1471 | err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card); |
1472 | if (card == NULL) | 1472 | if (err < 0) |
1473 | return -ENOMEM; | 1473 | return err; |
1474 | if ((err = snd_fm801_create(card, pci, tea575x_tuner[dev], &chip)) < 0) { | 1474 | if ((err = snd_fm801_create(card, pci, tea575x_tuner[dev], &chip)) < 0) { |
1475 | snd_card_free(card); | 1475 | snd_card_free(card); |
1476 | return err; | 1476 | return err; |
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c index b7bba7dc7cf1..d03f99298be9 100644 --- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c | |||
@@ -487,7 +487,6 @@ int /*__devinit*/ snd_hda_bus_new(struct snd_card *card, | |||
487 | { | 487 | { |
488 | struct hda_bus *bus; | 488 | struct hda_bus *bus; |
489 | int err; | 489 | int err; |
490 | char qname[8]; | ||
491 | static struct snd_device_ops dev_ops = { | 490 | static struct snd_device_ops dev_ops = { |
492 | .dev_register = snd_hda_bus_dev_register, | 491 | .dev_register = snd_hda_bus_dev_register, |
493 | .dev_free = snd_hda_bus_dev_free, | 492 | .dev_free = snd_hda_bus_dev_free, |
@@ -517,10 +516,12 @@ int /*__devinit*/ snd_hda_bus_new(struct snd_card *card, | |||
517 | mutex_init(&bus->cmd_mutex); | 516 | mutex_init(&bus->cmd_mutex); |
518 | INIT_LIST_HEAD(&bus->codec_list); | 517 | INIT_LIST_HEAD(&bus->codec_list); |
519 | 518 | ||
520 | snprintf(qname, sizeof(qname), "hda%d", card->number); | 519 | snprintf(bus->workq_name, sizeof(bus->workq_name), |
521 | bus->workq = create_workqueue(qname); | 520 | "hd-audio%d", card->number); |
521 | bus->workq = create_singlethread_workqueue(bus->workq_name); | ||
522 | if (!bus->workq) { | 522 | if (!bus->workq) { |
523 | snd_printk(KERN_ERR "cannot create workqueue %s\n", qname); | 523 | snd_printk(KERN_ERR "cannot create workqueue %s\n", |
524 | bus->workq_name); | ||
524 | kfree(bus); | 525 | kfree(bus); |
525 | return -ENOMEM; | 526 | return -ENOMEM; |
526 | } | 527 | } |
@@ -3087,6 +3088,16 @@ int snd_hda_multi_out_dig_prepare(struct hda_codec *codec, | |||
3087 | } | 3088 | } |
3088 | EXPORT_SYMBOL_HDA(snd_hda_multi_out_dig_prepare); | 3089 | EXPORT_SYMBOL_HDA(snd_hda_multi_out_dig_prepare); |
3089 | 3090 | ||
3091 | int snd_hda_multi_out_dig_cleanup(struct hda_codec *codec, | ||
3092 | struct hda_multi_out *mout) | ||
3093 | { | ||
3094 | mutex_lock(&codec->spdif_mutex); | ||
3095 | cleanup_dig_out_stream(codec, mout->dig_out_nid); | ||
3096 | mutex_unlock(&codec->spdif_mutex); | ||
3097 | return 0; | ||
3098 | } | ||
3099 | EXPORT_SYMBOL_HDA(snd_hda_multi_out_dig_cleanup); | ||
3100 | |||
3090 | /* | 3101 | /* |
3091 | * release the digital out | 3102 | * release the digital out |
3092 | */ | 3103 | */ |
diff --git a/sound/pci/hda/hda_codec.h b/sound/pci/hda/hda_codec.h index 5810ef588402..09a332ada0c6 100644 --- a/sound/pci/hda/hda_codec.h +++ b/sound/pci/hda/hda_codec.h | |||
@@ -614,6 +614,7 @@ struct hda_bus { | |||
614 | 614 | ||
615 | /* unsolicited event queue */ | 615 | /* unsolicited event queue */ |
616 | struct hda_bus_unsolicited *unsol; | 616 | struct hda_bus_unsolicited *unsol; |
617 | char workq_name[16]; | ||
617 | struct workqueue_struct *workq; /* common workqueue for codecs */ | 618 | struct workqueue_struct *workq; /* common workqueue for codecs */ |
618 | 619 | ||
619 | /* assigned PCMs */ | 620 | /* assigned PCMs */ |
diff --git a/sound/pci/hda/hda_hwdep.c b/sound/pci/hda/hda_hwdep.c index 300ab407cf42..4ae51dcb81af 100644 --- a/sound/pci/hda/hda_hwdep.c +++ b/sound/pci/hda/hda_hwdep.c | |||
@@ -175,7 +175,7 @@ static int reconfig_codec(struct hda_codec *codec) | |||
175 | err = snd_hda_codec_build_controls(codec); | 175 | err = snd_hda_codec_build_controls(codec); |
176 | if (err < 0) | 176 | if (err < 0) |
177 | return err; | 177 | return err; |
178 | return 0; | 178 | return snd_card_register(codec->bus->card); |
179 | } | 179 | } |
180 | 180 | ||
181 | /* | 181 | /* |
@@ -277,18 +277,19 @@ static ssize_t init_verbs_store(struct device *dev, | |||
277 | { | 277 | { |
278 | struct snd_hwdep *hwdep = dev_get_drvdata(dev); | 278 | struct snd_hwdep *hwdep = dev_get_drvdata(dev); |
279 | struct hda_codec *codec = hwdep->private_data; | 279 | struct hda_codec *codec = hwdep->private_data; |
280 | char *p; | 280 | struct hda_verb *v; |
281 | struct hda_verb verb, *v; | 281 | int nid, verb, param; |
282 | 282 | ||
283 | verb.nid = simple_strtoul(buf, &p, 0); | 283 | if (sscanf(buf, "%i %i %i", &nid, &verb, ¶m) != 3) |
284 | verb.verb = simple_strtoul(p, &p, 0); | 284 | return -EINVAL; |
285 | verb.param = simple_strtoul(p, &p, 0); | 285 | if (!nid || !verb) |
286 | if (!verb.nid || !verb.verb || !verb.param) | ||
287 | return -EINVAL; | 286 | return -EINVAL; |
288 | v = snd_array_new(&codec->init_verbs); | 287 | v = snd_array_new(&codec->init_verbs); |
289 | if (!v) | 288 | if (!v) |
290 | return -ENOMEM; | 289 | return -ENOMEM; |
291 | *v = verb; | 290 | v->nid = nid; |
291 | v->verb = verb; | ||
292 | v->param = param; | ||
292 | return count; | 293 | return count; |
293 | } | 294 | } |
294 | 295 | ||
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c index 11e791b965f6..3683978324e8 100644 --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c | |||
@@ -1947,16 +1947,13 @@ static int azx_suspend(struct pci_dev *pci, pm_message_t state) | |||
1947 | return 0; | 1947 | return 0; |
1948 | } | 1948 | } |
1949 | 1949 | ||
1950 | static int azx_resume_early(struct pci_dev *pci) | ||
1951 | { | ||
1952 | return pci_restore_state(pci); | ||
1953 | } | ||
1954 | |||
1955 | static int azx_resume(struct pci_dev *pci) | 1950 | static int azx_resume(struct pci_dev *pci) |
1956 | { | 1951 | { |
1957 | struct snd_card *card = pci_get_drvdata(pci); | 1952 | struct snd_card *card = pci_get_drvdata(pci); |
1958 | struct azx *chip = card->private_data; | 1953 | struct azx *chip = card->private_data; |
1959 | 1954 | ||
1955 | pci_set_power_state(pci, PCI_D0); | ||
1956 | pci_restore_state(pci); | ||
1960 | if (pci_enable_device(pci) < 0) { | 1957 | if (pci_enable_device(pci) < 0) { |
1961 | printk(KERN_ERR "hda-intel: pci_enable_device failed, " | 1958 | printk(KERN_ERR "hda-intel: pci_enable_device failed, " |
1962 | "disabling device\n"); | 1959 | "disabling device\n"); |
@@ -2062,26 +2059,31 @@ static int __devinit check_position_fix(struct azx *chip, int fix) | |||
2062 | { | 2059 | { |
2063 | const struct snd_pci_quirk *q; | 2060 | const struct snd_pci_quirk *q; |
2064 | 2061 | ||
2065 | /* Check VIA HD Audio Controller exist */ | 2062 | switch (fix) { |
2066 | if (chip->pci->vendor == PCI_VENDOR_ID_VIA && | 2063 | case POS_FIX_LPIB: |
2067 | chip->pci->device == VIA_HDAC_DEVICE_ID) { | 2064 | case POS_FIX_POSBUF: |
2065 | return fix; | ||
2066 | } | ||
2067 | |||
2068 | /* Check VIA/ATI HD Audio Controller exist */ | ||
2069 | switch (chip->driver_type) { | ||
2070 | case AZX_DRIVER_VIA: | ||
2071 | case AZX_DRIVER_ATI: | ||
2068 | chip->via_dmapos_patch = 1; | 2072 | chip->via_dmapos_patch = 1; |
2069 | /* Use link position directly, avoid any transfer problem. */ | 2073 | /* Use link position directly, avoid any transfer problem. */ |
2070 | return POS_FIX_LPIB; | 2074 | return POS_FIX_LPIB; |
2071 | } | 2075 | } |
2072 | chip->via_dmapos_patch = 0; | 2076 | chip->via_dmapos_patch = 0; |
2073 | 2077 | ||
2074 | if (fix == POS_FIX_AUTO) { | 2078 | q = snd_pci_quirk_lookup(chip->pci, position_fix_list); |
2075 | q = snd_pci_quirk_lookup(chip->pci, position_fix_list); | 2079 | if (q) { |
2076 | if (q) { | 2080 | printk(KERN_INFO |
2077 | printk(KERN_INFO | 2081 | "hda_intel: position_fix set to %d " |
2078 | "hda_intel: position_fix set to %d " | 2082 | "for device %04x:%04x\n", |
2079 | "for device %04x:%04x\n", | 2083 | q->value, q->subvendor, q->subdevice); |
2080 | q->value, q->subvendor, q->subdevice); | 2084 | return q->value; |
2081 | return q->value; | ||
2082 | } | ||
2083 | } | 2085 | } |
2084 | return fix; | 2086 | return POS_FIX_AUTO; |
2085 | } | 2087 | } |
2086 | 2088 | ||
2087 | /* | 2089 | /* |
@@ -2098,6 +2100,8 @@ static struct snd_pci_quirk probe_mask_list[] __devinitdata = { | |||
2098 | SND_PCI_QUIRK(0x1028, 0x20ac, "Dell Studio Desktop", 0x01), | 2100 | SND_PCI_QUIRK(0x1028, 0x20ac, "Dell Studio Desktop", 0x01), |
2099 | /* including bogus ALC268 in slot#2 that conflicts with ALC888 */ | 2101 | /* including bogus ALC268 in slot#2 that conflicts with ALC888 */ |
2100 | SND_PCI_QUIRK(0x17c0, 0x4085, "Medion MD96630", 0x01), | 2102 | SND_PCI_QUIRK(0x17c0, 0x4085, "Medion MD96630", 0x01), |
2103 | /* conflict of ALC268 in slot#3 (digital I/O); a temporary fix */ | ||
2104 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba laptop", 0x03), | ||
2101 | {} | 2105 | {} |
2102 | }; | 2106 | }; |
2103 | 2107 | ||
@@ -2211,9 +2215,17 @@ static int __devinit azx_create(struct snd_card *card, struct pci_dev *pci, | |||
2211 | gcap = azx_readw(chip, GCAP); | 2215 | gcap = azx_readw(chip, GCAP); |
2212 | snd_printdd("chipset global capabilities = 0x%x\n", gcap); | 2216 | snd_printdd("chipset global capabilities = 0x%x\n", gcap); |
2213 | 2217 | ||
2218 | /* ATI chips seems buggy about 64bit DMA addresses */ | ||
2219 | if (chip->driver_type == AZX_DRIVER_ATI) | ||
2220 | gcap &= ~0x01; | ||
2221 | |||
2214 | /* allow 64bit DMA address if supported by H/W */ | 2222 | /* allow 64bit DMA address if supported by H/W */ |
2215 | if ((gcap & 0x01) && !pci_set_dma_mask(pci, DMA_64BIT_MASK)) | 2223 | if ((gcap & 0x01) && !pci_set_dma_mask(pci, DMA_64BIT_MASK)) |
2216 | pci_set_consistent_dma_mask(pci, DMA_64BIT_MASK); | 2224 | pci_set_consistent_dma_mask(pci, DMA_64BIT_MASK); |
2225 | else { | ||
2226 | pci_set_dma_mask(pci, DMA_32BIT_MASK); | ||
2227 | pci_set_consistent_dma_mask(pci, DMA_32BIT_MASK); | ||
2228 | } | ||
2217 | 2229 | ||
2218 | /* read number of streams from GCAP register instead of using | 2230 | /* read number of streams from GCAP register instead of using |
2219 | * hardcoded value | 2231 | * hardcoded value |
@@ -2335,10 +2347,10 @@ static int __devinit azx_probe(struct pci_dev *pci, | |||
2335 | return -ENOENT; | 2347 | return -ENOENT; |
2336 | } | 2348 | } |
2337 | 2349 | ||
2338 | card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); | 2350 | err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card); |
2339 | if (!card) { | 2351 | if (err < 0) { |
2340 | snd_printk(KERN_ERR SFX "Error creating card!\n"); | 2352 | snd_printk(KERN_ERR SFX "Error creating card!\n"); |
2341 | return -ENOMEM; | 2353 | return err; |
2342 | } | 2354 | } |
2343 | 2355 | ||
2344 | err = azx_create(card, pci, dev, pci_id->driver_data, &chip); | 2356 | err = azx_create(card, pci, dev, pci_id->driver_data, &chip); |
@@ -2468,7 +2480,6 @@ static struct pci_driver driver = { | |||
2468 | .remove = __devexit_p(azx_remove), | 2480 | .remove = __devexit_p(azx_remove), |
2469 | #ifdef CONFIG_PM | 2481 | #ifdef CONFIG_PM |
2470 | .suspend = azx_suspend, | 2482 | .suspend = azx_suspend, |
2471 | .resume_early = azx_resume_early, | ||
2472 | .resume = azx_resume, | 2483 | .resume = azx_resume, |
2473 | #endif | 2484 | #endif |
2474 | }; | 2485 | }; |
diff --git a/sound/pci/hda/hda_local.h b/sound/pci/hda/hda_local.h index 1dd8716c387f..44f189cb97ae 100644 --- a/sound/pci/hda/hda_local.h +++ b/sound/pci/hda/hda_local.h | |||
@@ -251,6 +251,8 @@ int snd_hda_multi_out_dig_prepare(struct hda_codec *codec, | |||
251 | unsigned int stream_tag, | 251 | unsigned int stream_tag, |
252 | unsigned int format, | 252 | unsigned int format, |
253 | struct snd_pcm_substream *substream); | 253 | struct snd_pcm_substream *substream); |
254 | int snd_hda_multi_out_dig_cleanup(struct hda_codec *codec, | ||
255 | struct hda_multi_out *mout); | ||
254 | int snd_hda_multi_out_analog_open(struct hda_codec *codec, | 256 | int snd_hda_multi_out_analog_open(struct hda_codec *codec, |
255 | struct hda_multi_out *mout, | 257 | struct hda_multi_out *mout, |
256 | struct snd_pcm_substream *substream, | 258 | struct snd_pcm_substream *substream, |
diff --git a/sound/pci/hda/hda_proc.c b/sound/pci/hda/hda_proc.c index 7ca66d654148..144b85276d5a 100644 --- a/sound/pci/hda/hda_proc.c +++ b/sound/pci/hda/hda_proc.c | |||
@@ -399,7 +399,8 @@ static void print_conn_list(struct snd_info_buffer *buffer, | |||
399 | { | 399 | { |
400 | int c, curr = -1; | 400 | int c, curr = -1; |
401 | 401 | ||
402 | if (conn_len > 1 && wid_type != AC_WID_AUD_MIX) | 402 | if (conn_len > 1 && wid_type != AC_WID_AUD_MIX && |
403 | wid_type != AC_WID_VOL_KNB) | ||
403 | curr = snd_hda_codec_read(codec, nid, 0, | 404 | curr = snd_hda_codec_read(codec, nid, 0, |
404 | AC_VERB_GET_CONNECT_SEL, 0); | 405 | AC_VERB_GET_CONNECT_SEL, 0); |
405 | snd_iprintf(buffer, " Connection: %d\n", conn_len); | 406 | snd_iprintf(buffer, " Connection: %d\n", conn_len); |
diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c index 2e7371ec2e23..e48612323aa0 100644 --- a/sound/pci/hda/patch_analog.c +++ b/sound/pci/hda/patch_analog.c | |||
@@ -275,6 +275,14 @@ static int ad198x_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo, | |||
275 | format, substream); | 275 | format, substream); |
276 | } | 276 | } |
277 | 277 | ||
278 | static int ad198x_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, | ||
279 | struct hda_codec *codec, | ||
280 | struct snd_pcm_substream *substream) | ||
281 | { | ||
282 | struct ad198x_spec *spec = codec->spec; | ||
283 | return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout); | ||
284 | } | ||
285 | |||
278 | /* | 286 | /* |
279 | * Analog capture | 287 | * Analog capture |
280 | */ | 288 | */ |
@@ -333,7 +341,8 @@ static struct hda_pcm_stream ad198x_pcm_digital_playback = { | |||
333 | .ops = { | 341 | .ops = { |
334 | .open = ad198x_dig_playback_pcm_open, | 342 | .open = ad198x_dig_playback_pcm_open, |
335 | .close = ad198x_dig_playback_pcm_close, | 343 | .close = ad198x_dig_playback_pcm_close, |
336 | .prepare = ad198x_dig_playback_pcm_prepare | 344 | .prepare = ad198x_dig_playback_pcm_prepare, |
345 | .cleanup = ad198x_dig_playback_pcm_cleanup | ||
337 | }, | 346 | }, |
338 | }; | 347 | }; |
339 | 348 | ||
@@ -1885,8 +1894,8 @@ static hda_nid_t ad1988_capsrc_nids[3] = { | |||
1885 | #define AD1988_SPDIF_OUT_HDMI 0x0b | 1894 | #define AD1988_SPDIF_OUT_HDMI 0x0b |
1886 | #define AD1988_SPDIF_IN 0x07 | 1895 | #define AD1988_SPDIF_IN 0x07 |
1887 | 1896 | ||
1888 | static hda_nid_t ad1989b_slave_dig_outs[2] = { | 1897 | static hda_nid_t ad1989b_slave_dig_outs[] = { |
1889 | AD1988_SPDIF_OUT, AD1988_SPDIF_OUT_HDMI | 1898 | AD1988_SPDIF_OUT, AD1988_SPDIF_OUT_HDMI, 0 |
1890 | }; | 1899 | }; |
1891 | 1900 | ||
1892 | static struct hda_input_mux ad1988_6stack_capture_source = { | 1901 | static struct hda_input_mux ad1988_6stack_capture_source = { |
diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c index 75de40aaab0a..0177ef8f4c9e 100644 --- a/sound/pci/hda/patch_conexant.c +++ b/sound/pci/hda/patch_conexant.c | |||
@@ -347,6 +347,7 @@ static int conexant_mux_enum_put(struct snd_kcontrol *kcontrol, | |||
347 | &spec->cur_mux[adc_idx]); | 347 | &spec->cur_mux[adc_idx]); |
348 | } | 348 | } |
349 | 349 | ||
350 | #ifdef CONFIG_SND_JACK | ||
350 | static int conexant_add_jack(struct hda_codec *codec, | 351 | static int conexant_add_jack(struct hda_codec *codec, |
351 | hda_nid_t nid, int type) | 352 | hda_nid_t nid, int type) |
352 | { | 353 | { |
@@ -394,7 +395,6 @@ static void conexant_report_jack(struct hda_codec *codec, hda_nid_t nid) | |||
394 | 395 | ||
395 | static int conexant_init_jacks(struct hda_codec *codec) | 396 | static int conexant_init_jacks(struct hda_codec *codec) |
396 | { | 397 | { |
397 | #ifdef CONFIG_SND_JACK | ||
398 | struct conexant_spec *spec = codec->spec; | 398 | struct conexant_spec *spec = codec->spec; |
399 | int i; | 399 | int i; |
400 | 400 | ||
@@ -422,10 +422,19 @@ static int conexant_init_jacks(struct hda_codec *codec) | |||
422 | ++hv; | 422 | ++hv; |
423 | } | 423 | } |
424 | } | 424 | } |
425 | #endif | ||
426 | return 0; | 425 | return 0; |
427 | 426 | ||
428 | } | 427 | } |
428 | #else | ||
429 | static inline void conexant_report_jack(struct hda_codec *codec, hda_nid_t nid) | ||
430 | { | ||
431 | } | ||
432 | |||
433 | static inline int conexant_init_jacks(struct hda_codec *codec) | ||
434 | { | ||
435 | return 0; | ||
436 | } | ||
437 | #endif | ||
429 | 438 | ||
430 | static int conexant_init(struct hda_codec *codec) | 439 | static int conexant_init(struct hda_codec *codec) |
431 | { | 440 | { |
@@ -1566,6 +1575,7 @@ static struct snd_pci_quirk cxt5047_cfg_tbl[] = { | |||
1566 | SND_PCI_QUIRK(0x103c, 0x30a5, "HP DV5200T/DV8000T", CXT5047_LAPTOP_HP), | 1575 | SND_PCI_QUIRK(0x103c, 0x30a5, "HP DV5200T/DV8000T", CXT5047_LAPTOP_HP), |
1567 | SND_PCI_QUIRK(0x103c, 0x30b2, "HP DV2000T/DV3000T", CXT5047_LAPTOP), | 1576 | SND_PCI_QUIRK(0x103c, 0x30b2, "HP DV2000T/DV3000T", CXT5047_LAPTOP), |
1568 | SND_PCI_QUIRK(0x103c, 0x30b5, "HP DV2000Z", CXT5047_LAPTOP), | 1577 | SND_PCI_QUIRK(0x103c, 0x30b5, "HP DV2000Z", CXT5047_LAPTOP), |
1578 | SND_PCI_QUIRK(0x103c, 0x30cf, "HP DV6700", CXT5047_LAPTOP), | ||
1569 | SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba P100", CXT5047_LAPTOP_EAPD), | 1579 | SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba P100", CXT5047_LAPTOP_EAPD), |
1570 | {} | 1580 | {} |
1571 | }; | 1581 | }; |
diff --git a/sound/pci/hda/patch_intelhdmi.c b/sound/pci/hda/patch_intelhdmi.c index 3564f4e4b74c..fcc77fec4487 100644 --- a/sound/pci/hda/patch_intelhdmi.c +++ b/sound/pci/hda/patch_intelhdmi.c | |||
@@ -49,11 +49,6 @@ static struct hda_verb pinout_enable_verb[] = { | |||
49 | {} /* terminator */ | 49 | {} /* terminator */ |
50 | }; | 50 | }; |
51 | 51 | ||
52 | static struct hda_verb pinout_disable_verb[] = { | ||
53 | {PIN_NID, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00}, | ||
54 | {} | ||
55 | }; | ||
56 | |||
57 | static struct hda_verb unsolicited_response_verb[] = { | 52 | static struct hda_verb unsolicited_response_verb[] = { |
58 | {PIN_NID, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | | 53 | {PIN_NID, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | |
59 | INTEL_HDMI_EVENT_TAG}, | 54 | INTEL_HDMI_EVENT_TAG}, |
@@ -248,10 +243,6 @@ static void hdmi_write_dip_byte(struct hda_codec *codec, hda_nid_t nid, | |||
248 | 243 | ||
249 | static void hdmi_enable_output(struct hda_codec *codec) | 244 | static void hdmi_enable_output(struct hda_codec *codec) |
250 | { | 245 | { |
251 | /* Enable Audio InfoFrame Transmission */ | ||
252 | hdmi_set_dip_index(codec, PIN_NID, 0x0, 0x0); | ||
253 | snd_hda_codec_write(codec, PIN_NID, 0, AC_VERB_SET_HDMI_DIP_XMIT, | ||
254 | AC_DIPXMIT_BEST); | ||
255 | /* Unmute */ | 246 | /* Unmute */ |
256 | if (get_wcaps(codec, PIN_NID) & AC_WCAP_OUT_AMP) | 247 | if (get_wcaps(codec, PIN_NID) & AC_WCAP_OUT_AMP) |
257 | snd_hda_codec_write(codec, PIN_NID, 0, | 248 | snd_hda_codec_write(codec, PIN_NID, 0, |
@@ -260,17 +251,24 @@ static void hdmi_enable_output(struct hda_codec *codec) | |||
260 | snd_hda_sequence_write(codec, pinout_enable_verb); | 251 | snd_hda_sequence_write(codec, pinout_enable_verb); |
261 | } | 252 | } |
262 | 253 | ||
263 | static void hdmi_disable_output(struct hda_codec *codec) | 254 | /* |
255 | * Enable Audio InfoFrame Transmission | ||
256 | */ | ||
257 | static void hdmi_start_infoframe_trans(struct hda_codec *codec) | ||
264 | { | 258 | { |
265 | snd_hda_sequence_write(codec, pinout_disable_verb); | 259 | hdmi_set_dip_index(codec, PIN_NID, 0x0, 0x0); |
266 | if (get_wcaps(codec, PIN_NID) & AC_WCAP_OUT_AMP) | 260 | snd_hda_codec_write(codec, PIN_NID, 0, AC_VERB_SET_HDMI_DIP_XMIT, |
267 | snd_hda_codec_write(codec, PIN_NID, 0, | 261 | AC_DIPXMIT_BEST); |
268 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE); | 262 | } |
269 | 263 | ||
270 | /* | 264 | /* |
271 | * FIXME: noises may arise when playing music after reloading the | 265 | * Disable Audio InfoFrame Transmission |
272 | * kernel module, until the next X restart or monitor repower. | 266 | */ |
273 | */ | 267 | static void hdmi_stop_infoframe_trans(struct hda_codec *codec) |
268 | { | ||
269 | hdmi_set_dip_index(codec, PIN_NID, 0x0, 0x0); | ||
270 | snd_hda_codec_write(codec, PIN_NID, 0, AC_VERB_SET_HDMI_DIP_XMIT, | ||
271 | AC_DIPXMIT_DISABLE); | ||
274 | } | 272 | } |
275 | 273 | ||
276 | static int hdmi_get_channel_count(struct hda_codec *codec) | 274 | static int hdmi_get_channel_count(struct hda_codec *codec) |
@@ -368,11 +366,16 @@ static void hdmi_fill_audio_infoframe(struct hda_codec *codec, | |||
368 | struct hdmi_audio_infoframe *ai) | 366 | struct hdmi_audio_infoframe *ai) |
369 | { | 367 | { |
370 | u8 *params = (u8 *)ai; | 368 | u8 *params = (u8 *)ai; |
369 | u8 sum = 0; | ||
371 | int i; | 370 | int i; |
372 | 371 | ||
373 | hdmi_debug_dip_size(codec); | 372 | hdmi_debug_dip_size(codec); |
374 | hdmi_clear_dip_buffers(codec); /* be paranoid */ | 373 | hdmi_clear_dip_buffers(codec); /* be paranoid */ |
375 | 374 | ||
375 | for (i = 0; i < sizeof(ai); i++) | ||
376 | sum += params[i]; | ||
377 | ai->checksum = - sum; | ||
378 | |||
376 | hdmi_set_dip_index(codec, PIN_NID, 0x0, 0x0); | 379 | hdmi_set_dip_index(codec, PIN_NID, 0x0, 0x0); |
377 | for (i = 0; i < sizeof(ai); i++) | 380 | for (i = 0; i < sizeof(ai); i++) |
378 | hdmi_write_dip_byte(codec, PIN_NID, params[i]); | 381 | hdmi_write_dip_byte(codec, PIN_NID, params[i]); |
@@ -419,14 +422,18 @@ static int hdmi_setup_channel_allocation(struct hda_codec *codec, | |||
419 | /* | 422 | /* |
420 | * CA defaults to 0 for basic stereo audio | 423 | * CA defaults to 0 for basic stereo audio |
421 | */ | 424 | */ |
422 | if (!eld->eld_ver) | ||
423 | return 0; | ||
424 | if (!eld->spk_alloc) | ||
425 | return 0; | ||
426 | if (channels <= 2) | 425 | if (channels <= 2) |
427 | return 0; | 426 | return 0; |
428 | 427 | ||
429 | /* | 428 | /* |
429 | * HDMI sink's ELD info cannot always be retrieved for now, e.g. | ||
430 | * in console or for audio devices. Assume the highest speakers | ||
431 | * configuration, to _not_ prohibit multi-channel audio playback. | ||
432 | */ | ||
433 | if (!eld->spk_alloc) | ||
434 | eld->spk_alloc = 0xffff; | ||
435 | |||
436 | /* | ||
430 | * expand ELD's speaker allocation mask | 437 | * expand ELD's speaker allocation mask |
431 | * | 438 | * |
432 | * ELD tells the speaker mask in a compact(paired) form, | 439 | * ELD tells the speaker mask in a compact(paired) form, |
@@ -485,6 +492,7 @@ static void hdmi_setup_audio_infoframe(struct hda_codec *codec, | |||
485 | hdmi_setup_channel_mapping(codec, &ai); | 492 | hdmi_setup_channel_mapping(codec, &ai); |
486 | 493 | ||
487 | hdmi_fill_audio_infoframe(codec, &ai); | 494 | hdmi_fill_audio_infoframe(codec, &ai); |
495 | hdmi_start_infoframe_trans(codec); | ||
488 | } | 496 | } |
489 | 497 | ||
490 | 498 | ||
@@ -562,7 +570,7 @@ static int intel_hdmi_playback_pcm_close(struct hda_pcm_stream *hinfo, | |||
562 | { | 570 | { |
563 | struct intel_hdmi_spec *spec = codec->spec; | 571 | struct intel_hdmi_spec *spec = codec->spec; |
564 | 572 | ||
565 | hdmi_disable_output(codec); | 573 | hdmi_stop_infoframe_trans(codec); |
566 | 574 | ||
567 | return snd_hda_multi_out_dig_close(codec, &spec->multiout); | 575 | return snd_hda_multi_out_dig_close(codec, &spec->multiout); |
568 | } | 576 | } |
@@ -582,8 +590,6 @@ static int intel_hdmi_playback_pcm_prepare(struct hda_pcm_stream *hinfo, | |||
582 | 590 | ||
583 | hdmi_setup_audio_infoframe(codec, substream); | 591 | hdmi_setup_audio_infoframe(codec, substream); |
584 | 592 | ||
585 | hdmi_enable_output(codec); | ||
586 | |||
587 | return 0; | 593 | return 0; |
588 | } | 594 | } |
589 | 595 | ||
@@ -628,8 +634,7 @@ static int intel_hdmi_build_controls(struct hda_codec *codec) | |||
628 | 634 | ||
629 | static int intel_hdmi_init(struct hda_codec *codec) | 635 | static int intel_hdmi_init(struct hda_codec *codec) |
630 | { | 636 | { |
631 | /* disable audio output as early as possible */ | 637 | hdmi_enable_output(codec); |
632 | hdmi_disable_output(codec); | ||
633 | 638 | ||
634 | snd_hda_sequence_write(codec, unsolicited_response_verb); | 639 | snd_hda_sequence_write(codec, unsolicited_response_verb); |
635 | 640 | ||
@@ -679,6 +684,7 @@ static struct hda_codec_preset snd_hda_preset_intelhdmi[] = { | |||
679 | { .id = 0x80862801, .name = "G45 DEVBLC", .patch = patch_intel_hdmi }, | 684 | { .id = 0x80862801, .name = "G45 DEVBLC", .patch = patch_intel_hdmi }, |
680 | { .id = 0x80862802, .name = "G45 DEVCTG", .patch = patch_intel_hdmi }, | 685 | { .id = 0x80862802, .name = "G45 DEVCTG", .patch = patch_intel_hdmi }, |
681 | { .id = 0x80862803, .name = "G45 DEVELK", .patch = patch_intel_hdmi }, | 686 | { .id = 0x80862803, .name = "G45 DEVELK", .patch = patch_intel_hdmi }, |
687 | { .id = 0x80862804, .name = "G45 DEVIBX", .patch = patch_intel_hdmi }, | ||
682 | { .id = 0x10951392, .name = "SiI1392 HDMI", .patch = patch_intel_hdmi }, | 688 | { .id = 0x10951392, .name = "SiI1392 HDMI", .patch = patch_intel_hdmi }, |
683 | {} /* terminator */ | 689 | {} /* terminator */ |
684 | }; | 690 | }; |
@@ -687,6 +693,7 @@ MODULE_ALIAS("snd-hda-codec-id:808629fb"); | |||
687 | MODULE_ALIAS("snd-hda-codec-id:80862801"); | 693 | MODULE_ALIAS("snd-hda-codec-id:80862801"); |
688 | MODULE_ALIAS("snd-hda-codec-id:80862802"); | 694 | MODULE_ALIAS("snd-hda-codec-id:80862802"); |
689 | MODULE_ALIAS("snd-hda-codec-id:80862803"); | 695 | MODULE_ALIAS("snd-hda-codec-id:80862803"); |
696 | MODULE_ALIAS("snd-hda-codec-id:80862804"); | ||
690 | MODULE_ALIAS("snd-hda-codec-id:10951392"); | 697 | MODULE_ALIAS("snd-hda-codec-id:10951392"); |
691 | 698 | ||
692 | MODULE_LICENSE("GPL"); | 699 | MODULE_LICENSE("GPL"); |
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 5d249a547fbf..6c26afcb8262 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c | |||
@@ -1037,6 +1037,7 @@ do_sku: | |||
1037 | case 0x10ec0267: | 1037 | case 0x10ec0267: |
1038 | case 0x10ec0268: | 1038 | case 0x10ec0268: |
1039 | case 0x10ec0269: | 1039 | case 0x10ec0269: |
1040 | case 0x10ec0272: | ||
1040 | case 0x10ec0660: | 1041 | case 0x10ec0660: |
1041 | case 0x10ec0662: | 1042 | case 0x10ec0662: |
1042 | case 0x10ec0663: | 1043 | case 0x10ec0663: |
@@ -1065,6 +1066,7 @@ do_sku: | |||
1065 | case 0x10ec0882: | 1066 | case 0x10ec0882: |
1066 | case 0x10ec0883: | 1067 | case 0x10ec0883: |
1067 | case 0x10ec0885: | 1068 | case 0x10ec0885: |
1069 | case 0x10ec0887: | ||
1068 | case 0x10ec0889: | 1070 | case 0x10ec0889: |
1069 | snd_hda_codec_write(codec, 0x20, 0, | 1071 | snd_hda_codec_write(codec, 0x20, 0, |
1070 | AC_VERB_SET_COEF_INDEX, 7); | 1072 | AC_VERB_SET_COEF_INDEX, 7); |
@@ -7012,12 +7014,15 @@ static int patch_alc882(struct hda_codec *codec) | |||
7012 | break; | 7014 | break; |
7013 | case 0x106b1000: /* iMac 24 */ | 7015 | case 0x106b1000: /* iMac 24 */ |
7014 | case 0x106b2800: /* AppleTV */ | 7016 | case 0x106b2800: /* AppleTV */ |
7017 | case 0x106b3e00: /* iMac 24 Aluminium */ | ||
7015 | board_config = ALC885_IMAC24; | 7018 | board_config = ALC885_IMAC24; |
7016 | break; | 7019 | break; |
7020 | case 0x106b00a0: /* MacBookPro3,1 - Another revision */ | ||
7017 | case 0x106b00a1: /* Macbook (might be wrong - PCI SSID?) */ | 7021 | case 0x106b00a1: /* Macbook (might be wrong - PCI SSID?) */ |
7018 | case 0x106b00a4: /* MacbookPro4,1 */ | 7022 | case 0x106b00a4: /* MacbookPro4,1 */ |
7019 | case 0x106b2c00: /* Macbook Pro rev3 */ | 7023 | case 0x106b2c00: /* Macbook Pro rev3 */ |
7020 | case 0x106b3600: /* Macbook 3.1 */ | 7024 | case 0x106b3600: /* Macbook 3.1 */ |
7025 | case 0x106b3800: /* MacbookPro4,1 - latter revision */ | ||
7021 | board_config = ALC885_MBP3; | 7026 | board_config = ALC885_MBP3; |
7022 | break; | 7027 | break; |
7023 | default: | 7028 | default: |
@@ -8465,6 +8470,8 @@ static struct snd_pci_quirk alc883_cfg_tbl[] = { | |||
8465 | ALC888_ACER_ASPIRE_4930G), | 8470 | ALC888_ACER_ASPIRE_4930G), |
8466 | SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G", | 8471 | SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G", |
8467 | ALC888_ACER_ASPIRE_4930G), | 8472 | ALC888_ACER_ASPIRE_4930G), |
8473 | SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G", | ||
8474 | ALC888_ACER_ASPIRE_4930G), | ||
8468 | SND_PCI_QUIRK(0x1025, 0, "Acer laptop", ALC883_ACER), /* default Acer */ | 8475 | SND_PCI_QUIRK(0x1025, 0, "Acer laptop", ALC883_ACER), /* default Acer */ |
8469 | SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL), | 8476 | SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL), |
8470 | SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG), | 8477 | SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG), |
@@ -8474,6 +8481,7 @@ static struct snd_pci_quirk alc883_cfg_tbl[] = { | |||
8474 | SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP), | 8481 | SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP), |
8475 | SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V), | 8482 | SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V), |
8476 | SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG), | 8483 | SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG), |
8484 | SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG), | ||
8477 | SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q), | 8485 | SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q), |
8478 | SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601), | 8486 | SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601), |
8479 | SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG), | 8487 | SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG), |
@@ -8513,6 +8521,8 @@ static struct snd_pci_quirk alc883_cfg_tbl[] = { | |||
8513 | SND_PCI_QUIRK(0x1558, 0, "Clevo laptop", ALC883_LAPTOP_EAPD), | 8521 | SND_PCI_QUIRK(0x1558, 0, "Clevo laptop", ALC883_LAPTOP_EAPD), |
8514 | SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch), | 8522 | SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch), |
8515 | SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION), | 8523 | SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION), |
8524 | SND_PCI_QUIRK(0x1734, 0x1107, "FSC AMILO Xi2550", | ||
8525 | ALC883_FUJITSU_PI2515), | ||
8516 | SND_PCI_QUIRK(0x1734, 0x1108, "Fujitsu AMILO Pi2515", ALC883_FUJITSU_PI2515), | 8526 | SND_PCI_QUIRK(0x1734, 0x1108, "Fujitsu AMILO Pi2515", ALC883_FUJITSU_PI2515), |
8517 | SND_PCI_QUIRK(0x1734, 0x113d, "Fujitsu AMILO Xa3530", | 8527 | SND_PCI_QUIRK(0x1734, 0x113d, "Fujitsu AMILO Xa3530", |
8518 | ALC888_FUJITSU_XA3530), | 8528 | ALC888_FUJITSU_XA3530), |
@@ -10547,6 +10557,7 @@ static struct snd_pci_quirk alc262_cfg_tbl[] = { | |||
10547 | SND_PCI_QUIRK(0x103c, 0x1309, "HP xw4*00", ALC262_HP_BPC), | 10557 | SND_PCI_QUIRK(0x103c, 0x1309, "HP xw4*00", ALC262_HP_BPC), |
10548 | SND_PCI_QUIRK(0x103c, 0x130a, "HP xw6*00", ALC262_HP_BPC), | 10558 | SND_PCI_QUIRK(0x103c, 0x130a, "HP xw6*00", ALC262_HP_BPC), |
10549 | SND_PCI_QUIRK(0x103c, 0x130b, "HP xw8*00", ALC262_HP_BPC), | 10559 | SND_PCI_QUIRK(0x103c, 0x130b, "HP xw8*00", ALC262_HP_BPC), |
10560 | SND_PCI_QUIRK(0x103c, 0x170b, "HP xw*", ALC262_HP_BPC), | ||
10550 | SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL), | 10561 | SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL), |
10551 | SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF), | 10562 | SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF), |
10552 | SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL), | 10563 | SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL), |
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index 3dd4eee70b7c..6094344fb223 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c | |||
@@ -1207,7 +1207,7 @@ static const char *slave_vols[] = { | |||
1207 | "LFE Playback Volume", | 1207 | "LFE Playback Volume", |
1208 | "Side Playback Volume", | 1208 | "Side Playback Volume", |
1209 | "Headphone Playback Volume", | 1209 | "Headphone Playback Volume", |
1210 | "Headphone Playback Volume", | 1210 | "Headphone2 Playback Volume", |
1211 | "Speaker Playback Volume", | 1211 | "Speaker Playback Volume", |
1212 | "External Speaker Playback Volume", | 1212 | "External Speaker Playback Volume", |
1213 | "Speaker2 Playback Volume", | 1213 | "Speaker2 Playback Volume", |
@@ -1221,7 +1221,7 @@ static const char *slave_sws[] = { | |||
1221 | "LFE Playback Switch", | 1221 | "LFE Playback Switch", |
1222 | "Side Playback Switch", | 1222 | "Side Playback Switch", |
1223 | "Headphone Playback Switch", | 1223 | "Headphone Playback Switch", |
1224 | "Headphone Playback Switch", | 1224 | "Headphone2 Playback Switch", |
1225 | "Speaker Playback Switch", | 1225 | "Speaker Playback Switch", |
1226 | "External Speaker Playback Switch", | 1226 | "External Speaker Playback Switch", |
1227 | "Speaker2 Playback Switch", | 1227 | "Speaker2 Playback Switch", |
@@ -1799,11 +1799,13 @@ static struct snd_pci_quirk stac92hd71bxx_cfg_tbl[] = { | |||
1799 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x30f2, | 1799 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x30f2, |
1800 | "HP dv5", STAC_HP_M4), | 1800 | "HP dv5", STAC_HP_M4), |
1801 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x30f4, | 1801 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x30f4, |
1802 | "HP dv7", STAC_HP_M4), | 1802 | "HP dv7", STAC_HP_DV5), |
1803 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x30f7, | 1803 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x30f7, |
1804 | "HP dv4", STAC_HP_DV5), | 1804 | "HP dv4", STAC_HP_DV5), |
1805 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x30fc, | 1805 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x30fc, |
1806 | "HP dv7", STAC_HP_M4), | 1806 | "HP dv7", STAC_HP_M4), |
1807 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3600, | ||
1808 | "HP dv5", STAC_HP_DV5), | ||
1807 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3603, | 1809 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3603, |
1808 | "HP dv5", STAC_HP_DV5), | 1810 | "HP dv5", STAC_HP_DV5), |
1809 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x361a, | 1811 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x361a, |
@@ -2440,6 +2442,14 @@ static int stac92xx_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo, | |||
2440 | stream_tag, format, substream); | 2442 | stream_tag, format, substream); |
2441 | } | 2443 | } |
2442 | 2444 | ||
2445 | static int stac92xx_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, | ||
2446 | struct hda_codec *codec, | ||
2447 | struct snd_pcm_substream *substream) | ||
2448 | { | ||
2449 | struct sigmatel_spec *spec = codec->spec; | ||
2450 | return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout); | ||
2451 | } | ||
2452 | |||
2443 | 2453 | ||
2444 | /* | 2454 | /* |
2445 | * Analog capture callbacks | 2455 | * Analog capture callbacks |
@@ -2484,7 +2494,8 @@ static struct hda_pcm_stream stac92xx_pcm_digital_playback = { | |||
2484 | .ops = { | 2494 | .ops = { |
2485 | .open = stac92xx_dig_playback_pcm_open, | 2495 | .open = stac92xx_dig_playback_pcm_open, |
2486 | .close = stac92xx_dig_playback_pcm_close, | 2496 | .close = stac92xx_dig_playback_pcm_close, |
2487 | .prepare = stac92xx_dig_playback_pcm_prepare | 2497 | .prepare = stac92xx_dig_playback_pcm_prepare, |
2498 | .cleanup = stac92xx_dig_playback_pcm_cleanup | ||
2488 | }, | 2499 | }, |
2489 | }; | 2500 | }; |
2490 | 2501 | ||
@@ -2539,6 +2550,8 @@ static int stac92xx_build_pcms(struct hda_codec *codec) | |||
2539 | 2550 | ||
2540 | info->name = "STAC92xx Analog"; | 2551 | info->name = "STAC92xx Analog"; |
2541 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = stac92xx_pcm_analog_playback; | 2552 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = stac92xx_pcm_analog_playback; |
2553 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = | ||
2554 | spec->multiout.dac_nids[0]; | ||
2542 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = stac92xx_pcm_analog_capture; | 2555 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = stac92xx_pcm_analog_capture; |
2543 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0]; | 2556 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0]; |
2544 | info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams = spec->num_adcs; | 2557 | info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams = spec->num_adcs; |
@@ -3503,6 +3516,7 @@ static int stac92xx_parse_auto_config(struct hda_codec *codec, hda_nid_t dig_out | |||
3503 | if (! spec->autocfg.line_outs) | 3516 | if (! spec->autocfg.line_outs) |
3504 | return 0; /* can't find valid pin config */ | 3517 | return 0; /* can't find valid pin config */ |
3505 | 3518 | ||
3519 | #if 0 /* FIXME: temporarily disabled */ | ||
3506 | /* If we have no real line-out pin and multiple hp-outs, HPs should | 3520 | /* If we have no real line-out pin and multiple hp-outs, HPs should |
3507 | * be set up as multi-channel outputs. | 3521 | * be set up as multi-channel outputs. |
3508 | */ | 3522 | */ |
@@ -3522,6 +3536,7 @@ static int stac92xx_parse_auto_config(struct hda_codec *codec, hda_nid_t dig_out | |||
3522 | spec->autocfg.line_out_type = AUTO_PIN_HP_OUT; | 3536 | spec->autocfg.line_out_type = AUTO_PIN_HP_OUT; |
3523 | spec->autocfg.hp_outs = 0; | 3537 | spec->autocfg.hp_outs = 0; |
3524 | } | 3538 | } |
3539 | #endif /* FIXME: temporarily disabled */ | ||
3525 | if (spec->autocfg.mono_out_pin) { | 3540 | if (spec->autocfg.mono_out_pin) { |
3526 | int dir = get_wcaps(codec, spec->autocfg.mono_out_pin) & | 3541 | int dir = get_wcaps(codec, spec->autocfg.mono_out_pin) & |
3527 | (AC_WCAP_OUT_AMP | AC_WCAP_IN_AMP); | 3542 | (AC_WCAP_OUT_AMP | AC_WCAP_IN_AMP); |
@@ -4976,7 +4991,7 @@ again: | |||
4976 | case STAC_DELL_M4_3: | 4991 | case STAC_DELL_M4_3: |
4977 | spec->num_dmics = 1; | 4992 | spec->num_dmics = 1; |
4978 | spec->num_smuxes = 0; | 4993 | spec->num_smuxes = 0; |
4979 | spec->num_dmuxes = 0; | 4994 | spec->num_dmuxes = 1; |
4980 | break; | 4995 | break; |
4981 | default: | 4996 | default: |
4982 | spec->num_dmics = STAC92HD71BXX_NUM_DMICS; | 4997 | spec->num_dmics = STAC92HD71BXX_NUM_DMICS; |
diff --git a/sound/pci/ice1712/ice1712.c b/sound/pci/ice1712/ice1712.c index 58d7cda03de5..bab1c700f497 100644 --- a/sound/pci/ice1712/ice1712.c +++ b/sound/pci/ice1712/ice1712.c | |||
@@ -2648,9 +2648,9 @@ static int __devinit snd_ice1712_probe(struct pci_dev *pci, | |||
2648 | return -ENOENT; | 2648 | return -ENOENT; |
2649 | } | 2649 | } |
2650 | 2650 | ||
2651 | card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); | 2651 | err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card); |
2652 | if (card == NULL) | 2652 | if (err < 0) |
2653 | return -ENOMEM; | 2653 | return err; |
2654 | 2654 | ||
2655 | strcpy(card->driver, "ICE1712"); | 2655 | strcpy(card->driver, "ICE1712"); |
2656 | strcpy(card->shortname, "ICEnsemble ICE1712"); | 2656 | strcpy(card->shortname, "ICEnsemble ICE1712"); |
diff --git a/sound/pci/ice1712/ice1724.c b/sound/pci/ice1712/ice1724.c index bb8d8c766b9d..7ff36d3f0f44 100644 --- a/sound/pci/ice1712/ice1724.c +++ b/sound/pci/ice1712/ice1724.c | |||
@@ -2456,9 +2456,9 @@ static int __devinit snd_vt1724_probe(struct pci_dev *pci, | |||
2456 | return -ENOENT; | 2456 | return -ENOENT; |
2457 | } | 2457 | } |
2458 | 2458 | ||
2459 | card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); | 2459 | err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card); |
2460 | if (card == NULL) | 2460 | if (err < 0) |
2461 | return -ENOMEM; | 2461 | return err; |
2462 | 2462 | ||
2463 | strcpy(card->driver, "ICE1724"); | 2463 | strcpy(card->driver, "ICE1724"); |
2464 | strcpy(card->shortname, "ICEnsemble ICE1724"); | 2464 | strcpy(card->shortname, "ICEnsemble ICE1724"); |
diff --git a/sound/pci/intel8x0.c b/sound/pci/intel8x0.c index 19d3391e229f..608655e9275e 100644 --- a/sound/pci/intel8x0.c +++ b/sound/pci/intel8x0.c | |||
@@ -617,7 +617,7 @@ static int snd_intel8x0_ali_codec_semaphore(struct intel8x0 *chip) | |||
617 | int time = 100; | 617 | int time = 100; |
618 | if (chip->buggy_semaphore) | 618 | if (chip->buggy_semaphore) |
619 | return 0; /* just ignore ... */ | 619 | return 0; /* just ignore ... */ |
620 | while (time-- && (igetdword(chip, ICHREG(ALI_CAS)) & ALI_CAS_SEM_BUSY)) | 620 | while (--time && (igetdword(chip, ICHREG(ALI_CAS)) & ALI_CAS_SEM_BUSY)) |
621 | udelay(1); | 621 | udelay(1); |
622 | if (! time && ! chip->in_ac97_init) | 622 | if (! time && ! chip->in_ac97_init) |
623 | snd_printk(KERN_WARNING "ali_codec_semaphore timeout\n"); | 623 | snd_printk(KERN_WARNING "ali_codec_semaphore timeout\n"); |
@@ -3058,9 +3058,9 @@ static int __devinit snd_intel8x0_probe(struct pci_dev *pci, | |||
3058 | int err; | 3058 | int err; |
3059 | struct shortname_table *name; | 3059 | struct shortname_table *name; |
3060 | 3060 | ||
3061 | card = snd_card_new(index, id, THIS_MODULE, 0); | 3061 | err = snd_card_create(index, id, THIS_MODULE, 0, &card); |
3062 | if (card == NULL) | 3062 | if (err < 0) |
3063 | return -ENOMEM; | 3063 | return err; |
3064 | 3064 | ||
3065 | if (spdif_aclink < 0) | 3065 | if (spdif_aclink < 0) |
3066 | spdif_aclink = check_default_spdif_aclink(pci); | 3066 | spdif_aclink = check_default_spdif_aclink(pci); |
diff --git a/sound/pci/intel8x0m.c b/sound/pci/intel8x0m.c index 93449e464566..33a843c19316 100644 --- a/sound/pci/intel8x0m.c +++ b/sound/pci/intel8x0m.c | |||
@@ -1269,9 +1269,9 @@ static int __devinit snd_intel8x0m_probe(struct pci_dev *pci, | |||
1269 | int err; | 1269 | int err; |
1270 | struct shortname_table *name; | 1270 | struct shortname_table *name; |
1271 | 1271 | ||
1272 | card = snd_card_new(index, id, THIS_MODULE, 0); | 1272 | err = snd_card_create(index, id, THIS_MODULE, 0, &card); |
1273 | if (card == NULL) | 1273 | if (err < 0) |
1274 | return -ENOMEM; | 1274 | return err; |
1275 | 1275 | ||
1276 | strcpy(card->driver, "ICH-MODEM"); | 1276 | strcpy(card->driver, "ICH-MODEM"); |
1277 | strcpy(card->shortname, "Intel ICH"); | 1277 | strcpy(card->shortname, "Intel ICH"); |
diff --git a/sound/pci/korg1212/korg1212.c b/sound/pci/korg1212/korg1212.c index 5f8006b42750..8b79969034be 100644 --- a/sound/pci/korg1212/korg1212.c +++ b/sound/pci/korg1212/korg1212.c | |||
@@ -2443,9 +2443,9 @@ snd_korg1212_probe(struct pci_dev *pci, | |||
2443 | dev++; | 2443 | dev++; |
2444 | return -ENOENT; | 2444 | return -ENOENT; |
2445 | } | 2445 | } |
2446 | card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); | 2446 | err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card); |
2447 | if (card == NULL) | 2447 | if (err < 0) |
2448 | return -ENOMEM; | 2448 | return err; |
2449 | 2449 | ||
2450 | if ((err = snd_korg1212_create(card, pci, &korg1212)) < 0) { | 2450 | if ((err = snd_korg1212_create(card, pci, &korg1212)) < 0) { |
2451 | snd_card_free(card); | 2451 | snd_card_free(card); |
diff --git a/sound/pci/maestro3.c b/sound/pci/maestro3.c index 59bbaf8f3e5b..70141548f251 100644 --- a/sound/pci/maestro3.c +++ b/sound/pci/maestro3.c | |||
@@ -2691,9 +2691,9 @@ snd_m3_probe(struct pci_dev *pci, const struct pci_device_id *pci_id) | |||
2691 | return -ENOENT; | 2691 | return -ENOENT; |
2692 | } | 2692 | } |
2693 | 2693 | ||
2694 | card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); | 2694 | err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card); |
2695 | if (card == NULL) | 2695 | if (err < 0) |
2696 | return -ENOMEM; | 2696 | return err; |
2697 | 2697 | ||
2698 | switch (pci->device) { | 2698 | switch (pci->device) { |
2699 | case PCI_DEVICE_ID_ESS_ALLEGRO: | 2699 | case PCI_DEVICE_ID_ESS_ALLEGRO: |
diff --git a/sound/pci/mixart/mixart.c b/sound/pci/mixart/mixart.c index f23a73577c22..c1eb84a14c42 100644 --- a/sound/pci/mixart/mixart.c +++ b/sound/pci/mixart/mixart.c | |||
@@ -607,6 +607,7 @@ static int snd_mixart_hw_params(struct snd_pcm_substream *subs, | |||
607 | /* set the format to the board */ | 607 | /* set the format to the board */ |
608 | err = mixart_set_format(stream, format); | 608 | err = mixart_set_format(stream, format); |
609 | if(err < 0) { | 609 | if(err < 0) { |
610 | mutex_unlock(&mgr->setup_mutex); | ||
610 | return err; | 611 | return err; |
611 | } | 612 | } |
612 | 613 | ||
@@ -1365,12 +1366,12 @@ static int __devinit snd_mixart_probe(struct pci_dev *pci, | |||
1365 | else | 1366 | else |
1366 | idx = index[dev] + i; | 1367 | idx = index[dev] + i; |
1367 | snprintf(tmpid, sizeof(tmpid), "%s-%d", id[dev] ? id[dev] : "MIXART", i); | 1368 | snprintf(tmpid, sizeof(tmpid), "%s-%d", id[dev] ? id[dev] : "MIXART", i); |
1368 | card = snd_card_new(idx, tmpid, THIS_MODULE, 0); | 1369 | err = snd_card_create(idx, tmpid, THIS_MODULE, 0, &card); |
1369 | 1370 | ||
1370 | if (! card) { | 1371 | if (err < 0) { |
1371 | snd_printk(KERN_ERR "cannot allocate the card %d\n", i); | 1372 | snd_printk(KERN_ERR "cannot allocate the card %d\n", i); |
1372 | snd_mixart_free(mgr); | 1373 | snd_mixart_free(mgr); |
1373 | return -ENOMEM; | 1374 | return err; |
1374 | } | 1375 | } |
1375 | 1376 | ||
1376 | strcpy(card->driver, CARD_NAME); | 1377 | strcpy(card->driver, CARD_NAME); |
diff --git a/sound/pci/mixart/mixart_hwdep.c b/sound/pci/mixart/mixart_hwdep.c index dda562081d7e..4cf4cd8c939c 100644 --- a/sound/pci/mixart/mixart_hwdep.c +++ b/sound/pci/mixart/mixart_hwdep.c | |||
@@ -587,16 +587,6 @@ MODULE_FIRMWARE("mixart/miXart8AES.xlx"); | |||
587 | /* miXart hwdep interface id string */ | 587 | /* miXart hwdep interface id string */ |
588 | #define SND_MIXART_HWDEP_ID "miXart Loader" | 588 | #define SND_MIXART_HWDEP_ID "miXart Loader" |
589 | 589 | ||
590 | static int mixart_hwdep_open(struct snd_hwdep *hw, struct file *file) | ||
591 | { | ||
592 | return 0; | ||
593 | } | ||
594 | |||
595 | static int mixart_hwdep_release(struct snd_hwdep *hw, struct file *file) | ||
596 | { | ||
597 | return 0; | ||
598 | } | ||
599 | |||
600 | static int mixart_hwdep_dsp_status(struct snd_hwdep *hw, | 590 | static int mixart_hwdep_dsp_status(struct snd_hwdep *hw, |
601 | struct snd_hwdep_dsp_status *info) | 591 | struct snd_hwdep_dsp_status *info) |
602 | { | 592 | { |
@@ -649,8 +639,6 @@ int snd_mixart_setup_firmware(struct mixart_mgr *mgr) | |||
649 | 639 | ||
650 | hw->iface = SNDRV_HWDEP_IFACE_MIXART; | 640 | hw->iface = SNDRV_HWDEP_IFACE_MIXART; |
651 | hw->private_data = mgr; | 641 | hw->private_data = mgr; |
652 | hw->ops.open = mixart_hwdep_open; | ||
653 | hw->ops.release = mixart_hwdep_release; | ||
654 | hw->ops.dsp_status = mixart_hwdep_dsp_status; | 642 | hw->ops.dsp_status = mixart_hwdep_dsp_status; |
655 | hw->ops.dsp_load = mixart_hwdep_dsp_load; | 643 | hw->ops.dsp_load = mixart_hwdep_dsp_load; |
656 | hw->exclusive = 1; | 644 | hw->exclusive = 1; |
diff --git a/sound/pci/nm256/nm256.c b/sound/pci/nm256/nm256.c index 50c9f8a05082..522a040855d4 100644 --- a/sound/pci/nm256/nm256.c +++ b/sound/pci/nm256/nm256.c | |||
@@ -1668,9 +1668,9 @@ static int __devinit snd_nm256_probe(struct pci_dev *pci, | |||
1668 | } | 1668 | } |
1669 | } | 1669 | } |
1670 | 1670 | ||
1671 | card = snd_card_new(index, id, THIS_MODULE, 0); | 1671 | err = snd_card_create(index, id, THIS_MODULE, 0, &card); |
1672 | if (card == NULL) | 1672 | if (err < 0) |
1673 | return -ENOMEM; | 1673 | return err; |
1674 | 1674 | ||
1675 | switch (pci->device) { | 1675 | switch (pci->device) { |
1676 | case PCI_DEVICE_ID_NEOMAGIC_NM256AV_AUDIO: | 1676 | case PCI_DEVICE_ID_NEOMAGIC_NM256AV_AUDIO: |
diff --git a/sound/pci/oxygen/oxygen_lib.c b/sound/pci/oxygen/oxygen_lib.c index 84f481d41efa..9c81e0b05113 100644 --- a/sound/pci/oxygen/oxygen_lib.c +++ b/sound/pci/oxygen/oxygen_lib.c | |||
@@ -459,10 +459,10 @@ int oxygen_pci_probe(struct pci_dev *pci, int index, char *id, | |||
459 | struct oxygen *chip; | 459 | struct oxygen *chip; |
460 | int err; | 460 | int err; |
461 | 461 | ||
462 | card = snd_card_new(index, id, model->owner, | 462 | err = snd_card_create(index, id, model->owner, |
463 | sizeof *chip + model->model_data_size); | 463 | sizeof(*chip) + model->model_data_size, &card); |
464 | if (!card) | 464 | if (err < 0) |
465 | return -ENOMEM; | 465 | return err; |
466 | 466 | ||
467 | chip = card->private_data; | 467 | chip = card->private_data; |
468 | chip->card = card; | 468 | chip->card = card; |
diff --git a/sound/pci/oxygen/virtuoso.c b/sound/pci/oxygen/virtuoso.c index 18c7c91786bc..6c870c12a177 100644 --- a/sound/pci/oxygen/virtuoso.c +++ b/sound/pci/oxygen/virtuoso.c | |||
@@ -26,7 +26,7 @@ | |||
26 | * SPI 0 -> 1st PCM1796 (front) | 26 | * SPI 0 -> 1st PCM1796 (front) |
27 | * SPI 1 -> 2nd PCM1796 (surround) | 27 | * SPI 1 -> 2nd PCM1796 (surround) |
28 | * SPI 2 -> 3rd PCM1796 (center/LFE) | 28 | * SPI 2 -> 3rd PCM1796 (center/LFE) |
29 | * SPI 4 -> 4th PCM1796 (back) and EEPROM self-destruct (do not use!) | 29 | * SPI 4 -> 4th PCM1796 (back) |
30 | * | 30 | * |
31 | * GPIO 2 -> M0 of CS5381 | 31 | * GPIO 2 -> M0 of CS5381 |
32 | * GPIO 3 -> M1 of CS5381 | 32 | * GPIO 3 -> M1 of CS5381 |
@@ -207,12 +207,6 @@ static void xonar_gpio_changed(struct oxygen *chip); | |||
207 | static inline void pcm1796_write_spi(struct oxygen *chip, unsigned int codec, | 207 | static inline void pcm1796_write_spi(struct oxygen *chip, unsigned int codec, |
208 | u8 reg, u8 value) | 208 | u8 reg, u8 value) |
209 | { | 209 | { |
210 | /* | ||
211 | * We don't want to do writes on SPI 4 because the EEPROM, which shares | ||
212 | * the same pin, might get confused and broken. We'd better take care | ||
213 | * that the driver works with the default register values ... | ||
214 | */ | ||
215 | #if 0 | ||
216 | /* maps ALSA channel pair number to SPI output */ | 210 | /* maps ALSA channel pair number to SPI output */ |
217 | static const u8 codec_map[4] = { | 211 | static const u8 codec_map[4] = { |
218 | 0, 1, 2, 4 | 212 | 0, 1, 2, 4 |
@@ -223,7 +217,6 @@ static inline void pcm1796_write_spi(struct oxygen *chip, unsigned int codec, | |||
223 | (codec_map[codec] << OXYGEN_SPI_CODEC_SHIFT) | | 217 | (codec_map[codec] << OXYGEN_SPI_CODEC_SHIFT) | |
224 | OXYGEN_SPI_CEN_LATCH_CLOCK_HI, | 218 | OXYGEN_SPI_CEN_LATCH_CLOCK_HI, |
225 | (reg << 8) | value); | 219 | (reg << 8) | value); |
226 | #endif | ||
227 | } | 220 | } |
228 | 221 | ||
229 | static inline void pcm1796_write_i2c(struct oxygen *chip, unsigned int codec, | 222 | static inline void pcm1796_write_i2c(struct oxygen *chip, unsigned int codec, |
@@ -757,9 +750,6 @@ static const DECLARE_TLV_DB_SCALE(cs4362a_db_scale, -12700, 100, 0); | |||
757 | 750 | ||
758 | static int xonar_d2_control_filter(struct snd_kcontrol_new *template) | 751 | static int xonar_d2_control_filter(struct snd_kcontrol_new *template) |
759 | { | 752 | { |
760 | if (!strncmp(template->name, "Master Playback ", 16)) | ||
761 | /* disable volume/mute because they would require SPI writes */ | ||
762 | return 1; | ||
763 | if (!strncmp(template->name, "CD Capture ", 11)) | 753 | if (!strncmp(template->name, "CD Capture ", 11)) |
764 | /* CD in is actually connected to the video in pin */ | 754 | /* CD in is actually connected to the video in pin */ |
765 | template->private_value ^= AC97_CD ^ AC97_VIDEO; | 755 | template->private_value ^= AC97_CD ^ AC97_VIDEO; |
@@ -850,8 +840,9 @@ static const struct oxygen_model model_xonar_d2 = { | |||
850 | .dac_volume_min = 0x0f, | 840 | .dac_volume_min = 0x0f, |
851 | .dac_volume_max = 0xff, | 841 | .dac_volume_max = 0xff, |
852 | .misc_flags = OXYGEN_MISC_MIDI, | 842 | .misc_flags = OXYGEN_MISC_MIDI, |
853 | .function_flags = OXYGEN_FUNCTION_SPI, | 843 | .function_flags = OXYGEN_FUNCTION_SPI | |
854 | .dac_i2s_format = OXYGEN_I2S_FORMAT_I2S, | 844 | OXYGEN_FUNCTION_ENABLE_SPI_4_5, |
845 | .dac_i2s_format = OXYGEN_I2S_FORMAT_LJUST, | ||
855 | .adc_i2s_format = OXYGEN_I2S_FORMAT_LJUST, | 846 | .adc_i2s_format = OXYGEN_I2S_FORMAT_LJUST, |
856 | }; | 847 | }; |
857 | 848 | ||
diff --git a/sound/pci/pcxhr/pcxhr.c b/sound/pci/pcxhr/pcxhr.c index 27cf2c28d113..7f95459c8b1f 100644 --- a/sound/pci/pcxhr/pcxhr.c +++ b/sound/pci/pcxhr/pcxhr.c | |||
@@ -1510,12 +1510,12 @@ static int __devinit pcxhr_probe(struct pci_dev *pci, | |||
1510 | 1510 | ||
1511 | snprintf(tmpid, sizeof(tmpid), "%s-%d", | 1511 | snprintf(tmpid, sizeof(tmpid), "%s-%d", |
1512 | id[dev] ? id[dev] : card_name, i); | 1512 | id[dev] ? id[dev] : card_name, i); |
1513 | card = snd_card_new(idx, tmpid, THIS_MODULE, 0); | 1513 | err = snd_card_create(idx, tmpid, THIS_MODULE, 0, &card); |
1514 | 1514 | ||
1515 | if (! card) { | 1515 | if (err < 0) { |
1516 | snd_printk(KERN_ERR "cannot allocate the card %d\n", i); | 1516 | snd_printk(KERN_ERR "cannot allocate the card %d\n", i); |
1517 | pcxhr_free(mgr); | 1517 | pcxhr_free(mgr); |
1518 | return -ENOMEM; | 1518 | return err; |
1519 | } | 1519 | } |
1520 | 1520 | ||
1521 | strcpy(card->driver, DRIVER_NAME); | 1521 | strcpy(card->driver, DRIVER_NAME); |
diff --git a/sound/pci/pcxhr/pcxhr.h b/sound/pci/pcxhr/pcxhr.h index 84131a916c92..69d87dee6995 100644 --- a/sound/pci/pcxhr/pcxhr.h +++ b/sound/pci/pcxhr/pcxhr.h | |||
@@ -97,12 +97,12 @@ struct pcxhr_mgr { | |||
97 | int capture_chips; | 97 | int capture_chips; |
98 | int fw_file_set; | 98 | int fw_file_set; |
99 | int firmware_num; | 99 | int firmware_num; |
100 | int is_hr_stereo:1; | 100 | unsigned int is_hr_stereo:1; |
101 | int board_has_aes1:1; /* if 1 board has AES1 plug and SRC */ | 101 | unsigned int board_has_aes1:1; /* if 1 board has AES1 plug and SRC */ |
102 | int board_has_analog:1; /* if 0 the board is digital only */ | 102 | unsigned int board_has_analog:1; /* if 0 the board is digital only */ |
103 | int board_has_mic:1; /* if 1 the board has microphone input */ | 103 | unsigned int board_has_mic:1; /* if 1 the board has microphone input */ |
104 | int board_aes_in_192k:1;/* if 1 the aes input plugs do support 192kHz */ | 104 | unsigned int board_aes_in_192k:1;/* if 1 the aes input plugs do support 192kHz */ |
105 | int mono_capture:1; /* if 1 the board does mono capture */ | 105 | unsigned int mono_capture:1; /* if 1 the board does mono capture */ |
106 | 106 | ||
107 | struct snd_dma_buffer hostport; | 107 | struct snd_dma_buffer hostport; |
108 | 108 | ||
diff --git a/sound/pci/pcxhr/pcxhr_hwdep.c b/sound/pci/pcxhr/pcxhr_hwdep.c index 592743a298b0..17cb1233a903 100644 --- a/sound/pci/pcxhr/pcxhr_hwdep.c +++ b/sound/pci/pcxhr/pcxhr_hwdep.c | |||
@@ -471,16 +471,6 @@ static int pcxhr_hwdep_dsp_load(struct snd_hwdep *hw, | |||
471 | return 0; | 471 | return 0; |
472 | } | 472 | } |
473 | 473 | ||
474 | static int pcxhr_hwdep_open(struct snd_hwdep *hw, struct file *file) | ||
475 | { | ||
476 | return 0; | ||
477 | } | ||
478 | |||
479 | static int pcxhr_hwdep_release(struct snd_hwdep *hw, struct file *file) | ||
480 | { | ||
481 | return 0; | ||
482 | } | ||
483 | |||
484 | int pcxhr_setup_firmware(struct pcxhr_mgr *mgr) | 474 | int pcxhr_setup_firmware(struct pcxhr_mgr *mgr) |
485 | { | 475 | { |
486 | int err; | 476 | int err; |
@@ -495,8 +485,6 @@ int pcxhr_setup_firmware(struct pcxhr_mgr *mgr) | |||
495 | 485 | ||
496 | hw->iface = SNDRV_HWDEP_IFACE_PCXHR; | 486 | hw->iface = SNDRV_HWDEP_IFACE_PCXHR; |
497 | hw->private_data = mgr; | 487 | hw->private_data = mgr; |
498 | hw->ops.open = pcxhr_hwdep_open; | ||
499 | hw->ops.release = pcxhr_hwdep_release; | ||
500 | hw->ops.dsp_status = pcxhr_hwdep_dsp_status; | 488 | hw->ops.dsp_status = pcxhr_hwdep_dsp_status; |
501 | hw->ops.dsp_load = pcxhr_hwdep_dsp_load; | 489 | hw->ops.dsp_load = pcxhr_hwdep_dsp_load; |
502 | hw->exclusive = 1; | 490 | hw->exclusive = 1; |
diff --git a/sound/pci/riptide/riptide.c b/sound/pci/riptide/riptide.c index 3caacfb9d8e0..6f1034417a02 100644 --- a/sound/pci/riptide/riptide.c +++ b/sound/pci/riptide/riptide.c | |||
@@ -2102,9 +2102,9 @@ snd_card_riptide_probe(struct pci_dev *pci, const struct pci_device_id *pci_id) | |||
2102 | return -ENOENT; | 2102 | return -ENOENT; |
2103 | } | 2103 | } |
2104 | 2104 | ||
2105 | card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); | 2105 | err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card); |
2106 | if (card == NULL) | 2106 | if (err < 0) |
2107 | return -ENOMEM; | 2107 | return err; |
2108 | if ((err = snd_riptide_create(card, pci, &chip)) < 0) { | 2108 | if ((err = snd_riptide_create(card, pci, &chip)) < 0) { |
2109 | snd_card_free(card); | 2109 | snd_card_free(card); |
2110 | return err; | 2110 | return err; |
diff --git a/sound/pci/rme32.c b/sound/pci/rme32.c index e7ef3a1a25a8..d7b966e7c4cf 100644 --- a/sound/pci/rme32.c +++ b/sound/pci/rme32.c | |||
@@ -1941,9 +1941,10 @@ snd_rme32_probe(struct pci_dev *pci, const struct pci_device_id *pci_id) | |||
1941 | return -ENOENT; | 1941 | return -ENOENT; |
1942 | } | 1942 | } |
1943 | 1943 | ||
1944 | if ((card = snd_card_new(index[dev], id[dev], THIS_MODULE, | 1944 | err = snd_card_create(index[dev], id[dev], THIS_MODULE, |
1945 | sizeof(struct rme32))) == NULL) | 1945 | sizeof(struct rme32), &card); |
1946 | return -ENOMEM; | 1946 | if (err < 0) |
1947 | return err; | ||
1947 | card->private_free = snd_rme32_card_free; | 1948 | card->private_free = snd_rme32_card_free; |
1948 | rme32 = (struct rme32 *) card->private_data; | 1949 | rme32 = (struct rme32 *) card->private_data; |
1949 | rme32->card = card; | 1950 | rme32->card = card; |
diff --git a/sound/pci/rme96.c b/sound/pci/rme96.c index 3fdd488d0975..55fb1c131f58 100644 --- a/sound/pci/rme96.c +++ b/sound/pci/rme96.c | |||
@@ -2348,9 +2348,10 @@ snd_rme96_probe(struct pci_dev *pci, | |||
2348 | dev++; | 2348 | dev++; |
2349 | return -ENOENT; | 2349 | return -ENOENT; |
2350 | } | 2350 | } |
2351 | if ((card = snd_card_new(index[dev], id[dev], THIS_MODULE, | 2351 | err = snd_card_create(index[dev], id[dev], THIS_MODULE, |
2352 | sizeof(struct rme96))) == NULL) | 2352 | sizeof(struct rme96), &card); |
2353 | return -ENOMEM; | 2353 | if (err < 0) |
2354 | return err; | ||
2354 | card->private_free = snd_rme96_card_free; | 2355 | card->private_free = snd_rme96_card_free; |
2355 | rme96 = (struct rme96 *)card->private_data; | 2356 | rme96 = (struct rme96 *)card->private_data; |
2356 | rme96->card = card; | 2357 | rme96->card = card; |
diff --git a/sound/pci/rme9652/hdsp.c b/sound/pci/rme9652/hdsp.c index 44d0c15e2b71..bacfdd12619b 100644 --- a/sound/pci/rme9652/hdsp.c +++ b/sound/pci/rme9652/hdsp.c | |||
@@ -4413,13 +4413,6 @@ static int snd_hdsp_capture_release(struct snd_pcm_substream *substream) | |||
4413 | return 0; | 4413 | return 0; |
4414 | } | 4414 | } |
4415 | 4415 | ||
4416 | static int snd_hdsp_hwdep_dummy_op(struct snd_hwdep *hw, struct file *file) | ||
4417 | { | ||
4418 | /* we have nothing to initialize but the call is required */ | ||
4419 | return 0; | ||
4420 | } | ||
4421 | |||
4422 | |||
4423 | /* helper functions for copying meter values */ | 4416 | /* helper functions for copying meter values */ |
4424 | static inline int copy_u32_le(void __user *dest, void __iomem *src) | 4417 | static inline int copy_u32_le(void __user *dest, void __iomem *src) |
4425 | { | 4418 | { |
@@ -4738,9 +4731,7 @@ static int snd_hdsp_create_hwdep(struct snd_card *card, struct hdsp *hdsp) | |||
4738 | hw->private_data = hdsp; | 4731 | hw->private_data = hdsp; |
4739 | strcpy(hw->name, "HDSP hwdep interface"); | 4732 | strcpy(hw->name, "HDSP hwdep interface"); |
4740 | 4733 | ||
4741 | hw->ops.open = snd_hdsp_hwdep_dummy_op; | ||
4742 | hw->ops.ioctl = snd_hdsp_hwdep_ioctl; | 4734 | hw->ops.ioctl = snd_hdsp_hwdep_ioctl; |
4743 | hw->ops.release = snd_hdsp_hwdep_dummy_op; | ||
4744 | 4735 | ||
4745 | return 0; | 4736 | return 0; |
4746 | } | 4737 | } |
@@ -5158,8 +5149,10 @@ static int __devinit snd_hdsp_probe(struct pci_dev *pci, | |||
5158 | return -ENOENT; | 5149 | return -ENOENT; |
5159 | } | 5150 | } |
5160 | 5151 | ||
5161 | if (!(card = snd_card_new(index[dev], id[dev], THIS_MODULE, sizeof(struct hdsp)))) | 5152 | err = snd_card_create(index[dev], id[dev], THIS_MODULE, |
5162 | return -ENOMEM; | 5153 | sizeof(struct hdsp), &card); |
5154 | if (err < 0) | ||
5155 | return err; | ||
5163 | 5156 | ||
5164 | hdsp = (struct hdsp *) card->private_data; | 5157 | hdsp = (struct hdsp *) card->private_data; |
5165 | card->private_free = snd_hdsp_card_free; | 5158 | card->private_free = snd_hdsp_card_free; |
diff --git a/sound/pci/rme9652/hdspm.c b/sound/pci/rme9652/hdspm.c index 71231cf1b2b0..bac2dc0c5d85 100644 --- a/sound/pci/rme9652/hdspm.c +++ b/sound/pci/rme9652/hdspm.c | |||
@@ -4100,13 +4100,6 @@ static int snd_hdspm_capture_release(struct snd_pcm_substream *substream) | |||
4100 | return 0; | 4100 | return 0; |
4101 | } | 4101 | } |
4102 | 4102 | ||
4103 | static int snd_hdspm_hwdep_dummy_op(struct snd_hwdep * hw, struct file *file) | ||
4104 | { | ||
4105 | /* we have nothing to initialize but the call is required */ | ||
4106 | return 0; | ||
4107 | } | ||
4108 | |||
4109 | |||
4110 | static int snd_hdspm_hwdep_ioctl(struct snd_hwdep * hw, struct file *file, | 4103 | static int snd_hdspm_hwdep_ioctl(struct snd_hwdep * hw, struct file *file, |
4111 | unsigned int cmd, unsigned long arg) | 4104 | unsigned int cmd, unsigned long arg) |
4112 | { | 4105 | { |
@@ -4213,9 +4206,7 @@ static int __devinit snd_hdspm_create_hwdep(struct snd_card *card, | |||
4213 | hw->private_data = hdspm; | 4206 | hw->private_data = hdspm; |
4214 | strcpy(hw->name, "HDSPM hwdep interface"); | 4207 | strcpy(hw->name, "HDSPM hwdep interface"); |
4215 | 4208 | ||
4216 | hw->ops.open = snd_hdspm_hwdep_dummy_op; | ||
4217 | hw->ops.ioctl = snd_hdspm_hwdep_ioctl; | 4209 | hw->ops.ioctl = snd_hdspm_hwdep_ioctl; |
4218 | hw->ops.release = snd_hdspm_hwdep_dummy_op; | ||
4219 | 4210 | ||
4220 | return 0; | 4211 | return 0; |
4221 | } | 4212 | } |
@@ -4503,10 +4494,10 @@ static int __devinit snd_hdspm_probe(struct pci_dev *pci, | |||
4503 | return -ENOENT; | 4494 | return -ENOENT; |
4504 | } | 4495 | } |
4505 | 4496 | ||
4506 | card = snd_card_new(index[dev], id[dev], | 4497 | err = snd_card_create(index[dev], id[dev], |
4507 | THIS_MODULE, sizeof(struct hdspm)); | 4498 | THIS_MODULE, sizeof(struct hdspm), &card); |
4508 | if (!card) | 4499 | if (err < 0) |
4509 | return -ENOMEM; | 4500 | return err; |
4510 | 4501 | ||
4511 | hdspm = card->private_data; | 4502 | hdspm = card->private_data; |
4512 | card->private_free = snd_hdspm_card_free; | 4503 | card->private_free = snd_hdspm_card_free; |
diff --git a/sound/pci/rme9652/rme9652.c b/sound/pci/rme9652/rme9652.c index 2570907134d7..bc539abb2105 100644 --- a/sound/pci/rme9652/rme9652.c +++ b/sound/pci/rme9652/rme9652.c | |||
@@ -2594,11 +2594,11 @@ static int __devinit snd_rme9652_probe(struct pci_dev *pci, | |||
2594 | return -ENOENT; | 2594 | return -ENOENT; |
2595 | } | 2595 | } |
2596 | 2596 | ||
2597 | card = snd_card_new(index[dev], id[dev], THIS_MODULE, | 2597 | err = snd_card_create(index[dev], id[dev], THIS_MODULE, |
2598 | sizeof(struct snd_rme9652)); | 2598 | sizeof(struct snd_rme9652), &card); |
2599 | 2599 | ||
2600 | if (!card) | 2600 | if (err < 0) |
2601 | return -ENOMEM; | 2601 | return err; |
2602 | 2602 | ||
2603 | rme9652 = (struct snd_rme9652 *) card->private_data; | 2603 | rme9652 = (struct snd_rme9652 *) card->private_data; |
2604 | card->private_free = snd_rme9652_card_free; | 2604 | card->private_free = snd_rme9652_card_free; |
diff --git a/sound/pci/sis7019.c b/sound/pci/sis7019.c index df2007e3be7c..baf6d8e3dabc 100644 --- a/sound/pci/sis7019.c +++ b/sound/pci/sis7019.c | |||
@@ -1387,9 +1387,8 @@ static int __devinit snd_sis7019_probe(struct pci_dev *pci, | |||
1387 | if (!enable) | 1387 | if (!enable) |
1388 | goto error_out; | 1388 | goto error_out; |
1389 | 1389 | ||
1390 | rc = -ENOMEM; | 1390 | rc = snd_card_create(index, id, THIS_MODULE, sizeof(*sis), &card); |
1391 | card = snd_card_new(index, id, THIS_MODULE, sizeof(*sis)); | 1391 | if (rc < 0) |
1392 | if (!card) | ||
1393 | goto error_out; | 1392 | goto error_out; |
1394 | 1393 | ||
1395 | strcpy(card->driver, "SiS7019"); | 1394 | strcpy(card->driver, "SiS7019"); |
diff --git a/sound/pci/sonicvibes.c b/sound/pci/sonicvibes.c index e922b1887b1d..d989215f3556 100644 --- a/sound/pci/sonicvibes.c +++ b/sound/pci/sonicvibes.c | |||
@@ -1458,9 +1458,9 @@ static int __devinit snd_sonic_probe(struct pci_dev *pci, | |||
1458 | return -ENOENT; | 1458 | return -ENOENT; |
1459 | } | 1459 | } |
1460 | 1460 | ||
1461 | card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); | 1461 | err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card); |
1462 | if (card == NULL) | 1462 | if (err < 0) |
1463 | return -ENOMEM; | 1463 | return err; |
1464 | for (idx = 0; idx < 5; idx++) { | 1464 | for (idx = 0; idx < 5; idx++) { |
1465 | if (pci_resource_start(pci, idx) == 0 || | 1465 | if (pci_resource_start(pci, idx) == 0 || |
1466 | !(pci_resource_flags(pci, idx) & IORESOURCE_IO)) { | 1466 | !(pci_resource_flags(pci, idx) & IORESOURCE_IO)) { |
diff --git a/sound/pci/trident/trident.c b/sound/pci/trident/trident.c index d94b16ffb385..21cef97d478d 100644 --- a/sound/pci/trident/trident.c +++ b/sound/pci/trident/trident.c | |||
@@ -89,9 +89,9 @@ static int __devinit snd_trident_probe(struct pci_dev *pci, | |||
89 | return -ENOENT; | 89 | return -ENOENT; |
90 | } | 90 | } |
91 | 91 | ||
92 | card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); | 92 | err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card); |
93 | if (card == NULL) | 93 | if (err < 0) |
94 | return -ENOMEM; | 94 | return err; |
95 | 95 | ||
96 | if ((err = snd_trident_create(card, pci, | 96 | if ((err = snd_trident_create(card, pci, |
97 | pcm_channels[dev], | 97 | pcm_channels[dev], |
diff --git a/sound/pci/via82xx.c b/sound/pci/via82xx.c index a027896a220f..809b233dd4a3 100644 --- a/sound/pci/via82xx.c +++ b/sound/pci/via82xx.c | |||
@@ -2436,9 +2436,9 @@ static int __devinit snd_via82xx_probe(struct pci_dev *pci, | |||
2436 | unsigned int i; | 2436 | unsigned int i; |
2437 | int err; | 2437 | int err; |
2438 | 2438 | ||
2439 | card = snd_card_new(index, id, THIS_MODULE, 0); | 2439 | err = snd_card_create(index, id, THIS_MODULE, 0, &card); |
2440 | if (card == NULL) | 2440 | if (err < 0) |
2441 | return -ENOMEM; | 2441 | return err; |
2442 | 2442 | ||
2443 | card_type = pci_id->driver_data; | 2443 | card_type = pci_id->driver_data; |
2444 | switch (card_type) { | 2444 | switch (card_type) { |
diff --git a/sound/pci/via82xx_modem.c b/sound/pci/via82xx_modem.c index c0d9cc9dad44..0d54e3503c1e 100644 --- a/sound/pci/via82xx_modem.c +++ b/sound/pci/via82xx_modem.c | |||
@@ -1170,9 +1170,9 @@ static int __devinit snd_via82xx_probe(struct pci_dev *pci, | |||
1170 | unsigned int i; | 1170 | unsigned int i; |
1171 | int err; | 1171 | int err; |
1172 | 1172 | ||
1173 | card = snd_card_new(index, id, THIS_MODULE, 0); | 1173 | err = snd_card_create(index, id, THIS_MODULE, 0, &card); |
1174 | if (card == NULL) | 1174 | if (err < 0) |
1175 | return -ENOMEM; | 1175 | return err; |
1176 | 1176 | ||
1177 | card_type = pci_id->driver_data; | 1177 | card_type = pci_id->driver_data; |
1178 | switch (card_type) { | 1178 | switch (card_type) { |
diff --git a/sound/pci/vx222/vx222.c b/sound/pci/vx222/vx222.c index acc352f4a441..fc9136c3e0d7 100644 --- a/sound/pci/vx222/vx222.c +++ b/sound/pci/vx222/vx222.c | |||
@@ -204,9 +204,9 @@ static int __devinit snd_vx222_probe(struct pci_dev *pci, | |||
204 | return -ENOENT; | 204 | return -ENOENT; |
205 | } | 205 | } |
206 | 206 | ||
207 | card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); | 207 | err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card); |
208 | if (card == NULL) | 208 | if (err < 0) |
209 | return -ENOMEM; | 209 | return err; |
210 | 210 | ||
211 | switch ((int)pci_id->driver_data) { | 211 | switch ((int)pci_id->driver_data) { |
212 | case VX_PCI_VX222_OLD: | 212 | case VX_PCI_VX222_OLD: |
diff --git a/sound/pci/ymfpci/ymfpci.c b/sound/pci/ymfpci/ymfpci.c index 2631a554845e..4af66661f9b0 100644 --- a/sound/pci/ymfpci/ymfpci.c +++ b/sound/pci/ymfpci/ymfpci.c | |||
@@ -187,9 +187,9 @@ static int __devinit snd_card_ymfpci_probe(struct pci_dev *pci, | |||
187 | return -ENOENT; | 187 | return -ENOENT; |
188 | } | 188 | } |
189 | 189 | ||
190 | card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); | 190 | err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card); |
191 | if (card == NULL) | 191 | if (err < 0) |
192 | return -ENOMEM; | 192 | return err; |
193 | 193 | ||
194 | switch (pci_id->device) { | 194 | switch (pci_id->device) { |
195 | case 0x0004: str = "YMF724"; model = "DS-1"; break; | 195 | case 0x0004: str = "YMF724"; model = "DS-1"; break; |
diff --git a/sound/pcmcia/pdaudiocf/pdaudiocf.c b/sound/pcmcia/pdaudiocf/pdaudiocf.c index 819aaaac432f..7dea74b71cf1 100644 --- a/sound/pcmcia/pdaudiocf/pdaudiocf.c +++ b/sound/pcmcia/pdaudiocf/pdaudiocf.c | |||
@@ -91,7 +91,7 @@ static int snd_pdacf_dev_free(struct snd_device *device) | |||
91 | */ | 91 | */ |
92 | static int snd_pdacf_probe(struct pcmcia_device *link) | 92 | static int snd_pdacf_probe(struct pcmcia_device *link) |
93 | { | 93 | { |
94 | int i; | 94 | int i, err; |
95 | struct snd_pdacf *pdacf; | 95 | struct snd_pdacf *pdacf; |
96 | struct snd_card *card; | 96 | struct snd_card *card; |
97 | static struct snd_device_ops ops = { | 97 | static struct snd_device_ops ops = { |
@@ -112,20 +112,23 @@ static int snd_pdacf_probe(struct pcmcia_device *link) | |||
112 | return -ENODEV; /* disabled explicitly */ | 112 | return -ENODEV; /* disabled explicitly */ |
113 | 113 | ||
114 | /* ok, create a card instance */ | 114 | /* ok, create a card instance */ |
115 | card = snd_card_new(index[i], id[i], THIS_MODULE, 0); | 115 | err = snd_card_create(index[i], id[i], THIS_MODULE, 0, &card); |
116 | if (card == NULL) { | 116 | if (err < 0) { |
117 | snd_printk(KERN_ERR "pdacf: cannot create a card instance\n"); | 117 | snd_printk(KERN_ERR "pdacf: cannot create a card instance\n"); |
118 | return -ENOMEM; | 118 | return err; |
119 | } | 119 | } |
120 | 120 | ||
121 | pdacf = snd_pdacf_create(card); | 121 | pdacf = snd_pdacf_create(card); |
122 | if (! pdacf) | 122 | if (!pdacf) { |
123 | return -EIO; | 123 | snd_card_free(card); |
124 | return -ENOMEM; | ||
125 | } | ||
124 | 126 | ||
125 | if (snd_device_new(card, SNDRV_DEV_LOWLEVEL, pdacf, &ops) < 0) { | 127 | err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, pdacf, &ops); |
128 | if (err < 0) { | ||
126 | kfree(pdacf); | 129 | kfree(pdacf); |
127 | snd_card_free(card); | 130 | snd_card_free(card); |
128 | return -ENODEV; | 131 | return err; |
129 | } | 132 | } |
130 | 133 | ||
131 | snd_card_set_dev(card, &handle_to_dev(link)); | 134 | snd_card_set_dev(card, &handle_to_dev(link)); |
diff --git a/sound/pcmcia/vx/vxpocket.c b/sound/pcmcia/vx/vxpocket.c index 706602a40600..7445cc8a47d3 100644 --- a/sound/pcmcia/vx/vxpocket.c +++ b/sound/pcmcia/vx/vxpocket.c | |||
@@ -130,23 +130,26 @@ static struct snd_vx_hardware vxp440_hw = { | |||
130 | /* | 130 | /* |
131 | * create vxpocket instance | 131 | * create vxpocket instance |
132 | */ | 132 | */ |
133 | static struct snd_vxpocket *snd_vxpocket_new(struct snd_card *card, int ibl, | 133 | static int snd_vxpocket_new(struct snd_card *card, int ibl, |
134 | struct pcmcia_device *link) | 134 | struct pcmcia_device *link, |
135 | struct snd_vxpocket **chip_ret) | ||
135 | { | 136 | { |
136 | struct vx_core *chip; | 137 | struct vx_core *chip; |
137 | struct snd_vxpocket *vxp; | 138 | struct snd_vxpocket *vxp; |
138 | static struct snd_device_ops ops = { | 139 | static struct snd_device_ops ops = { |
139 | .dev_free = snd_vxpocket_dev_free, | 140 | .dev_free = snd_vxpocket_dev_free, |
140 | }; | 141 | }; |
142 | int err; | ||
141 | 143 | ||
142 | chip = snd_vx_create(card, &vxpocket_hw, &snd_vxpocket_ops, | 144 | chip = snd_vx_create(card, &vxpocket_hw, &snd_vxpocket_ops, |
143 | sizeof(struct snd_vxpocket) - sizeof(struct vx_core)); | 145 | sizeof(struct snd_vxpocket) - sizeof(struct vx_core)); |
144 | if (! chip) | 146 | if (!chip) |
145 | return NULL; | 147 | return -ENOMEM; |
146 | 148 | ||
147 | if (snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops) < 0) { | 149 | err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops); |
150 | if (err < 0) { | ||
148 | kfree(chip); | 151 | kfree(chip); |
149 | return NULL; | 152 | return err; |
150 | } | 153 | } |
151 | chip->ibl.size = ibl; | 154 | chip->ibl.size = ibl; |
152 | 155 | ||
@@ -169,7 +172,8 @@ static struct snd_vxpocket *snd_vxpocket_new(struct snd_card *card, int ibl, | |||
169 | link->conf.ConfigIndex = 1; | 172 | link->conf.ConfigIndex = 1; |
170 | link->conf.Present = PRESENT_OPTION; | 173 | link->conf.Present = PRESENT_OPTION; |
171 | 174 | ||
172 | return vxp; | 175 | *chip_ret = vxp; |
176 | return 0; | ||
173 | } | 177 | } |
174 | 178 | ||
175 | 179 | ||
@@ -292,7 +296,7 @@ static int vxpocket_probe(struct pcmcia_device *p_dev) | |||
292 | { | 296 | { |
293 | struct snd_card *card; | 297 | struct snd_card *card; |
294 | struct snd_vxpocket *vxp; | 298 | struct snd_vxpocket *vxp; |
295 | int i; | 299 | int i, err; |
296 | 300 | ||
297 | /* find an empty slot from the card list */ | 301 | /* find an empty slot from the card list */ |
298 | for (i = 0; i < SNDRV_CARDS; i++) { | 302 | for (i = 0; i < SNDRV_CARDS; i++) { |
@@ -307,16 +311,16 @@ static int vxpocket_probe(struct pcmcia_device *p_dev) | |||
307 | return -ENODEV; /* disabled explicitly */ | 311 | return -ENODEV; /* disabled explicitly */ |
308 | 312 | ||
309 | /* ok, create a card instance */ | 313 | /* ok, create a card instance */ |
310 | card = snd_card_new(index[i], id[i], THIS_MODULE, 0); | 314 | err = snd_card_create(index[i], id[i], THIS_MODULE, 0, &card); |
311 | if (card == NULL) { | 315 | if (err < 0) { |
312 | snd_printk(KERN_ERR "vxpocket: cannot create a card instance\n"); | 316 | snd_printk(KERN_ERR "vxpocket: cannot create a card instance\n"); |
313 | return -ENOMEM; | 317 | return err; |
314 | } | 318 | } |
315 | 319 | ||
316 | vxp = snd_vxpocket_new(card, ibl[i], p_dev); | 320 | err = snd_vxpocket_new(card, ibl[i], p_dev, &vxp); |
317 | if (! vxp) { | 321 | if (err < 0) { |
318 | snd_card_free(card); | 322 | snd_card_free(card); |
319 | return -ENODEV; | 323 | return err; |
320 | } | 324 | } |
321 | card->private_data = vxp; | 325 | card->private_data = vxp; |
322 | 326 | ||
diff --git a/sound/ppc/powermac.c b/sound/ppc/powermac.c index c936225771ba..2e18ed0ea899 100644 --- a/sound/ppc/powermac.c +++ b/sound/ppc/powermac.c | |||
@@ -58,9 +58,9 @@ static int __init snd_pmac_probe(struct platform_device *devptr) | |||
58 | char *name_ext; | 58 | char *name_ext; |
59 | int err; | 59 | int err; |
60 | 60 | ||
61 | card = snd_card_new(index, id, THIS_MODULE, 0); | 61 | err = snd_card_create(index, id, THIS_MODULE, 0, &card); |
62 | if (card == NULL) | 62 | if (err < 0) |
63 | return -ENOMEM; | 63 | return err; |
64 | 64 | ||
65 | if ((err = snd_pmac_new(card, &chip)) < 0) | 65 | if ((err = snd_pmac_new(card, &chip)) < 0) |
66 | goto __error; | 66 | goto __error; |
diff --git a/sound/ppc/snd_ps3.c b/sound/ppc/snd_ps3.c index ff321110ec02..f361c26506aa 100644 --- a/sound/ppc/snd_ps3.c +++ b/sound/ppc/snd_ps3.c | |||
@@ -969,11 +969,9 @@ static int __init snd_ps3_driver_probe(struct ps3_system_bus_device *dev) | |||
969 | } | 969 | } |
970 | 970 | ||
971 | /* create card instance */ | 971 | /* create card instance */ |
972 | the_card.card = snd_card_new(index, id, THIS_MODULE, 0); | 972 | ret = snd_card_create(index, id, THIS_MODULE, 0, &the_card.card); |
973 | if (!the_card.card) { | 973 | if (ret < 0) |
974 | ret = -ENXIO; | ||
975 | goto clean_irq; | 974 | goto clean_irq; |
976 | } | ||
977 | 975 | ||
978 | strcpy(the_card.card->driver, "PS3"); | 976 | strcpy(the_card.card->driver, "PS3"); |
979 | strcpy(the_card.card->shortname, "PS3"); | 977 | strcpy(the_card.card->shortname, "PS3"); |
diff --git a/sound/sh/aica.c b/sound/sh/aica.c index 7c920f3e7fe3..f551233c5a08 100644 --- a/sound/sh/aica.c +++ b/sound/sh/aica.c | |||
@@ -609,11 +609,11 @@ static int __devinit snd_aica_probe(struct platform_device *devptr) | |||
609 | dreamcastcard = kmalloc(sizeof(struct snd_card_aica), GFP_KERNEL); | 609 | dreamcastcard = kmalloc(sizeof(struct snd_card_aica), GFP_KERNEL); |
610 | if (unlikely(!dreamcastcard)) | 610 | if (unlikely(!dreamcastcard)) |
611 | return -ENOMEM; | 611 | return -ENOMEM; |
612 | dreamcastcard->card = | 612 | err = snd_card_create(index, SND_AICA_DRIVER, THIS_MODULE, 0, |
613 | snd_card_new(index, SND_AICA_DRIVER, THIS_MODULE, 0); | 613 | &dreamcastcard->card); |
614 | if (unlikely(!dreamcastcard->card)) { | 614 | if (unlikely(err < 0)) { |
615 | kfree(dreamcastcard); | 615 | kfree(dreamcastcard); |
616 | return -ENODEV; | 616 | return err; |
617 | } | 617 | } |
618 | strcpy(dreamcastcard->card->driver, "snd_aica"); | 618 | strcpy(dreamcastcard->card->driver, "snd_aica"); |
619 | strcpy(dreamcastcard->card->shortname, SND_AICA_DRIVER); | 619 | strcpy(dreamcastcard->card->shortname, SND_AICA_DRIVER); |
diff --git a/sound/soc/atmel/atmel_ssc_dai.c b/sound/soc/atmel/atmel_ssc_dai.c index c5d67900d666..ff0054b76502 100644 --- a/sound/soc/atmel/atmel_ssc_dai.c +++ b/sound/soc/atmel/atmel_ssc_dai.c | |||
@@ -10,7 +10,7 @@ | |||
10 | * Based on at91-ssc.c by | 10 | * Based on at91-ssc.c by |
11 | * Frank Mandarino <fmandarino@endrelia.com> | 11 | * Frank Mandarino <fmandarino@endrelia.com> |
12 | * Based on pxa2xx Platform drivers by | 12 | * Based on pxa2xx Platform drivers by |
13 | * Liam Girdwood <liam.girdwood@wolfsonmicro.com> | 13 | * Liam Girdwood <lrg@slimlogic.co.uk> |
14 | * | 14 | * |
15 | * This program is free software; you can redistribute it and/or modify | 15 | * This program is free software; you can redistribute it and/or modify |
16 | * it under the terms of the GNU General Public License as published by | 16 | * it under the terms of the GNU General Public License as published by |
diff --git a/sound/soc/atmel/atmel_ssc_dai.h b/sound/soc/atmel/atmel_ssc_dai.h index a828746e8a2f..391135f9c6c1 100644 --- a/sound/soc/atmel/atmel_ssc_dai.h +++ b/sound/soc/atmel/atmel_ssc_dai.h | |||
@@ -10,7 +10,7 @@ | |||
10 | * Based on at91-ssc.c by | 10 | * Based on at91-ssc.c by |
11 | * Frank Mandarino <fmandarino@endrelia.com> | 11 | * Frank Mandarino <fmandarino@endrelia.com> |
12 | * Based on pxa2xx Platform drivers by | 12 | * Based on pxa2xx Platform drivers by |
13 | * Liam Girdwood <liam.girdwood@wolfsonmicro.com> | 13 | * Liam Girdwood <lrg@slimlogic.co.uk> |
14 | * | 14 | * |
15 | * This program is free software; you can redistribute it and/or modify | 15 | * This program is free software; you can redistribute it and/or modify |
16 | * it under the terms of the GNU General Public License as published by | 16 | * it under the terms of the GNU General Public License as published by |
diff --git a/sound/soc/codecs/tlv320aic3x.c b/sound/soc/codecs/tlv320aic3x.c index b47a749c5ea2..aea0cb72d80a 100644 --- a/sound/soc/codecs/tlv320aic3x.c +++ b/sound/soc/codecs/tlv320aic3x.c | |||
@@ -165,10 +165,13 @@ static int snd_soc_dapm_put_volsw_aic3x(struct snd_kcontrol *kcontrol, | |||
165 | struct snd_ctl_elem_value *ucontrol) | 165 | struct snd_ctl_elem_value *ucontrol) |
166 | { | 166 | { |
167 | struct snd_soc_dapm_widget *widget = snd_kcontrol_chip(kcontrol); | 167 | struct snd_soc_dapm_widget *widget = snd_kcontrol_chip(kcontrol); |
168 | int reg = kcontrol->private_value & 0xff; | 168 | struct soc_mixer_control *mc = |
169 | int shift = (kcontrol->private_value >> 8) & 0x0f; | 169 | (struct soc_mixer_control *)kcontrol->private_value; |
170 | int mask = (kcontrol->private_value >> 16) & 0xff; | 170 | unsigned int reg = mc->reg; |
171 | int invert = (kcontrol->private_value >> 24) & 0x01; | 171 | unsigned int shift = mc->shift; |
172 | int max = mc->max; | ||
173 | unsigned int mask = (1 << fls(max)) - 1; | ||
174 | unsigned int invert = mc->invert; | ||
172 | unsigned short val, val_mask; | 175 | unsigned short val, val_mask; |
173 | int ret; | 176 | int ret; |
174 | struct snd_soc_dapm_path *path; | 177 | struct snd_soc_dapm_path *path; |
diff --git a/sound/soc/codecs/wm8350.c b/sound/soc/codecs/wm8350.c index e3989d406f54..35d99750c383 100644 --- a/sound/soc/codecs/wm8350.c +++ b/sound/soc/codecs/wm8350.c | |||
@@ -3,7 +3,7 @@ | |||
3 | * | 3 | * |
4 | * Copyright (C) 2007, 2008 Wolfson Microelectronics PLC. | 4 | * Copyright (C) 2007, 2008 Wolfson Microelectronics PLC. |
5 | * | 5 | * |
6 | * Author: Liam Girdwood <lg@opensource.wolfsonmicro.com> | 6 | * Author: Liam Girdwood <lrg@slimlogic.co.uk> |
7 | * | 7 | * |
8 | * This program is free software; you can redistribute it and/or modify | 8 | * This program is free software; you can redistribute it and/or modify |
9 | * it under the terms of the GNU General Public License version 2 as | 9 | * it under the terms of the GNU General Public License version 2 as |
diff --git a/sound/soc/codecs/wm8753.c b/sound/soc/codecs/wm8753.c index 6c21b50c9375..77620ab98756 100644 --- a/sound/soc/codecs/wm8753.c +++ b/sound/soc/codecs/wm8753.c | |||
@@ -1451,7 +1451,14 @@ static const struct snd_soc_dai wm8753_all_dai[] = { | |||
1451 | }, | 1451 | }, |
1452 | }; | 1452 | }; |
1453 | 1453 | ||
1454 | struct snd_soc_dai wm8753_dai[2]; | 1454 | struct snd_soc_dai wm8753_dai[] = { |
1455 | { | ||
1456 | .name = "WM8753 DAI 0", | ||
1457 | }, | ||
1458 | { | ||
1459 | .name = "WM8753 DAI 1", | ||
1460 | }, | ||
1461 | }; | ||
1455 | EXPORT_SYMBOL_GPL(wm8753_dai); | 1462 | EXPORT_SYMBOL_GPL(wm8753_dai); |
1456 | 1463 | ||
1457 | static void wm8753_set_dai_mode(struct snd_soc_codec *codec, unsigned int mode) | 1464 | static void wm8753_set_dai_mode(struct snd_soc_codec *codec, unsigned int mode) |
diff --git a/sound/soc/codecs/wm8990.c b/sound/soc/codecs/wm8990.c index 5b5afc144478..a5731faa150c 100644 --- a/sound/soc/codecs/wm8990.c +++ b/sound/soc/codecs/wm8990.c | |||
@@ -2,8 +2,7 @@ | |||
2 | * wm8990.c -- WM8990 ALSA Soc Audio driver | 2 | * wm8990.c -- WM8990 ALSA Soc Audio driver |
3 | * | 3 | * |
4 | * Copyright 2008 Wolfson Microelectronics PLC. | 4 | * Copyright 2008 Wolfson Microelectronics PLC. |
5 | * Author: Liam Girdwood | 5 | * Author: Liam Girdwood <lrg@slimlogic.co.uk> |
6 | * lg@opensource.wolfsonmicro.com or linux@wolfsonmicro.com | ||
7 | * | 6 | * |
8 | * This program is free software; you can redistribute it and/or modify it | 7 | * This program is free software; you can redistribute it and/or modify it |
9 | * under the terms of the GNU General Public License as published by the | 8 | * under the terms of the GNU General Public License as published by the |
@@ -177,7 +176,9 @@ static int wm899x_outpga_put_volsw_vu(struct snd_kcontrol *kcontrol, | |||
177 | struct snd_ctl_elem_value *ucontrol) | 176 | struct snd_ctl_elem_value *ucontrol) |
178 | { | 177 | { |
179 | struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); | 178 | struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); |
180 | int reg = kcontrol->private_value & 0xff; | 179 | struct soc_mixer_control *mc = |
180 | (struct soc_mixer_control *)kcontrol->private_value; | ||
181 | int reg = mc->reg; | ||
181 | int ret; | 182 | int ret; |
182 | u16 val; | 183 | u16 val; |
183 | 184 | ||
diff --git a/sound/soc/omap/omap-mcbsp.c b/sound/soc/omap/omap-mcbsp.c index ec5e18a78758..05dd5abcddf4 100644 --- a/sound/soc/omap/omap-mcbsp.c +++ b/sound/soc/omap/omap-mcbsp.c | |||
@@ -302,6 +302,10 @@ static int omap_mcbsp_dai_set_dai_fmt(struct snd_soc_dai *cpu_dai, | |||
302 | regs->spcr1 |= RINTM(3); | 302 | regs->spcr1 |= RINTM(3); |
303 | regs->rcr2 |= RFIG; | 303 | regs->rcr2 |= RFIG; |
304 | regs->xcr2 |= XFIG; | 304 | regs->xcr2 |= XFIG; |
305 | if (cpu_is_omap2430() || cpu_is_omap34xx()) { | ||
306 | regs->xccr = DXENDLY(1) | XDMAEN; | ||
307 | regs->rccr = RFULL_CYCLE | RDMAEN; | ||
308 | } | ||
305 | 309 | ||
306 | switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) { | 310 | switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) { |
307 | case SND_SOC_DAIFMT_I2S: | 311 | case SND_SOC_DAIFMT_I2S: |
diff --git a/sound/soc/omap/omap-pcm.c b/sound/soc/omap/omap-pcm.c index b0362dfd5b71..dd3bb2933762 100644 --- a/sound/soc/omap/omap-pcm.c +++ b/sound/soc/omap/omap-pcm.c | |||
@@ -175,9 +175,10 @@ static int omap_pcm_trigger(struct snd_pcm_substream *substream, int cmd) | |||
175 | { | 175 | { |
176 | struct snd_pcm_runtime *runtime = substream->runtime; | 176 | struct snd_pcm_runtime *runtime = substream->runtime; |
177 | struct omap_runtime_data *prtd = runtime->private_data; | 177 | struct omap_runtime_data *prtd = runtime->private_data; |
178 | unsigned long flags; | ||
178 | int ret = 0; | 179 | int ret = 0; |
179 | 180 | ||
180 | spin_lock_irq(&prtd->lock); | 181 | spin_lock_irqsave(&prtd->lock, flags); |
181 | switch (cmd) { | 182 | switch (cmd) { |
182 | case SNDRV_PCM_TRIGGER_START: | 183 | case SNDRV_PCM_TRIGGER_START: |
183 | case SNDRV_PCM_TRIGGER_RESUME: | 184 | case SNDRV_PCM_TRIGGER_RESUME: |
@@ -195,7 +196,7 @@ static int omap_pcm_trigger(struct snd_pcm_substream *substream, int cmd) | |||
195 | default: | 196 | default: |
196 | ret = -EINVAL; | 197 | ret = -EINVAL; |
197 | } | 198 | } |
198 | spin_unlock_irq(&prtd->lock); | 199 | spin_unlock_irqrestore(&prtd->lock, flags); |
199 | 200 | ||
200 | return ret; | 201 | return ret; |
201 | } | 202 | } |
diff --git a/sound/soc/omap/sdp3430.c b/sound/soc/omap/sdp3430.c index ad97836818b1..e226fa75669c 100644 --- a/sound/soc/omap/sdp3430.c +++ b/sound/soc/omap/sdp3430.c | |||
@@ -91,7 +91,7 @@ static struct snd_soc_dai_link sdp3430_dai = { | |||
91 | }; | 91 | }; |
92 | 92 | ||
93 | /* Audio machine driver */ | 93 | /* Audio machine driver */ |
94 | static struct snd_soc_machine snd_soc_machine_sdp3430 = { | 94 | static struct snd_soc_card snd_soc_sdp3430 = { |
95 | .name = "SDP3430", | 95 | .name = "SDP3430", |
96 | .platform = &omap_soc_platform, | 96 | .platform = &omap_soc_platform, |
97 | .dai_link = &sdp3430_dai, | 97 | .dai_link = &sdp3430_dai, |
@@ -100,7 +100,7 @@ static struct snd_soc_machine snd_soc_machine_sdp3430 = { | |||
100 | 100 | ||
101 | /* Audio subsystem */ | 101 | /* Audio subsystem */ |
102 | static struct snd_soc_device sdp3430_snd_devdata = { | 102 | static struct snd_soc_device sdp3430_snd_devdata = { |
103 | .machine = &snd_soc_machine_sdp3430, | 103 | .card = &snd_soc_sdp3430, |
104 | .codec_dev = &soc_codec_dev_twl4030, | 104 | .codec_dev = &soc_codec_dev_twl4030, |
105 | }; | 105 | }; |
106 | 106 | ||
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 55fdb4abb179..637f0d1ea98e 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c | |||
@@ -1311,17 +1311,17 @@ int snd_soc_new_pcms(struct snd_soc_device *socdev, int idx, const char *xid) | |||
1311 | { | 1311 | { |
1312 | struct snd_soc_codec *codec = socdev->codec; | 1312 | struct snd_soc_codec *codec = socdev->codec; |
1313 | struct snd_soc_card *card = socdev->card; | 1313 | struct snd_soc_card *card = socdev->card; |
1314 | int ret = 0, i; | 1314 | int ret, i; |
1315 | 1315 | ||
1316 | mutex_lock(&codec->mutex); | 1316 | mutex_lock(&codec->mutex); |
1317 | 1317 | ||
1318 | /* register a sound card */ | 1318 | /* register a sound card */ |
1319 | codec->card = snd_card_new(idx, xid, codec->owner, 0); | 1319 | ret = snd_card_create(idx, xid, codec->owner, 0, &codec->card); |
1320 | if (!codec->card) { | 1320 | if (ret < 0) { |
1321 | printk(KERN_ERR "asoc: can't create sound card for codec %s\n", | 1321 | printk(KERN_ERR "asoc: can't create sound card for codec %s\n", |
1322 | codec->name); | 1322 | codec->name); |
1323 | mutex_unlock(&codec->mutex); | 1323 | mutex_unlock(&codec->mutex); |
1324 | return -ENODEV; | 1324 | return ret; |
1325 | } | 1325 | } |
1326 | 1326 | ||
1327 | codec->card->dev = socdev->dev; | 1327 | codec->card->dev = socdev->dev; |
@@ -1385,7 +1385,10 @@ int snd_soc_init_card(struct snd_soc_device *socdev) | |||
1385 | 1385 | ||
1386 | mutex_lock(&codec->mutex); | 1386 | mutex_lock(&codec->mutex); |
1387 | #ifdef CONFIG_SND_SOC_AC97_BUS | 1387 | #ifdef CONFIG_SND_SOC_AC97_BUS |
1388 | if (ac97) { | 1388 | /* Only instantiate AC97 if not already done by the adaptor |
1389 | * for the generic AC97 subsystem. | ||
1390 | */ | ||
1391 | if (ac97 && strcmp(codec->name, "AC97") != 0) { | ||
1389 | ret = soc_ac97_dev_register(codec); | 1392 | ret = soc_ac97_dev_register(codec); |
1390 | if (ret < 0) { | 1393 | if (ret < 0) { |
1391 | printk(KERN_ERR "asoc: AC97 device register failed\n"); | 1394 | printk(KERN_ERR "asoc: AC97 device register failed\n"); |
diff --git a/sound/sparc/amd7930.c b/sound/sparc/amd7930.c index 7cbc725934e5..574af56ba8a6 100644 --- a/sound/sparc/amd7930.c +++ b/sound/sparc/amd7930.c | |||
@@ -1019,9 +1019,10 @@ static int __devinit amd7930_sbus_probe(struct of_device *op, const struct of_de | |||
1019 | return -ENOENT; | 1019 | return -ENOENT; |
1020 | } | 1020 | } |
1021 | 1021 | ||
1022 | card = snd_card_new(index[dev_num], id[dev_num], THIS_MODULE, 0); | 1022 | err = snd_card_create(index[dev_num], id[dev_num], THIS_MODULE, 0, |
1023 | if (card == NULL) | 1023 | &card); |
1024 | return -ENOMEM; | 1024 | if (err < 0) |
1025 | return err; | ||
1025 | 1026 | ||
1026 | strcpy(card->driver, "AMD7930"); | 1027 | strcpy(card->driver, "AMD7930"); |
1027 | strcpy(card->shortname, "Sun AMD7930"); | 1028 | strcpy(card->shortname, "Sun AMD7930"); |
diff --git a/sound/sparc/cs4231.c b/sound/sparc/cs4231.c index 41c387587474..7d93fa705ccf 100644 --- a/sound/sparc/cs4231.c +++ b/sound/sparc/cs4231.c | |||
@@ -1563,6 +1563,7 @@ static int __init cs4231_attach_begin(struct snd_card **rcard) | |||
1563 | { | 1563 | { |
1564 | struct snd_card *card; | 1564 | struct snd_card *card; |
1565 | struct snd_cs4231 *chip; | 1565 | struct snd_cs4231 *chip; |
1566 | int err; | ||
1566 | 1567 | ||
1567 | *rcard = NULL; | 1568 | *rcard = NULL; |
1568 | 1569 | ||
@@ -1574,10 +1575,10 @@ static int __init cs4231_attach_begin(struct snd_card **rcard) | |||
1574 | return -ENOENT; | 1575 | return -ENOENT; |
1575 | } | 1576 | } |
1576 | 1577 | ||
1577 | card = snd_card_new(index[dev], id[dev], THIS_MODULE, | 1578 | err = snd_card_create(index[dev], id[dev], THIS_MODULE, |
1578 | sizeof(struct snd_cs4231)); | 1579 | sizeof(struct snd_cs4231), &card); |
1579 | if (card == NULL) | 1580 | if (err < 0) |
1580 | return -ENOMEM; | 1581 | return err; |
1581 | 1582 | ||
1582 | strcpy(card->driver, "CS4231"); | 1583 | strcpy(card->driver, "CS4231"); |
1583 | strcpy(card->shortname, "Sun CS4231"); | 1584 | strcpy(card->shortname, "Sun CS4231"); |
diff --git a/sound/sparc/dbri.c b/sound/sparc/dbri.c index 23ed6f04a718..af95ff1e126c 100644 --- a/sound/sparc/dbri.c +++ b/sound/sparc/dbri.c | |||
@@ -2612,10 +2612,10 @@ static int __devinit dbri_probe(struct of_device *op, const struct of_device_id | |||
2612 | return -ENODEV; | 2612 | return -ENODEV; |
2613 | } | 2613 | } |
2614 | 2614 | ||
2615 | card = snd_card_new(index[dev], id[dev], THIS_MODULE, | 2615 | err = snd_card_create(index[dev], id[dev], THIS_MODULE, |
2616 | sizeof(struct snd_dbri)); | 2616 | sizeof(struct snd_dbri), &card); |
2617 | if (card == NULL) | 2617 | if (err < 0) |
2618 | return -ENOMEM; | 2618 | return err; |
2619 | 2619 | ||
2620 | strcpy(card->driver, "DBRI"); | 2620 | strcpy(card->driver, "DBRI"); |
2621 | strcpy(card->shortname, "Sun DBRI"); | 2621 | strcpy(card->shortname, "Sun DBRI"); |
diff --git a/sound/spi/at73c213.c b/sound/spi/at73c213.c index 09802e8a6fb8..4c7b051f9d17 100644 --- a/sound/spi/at73c213.c +++ b/sound/spi/at73c213.c | |||
@@ -965,12 +965,11 @@ static int __devinit snd_at73c213_probe(struct spi_device *spi) | |||
965 | return PTR_ERR(board->dac_clk); | 965 | return PTR_ERR(board->dac_clk); |
966 | } | 966 | } |
967 | 967 | ||
968 | retval = -ENOMEM; | ||
969 | |||
970 | /* Allocate "card" using some unused identifiers. */ | 968 | /* Allocate "card" using some unused identifiers. */ |
971 | snprintf(id, sizeof id, "at73c213_%d", board->ssc_id); | 969 | snprintf(id, sizeof id, "at73c213_%d", board->ssc_id); |
972 | card = snd_card_new(-1, id, THIS_MODULE, sizeof(struct snd_at73c213)); | 970 | retval = snd_card_create(-1, id, THIS_MODULE, |
973 | if (!card) | 971 | sizeof(struct snd_at73c213), &card); |
972 | if (retval < 0) | ||
974 | goto out; | 973 | goto out; |
975 | 974 | ||
976 | chip = card->private_data; | 975 | chip = card->private_data; |
diff --git a/sound/synth/emux/emux_hwdep.c b/sound/synth/emux/emux_hwdep.c index 0a5391436add..ff0b2a8fd25b 100644 --- a/sound/synth/emux/emux_hwdep.c +++ b/sound/synth/emux/emux_hwdep.c | |||
@@ -24,25 +24,6 @@ | |||
24 | #include <asm/uaccess.h> | 24 | #include <asm/uaccess.h> |
25 | #include "emux_voice.h" | 25 | #include "emux_voice.h" |
26 | 26 | ||
27 | /* | ||
28 | * open the hwdep device | ||
29 | */ | ||
30 | static int | ||
31 | snd_emux_hwdep_open(struct snd_hwdep *hw, struct file *file) | ||
32 | { | ||
33 | return 0; | ||
34 | } | ||
35 | |||
36 | |||
37 | /* | ||
38 | * close the device | ||
39 | */ | ||
40 | static int | ||
41 | snd_emux_hwdep_release(struct snd_hwdep *hw, struct file *file) | ||
42 | { | ||
43 | return 0; | ||
44 | } | ||
45 | |||
46 | 27 | ||
47 | #define TMP_CLIENT_ID 0x1001 | 28 | #define TMP_CLIENT_ID 0x1001 |
48 | 29 | ||
@@ -146,8 +127,6 @@ snd_emux_init_hwdep(struct snd_emux *emu) | |||
146 | emu->hwdep = hw; | 127 | emu->hwdep = hw; |
147 | strcpy(hw->name, SNDRV_EMUX_HWDEP_NAME); | 128 | strcpy(hw->name, SNDRV_EMUX_HWDEP_NAME); |
148 | hw->iface = SNDRV_HWDEP_IFACE_EMUX_WAVETABLE; | 129 | hw->iface = SNDRV_HWDEP_IFACE_EMUX_WAVETABLE; |
149 | hw->ops.open = snd_emux_hwdep_open; | ||
150 | hw->ops.release = snd_emux_hwdep_release; | ||
151 | hw->ops.ioctl = snd_emux_hwdep_ioctl; | 130 | hw->ops.ioctl = snd_emux_hwdep_ioctl; |
152 | hw->exclusive = 1; | 131 | hw->exclusive = 1; |
153 | hw->private_data = emu; | 132 | hw->private_data = emu; |
diff --git a/sound/usb/caiaq/caiaq-device.c b/sound/usb/caiaq/caiaq-device.c index 41c36b055f6b..09aed2363cc9 100644 --- a/sound/usb/caiaq/caiaq-device.c +++ b/sound/usb/caiaq/caiaq-device.c | |||
@@ -336,9 +336,10 @@ static void __devinit setup_card(struct snd_usb_caiaqdev *dev) | |||
336 | log("Unable to set up control system (ret=%d)\n", ret); | 336 | log("Unable to set up control system (ret=%d)\n", ret); |
337 | } | 337 | } |
338 | 338 | ||
339 | static struct snd_card* create_card(struct usb_device* usb_dev) | 339 | static int create_card(struct usb_device* usb_dev, struct snd_card **cardp) |
340 | { | 340 | { |
341 | int devnum; | 341 | int devnum; |
342 | int err; | ||
342 | struct snd_card *card; | 343 | struct snd_card *card; |
343 | struct snd_usb_caiaqdev *dev; | 344 | struct snd_usb_caiaqdev *dev; |
344 | 345 | ||
@@ -347,12 +348,12 @@ static struct snd_card* create_card(struct usb_device* usb_dev) | |||
347 | break; | 348 | break; |
348 | 349 | ||
349 | if (devnum >= SNDRV_CARDS) | 350 | if (devnum >= SNDRV_CARDS) |
350 | return NULL; | 351 | return -ENODEV; |
351 | 352 | ||
352 | card = snd_card_new(index[devnum], id[devnum], THIS_MODULE, | 353 | err = snd_card_create(index[devnum], id[devnum], THIS_MODULE, |
353 | sizeof(struct snd_usb_caiaqdev)); | 354 | sizeof(struct snd_usb_caiaqdev), &card); |
354 | if (!card) | 355 | if (err < 0) |
355 | return NULL; | 356 | return err; |
356 | 357 | ||
357 | dev = caiaqdev(card); | 358 | dev = caiaqdev(card); |
358 | dev->chip.dev = usb_dev; | 359 | dev->chip.dev = usb_dev; |
@@ -362,7 +363,8 @@ static struct snd_card* create_card(struct usb_device* usb_dev) | |||
362 | spin_lock_init(&dev->spinlock); | 363 | spin_lock_init(&dev->spinlock); |
363 | snd_card_set_dev(card, &usb_dev->dev); | 364 | snd_card_set_dev(card, &usb_dev->dev); |
364 | 365 | ||
365 | return card; | 366 | *cardp = card; |
367 | return 0; | ||
366 | } | 368 | } |
367 | 369 | ||
368 | static int __devinit init_card(struct snd_usb_caiaqdev *dev) | 370 | static int __devinit init_card(struct snd_usb_caiaqdev *dev) |
@@ -441,10 +443,10 @@ static int __devinit snd_probe(struct usb_interface *intf, | |||
441 | struct snd_card *card; | 443 | struct snd_card *card; |
442 | struct usb_device *device = interface_to_usbdev(intf); | 444 | struct usb_device *device = interface_to_usbdev(intf); |
443 | 445 | ||
444 | card = create_card(device); | 446 | ret = create_card(device, &card); |
445 | 447 | ||
446 | if (!card) | 448 | if (ret < 0) |
447 | return -ENOMEM; | 449 | return ret; |
448 | 450 | ||
449 | usb_set_intfdata(intf, card); | 451 | usb_set_intfdata(intf, card); |
450 | ret = init_card(caiaqdev(card)); | 452 | ret = init_card(caiaqdev(card)); |
diff --git a/sound/usb/usbaudio.c b/sound/usb/usbaudio.c index c709b9563226..8f3cdb37a0ec 100644 --- a/sound/usb/usbaudio.c +++ b/sound/usb/usbaudio.c | |||
@@ -2524,7 +2524,6 @@ static int parse_audio_format_rates(struct snd_usb_audio *chip, struct audioform | |||
2524 | * build the rate table and bitmap flags | 2524 | * build the rate table and bitmap flags |
2525 | */ | 2525 | */ |
2526 | int r, idx; | 2526 | int r, idx; |
2527 | unsigned int nonzero_rates = 0; | ||
2528 | 2527 | ||
2529 | fp->rate_table = kmalloc(sizeof(int) * nr_rates, GFP_KERNEL); | 2528 | fp->rate_table = kmalloc(sizeof(int) * nr_rates, GFP_KERNEL); |
2530 | if (fp->rate_table == NULL) { | 2529 | if (fp->rate_table == NULL) { |
@@ -2532,24 +2531,27 @@ static int parse_audio_format_rates(struct snd_usb_audio *chip, struct audioform | |||
2532 | return -1; | 2531 | return -1; |
2533 | } | 2532 | } |
2534 | 2533 | ||
2535 | fp->nr_rates = nr_rates; | 2534 | fp->nr_rates = 0; |
2536 | fp->rate_min = fp->rate_max = combine_triple(&fmt[8]); | 2535 | fp->rate_min = fp->rate_max = 0; |
2537 | for (r = 0, idx = offset + 1; r < nr_rates; r++, idx += 3) { | 2536 | for (r = 0, idx = offset + 1; r < nr_rates; r++, idx += 3) { |
2538 | unsigned int rate = combine_triple(&fmt[idx]); | 2537 | unsigned int rate = combine_triple(&fmt[idx]); |
2538 | if (!rate) | ||
2539 | continue; | ||
2539 | /* C-Media CM6501 mislabels its 96 kHz altsetting */ | 2540 | /* C-Media CM6501 mislabels its 96 kHz altsetting */ |
2540 | if (rate == 48000 && nr_rates == 1 && | 2541 | if (rate == 48000 && nr_rates == 1 && |
2541 | chip->usb_id == USB_ID(0x0d8c, 0x0201) && | 2542 | (chip->usb_id == USB_ID(0x0d8c, 0x0201) || |
2543 | chip->usb_id == USB_ID(0x0d8c, 0x0102)) && | ||
2542 | fp->altsetting == 5 && fp->maxpacksize == 392) | 2544 | fp->altsetting == 5 && fp->maxpacksize == 392) |
2543 | rate = 96000; | 2545 | rate = 96000; |
2544 | fp->rate_table[r] = rate; | 2546 | fp->rate_table[fp->nr_rates] = rate; |
2545 | nonzero_rates |= rate; | 2547 | if (!fp->rate_min || rate < fp->rate_min) |
2546 | if (rate < fp->rate_min) | ||
2547 | fp->rate_min = rate; | 2548 | fp->rate_min = rate; |
2548 | else if (rate > fp->rate_max) | 2549 | if (!fp->rate_max || rate > fp->rate_max) |
2549 | fp->rate_max = rate; | 2550 | fp->rate_max = rate; |
2550 | fp->rates |= snd_pcm_rate_to_rate_bit(rate); | 2551 | fp->rates |= snd_pcm_rate_to_rate_bit(rate); |
2552 | fp->nr_rates++; | ||
2551 | } | 2553 | } |
2552 | if (!nonzero_rates) { | 2554 | if (!fp->nr_rates) { |
2553 | hwc_debug("All rates were zero. Skipping format!\n"); | 2555 | hwc_debug("All rates were zero. Skipping format!\n"); |
2554 | return -1; | 2556 | return -1; |
2555 | } | 2557 | } |
@@ -2966,6 +2968,7 @@ static int create_fixed_stream_quirk(struct snd_usb_audio *chip, | |||
2966 | return -EINVAL; | 2968 | return -EINVAL; |
2967 | } | 2969 | } |
2968 | alts = &iface->altsetting[fp->altset_idx]; | 2970 | alts = &iface->altsetting[fp->altset_idx]; |
2971 | fp->maxpacksize = le16_to_cpu(get_endpoint(alts, 0)->wMaxPacketSize); | ||
2969 | usb_set_interface(chip->dev, fp->iface, 0); | 2972 | usb_set_interface(chip->dev, fp->iface, 0); |
2970 | init_usb_pitch(chip->dev, fp->iface, alts, fp); | 2973 | init_usb_pitch(chip->dev, fp->iface, alts, fp); |
2971 | init_usb_sample_rate(chip->dev, fp->iface, alts, fp, fp->rate_max); | 2974 | init_usb_sample_rate(chip->dev, fp->iface, alts, fp, fp->rate_max); |
@@ -3463,10 +3466,10 @@ static int snd_usb_audio_create(struct usb_device *dev, int idx, | |||
3463 | return -ENXIO; | 3466 | return -ENXIO; |
3464 | } | 3467 | } |
3465 | 3468 | ||
3466 | card = snd_card_new(index[idx], id[idx], THIS_MODULE, 0); | 3469 | err = snd_card_create(index[idx], id[idx], THIS_MODULE, 0, &card); |
3467 | if (card == NULL) { | 3470 | if (err < 0) { |
3468 | snd_printk(KERN_ERR "cannot create card instance %d\n", idx); | 3471 | snd_printk(KERN_ERR "cannot create card instance %d\n", idx); |
3469 | return -ENOMEM; | 3472 | return err; |
3470 | } | 3473 | } |
3471 | 3474 | ||
3472 | chip = kzalloc(sizeof(*chip), GFP_KERNEL); | 3475 | chip = kzalloc(sizeof(*chip), GFP_KERNEL); |
diff --git a/sound/usb/usbmidi.c b/sound/usb/usbmidi.c index 320641ab5be7..26bad373fe65 100644 --- a/sound/usb/usbmidi.c +++ b/sound/usb/usbmidi.c | |||
@@ -1625,6 +1625,7 @@ static int snd_usbmidi_create_endpoints_midiman(struct snd_usb_midi* umidi, | |||
1625 | } | 1625 | } |
1626 | 1626 | ||
1627 | ep_info.out_ep = get_endpoint(hostif, 2)->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK; | 1627 | ep_info.out_ep = get_endpoint(hostif, 2)->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK; |
1628 | ep_info.out_interval = 0; | ||
1628 | ep_info.out_cables = endpoint->out_cables & 0x5555; | 1629 | ep_info.out_cables = endpoint->out_cables & 0x5555; |
1629 | err = snd_usbmidi_out_endpoint_create(umidi, &ep_info, &umidi->endpoints[0]); | 1630 | err = snd_usbmidi_out_endpoint_create(umidi, &ep_info, &umidi->endpoints[0]); |
1630 | if (err < 0) | 1631 | if (err < 0) |
diff --git a/sound/usb/usbmixer.c b/sound/usb/usbmixer.c index 00397c8a765b..2bde79216fa5 100644 --- a/sound/usb/usbmixer.c +++ b/sound/usb/usbmixer.c | |||
@@ -78,7 +78,6 @@ struct usb_mixer_interface { | |||
78 | 78 | ||
79 | /* Sound Blaster remote control stuff */ | 79 | /* Sound Blaster remote control stuff */ |
80 | const struct rc_config *rc_cfg; | 80 | const struct rc_config *rc_cfg; |
81 | unsigned long rc_hwdep_open; | ||
82 | u32 rc_code; | 81 | u32 rc_code; |
83 | wait_queue_head_t rc_waitq; | 82 | wait_queue_head_t rc_waitq; |
84 | struct urb *rc_urb; | 83 | struct urb *rc_urb; |
@@ -1797,24 +1796,6 @@ static void snd_usb_soundblaster_remote_complete(struct urb *urb) | |||
1797 | wake_up(&mixer->rc_waitq); | 1796 | wake_up(&mixer->rc_waitq); |
1798 | } | 1797 | } |
1799 | 1798 | ||
1800 | static int snd_usb_sbrc_hwdep_open(struct snd_hwdep *hw, struct file *file) | ||
1801 | { | ||
1802 | struct usb_mixer_interface *mixer = hw->private_data; | ||
1803 | |||
1804 | if (test_and_set_bit(0, &mixer->rc_hwdep_open)) | ||
1805 | return -EBUSY; | ||
1806 | return 0; | ||
1807 | } | ||
1808 | |||
1809 | static int snd_usb_sbrc_hwdep_release(struct snd_hwdep *hw, struct file *file) | ||
1810 | { | ||
1811 | struct usb_mixer_interface *mixer = hw->private_data; | ||
1812 | |||
1813 | clear_bit(0, &mixer->rc_hwdep_open); | ||
1814 | smp_mb__after_clear_bit(); | ||
1815 | return 0; | ||
1816 | } | ||
1817 | |||
1818 | static long snd_usb_sbrc_hwdep_read(struct snd_hwdep *hw, char __user *buf, | 1799 | static long snd_usb_sbrc_hwdep_read(struct snd_hwdep *hw, char __user *buf, |
1819 | long count, loff_t *offset) | 1800 | long count, loff_t *offset) |
1820 | { | 1801 | { |
@@ -1867,9 +1848,8 @@ static int snd_usb_soundblaster_remote_init(struct usb_mixer_interface *mixer) | |||
1867 | hwdep->iface = SNDRV_HWDEP_IFACE_SB_RC; | 1848 | hwdep->iface = SNDRV_HWDEP_IFACE_SB_RC; |
1868 | hwdep->private_data = mixer; | 1849 | hwdep->private_data = mixer; |
1869 | hwdep->ops.read = snd_usb_sbrc_hwdep_read; | 1850 | hwdep->ops.read = snd_usb_sbrc_hwdep_read; |
1870 | hwdep->ops.open = snd_usb_sbrc_hwdep_open; | ||
1871 | hwdep->ops.release = snd_usb_sbrc_hwdep_release; | ||
1872 | hwdep->ops.poll = snd_usb_sbrc_hwdep_poll; | 1851 | hwdep->ops.poll = snd_usb_sbrc_hwdep_poll; |
1852 | hwdep->exclusive = 1; | ||
1873 | 1853 | ||
1874 | mixer->rc_urb = usb_alloc_urb(0, GFP_KERNEL); | 1854 | mixer->rc_urb = usb_alloc_urb(0, GFP_KERNEL); |
1875 | if (!mixer->rc_urb) | 1855 | if (!mixer->rc_urb) |
diff --git a/sound/usb/usx2y/us122l.c b/sound/usb/usx2y/us122l.c index 73e59f4403a4..98276aafefe6 100644 --- a/sound/usb/usx2y/us122l.c +++ b/sound/usb/usx2y/us122l.c | |||
@@ -478,19 +478,21 @@ static bool us122l_create_card(struct snd_card *card) | |||
478 | return true; | 478 | return true; |
479 | } | 479 | } |
480 | 480 | ||
481 | static struct snd_card *usx2y_create_card(struct usb_device *device) | 481 | static int usx2y_create_card(struct usb_device *device, struct snd_card **cardp) |
482 | { | 482 | { |
483 | int dev; | 483 | int dev; |
484 | struct snd_card *card; | 484 | struct snd_card *card; |
485 | int err; | ||
486 | |||
485 | for (dev = 0; dev < SNDRV_CARDS; ++dev) | 487 | for (dev = 0; dev < SNDRV_CARDS; ++dev) |
486 | if (enable[dev] && !snd_us122l_card_used[dev]) | 488 | if (enable[dev] && !snd_us122l_card_used[dev]) |
487 | break; | 489 | break; |
488 | if (dev >= SNDRV_CARDS) | 490 | if (dev >= SNDRV_CARDS) |
489 | return NULL; | 491 | return -ENODEV; |
490 | card = snd_card_new(index[dev], id[dev], THIS_MODULE, | 492 | err = snd_card_create(index[dev], id[dev], THIS_MODULE, |
491 | sizeof(struct us122l)); | 493 | sizeof(struct us122l), &card); |
492 | if (!card) | 494 | if (err < 0) |
493 | return NULL; | 495 | return err; |
494 | snd_us122l_card_used[US122L(card)->chip.index = dev] = 1; | 496 | snd_us122l_card_used[US122L(card)->chip.index = dev] = 1; |
495 | 497 | ||
496 | US122L(card)->chip.dev = device; | 498 | US122L(card)->chip.dev = device; |
@@ -509,46 +511,57 @@ static struct snd_card *usx2y_create_card(struct usb_device *device) | |||
509 | US122L(card)->chip.dev->devnum | 511 | US122L(card)->chip.dev->devnum |
510 | ); | 512 | ); |
511 | snd_card_set_dev(card, &device->dev); | 513 | snd_card_set_dev(card, &device->dev); |
512 | return card; | 514 | *cardp = card; |
515 | return 0; | ||
513 | } | 516 | } |
514 | 517 | ||
515 | static void *us122l_usb_probe(struct usb_interface *intf, | 518 | static int us122l_usb_probe(struct usb_interface *intf, |
516 | const struct usb_device_id *device_id) | 519 | const struct usb_device_id *device_id, |
520 | struct snd_card **cardp) | ||
517 | { | 521 | { |
518 | struct usb_device *device = interface_to_usbdev(intf); | 522 | struct usb_device *device = interface_to_usbdev(intf); |
519 | struct snd_card *card = usx2y_create_card(device); | 523 | struct snd_card *card; |
524 | int err; | ||
520 | 525 | ||
521 | if (!card) | 526 | err = usx2y_create_card(device, &card); |
522 | return NULL; | 527 | if (err < 0) |
528 | return err; | ||
523 | 529 | ||
524 | if (!us122l_create_card(card) || | 530 | if (!us122l_create_card(card)) { |
525 | snd_card_register(card) < 0) { | ||
526 | snd_card_free(card); | 531 | snd_card_free(card); |
527 | return NULL; | 532 | return -EINVAL; |
533 | } | ||
534 | |||
535 | err = snd_card_register(card); | ||
536 | if (err < 0) { | ||
537 | snd_card_free(card); | ||
538 | return err; | ||
528 | } | 539 | } |
529 | 540 | ||
530 | usb_get_dev(device); | 541 | usb_get_dev(device); |
531 | return card; | 542 | *cardp = card; |
543 | return 0; | ||
532 | } | 544 | } |
533 | 545 | ||
534 | static int snd_us122l_probe(struct usb_interface *intf, | 546 | static int snd_us122l_probe(struct usb_interface *intf, |
535 | const struct usb_device_id *id) | 547 | const struct usb_device_id *id) |
536 | { | 548 | { |
537 | struct snd_card *card; | 549 | struct snd_card *card; |
550 | int err; | ||
551 | |||
538 | snd_printdd(KERN_DEBUG"%p:%i\n", | 552 | snd_printdd(KERN_DEBUG"%p:%i\n", |
539 | intf, intf->cur_altsetting->desc.bInterfaceNumber); | 553 | intf, intf->cur_altsetting->desc.bInterfaceNumber); |
540 | if (intf->cur_altsetting->desc.bInterfaceNumber != 1) | 554 | if (intf->cur_altsetting->desc.bInterfaceNumber != 1) |
541 | return 0; | 555 | return 0; |
542 | 556 | ||
543 | card = us122l_usb_probe(usb_get_intf(intf), id); | 557 | err = us122l_usb_probe(usb_get_intf(intf), id, &card); |
544 | 558 | if (err < 0) { | |
545 | if (card) { | 559 | usb_put_intf(intf); |
546 | usb_set_intfdata(intf, card); | 560 | return err; |
547 | return 0; | ||
548 | } | 561 | } |
549 | 562 | ||
550 | usb_put_intf(intf); | 563 | usb_set_intfdata(intf, card); |
551 | return -EIO; | 564 | return 0; |
552 | } | 565 | } |
553 | 566 | ||
554 | static void snd_us122l_disconnect(struct usb_interface *intf) | 567 | static void snd_us122l_disconnect(struct usb_interface *intf) |
diff --git a/sound/usb/usx2y/usX2Yhwdep.c b/sound/usb/usx2y/usX2Yhwdep.c index fc650c800afc..4af8740db717 100644 --- a/sound/usb/usx2y/usX2Yhwdep.c +++ b/sound/usb/usx2y/usX2Yhwdep.c | |||
@@ -103,16 +103,6 @@ static unsigned int snd_us428ctls_poll(struct snd_hwdep *hw, struct file *file, | |||
103 | } | 103 | } |
104 | 104 | ||
105 | 105 | ||
106 | static int snd_usX2Y_hwdep_open(struct snd_hwdep *hw, struct file *file) | ||
107 | { | ||
108 | return 0; | ||
109 | } | ||
110 | |||
111 | static int snd_usX2Y_hwdep_release(struct snd_hwdep *hw, struct file *file) | ||
112 | { | ||
113 | return 0; | ||
114 | } | ||
115 | |||
116 | static int snd_usX2Y_hwdep_dsp_status(struct snd_hwdep *hw, | 106 | static int snd_usX2Y_hwdep_dsp_status(struct snd_hwdep *hw, |
117 | struct snd_hwdep_dsp_status *info) | 107 | struct snd_hwdep_dsp_status *info) |
118 | { | 108 | { |
@@ -264,8 +254,6 @@ int usX2Y_hwdep_new(struct snd_card *card, struct usb_device* device) | |||
264 | 254 | ||
265 | hw->iface = SNDRV_HWDEP_IFACE_USX2Y; | 255 | hw->iface = SNDRV_HWDEP_IFACE_USX2Y; |
266 | hw->private_data = usX2Y(card); | 256 | hw->private_data = usX2Y(card); |
267 | hw->ops.open = snd_usX2Y_hwdep_open; | ||
268 | hw->ops.release = snd_usX2Y_hwdep_release; | ||
269 | hw->ops.dsp_status = snd_usX2Y_hwdep_dsp_status; | 257 | hw->ops.dsp_status = snd_usX2Y_hwdep_dsp_status; |
270 | hw->ops.dsp_load = snd_usX2Y_hwdep_dsp_load; | 258 | hw->ops.dsp_load = snd_usX2Y_hwdep_dsp_load; |
271 | hw->ops.mmap = snd_us428ctls_mmap; | 259 | hw->ops.mmap = snd_us428ctls_mmap; |
diff --git a/sound/usb/usx2y/usbusx2y.c b/sound/usb/usx2y/usbusx2y.c index c545a02dee48..5ce0da23ee96 100644 --- a/sound/usb/usx2y/usbusx2y.c +++ b/sound/usb/usx2y/usbusx2y.c | |||
@@ -333,18 +333,21 @@ static struct usb_device_id snd_usX2Y_usb_id_table[] = { | |||
333 | { /* terminator */ } | 333 | { /* terminator */ } |
334 | }; | 334 | }; |
335 | 335 | ||
336 | static struct snd_card *usX2Y_create_card(struct usb_device *device) | 336 | static int usX2Y_create_card(struct usb_device *device, struct snd_card **cardp) |
337 | { | 337 | { |
338 | int dev; | 338 | int dev; |
339 | struct snd_card * card; | 339 | struct snd_card * card; |
340 | int err; | ||
341 | |||
340 | for (dev = 0; dev < SNDRV_CARDS; ++dev) | 342 | for (dev = 0; dev < SNDRV_CARDS; ++dev) |
341 | if (enable[dev] && !snd_usX2Y_card_used[dev]) | 343 | if (enable[dev] && !snd_usX2Y_card_used[dev]) |
342 | break; | 344 | break; |
343 | if (dev >= SNDRV_CARDS) | 345 | if (dev >= SNDRV_CARDS) |
344 | return NULL; | 346 | return -ENODEV; |
345 | card = snd_card_new(index[dev], id[dev], THIS_MODULE, sizeof(struct usX2Ydev)); | 347 | err = snd_card_create(index[dev], id[dev], THIS_MODULE, |
346 | if (!card) | 348 | sizeof(struct usX2Ydev), &card); |
347 | return NULL; | 349 | if (err < 0) |
350 | return err; | ||
348 | snd_usX2Y_card_used[usX2Y(card)->chip.index = dev] = 1; | 351 | snd_usX2Y_card_used[usX2Y(card)->chip.index = dev] = 1; |
349 | card->private_free = snd_usX2Y_card_private_free; | 352 | card->private_free = snd_usX2Y_card_private_free; |
350 | usX2Y(card)->chip.dev = device; | 353 | usX2Y(card)->chip.dev = device; |
@@ -362,26 +365,36 @@ static struct snd_card *usX2Y_create_card(struct usb_device *device) | |||
362 | usX2Y(card)->chip.dev->bus->busnum, usX2Y(card)->chip.dev->devnum | 365 | usX2Y(card)->chip.dev->bus->busnum, usX2Y(card)->chip.dev->devnum |
363 | ); | 366 | ); |
364 | snd_card_set_dev(card, &device->dev); | 367 | snd_card_set_dev(card, &device->dev); |
365 | return card; | 368 | *cardp = card; |
369 | return 0; | ||
366 | } | 370 | } |
367 | 371 | ||
368 | 372 | ||
369 | static void *usX2Y_usb_probe(struct usb_device *device, struct usb_interface *intf, const struct usb_device_id *device_id) | 373 | static int usX2Y_usb_probe(struct usb_device *device, |
374 | struct usb_interface *intf, | ||
375 | const struct usb_device_id *device_id, | ||
376 | struct snd_card **cardp) | ||
370 | { | 377 | { |
371 | int err; | 378 | int err; |
372 | struct snd_card * card; | 379 | struct snd_card * card; |
380 | |||
381 | *cardp = NULL; | ||
373 | if (le16_to_cpu(device->descriptor.idVendor) != 0x1604 || | 382 | if (le16_to_cpu(device->descriptor.idVendor) != 0x1604 || |
374 | (le16_to_cpu(device->descriptor.idProduct) != USB_ID_US122 && | 383 | (le16_to_cpu(device->descriptor.idProduct) != USB_ID_US122 && |
375 | le16_to_cpu(device->descriptor.idProduct) != USB_ID_US224 && | 384 | le16_to_cpu(device->descriptor.idProduct) != USB_ID_US224 && |
376 | le16_to_cpu(device->descriptor.idProduct) != USB_ID_US428) || | 385 | le16_to_cpu(device->descriptor.idProduct) != USB_ID_US428)) |
377 | !(card = usX2Y_create_card(device))) | 386 | return -EINVAL; |
378 | return NULL; | 387 | |
388 | err = usX2Y_create_card(device, &card); | ||
389 | if (err < 0) | ||
390 | return err; | ||
379 | if ((err = usX2Y_hwdep_new(card, device)) < 0 || | 391 | if ((err = usX2Y_hwdep_new(card, device)) < 0 || |
380 | (err = snd_card_register(card)) < 0) { | 392 | (err = snd_card_register(card)) < 0) { |
381 | snd_card_free(card); | 393 | snd_card_free(card); |
382 | return NULL; | 394 | return err; |
383 | } | 395 | } |
384 | return card; | 396 | *cardp = card; |
397 | return 0; | ||
385 | } | 398 | } |
386 | 399 | ||
387 | /* | 400 | /* |
@@ -389,13 +402,14 @@ static void *usX2Y_usb_probe(struct usb_device *device, struct usb_interface *in | |||
389 | */ | 402 | */ |
390 | static int snd_usX2Y_probe(struct usb_interface *intf, const struct usb_device_id *id) | 403 | static int snd_usX2Y_probe(struct usb_interface *intf, const struct usb_device_id *id) |
391 | { | 404 | { |
392 | void *chip; | 405 | struct snd_card *card; |
393 | chip = usX2Y_usb_probe(interface_to_usbdev(intf), intf, id); | 406 | int err; |
394 | if (chip) { | 407 | |
395 | usb_set_intfdata(intf, chip); | 408 | err = usX2Y_usb_probe(interface_to_usbdev(intf), intf, id, &card); |
396 | return 0; | 409 | if (err < 0) |
397 | } else | 410 | return err; |
398 | return -EIO; | 411 | dev_set_drvdata(&intf->dev, card); |
412 | return 0; | ||
399 | } | 413 | } |
400 | 414 | ||
401 | static void snd_usX2Y_disconnect(struct usb_interface *intf) | 415 | static void snd_usX2Y_disconnect(struct usb_interface *intf) |