diff options
author | Takashi Iwai <tiwai@suse.de> | 2014-03-31 06:16:31 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2014-03-31 06:16:31 -0400 |
commit | 9ddd84f872898373c51469f9c931d5aa89fdc807 (patch) | |
tree | d81f9e396801f04d55924c0d3bbd903fe60ebcda /sound/core | |
parent | 749d32237bf39e6576dd95bfdf24e4378e51716c (diff) | |
parent | a4b7f21d7b42b33609df3f86992a8deff80abfaf (diff) |
Merge branch 'for-next' into for-linus
Diffstat (limited to 'sound/core')
42 files changed, 519 insertions, 555 deletions
diff --git a/sound/core/control.c b/sound/core/control.c index d8aa206e8bde..f038f5afafe2 100644 --- a/sound/core/control.c +++ b/sound/core/control.c | |||
@@ -151,7 +151,7 @@ void snd_ctl_notify(struct snd_card *card, unsigned int mask, | |||
151 | if (snd_BUG_ON(!card || !id)) | 151 | if (snd_BUG_ON(!card || !id)) |
152 | return; | 152 | return; |
153 | read_lock(&card->ctl_files_rwlock); | 153 | read_lock(&card->ctl_files_rwlock); |
154 | #if defined(CONFIG_SND_MIXER_OSS) || defined(CONFIG_SND_MIXER_OSS_MODULE) | 154 | #if IS_ENABLED(CONFIG_SND_MIXER_OSS) |
155 | card->mixer_oss_change_count++; | 155 | card->mixer_oss_change_count++; |
156 | #endif | 156 | #endif |
157 | list_for_each_entry(ctl, &card->ctl_files, list) { | 157 | list_for_each_entry(ctl, &card->ctl_files, list) { |
@@ -170,7 +170,7 @@ void snd_ctl_notify(struct snd_card *card, unsigned int mask, | |||
170 | ev->mask = mask; | 170 | ev->mask = mask; |
171 | list_add_tail(&ev->list, &ctl->events); | 171 | list_add_tail(&ev->list, &ctl->events); |
172 | } else { | 172 | } else { |
173 | snd_printk(KERN_ERR "No memory available to allocate event\n"); | 173 | dev_err(card->dev, "No memory available to allocate event\n"); |
174 | } | 174 | } |
175 | _found: | 175 | _found: |
176 | wake_up(&ctl->change_sleep); | 176 | wake_up(&ctl->change_sleep); |
@@ -206,7 +206,7 @@ static struct snd_kcontrol *snd_ctl_new(struct snd_kcontrol *control, | |||
206 | 206 | ||
207 | kctl = kzalloc(sizeof(*kctl) + sizeof(struct snd_kcontrol_volatile) * control->count, GFP_KERNEL); | 207 | kctl = kzalloc(sizeof(*kctl) + sizeof(struct snd_kcontrol_volatile) * control->count, GFP_KERNEL); |
208 | if (kctl == NULL) { | 208 | if (kctl == NULL) { |
209 | snd_printk(KERN_ERR "Cannot allocate control instance\n"); | 209 | pr_err("ALSA: Cannot allocate control instance\n"); |
210 | return NULL; | 210 | return NULL; |
211 | } | 211 | } |
212 | *kctl = *control; | 212 | *kctl = *control; |
@@ -241,9 +241,8 @@ struct snd_kcontrol *snd_ctl_new1(const struct snd_kcontrol_new *ncontrol, | |||
241 | if (ncontrol->name) { | 241 | if (ncontrol->name) { |
242 | strlcpy(kctl.id.name, ncontrol->name, sizeof(kctl.id.name)); | 242 | strlcpy(kctl.id.name, ncontrol->name, sizeof(kctl.id.name)); |
243 | if (strcmp(ncontrol->name, kctl.id.name) != 0) | 243 | if (strcmp(ncontrol->name, kctl.id.name) != 0) |
244 | snd_printk(KERN_WARNING | 244 | pr_warn("ALSA: Control name '%s' truncated to '%s'\n", |
245 | "Control name '%s' truncated to '%s'\n", | 245 | ncontrol->name, kctl.id.name); |
246 | ncontrol->name, kctl.id.name); | ||
247 | } | 246 | } |
248 | kctl.id.index = ncontrol->index; | 247 | kctl.id.index = ncontrol->index; |
249 | kctl.count = ncontrol->count ? ncontrol->count : 1; | 248 | kctl.count = ncontrol->count ? ncontrol->count : 1; |
@@ -306,7 +305,7 @@ static int snd_ctl_find_hole(struct snd_card *card, unsigned int count) | |||
306 | while (snd_ctl_remove_numid_conflict(card, count)) { | 305 | while (snd_ctl_remove_numid_conflict(card, count)) { |
307 | if (--iter == 0) { | 306 | if (--iter == 0) { |
308 | /* this situation is very unlikely */ | 307 | /* this situation is very unlikely */ |
309 | snd_printk(KERN_ERR "unable to allocate new control numid\n"); | 308 | dev_err(card->dev, "unable to allocate new control numid\n"); |
310 | return -ENOMEM; | 309 | return -ENOMEM; |
311 | } | 310 | } |
312 | } | 311 | } |
@@ -341,7 +340,7 @@ int snd_ctl_add(struct snd_card *card, struct snd_kcontrol *kcontrol) | |||
341 | down_write(&card->controls_rwsem); | 340 | down_write(&card->controls_rwsem); |
342 | if (snd_ctl_find_id(card, &id)) { | 341 | if (snd_ctl_find_id(card, &id)) { |
343 | up_write(&card->controls_rwsem); | 342 | up_write(&card->controls_rwsem); |
344 | snd_printd(KERN_ERR "control %i:%i:%i:%s:%i is already present\n", | 343 | dev_err(card->dev, "control %i:%i:%i:%s:%i is already present\n", |
345 | id.iface, | 344 | id.iface, |
346 | id.device, | 345 | id.device, |
347 | id.subdevice, | 346 | id.subdevice, |
@@ -1406,7 +1405,7 @@ static long snd_ctl_ioctl(struct file *file, unsigned int cmd, unsigned long arg | |||
1406 | } | 1405 | } |
1407 | } | 1406 | } |
1408 | up_read(&snd_ioctl_rwsem); | 1407 | up_read(&snd_ioctl_rwsem); |
1409 | snd_printdd("unknown ioctl = 0x%x\n", cmd); | 1408 | dev_dbg(card->dev, "unknown ioctl = 0x%x\n", cmd); |
1410 | return -ENOTTY; | 1409 | return -ENOTTY; |
1411 | } | 1410 | } |
1412 | 1411 | ||
diff --git a/sound/core/control_compat.c b/sound/core/control_compat.c index 2bb95a7a8809..b9c0910fb8c4 100644 --- a/sound/core/control_compat.c +++ b/sound/core/control_compat.c | |||
@@ -247,7 +247,7 @@ static int copy_ctl_value_from_user(struct snd_card *card, | |||
247 | } else { | 247 | } else { |
248 | size = get_elem_size(type, count); | 248 | size = get_elem_size(type, count); |
249 | if (size < 0) { | 249 | if (size < 0) { |
250 | printk(KERN_ERR "snd_ioctl32_ctl_elem_value: unknown type %d\n", type); | 250 | dev_err(card->dev, "snd_ioctl32_ctl_elem_value: unknown type %d\n", type); |
251 | return -EINVAL; | 251 | return -EINVAL; |
252 | } | 252 | } |
253 | if (copy_from_user(data->value.bytes.data, | 253 | if (copy_from_user(data->value.bytes.data, |
diff --git a/sound/core/device.c b/sound/core/device.c index df88defed176..41bec3075ae5 100644 --- a/sound/core/device.c +++ b/sound/core/device.c | |||
@@ -41,29 +41,73 @@ | |||
41 | * | 41 | * |
42 | * Return: Zero if successful, or a negative error code on failure. | 42 | * Return: Zero if successful, or a negative error code on failure. |
43 | */ | 43 | */ |
44 | int snd_device_new(struct snd_card *card, snd_device_type_t type, | 44 | int snd_device_new(struct snd_card *card, enum snd_device_type type, |
45 | void *device_data, struct snd_device_ops *ops) | 45 | void *device_data, struct snd_device_ops *ops) |
46 | { | 46 | { |
47 | struct snd_device *dev; | 47 | struct snd_device *dev; |
48 | struct list_head *p; | ||
48 | 49 | ||
49 | if (snd_BUG_ON(!card || !device_data || !ops)) | 50 | if (snd_BUG_ON(!card || !device_data || !ops)) |
50 | return -ENXIO; | 51 | return -ENXIO; |
51 | dev = kzalloc(sizeof(*dev), GFP_KERNEL); | 52 | dev = kzalloc(sizeof(*dev), GFP_KERNEL); |
52 | if (dev == NULL) { | 53 | if (dev == NULL) { |
53 | snd_printk(KERN_ERR "Cannot allocate device\n"); | 54 | dev_err(card->dev, "Cannot allocate device, type=%d\n", type); |
54 | return -ENOMEM; | 55 | return -ENOMEM; |
55 | } | 56 | } |
57 | INIT_LIST_HEAD(&dev->list); | ||
56 | dev->card = card; | 58 | dev->card = card; |
57 | dev->type = type; | 59 | dev->type = type; |
58 | dev->state = SNDRV_DEV_BUILD; | 60 | dev->state = SNDRV_DEV_BUILD; |
59 | dev->device_data = device_data; | 61 | dev->device_data = device_data; |
60 | dev->ops = ops; | 62 | dev->ops = ops; |
61 | list_add(&dev->list, &card->devices); /* add to the head of list */ | 63 | |
64 | /* insert the entry in an incrementally sorted list */ | ||
65 | list_for_each_prev(p, &card->devices) { | ||
66 | struct snd_device *pdev = list_entry(p, struct snd_device, list); | ||
67 | if ((unsigned int)pdev->type <= (unsigned int)type) | ||
68 | break; | ||
69 | } | ||
70 | |||
71 | list_add(&dev->list, p); | ||
62 | return 0; | 72 | return 0; |
63 | } | 73 | } |
64 | |||
65 | EXPORT_SYMBOL(snd_device_new); | 74 | EXPORT_SYMBOL(snd_device_new); |
66 | 75 | ||
76 | static int __snd_device_disconnect(struct snd_device *dev) | ||
77 | { | ||
78 | if (dev->state == SNDRV_DEV_REGISTERED) { | ||
79 | if (dev->ops->dev_disconnect && | ||
80 | dev->ops->dev_disconnect(dev)) | ||
81 | dev_err(dev->card->dev, "device disconnect failure\n"); | ||
82 | dev->state = SNDRV_DEV_DISCONNECTED; | ||
83 | } | ||
84 | return 0; | ||
85 | } | ||
86 | |||
87 | static void __snd_device_free(struct snd_device *dev) | ||
88 | { | ||
89 | /* unlink */ | ||
90 | list_del(&dev->list); | ||
91 | |||
92 | __snd_device_disconnect(dev); | ||
93 | if (dev->ops->dev_free) { | ||
94 | if (dev->ops->dev_free(dev)) | ||
95 | dev_err(dev->card->dev, "device free failure\n"); | ||
96 | } | ||
97 | kfree(dev); | ||
98 | } | ||
99 | |||
100 | static struct snd_device *look_for_dev(struct snd_card *card, void *device_data) | ||
101 | { | ||
102 | struct snd_device *dev; | ||
103 | |||
104 | list_for_each_entry(dev, &card->devices, list) | ||
105 | if (dev->device_data == device_data) | ||
106 | return dev; | ||
107 | |||
108 | return NULL; | ||
109 | } | ||
110 | |||
67 | /** | 111 | /** |
68 | * snd_device_free - release the device from the card | 112 | * snd_device_free - release the device from the card |
69 | * @card: the card instance | 113 | * @card: the card instance |
@@ -72,73 +116,33 @@ EXPORT_SYMBOL(snd_device_new); | |||
72 | * Removes the device from the list on the card and invokes the | 116 | * Removes the device from the list on the card and invokes the |
73 | * callbacks, dev_disconnect and dev_free, corresponding to the state. | 117 | * callbacks, dev_disconnect and dev_free, corresponding to the state. |
74 | * Then release the device. | 118 | * Then release the device. |
75 | * | ||
76 | * Return: Zero if successful, or a negative error code on failure or if the | ||
77 | * device not found. | ||
78 | */ | 119 | */ |
79 | int snd_device_free(struct snd_card *card, void *device_data) | 120 | void snd_device_free(struct snd_card *card, void *device_data) |
80 | { | 121 | { |
81 | struct snd_device *dev; | 122 | struct snd_device *dev; |
82 | 123 | ||
83 | if (snd_BUG_ON(!card || !device_data)) | 124 | if (snd_BUG_ON(!card || !device_data)) |
84 | return -ENXIO; | 125 | return; |
85 | list_for_each_entry(dev, &card->devices, list) { | 126 | dev = look_for_dev(card, device_data); |
86 | if (dev->device_data != device_data) | 127 | if (dev) |
87 | continue; | 128 | __snd_device_free(dev); |
88 | /* unlink */ | 129 | else |
89 | list_del(&dev->list); | 130 | dev_dbg(card->dev, "device free %p (from %pF), not found\n", |
90 | if (dev->state == SNDRV_DEV_REGISTERED && | 131 | device_data, __builtin_return_address(0)); |
91 | dev->ops->dev_disconnect) | ||
92 | if (dev->ops->dev_disconnect(dev)) | ||
93 | snd_printk(KERN_ERR | ||
94 | "device disconnect failure\n"); | ||
95 | if (dev->ops->dev_free) { | ||
96 | if (dev->ops->dev_free(dev)) | ||
97 | snd_printk(KERN_ERR "device free failure\n"); | ||
98 | } | ||
99 | kfree(dev); | ||
100 | return 0; | ||
101 | } | ||
102 | snd_printd("device free %p (from %pF), not found\n", device_data, | ||
103 | __builtin_return_address(0)); | ||
104 | return -ENXIO; | ||
105 | } | 132 | } |
106 | |||
107 | EXPORT_SYMBOL(snd_device_free); | 133 | EXPORT_SYMBOL(snd_device_free); |
108 | 134 | ||
109 | /** | 135 | static int __snd_device_register(struct snd_device *dev) |
110 | * snd_device_disconnect - disconnect the device | ||
111 | * @card: the card instance | ||
112 | * @device_data: the data pointer to disconnect | ||
113 | * | ||
114 | * Turns the device into the disconnection state, invoking | ||
115 | * dev_disconnect callback, if the device was already registered. | ||
116 | * | ||
117 | * Usually called from snd_card_disconnect(). | ||
118 | * | ||
119 | * Return: Zero if successful, or a negative error code on failure or if the | ||
120 | * device not found. | ||
121 | */ | ||
122 | int snd_device_disconnect(struct snd_card *card, void *device_data) | ||
123 | { | 136 | { |
124 | struct snd_device *dev; | 137 | if (dev->state == SNDRV_DEV_BUILD) { |
125 | 138 | if (dev->ops->dev_register) { | |
126 | if (snd_BUG_ON(!card || !device_data)) | 139 | int err = dev->ops->dev_register(dev); |
127 | return -ENXIO; | 140 | if (err < 0) |
128 | list_for_each_entry(dev, &card->devices, list) { | 141 | return err; |
129 | if (dev->device_data != device_data) | ||
130 | continue; | ||
131 | if (dev->state == SNDRV_DEV_REGISTERED && | ||
132 | dev->ops->dev_disconnect) { | ||
133 | if (dev->ops->dev_disconnect(dev)) | ||
134 | snd_printk(KERN_ERR "device disconnect failure\n"); | ||
135 | dev->state = SNDRV_DEV_DISCONNECTED; | ||
136 | } | 142 | } |
137 | return 0; | 143 | dev->state = SNDRV_DEV_REGISTERED; |
138 | } | 144 | } |
139 | snd_printd("device disconnect %p (from %pF), not found\n", device_data, | 145 | return 0; |
140 | __builtin_return_address(0)); | ||
141 | return -ENXIO; | ||
142 | } | 146 | } |
143 | 147 | ||
144 | /** | 148 | /** |
@@ -157,26 +161,15 @@ int snd_device_disconnect(struct snd_card *card, void *device_data) | |||
157 | int snd_device_register(struct snd_card *card, void *device_data) | 161 | int snd_device_register(struct snd_card *card, void *device_data) |
158 | { | 162 | { |
159 | struct snd_device *dev; | 163 | struct snd_device *dev; |
160 | int err; | ||
161 | 164 | ||
162 | if (snd_BUG_ON(!card || !device_data)) | 165 | if (snd_BUG_ON(!card || !device_data)) |
163 | return -ENXIO; | 166 | return -ENXIO; |
164 | list_for_each_entry(dev, &card->devices, list) { | 167 | dev = look_for_dev(card, device_data); |
165 | if (dev->device_data != device_data) | 168 | if (dev) |
166 | continue; | 169 | return __snd_device_register(dev); |
167 | if (dev->state == SNDRV_DEV_BUILD && dev->ops->dev_register) { | ||
168 | if ((err = dev->ops->dev_register(dev)) < 0) | ||
169 | return err; | ||
170 | dev->state = SNDRV_DEV_REGISTERED; | ||
171 | return 0; | ||
172 | } | ||
173 | snd_printd("snd_device_register busy\n"); | ||
174 | return -EBUSY; | ||
175 | } | ||
176 | snd_BUG(); | 170 | snd_BUG(); |
177 | return -ENXIO; | 171 | return -ENXIO; |
178 | } | 172 | } |
179 | |||
180 | EXPORT_SYMBOL(snd_device_register); | 173 | EXPORT_SYMBOL(snd_device_register); |
181 | 174 | ||
182 | /* | 175 | /* |
@@ -191,11 +184,9 @@ int snd_device_register_all(struct snd_card *card) | |||
191 | if (snd_BUG_ON(!card)) | 184 | if (snd_BUG_ON(!card)) |
192 | return -ENXIO; | 185 | return -ENXIO; |
193 | list_for_each_entry(dev, &card->devices, list) { | 186 | list_for_each_entry(dev, &card->devices, list) { |
194 | if (dev->state == SNDRV_DEV_BUILD && dev->ops->dev_register) { | 187 | err = __snd_device_register(dev); |
195 | if ((err = dev->ops->dev_register(dev)) < 0) | 188 | if (err < 0) |
196 | return err; | 189 | return err; |
197 | dev->state = SNDRV_DEV_REGISTERED; | ||
198 | } | ||
199 | } | 190 | } |
200 | return 0; | 191 | return 0; |
201 | } | 192 | } |
@@ -211,8 +202,8 @@ int snd_device_disconnect_all(struct snd_card *card) | |||
211 | 202 | ||
212 | if (snd_BUG_ON(!card)) | 203 | if (snd_BUG_ON(!card)) |
213 | return -ENXIO; | 204 | return -ENXIO; |
214 | list_for_each_entry(dev, &card->devices, list) { | 205 | list_for_each_entry_reverse(dev, &card->devices, list) { |
215 | if (snd_device_disconnect(card, dev->device_data) < 0) | 206 | if (__snd_device_disconnect(dev) < 0) |
216 | err = -ENXIO; | 207 | err = -ENXIO; |
217 | } | 208 | } |
218 | return err; | 209 | return err; |
@@ -222,24 +213,12 @@ int snd_device_disconnect_all(struct snd_card *card) | |||
222 | * release all the devices on the card. | 213 | * release all the devices on the card. |
223 | * called from init.c | 214 | * called from init.c |
224 | */ | 215 | */ |
225 | int snd_device_free_all(struct snd_card *card, snd_device_cmd_t cmd) | 216 | void snd_device_free_all(struct snd_card *card) |
226 | { | 217 | { |
227 | struct snd_device *dev; | 218 | struct snd_device *dev, *next; |
228 | int err; | ||
229 | unsigned int range_low, range_high, type; | ||
230 | 219 | ||
231 | if (snd_BUG_ON(!card)) | 220 | if (snd_BUG_ON(!card)) |
232 | return -ENXIO; | 221 | return; |
233 | range_low = (__force unsigned int)cmd * SNDRV_DEV_TYPE_RANGE_SIZE; | 222 | list_for_each_entry_safe_reverse(dev, next, &card->devices, list) |
234 | range_high = range_low + SNDRV_DEV_TYPE_RANGE_SIZE - 1; | 223 | __snd_device_free(dev); |
235 | __again: | ||
236 | list_for_each_entry(dev, &card->devices, list) { | ||
237 | type = (__force unsigned int)dev->type; | ||
238 | if (type >= range_low && type <= range_high) { | ||
239 | if ((err = snd_device_free(card, dev->device_data)) < 0) | ||
240 | return err; | ||
241 | goto __again; | ||
242 | } | ||
243 | } | ||
244 | return 0; | ||
245 | } | 224 | } |
diff --git a/sound/core/hrtimer.c b/sound/core/hrtimer.c index b8b31c433d64..886be7da989d 100644 --- a/sound/core/hrtimer.c +++ b/sound/core/hrtimer.c | |||
@@ -126,8 +126,7 @@ static int __init snd_hrtimer_init(void) | |||
126 | 126 | ||
127 | hrtimer_get_res(CLOCK_MONOTONIC, &tp); | 127 | hrtimer_get_res(CLOCK_MONOTONIC, &tp); |
128 | if (tp.tv_sec > 0 || !tp.tv_nsec) { | 128 | if (tp.tv_sec > 0 || !tp.tv_nsec) { |
129 | snd_printk(KERN_ERR | 129 | pr_err("snd-hrtimer: Invalid resolution %u.%09u", |
130 | "snd-hrtimer: Invalid resolution %u.%09u", | ||
131 | (unsigned)tp.tv_sec, (unsigned)tp.tv_nsec); | 130 | (unsigned)tp.tv_sec, (unsigned)tp.tv_nsec); |
132 | return -EINVAL; | 131 | return -EINVAL; |
133 | } | 132 | } |
diff --git a/sound/core/hwdep.c b/sound/core/hwdep.c index d105073298cb..69459e5f712e 100644 --- a/sound/core/hwdep.c +++ b/sound/core/hwdep.c | |||
@@ -375,7 +375,7 @@ int snd_hwdep_new(struct snd_card *card, char *id, int device, | |||
375 | *rhwdep = NULL; | 375 | *rhwdep = NULL; |
376 | hwdep = kzalloc(sizeof(*hwdep), GFP_KERNEL); | 376 | hwdep = kzalloc(sizeof(*hwdep), GFP_KERNEL); |
377 | if (hwdep == NULL) { | 377 | if (hwdep == NULL) { |
378 | snd_printk(KERN_ERR "hwdep: cannot allocate\n"); | 378 | dev_err(card->dev, "hwdep: cannot allocate\n"); |
379 | return -ENOMEM; | 379 | return -ENOMEM; |
380 | } | 380 | } |
381 | hwdep->card = card; | 381 | hwdep->card = card; |
@@ -395,6 +395,7 @@ int snd_hwdep_new(struct snd_card *card, char *id, int device, | |||
395 | *rhwdep = hwdep; | 395 | *rhwdep = hwdep; |
396 | return 0; | 396 | return 0; |
397 | } | 397 | } |
398 | EXPORT_SYMBOL(snd_hwdep_new); | ||
398 | 399 | ||
399 | static int snd_hwdep_free(struct snd_hwdep *hwdep) | 400 | static int snd_hwdep_free(struct snd_hwdep *hwdep) |
400 | { | 401 | { |
@@ -415,37 +416,61 @@ static int snd_hwdep_dev_free(struct snd_device *device) | |||
415 | static int snd_hwdep_dev_register(struct snd_device *device) | 416 | static int snd_hwdep_dev_register(struct snd_device *device) |
416 | { | 417 | { |
417 | struct snd_hwdep *hwdep = device->device_data; | 418 | struct snd_hwdep *hwdep = device->device_data; |
419 | struct snd_card *card = hwdep->card; | ||
420 | struct device *dev; | ||
418 | int err; | 421 | int err; |
419 | char name[32]; | 422 | char name[32]; |
420 | 423 | ||
421 | mutex_lock(®ister_mutex); | 424 | mutex_lock(®ister_mutex); |
422 | if (snd_hwdep_search(hwdep->card, hwdep->device)) { | 425 | if (snd_hwdep_search(card, hwdep->device)) { |
423 | mutex_unlock(®ister_mutex); | 426 | mutex_unlock(®ister_mutex); |
424 | return -EBUSY; | 427 | return -EBUSY; |
425 | } | 428 | } |
426 | list_add_tail(&hwdep->list, &snd_hwdep_devices); | 429 | list_add_tail(&hwdep->list, &snd_hwdep_devices); |
427 | sprintf(name, "hwC%iD%i", hwdep->card->number, hwdep->device); | 430 | sprintf(name, "hwC%iD%i", hwdep->card->number, hwdep->device); |
428 | if ((err = snd_register_device(SNDRV_DEVICE_TYPE_HWDEP, | 431 | dev = hwdep->dev; |
429 | hwdep->card, hwdep->device, | 432 | if (!dev) |
430 | &snd_hwdep_f_ops, hwdep, name)) < 0) { | 433 | dev = snd_card_get_device_link(hwdep->card); |
431 | snd_printk(KERN_ERR "unable to register hardware dependent device %i:%i\n", | 434 | err = snd_register_device_for_dev(SNDRV_DEVICE_TYPE_HWDEP, |
432 | hwdep->card->number, hwdep->device); | 435 | hwdep->card, hwdep->device, |
436 | &snd_hwdep_f_ops, hwdep, name, dev); | ||
437 | if (err < 0) { | ||
438 | dev_err(dev, | ||
439 | "unable to register hardware dependent device %i:%i\n", | ||
440 | card->number, hwdep->device); | ||
433 | list_del(&hwdep->list); | 441 | list_del(&hwdep->list); |
434 | mutex_unlock(®ister_mutex); | 442 | mutex_unlock(®ister_mutex); |
435 | return err; | 443 | return err; |
436 | } | 444 | } |
445 | |||
446 | if (hwdep->groups) { | ||
447 | struct device *d = snd_get_device(SNDRV_DEVICE_TYPE_HWDEP, | ||
448 | hwdep->card, hwdep->device); | ||
449 | if (d) { | ||
450 | if (hwdep->private_data) | ||
451 | dev_set_drvdata(d, hwdep->private_data); | ||
452 | err = sysfs_create_groups(&d->kobj, hwdep->groups); | ||
453 | if (err < 0) | ||
454 | dev_warn(dev, | ||
455 | "hwdep %d:%d: cannot create sysfs groups\n", | ||
456 | card->number, hwdep->device); | ||
457 | put_device(d); | ||
458 | } | ||
459 | } | ||
460 | |||
437 | #ifdef CONFIG_SND_OSSEMUL | 461 | #ifdef CONFIG_SND_OSSEMUL |
438 | hwdep->ossreg = 0; | 462 | hwdep->ossreg = 0; |
439 | if (hwdep->oss_type >= 0) { | 463 | if (hwdep->oss_type >= 0) { |
440 | if ((hwdep->oss_type == SNDRV_OSS_DEVICE_TYPE_DMFM) && (hwdep->device != 0)) { | 464 | if ((hwdep->oss_type == SNDRV_OSS_DEVICE_TYPE_DMFM) && (hwdep->device != 0)) { |
441 | snd_printk (KERN_WARNING "only hwdep device 0 can be registered as OSS direct FM device!\n"); | 465 | dev_warn(dev, |
466 | "only hwdep device 0 can be registered as OSS direct FM device!\n"); | ||
442 | } else { | 467 | } else { |
443 | if (snd_register_oss_device(hwdep->oss_type, | 468 | if (snd_register_oss_device(hwdep->oss_type, |
444 | hwdep->card, hwdep->device, | 469 | card, hwdep->device, |
445 | &snd_hwdep_f_ops, hwdep, | 470 | &snd_hwdep_f_ops, hwdep) < 0) { |
446 | hwdep->oss_dev) < 0) { | 471 | dev_err(dev, |
447 | snd_printk(KERN_ERR "unable to register OSS compatibility device %i:%i\n", | 472 | "unable to register OSS compatibility device %i:%i\n", |
448 | hwdep->card->number, hwdep->device); | 473 | card->number, hwdep->device); |
449 | } else | 474 | } else |
450 | hwdep->ossreg = 1; | 475 | hwdep->ossreg = 1; |
451 | } | 476 | } |
@@ -543,5 +568,3 @@ static void __exit alsa_hwdep_exit(void) | |||
543 | 568 | ||
544 | module_init(alsa_hwdep_init) | 569 | module_init(alsa_hwdep_init) |
545 | module_exit(alsa_hwdep_exit) | 570 | module_exit(alsa_hwdep_exit) |
546 | |||
547 | EXPORT_SYMBOL(snd_hwdep_new); | ||
diff --git a/sound/core/info.c b/sound/core/info.c index e79baa11b60e..051d55b05521 100644 --- a/sound/core/info.c +++ b/sound/core/info.c | |||
@@ -418,9 +418,14 @@ static int snd_info_entry_release(struct inode *inode, struct file *file) | |||
418 | if (entry->c.text.write) { | 418 | if (entry->c.text.write) { |
419 | entry->c.text.write(entry, data->wbuffer); | 419 | entry->c.text.write(entry, data->wbuffer); |
420 | if (data->wbuffer->error) { | 420 | if (data->wbuffer->error) { |
421 | snd_printk(KERN_WARNING "data write error to %s (%i)\n", | 421 | if (entry->card) |
422 | entry->name, | 422 | dev_warn(entry->card->dev, "info: data write error to %s (%i)\n", |
423 | data->wbuffer->error); | 423 | entry->name, |
424 | data->wbuffer->error); | ||
425 | else | ||
426 | pr_warn("ALSA: info: data write error to %s (%i)\n", | ||
427 | entry->name, | ||
428 | data->wbuffer->error); | ||
424 | } | 429 | } |
425 | } | 430 | } |
426 | kfree(data->wbuffer->buffer); | 431 | kfree(data->wbuffer->buffer); |
@@ -540,7 +545,7 @@ int __init snd_info_init(void) | |||
540 | snd_oss_root = entry; | 545 | snd_oss_root = entry; |
541 | } | 546 | } |
542 | #endif | 547 | #endif |
543 | #if defined(CONFIG_SND_SEQUENCER) || defined(CONFIG_SND_SEQUENCER_MODULE) | 548 | #if IS_ENABLED(CONFIG_SND_SEQUENCER) |
544 | { | 549 | { |
545 | struct snd_info_entry *entry; | 550 | struct snd_info_entry *entry; |
546 | if ((entry = snd_info_create_module_entry(THIS_MODULE, "seq", NULL)) == NULL) | 551 | if ((entry = snd_info_create_module_entry(THIS_MODULE, "seq", NULL)) == NULL) |
@@ -567,7 +572,7 @@ int __exit snd_info_done(void) | |||
567 | snd_minor_info_done(); | 572 | snd_minor_info_done(); |
568 | snd_info_version_done(); | 573 | snd_info_version_done(); |
569 | if (snd_proc_root) { | 574 | if (snd_proc_root) { |
570 | #if defined(CONFIG_SND_SEQUENCER) || defined(CONFIG_SND_SEQUENCER_MODULE) | 575 | #if IS_ENABLED(CONFIG_SND_SEQUENCER) |
571 | snd_info_free_entry(snd_seq_root); | 576 | snd_info_free_entry(snd_seq_root); |
572 | #endif | 577 | #endif |
573 | #ifdef CONFIG_SND_OSSEMUL | 578 | #ifdef CONFIG_SND_OSSEMUL |
diff --git a/sound/core/init.c b/sound/core/init.c index 0d42fcda0de2..5ee83845c5de 100644 --- a/sound/core/init.c +++ b/sound/core/init.c | |||
@@ -28,6 +28,7 @@ | |||
28 | #include <linux/time.h> | 28 | #include <linux/time.h> |
29 | #include <linux/ctype.h> | 29 | #include <linux/ctype.h> |
30 | #include <linux/pm.h> | 30 | #include <linux/pm.h> |
31 | #include <linux/completion.h> | ||
31 | 32 | ||
32 | #include <sound/core.h> | 33 | #include <sound/core.h> |
33 | #include <sound/control.h> | 34 | #include <sound/control.h> |
@@ -94,7 +95,7 @@ static int module_slot_match(struct module *module, int idx) | |||
94 | return match; | 95 | return match; |
95 | } | 96 | } |
96 | 97 | ||
97 | #if defined(CONFIG_SND_MIXER_OSS) || defined(CONFIG_SND_MIXER_OSS_MODULE) | 98 | #if IS_ENABLED(CONFIG_SND_MIXER_OSS) |
98 | int (*snd_mixer_oss_notify_callback)(struct snd_card *card, int free_flag); | 99 | int (*snd_mixer_oss_notify_callback)(struct snd_card *card, int free_flag); |
99 | EXPORT_SYMBOL(snd_mixer_oss_notify_callback); | 100 | EXPORT_SYMBOL(snd_mixer_oss_notify_callback); |
100 | #endif | 101 | #endif |
@@ -112,11 +113,11 @@ static inline int init_info_for_card(struct snd_card *card) | |||
112 | struct snd_info_entry *entry; | 113 | struct snd_info_entry *entry; |
113 | 114 | ||
114 | if ((err = snd_info_card_register(card)) < 0) { | 115 | if ((err = snd_info_card_register(card)) < 0) { |
115 | snd_printd("unable to create card info\n"); | 116 | dev_dbg(card->dev, "unable to create card info\n"); |
116 | return err; | 117 | return err; |
117 | } | 118 | } |
118 | if ((entry = snd_info_create_card_entry(card, "id", card->proc_root)) == NULL) { | 119 | if ((entry = snd_info_create_card_entry(card, "id", card->proc_root)) == NULL) { |
119 | snd_printd("unable to create card entry\n"); | 120 | dev_dbg(card->dev, "unable to create card entry\n"); |
120 | return err; | 121 | return err; |
121 | } | 122 | } |
122 | entry->c.text.read = snd_card_id_read; | 123 | entry->c.text.read = snd_card_id_read; |
@@ -156,8 +157,17 @@ static int get_slot_from_bitmask(int mask, int (*check)(struct module *, int), | |||
156 | return mask; /* unchanged */ | 157 | return mask; /* unchanged */ |
157 | } | 158 | } |
158 | 159 | ||
160 | static int snd_card_do_free(struct snd_card *card); | ||
161 | static const struct attribute_group *card_dev_attr_groups[]; | ||
162 | |||
163 | static void release_card_device(struct device *dev) | ||
164 | { | ||
165 | snd_card_do_free(dev_to_snd_card(dev)); | ||
166 | } | ||
167 | |||
159 | /** | 168 | /** |
160 | * snd_card_create - create and initialize a soundcard structure | 169 | * snd_card_new - create and initialize a soundcard structure |
170 | * @parent: the parent device object | ||
161 | * @idx: card index (address) [0 ... (SNDRV_CARDS-1)] | 171 | * @idx: card index (address) [0 ... (SNDRV_CARDS-1)] |
162 | * @xid: card identification (ASCII string) | 172 | * @xid: card identification (ASCII string) |
163 | * @module: top level module for locking | 173 | * @module: top level module for locking |
@@ -172,7 +182,7 @@ static int get_slot_from_bitmask(int mask, int (*check)(struct module *, int), | |||
172 | * | 182 | * |
173 | * Return: Zero if successful or a negative error code. | 183 | * Return: Zero if successful or a negative error code. |
174 | */ | 184 | */ |
175 | int snd_card_create(int idx, const char *xid, | 185 | int snd_card_new(struct device *parent, int idx, const char *xid, |
176 | struct module *module, int extra_size, | 186 | struct module *module, int extra_size, |
177 | struct snd_card **card_ret) | 187 | struct snd_card **card_ret) |
178 | { | 188 | { |
@@ -188,6 +198,8 @@ int snd_card_create(int idx, const char *xid, | |||
188 | card = kzalloc(sizeof(*card) + extra_size, GFP_KERNEL); | 198 | card = kzalloc(sizeof(*card) + extra_size, GFP_KERNEL); |
189 | if (!card) | 199 | if (!card) |
190 | return -ENOMEM; | 200 | return -ENOMEM; |
201 | if (extra_size > 0) | ||
202 | card->private_data = (char *)card + sizeof(struct snd_card); | ||
191 | if (xid) | 203 | if (xid) |
192 | strlcpy(card->id, xid, sizeof(card->id)); | 204 | strlcpy(card->id, xid, sizeof(card->id)); |
193 | err = 0; | 205 | err = 0; |
@@ -205,14 +217,16 @@ int snd_card_create(int idx, const char *xid, | |||
205 | err = -ENODEV; | 217 | err = -ENODEV; |
206 | if (err < 0) { | 218 | if (err < 0) { |
207 | mutex_unlock(&snd_card_mutex); | 219 | mutex_unlock(&snd_card_mutex); |
208 | snd_printk(KERN_ERR "cannot find the slot for index %d (range 0-%i), error: %d\n", | 220 | dev_err(parent, "cannot find the slot for index %d (range 0-%i), error: %d\n", |
209 | idx, snd_ecards_limit - 1, err); | 221 | idx, snd_ecards_limit - 1, err); |
210 | goto __error; | 222 | kfree(card); |
223 | return err; | ||
211 | } | 224 | } |
212 | set_bit(idx, snd_cards_lock); /* lock it */ | 225 | set_bit(idx, snd_cards_lock); /* lock it */ |
213 | if (idx >= snd_ecards_limit) | 226 | if (idx >= snd_ecards_limit) |
214 | snd_ecards_limit = idx + 1; /* increase the limit */ | 227 | snd_ecards_limit = idx + 1; /* increase the limit */ |
215 | mutex_unlock(&snd_card_mutex); | 228 | mutex_unlock(&snd_card_mutex); |
229 | card->dev = parent; | ||
216 | card->number = idx; | 230 | card->number = idx; |
217 | card->module = module; | 231 | card->module = module; |
218 | INIT_LIST_HEAD(&card->devices); | 232 | INIT_LIST_HEAD(&card->devices); |
@@ -222,36 +236,42 @@ int snd_card_create(int idx, const char *xid, | |||
222 | INIT_LIST_HEAD(&card->ctl_files); | 236 | INIT_LIST_HEAD(&card->ctl_files); |
223 | spin_lock_init(&card->files_lock); | 237 | spin_lock_init(&card->files_lock); |
224 | INIT_LIST_HEAD(&card->files_list); | 238 | INIT_LIST_HEAD(&card->files_list); |
225 | init_waitqueue_head(&card->shutdown_sleep); | ||
226 | atomic_set(&card->refcount, 0); | ||
227 | #ifdef CONFIG_PM | 239 | #ifdef CONFIG_PM |
228 | mutex_init(&card->power_lock); | 240 | mutex_init(&card->power_lock); |
229 | init_waitqueue_head(&card->power_sleep); | 241 | init_waitqueue_head(&card->power_sleep); |
230 | #endif | 242 | #endif |
243 | |||
244 | device_initialize(&card->card_dev); | ||
245 | card->card_dev.parent = parent; | ||
246 | card->card_dev.class = sound_class; | ||
247 | card->card_dev.release = release_card_device; | ||
248 | card->card_dev.groups = card_dev_attr_groups; | ||
249 | err = kobject_set_name(&card->card_dev.kobj, "card%d", idx); | ||
250 | if (err < 0) | ||
251 | goto __error; | ||
252 | |||
231 | /* the control interface cannot be accessed from the user space until */ | 253 | /* the control interface cannot be accessed from the user space until */ |
232 | /* snd_cards_bitmask and snd_cards are set with snd_card_register */ | 254 | /* snd_cards_bitmask and snd_cards are set with snd_card_register */ |
233 | err = snd_ctl_create(card); | 255 | err = snd_ctl_create(card); |
234 | if (err < 0) { | 256 | if (err < 0) { |
235 | snd_printk(KERN_ERR "unable to register control minors\n"); | 257 | dev_err(parent, "unable to register control minors\n"); |
236 | goto __error; | 258 | goto __error; |
237 | } | 259 | } |
238 | err = snd_info_card_create(card); | 260 | err = snd_info_card_create(card); |
239 | if (err < 0) { | 261 | if (err < 0) { |
240 | snd_printk(KERN_ERR "unable to create card info\n"); | 262 | dev_err(parent, "unable to create card info\n"); |
241 | goto __error_ctl; | 263 | goto __error_ctl; |
242 | } | 264 | } |
243 | if (extra_size > 0) | ||
244 | card->private_data = (char *)card + sizeof(struct snd_card); | ||
245 | *card_ret = card; | 265 | *card_ret = card; |
246 | return 0; | 266 | return 0; |
247 | 267 | ||
248 | __error_ctl: | 268 | __error_ctl: |
249 | snd_device_free_all(card, SNDRV_DEV_CMD_PRE); | 269 | snd_device_free_all(card); |
250 | __error: | 270 | __error: |
251 | kfree(card); | 271 | put_device(&card->card_dev); |
252 | return err; | 272 | return err; |
253 | } | 273 | } |
254 | EXPORT_SYMBOL(snd_card_create); | 274 | EXPORT_SYMBOL(snd_card_new); |
255 | 275 | ||
256 | /* return non-zero if a card is already locked */ | 276 | /* return non-zero if a card is already locked */ |
257 | int snd_card_locked(int card) | 277 | int snd_card_locked(int card) |
@@ -394,7 +414,7 @@ int snd_card_disconnect(struct snd_card *card) | |||
394 | /* phase 3: notify all connected devices about disconnection */ | 414 | /* phase 3: notify all connected devices about disconnection */ |
395 | /* at this point, they cannot respond to any calls except release() */ | 415 | /* at this point, they cannot respond to any calls except release() */ |
396 | 416 | ||
397 | #if defined(CONFIG_SND_MIXER_OSS) || defined(CONFIG_SND_MIXER_OSS_MODULE) | 417 | #if IS_ENABLED(CONFIG_SND_MIXER_OSS) |
398 | if (snd_mixer_oss_notify_callback) | 418 | if (snd_mixer_oss_notify_callback) |
399 | snd_mixer_oss_notify_callback(card, SND_MIXER_OSS_NOTIFY_DISCONNECT); | 419 | snd_mixer_oss_notify_callback(card, SND_MIXER_OSS_NOTIFY_DISCONNECT); |
400 | #endif | 420 | #endif |
@@ -402,12 +422,12 @@ int snd_card_disconnect(struct snd_card *card) | |||
402 | /* notify all devices that we are disconnected */ | 422 | /* notify all devices that we are disconnected */ |
403 | err = snd_device_disconnect_all(card); | 423 | err = snd_device_disconnect_all(card); |
404 | if (err < 0) | 424 | if (err < 0) |
405 | snd_printk(KERN_ERR "not all devices for card %i can be disconnected\n", card->number); | 425 | dev_err(card->dev, "not all devices for card %i can be disconnected\n", card->number); |
406 | 426 | ||
407 | snd_info_card_disconnect(card); | 427 | snd_info_card_disconnect(card); |
408 | if (card->card_dev) { | 428 | if (card->registered) { |
409 | device_unregister(card->card_dev); | 429 | device_del(&card->card_dev); |
410 | card->card_dev = NULL; | 430 | card->registered = false; |
411 | } | 431 | } |
412 | #ifdef CONFIG_PM | 432 | #ifdef CONFIG_PM |
413 | wake_up(&card->power_sleep); | 433 | wake_up(&card->power_sleep); |
@@ -430,81 +450,48 @@ EXPORT_SYMBOL(snd_card_disconnect); | |||
430 | */ | 450 | */ |
431 | static int snd_card_do_free(struct snd_card *card) | 451 | static int snd_card_do_free(struct snd_card *card) |
432 | { | 452 | { |
433 | #if defined(CONFIG_SND_MIXER_OSS) || defined(CONFIG_SND_MIXER_OSS_MODULE) | 453 | #if IS_ENABLED(CONFIG_SND_MIXER_OSS) |
434 | if (snd_mixer_oss_notify_callback) | 454 | if (snd_mixer_oss_notify_callback) |
435 | snd_mixer_oss_notify_callback(card, SND_MIXER_OSS_NOTIFY_FREE); | 455 | snd_mixer_oss_notify_callback(card, SND_MIXER_OSS_NOTIFY_FREE); |
436 | #endif | 456 | #endif |
437 | if (snd_device_free_all(card, SNDRV_DEV_CMD_PRE) < 0) { | 457 | snd_device_free_all(card); |
438 | snd_printk(KERN_ERR "unable to free all devices (pre)\n"); | ||
439 | /* Fatal, but this situation should never occur */ | ||
440 | } | ||
441 | if (snd_device_free_all(card, SNDRV_DEV_CMD_NORMAL) < 0) { | ||
442 | snd_printk(KERN_ERR "unable to free all devices (normal)\n"); | ||
443 | /* Fatal, but this situation should never occur */ | ||
444 | } | ||
445 | if (snd_device_free_all(card, SNDRV_DEV_CMD_POST) < 0) { | ||
446 | snd_printk(KERN_ERR "unable to free all devices (post)\n"); | ||
447 | /* Fatal, but this situation should never occur */ | ||
448 | } | ||
449 | if (card->private_free) | 458 | if (card->private_free) |
450 | card->private_free(card); | 459 | card->private_free(card); |
451 | snd_info_free_entry(card->proc_id); | 460 | snd_info_free_entry(card->proc_id); |
452 | if (snd_info_card_free(card) < 0) { | 461 | if (snd_info_card_free(card) < 0) { |
453 | snd_printk(KERN_WARNING "unable to free card info\n"); | 462 | dev_warn(card->dev, "unable to free card info\n"); |
454 | /* Not fatal error */ | 463 | /* Not fatal error */ |
455 | } | 464 | } |
465 | if (card->release_completion) | ||
466 | complete(card->release_completion); | ||
456 | kfree(card); | 467 | kfree(card); |
457 | return 0; | 468 | return 0; |
458 | } | 469 | } |
459 | 470 | ||
460 | /** | ||
461 | * snd_card_unref - release the reference counter | ||
462 | * @card: the card instance | ||
463 | * | ||
464 | * Decrements the reference counter. When it reaches to zero, wake up | ||
465 | * the sleeper and call the destructor if needed. | ||
466 | */ | ||
467 | void snd_card_unref(struct snd_card *card) | ||
468 | { | ||
469 | if (atomic_dec_and_test(&card->refcount)) { | ||
470 | wake_up(&card->shutdown_sleep); | ||
471 | if (card->free_on_last_close) | ||
472 | snd_card_do_free(card); | ||
473 | } | ||
474 | } | ||
475 | EXPORT_SYMBOL(snd_card_unref); | ||
476 | |||
477 | int snd_card_free_when_closed(struct snd_card *card) | 471 | int snd_card_free_when_closed(struct snd_card *card) |
478 | { | 472 | { |
479 | int ret; | 473 | int ret = snd_card_disconnect(card); |
480 | 474 | if (ret) | |
481 | atomic_inc(&card->refcount); | ||
482 | ret = snd_card_disconnect(card); | ||
483 | if (ret) { | ||
484 | atomic_dec(&card->refcount); | ||
485 | return ret; | 475 | return ret; |
486 | } | 476 | put_device(&card->card_dev); |
487 | |||
488 | card->free_on_last_close = 1; | ||
489 | if (atomic_dec_and_test(&card->refcount)) | ||
490 | snd_card_do_free(card); | ||
491 | return 0; | 477 | return 0; |
492 | } | 478 | } |
493 | |||
494 | EXPORT_SYMBOL(snd_card_free_when_closed); | 479 | EXPORT_SYMBOL(snd_card_free_when_closed); |
495 | 480 | ||
496 | int snd_card_free(struct snd_card *card) | 481 | int snd_card_free(struct snd_card *card) |
497 | { | 482 | { |
498 | int ret = snd_card_disconnect(card); | 483 | struct completion released; |
484 | int ret; | ||
485 | |||
486 | init_completion(&released); | ||
487 | card->release_completion = &released; | ||
488 | ret = snd_card_free_when_closed(card); | ||
499 | if (ret) | 489 | if (ret) |
500 | return ret; | 490 | return ret; |
501 | |||
502 | /* wait, until all devices are ready for the free operation */ | 491 | /* wait, until all devices are ready for the free operation */ |
503 | wait_event(card->shutdown_sleep, !atomic_read(&card->refcount)); | 492 | wait_for_completion(&released); |
504 | snd_card_do_free(card); | ||
505 | return 0; | 493 | return 0; |
506 | } | 494 | } |
507 | |||
508 | EXPORT_SYMBOL(snd_card_free); | 495 | EXPORT_SYMBOL(snd_card_free); |
509 | 496 | ||
510 | /* retrieve the last word of shortname or longname */ | 497 | /* retrieve the last word of shortname or longname */ |
@@ -598,7 +585,7 @@ static void snd_card_set_id_no_lock(struct snd_card *card, const char *src, | |||
598 | goto again; | 585 | goto again; |
599 | } | 586 | } |
600 | /* last resort... */ | 587 | /* last resort... */ |
601 | snd_printk(KERN_ERR "unable to set card id (%s)\n", id); | 588 | dev_err(card->dev, "unable to set card id (%s)\n", id); |
602 | if (card->proc_root->name) | 589 | if (card->proc_root->name) |
603 | strlcpy(card->id, card->proc_root->name, sizeof(card->id)); | 590 | strlcpy(card->id, card->proc_root->name, sizeof(card->id)); |
604 | } | 591 | } |
@@ -626,15 +613,15 @@ static ssize_t | |||
626 | card_id_show_attr(struct device *dev, | 613 | card_id_show_attr(struct device *dev, |
627 | struct device_attribute *attr, char *buf) | 614 | struct device_attribute *attr, char *buf) |
628 | { | 615 | { |
629 | struct snd_card *card = dev_get_drvdata(dev); | 616 | struct snd_card *card = container_of(dev, struct snd_card, card_dev); |
630 | return snprintf(buf, PAGE_SIZE, "%s\n", card ? card->id : "(null)"); | 617 | return snprintf(buf, PAGE_SIZE, "%s\n", card->id); |
631 | } | 618 | } |
632 | 619 | ||
633 | static ssize_t | 620 | static ssize_t |
634 | card_id_store_attr(struct device *dev, struct device_attribute *attr, | 621 | card_id_store_attr(struct device *dev, struct device_attribute *attr, |
635 | const char *buf, size_t count) | 622 | const char *buf, size_t count) |
636 | { | 623 | { |
637 | struct snd_card *card = dev_get_drvdata(dev); | 624 | struct snd_card *card = container_of(dev, struct snd_card, card_dev); |
638 | char buf1[sizeof(card->id)]; | 625 | char buf1[sizeof(card->id)]; |
639 | size_t copy = count > sizeof(card->id) - 1 ? | 626 | size_t copy = count > sizeof(card->id) - 1 ? |
640 | sizeof(card->id) - 1 : count; | 627 | sizeof(card->id) - 1 : count; |
@@ -660,19 +647,32 @@ card_id_store_attr(struct device *dev, struct device_attribute *attr, | |||
660 | return count; | 647 | return count; |
661 | } | 648 | } |
662 | 649 | ||
663 | static struct device_attribute card_id_attrs = | 650 | static DEVICE_ATTR(id, S_IRUGO | S_IWUSR, card_id_show_attr, card_id_store_attr); |
664 | __ATTR(id, S_IRUGO | S_IWUSR, card_id_show_attr, card_id_store_attr); | ||
665 | 651 | ||
666 | static ssize_t | 652 | static ssize_t |
667 | card_number_show_attr(struct device *dev, | 653 | card_number_show_attr(struct device *dev, |
668 | struct device_attribute *attr, char *buf) | 654 | struct device_attribute *attr, char *buf) |
669 | { | 655 | { |
670 | struct snd_card *card = dev_get_drvdata(dev); | 656 | struct snd_card *card = container_of(dev, struct snd_card, card_dev); |
671 | return snprintf(buf, PAGE_SIZE, "%i\n", card ? card->number : -1); | 657 | return snprintf(buf, PAGE_SIZE, "%i\n", card->number); |
672 | } | 658 | } |
673 | 659 | ||
674 | static struct device_attribute card_number_attrs = | 660 | static DEVICE_ATTR(number, S_IRUGO, card_number_show_attr, NULL); |
675 | __ATTR(number, S_IRUGO, card_number_show_attr, NULL); | 661 | |
662 | static struct attribute *card_dev_attrs[] = { | ||
663 | &dev_attr_id.attr, | ||
664 | &dev_attr_number.attr, | ||
665 | NULL | ||
666 | }; | ||
667 | |||
668 | static struct attribute_group card_dev_attr_group = { | ||
669 | .attrs = card_dev_attrs, | ||
670 | }; | ||
671 | |||
672 | static const struct attribute_group *card_dev_attr_groups[] = { | ||
673 | &card_dev_attr_group, | ||
674 | NULL | ||
675 | }; | ||
676 | 676 | ||
677 | /** | 677 | /** |
678 | * snd_card_register - register the soundcard | 678 | * snd_card_register - register the soundcard |
@@ -692,12 +692,11 @@ int snd_card_register(struct snd_card *card) | |||
692 | if (snd_BUG_ON(!card)) | 692 | if (snd_BUG_ON(!card)) |
693 | return -EINVAL; | 693 | return -EINVAL; |
694 | 694 | ||
695 | if (!card->card_dev) { | 695 | if (!card->registered) { |
696 | card->card_dev = device_create(sound_class, card->dev, | 696 | err = device_add(&card->card_dev); |
697 | MKDEV(0, 0), card, | 697 | if (err < 0) |
698 | "card%i", card->number); | 698 | return err; |
699 | if (IS_ERR(card->card_dev)) | 699 | card->registered = true; |
700 | card->card_dev = NULL; | ||
701 | } | 700 | } |
702 | 701 | ||
703 | if ((err = snd_device_register_all(card)) < 0) | 702 | if ((err = snd_device_register_all(card)) < 0) |
@@ -723,19 +722,10 @@ int snd_card_register(struct snd_card *card) | |||
723 | snd_cards[card->number] = card; | 722 | snd_cards[card->number] = card; |
724 | mutex_unlock(&snd_card_mutex); | 723 | mutex_unlock(&snd_card_mutex); |
725 | init_info_for_card(card); | 724 | init_info_for_card(card); |
726 | #if defined(CONFIG_SND_MIXER_OSS) || defined(CONFIG_SND_MIXER_OSS_MODULE) | 725 | #if IS_ENABLED(CONFIG_SND_MIXER_OSS) |
727 | if (snd_mixer_oss_notify_callback) | 726 | if (snd_mixer_oss_notify_callback) |
728 | snd_mixer_oss_notify_callback(card, SND_MIXER_OSS_NOTIFY_REGISTER); | 727 | snd_mixer_oss_notify_callback(card, SND_MIXER_OSS_NOTIFY_REGISTER); |
729 | #endif | 728 | #endif |
730 | if (card->card_dev) { | ||
731 | err = device_create_file(card->card_dev, &card_id_attrs); | ||
732 | if (err < 0) | ||
733 | return err; | ||
734 | err = device_create_file(card->card_dev, &card_number_attrs); | ||
735 | if (err < 0) | ||
736 | return err; | ||
737 | } | ||
738 | |||
739 | return 0; | 729 | return 0; |
740 | } | 730 | } |
741 | 731 | ||
@@ -908,7 +898,7 @@ int snd_card_file_add(struct snd_card *card, struct file *file) | |||
908 | return -ENODEV; | 898 | return -ENODEV; |
909 | } | 899 | } |
910 | list_add(&mfile->list, &card->files_list); | 900 | list_add(&mfile->list, &card->files_list); |
911 | atomic_inc(&card->refcount); | 901 | get_device(&card->card_dev); |
912 | spin_unlock(&card->files_lock); | 902 | spin_unlock(&card->files_lock); |
913 | return 0; | 903 | return 0; |
914 | } | 904 | } |
@@ -947,11 +937,11 @@ int snd_card_file_remove(struct snd_card *card, struct file *file) | |||
947 | } | 937 | } |
948 | spin_unlock(&card->files_lock); | 938 | spin_unlock(&card->files_lock); |
949 | if (!found) { | 939 | if (!found) { |
950 | snd_printk(KERN_ERR "ALSA card file remove problem (%p)\n", file); | 940 | dev_err(card->dev, "card file remove problem (%p)\n", file); |
951 | return -ENOENT; | 941 | return -ENOENT; |
952 | } | 942 | } |
953 | kfree(found); | 943 | kfree(found); |
954 | snd_card_unref(card); | 944 | put_device(&card->card_dev); |
955 | return 0; | 945 | return 0; |
956 | } | 946 | } |
957 | 947 | ||
diff --git a/sound/core/isadma.c b/sound/core/isadma.c index e2b386156a4c..31e8544d7f2d 100644 --- a/sound/core/isadma.c +++ b/sound/core/isadma.c | |||
@@ -106,7 +106,7 @@ unsigned int snd_dma_pointer(unsigned long dma, unsigned int size) | |||
106 | result = result1; | 106 | result = result1; |
107 | #ifdef CONFIG_SND_DEBUG | 107 | #ifdef CONFIG_SND_DEBUG |
108 | if (result > size) | 108 | if (result > size) |
109 | snd_printk(KERN_ERR "pointer (0x%x) for DMA #%ld is greater than transfer size (0x%x)\n", result, dma, size); | 109 | pr_err("ALSA: pointer (0x%x) for DMA #%ld is greater than transfer size (0x%x)\n", result, dma, size); |
110 | #endif | 110 | #endif |
111 | if (result >= size || result == 0) | 111 | if (result >= size || result == 0) |
112 | return 0; | 112 | return 0; |
diff --git a/sound/core/memalloc.c b/sound/core/memalloc.c index 4595f93d151e..082509eb805d 100644 --- a/sound/core/memalloc.c +++ b/sound/core/memalloc.c | |||
@@ -207,7 +207,7 @@ int snd_dma_alloc_pages(int type, struct device *device, size_t size, | |||
207 | break; | 207 | break; |
208 | #endif | 208 | #endif |
209 | default: | 209 | default: |
210 | printk(KERN_ERR "snd-malloc: invalid device type %d\n", type); | 210 | pr_err("snd-malloc: invalid device type %d\n", type); |
211 | dmab->area = NULL; | 211 | dmab->area = NULL; |
212 | dmab->addr = 0; | 212 | dmab->addr = 0; |
213 | return -ENXIO; | 213 | return -ENXIO; |
@@ -284,7 +284,7 @@ void snd_dma_free_pages(struct snd_dma_buffer *dmab) | |||
284 | break; | 284 | break; |
285 | #endif | 285 | #endif |
286 | default: | 286 | default: |
287 | printk(KERN_ERR "snd-malloc: invalid device type %d\n", dmab->dev.type); | 287 | pr_err("snd-malloc: invalid device type %d\n", dmab->dev.type); |
288 | } | 288 | } |
289 | } | 289 | } |
290 | 290 | ||
diff --git a/sound/core/oss/mixer_oss.c b/sound/core/oss/mixer_oss.c index e8a1d18774b2..5e6349f00ecd 100644 --- a/sound/core/oss/mixer_oss.c +++ b/sound/core/oss/mixer_oss.c | |||
@@ -1187,7 +1187,8 @@ static void snd_mixer_oss_proc_write(struct snd_info_entry *entry, | |||
1187 | if (oss_mixer_names[ch] && strcmp(oss_mixer_names[ch], str) == 0) | 1187 | if (oss_mixer_names[ch] && strcmp(oss_mixer_names[ch], str) == 0) |
1188 | break; | 1188 | break; |
1189 | if (ch >= SNDRV_OSS_MAX_MIXERS) { | 1189 | if (ch >= SNDRV_OSS_MAX_MIXERS) { |
1190 | snd_printk(KERN_ERR "mixer_oss: invalid OSS volume '%s'\n", str); | 1190 | pr_err("ALSA: mixer_oss: invalid OSS volume '%s'\n", |
1191 | str); | ||
1191 | continue; | 1192 | continue; |
1192 | } | 1193 | } |
1193 | cptr = snd_info_get_str(str, cptr, sizeof(str)); | 1194 | cptr = snd_info_get_str(str, cptr, sizeof(str)); |
@@ -1201,7 +1202,7 @@ static void snd_mixer_oss_proc_write(struct snd_info_entry *entry, | |||
1201 | snd_info_get_str(idxstr, cptr, sizeof(idxstr)); | 1202 | snd_info_get_str(idxstr, cptr, sizeof(idxstr)); |
1202 | idx = simple_strtoul(idxstr, NULL, 10); | 1203 | idx = simple_strtoul(idxstr, NULL, 10); |
1203 | if (idx >= 0x4000) { /* too big */ | 1204 | if (idx >= 0x4000) { /* too big */ |
1204 | snd_printk(KERN_ERR "mixer_oss: invalid index %d\n", idx); | 1205 | pr_err("ALSA: mixer_oss: invalid index %d\n", idx); |
1205 | continue; | 1206 | continue; |
1206 | } | 1207 | } |
1207 | mutex_lock(&mixer->reg_mutex); | 1208 | mutex_lock(&mixer->reg_mutex); |
@@ -1212,7 +1213,7 @@ static void snd_mixer_oss_proc_write(struct snd_info_entry *entry, | |||
1212 | goto __unlock; | 1213 | goto __unlock; |
1213 | tbl = kmalloc(sizeof(*tbl), GFP_KERNEL); | 1214 | tbl = kmalloc(sizeof(*tbl), GFP_KERNEL); |
1214 | if (! tbl) { | 1215 | if (! tbl) { |
1215 | snd_printk(KERN_ERR "mixer_oss: no memory\n"); | 1216 | pr_err("ALSA: mixer_oss: no memory\n"); |
1216 | goto __unlock; | 1217 | goto __unlock; |
1217 | } | 1218 | } |
1218 | tbl->oss_id = ch; | 1219 | tbl->oss_id = ch; |
@@ -1343,20 +1344,18 @@ static int snd_mixer_oss_notify_handler(struct snd_card *card, int cmd) | |||
1343 | struct snd_mixer_oss *mixer; | 1344 | struct snd_mixer_oss *mixer; |
1344 | 1345 | ||
1345 | if (cmd == SND_MIXER_OSS_NOTIFY_REGISTER) { | 1346 | if (cmd == SND_MIXER_OSS_NOTIFY_REGISTER) { |
1346 | char name[128]; | ||
1347 | int idx, err; | 1347 | int idx, err; |
1348 | 1348 | ||
1349 | mixer = kcalloc(2, sizeof(*mixer), GFP_KERNEL); | 1349 | mixer = kcalloc(2, sizeof(*mixer), GFP_KERNEL); |
1350 | if (mixer == NULL) | 1350 | if (mixer == NULL) |
1351 | return -ENOMEM; | 1351 | return -ENOMEM; |
1352 | mutex_init(&mixer->reg_mutex); | 1352 | mutex_init(&mixer->reg_mutex); |
1353 | sprintf(name, "mixer%i%i", card->number, 0); | ||
1354 | if ((err = snd_register_oss_device(SNDRV_OSS_DEVICE_TYPE_MIXER, | 1353 | if ((err = snd_register_oss_device(SNDRV_OSS_DEVICE_TYPE_MIXER, |
1355 | card, 0, | 1354 | card, 0, |
1356 | &snd_mixer_oss_f_ops, card, | 1355 | &snd_mixer_oss_f_ops, card)) < 0) { |
1357 | name)) < 0) { | 1356 | dev_err(card->dev, |
1358 | snd_printk(KERN_ERR "unable to register OSS mixer device %i:%i\n", | 1357 | "unable to register OSS mixer device %i:%i\n", |
1359 | card->number, 0); | 1358 | card->number, 0); |
1360 | kfree(mixer); | 1359 | kfree(mixer); |
1361 | return err; | 1360 | return err; |
1362 | } | 1361 | } |
@@ -1365,7 +1364,8 @@ static int snd_mixer_oss_notify_handler(struct snd_card *card, int cmd) | |||
1365 | if (*card->mixername) | 1364 | if (*card->mixername) |
1366 | strlcpy(mixer->name, card->mixername, sizeof(mixer->name)); | 1365 | strlcpy(mixer->name, card->mixername, sizeof(mixer->name)); |
1367 | else | 1366 | else |
1368 | strlcpy(mixer->name, name, sizeof(mixer->name)); | 1367 | snprintf(mixer->name, sizeof(mixer->name), |
1368 | "mixer%i", card->number); | ||
1369 | #ifdef SNDRV_OSS_INFO_DEV_MIXERS | 1369 | #ifdef SNDRV_OSS_INFO_DEV_MIXERS |
1370 | snd_oss_info_register(SNDRV_OSS_INFO_DEV_MIXERS, | 1370 | snd_oss_info_register(SNDRV_OSS_INFO_DEV_MIXERS, |
1371 | card->number, | 1371 | card->number, |
diff --git a/sound/core/oss/pcm_oss.c b/sound/core/oss/pcm_oss.c index 4c1cc51772e6..ada69d7a8d70 100644 --- a/sound/core/oss/pcm_oss.c +++ b/sound/core/oss/pcm_oss.c | |||
@@ -854,7 +854,7 @@ static int snd_pcm_oss_change_params(struct snd_pcm_substream *substream) | |||
854 | params = kmalloc(sizeof(*params), GFP_KERNEL); | 854 | params = kmalloc(sizeof(*params), GFP_KERNEL); |
855 | sparams = kmalloc(sizeof(*sparams), GFP_KERNEL); | 855 | sparams = kmalloc(sizeof(*sparams), GFP_KERNEL); |
856 | if (!sw_params || !params || !sparams) { | 856 | if (!sw_params || !params || !sparams) { |
857 | snd_printd("No memory\n"); | 857 | pcm_dbg(substream->pcm, "No memory\n"); |
858 | err = -ENOMEM; | 858 | err = -ENOMEM; |
859 | goto failure; | 859 | goto failure; |
860 | } | 860 | } |
@@ -877,7 +877,7 @@ static int snd_pcm_oss_change_params(struct snd_pcm_substream *substream) | |||
877 | } | 877 | } |
878 | err = snd_pcm_hw_param_mask(substream, sparams, SNDRV_PCM_HW_PARAM_ACCESS, &mask); | 878 | err = snd_pcm_hw_param_mask(substream, sparams, SNDRV_PCM_HW_PARAM_ACCESS, &mask); |
879 | if (err < 0) { | 879 | if (err < 0) { |
880 | snd_printd("No usable accesses\n"); | 880 | pcm_dbg(substream->pcm, "No usable accesses\n"); |
881 | err = -EINVAL; | 881 | err = -EINVAL; |
882 | goto failure; | 882 | goto failure; |
883 | } | 883 | } |
@@ -902,7 +902,7 @@ static int snd_pcm_oss_change_params(struct snd_pcm_substream *substream) | |||
902 | break; | 902 | break; |
903 | } | 903 | } |
904 | if ((__force int)sformat > (__force int)SNDRV_PCM_FORMAT_LAST) { | 904 | if ((__force int)sformat > (__force int)SNDRV_PCM_FORMAT_LAST) { |
905 | snd_printd("Cannot find a format!!!\n"); | 905 | pcm_dbg(substream->pcm, "Cannot find a format!!!\n"); |
906 | err = -EINVAL; | 906 | err = -EINVAL; |
907 | goto failure; | 907 | goto failure; |
908 | } | 908 | } |
@@ -942,14 +942,16 @@ static int snd_pcm_oss_change_params(struct snd_pcm_substream *substream) | |||
942 | if ((err = snd_pcm_plug_format_plugins(substream, | 942 | if ((err = snd_pcm_plug_format_plugins(substream, |
943 | params, | 943 | params, |
944 | sparams)) < 0) { | 944 | sparams)) < 0) { |
945 | snd_printd("snd_pcm_plug_format_plugins failed: %i\n", err); | 945 | pcm_dbg(substream->pcm, |
946 | "snd_pcm_plug_format_plugins failed: %i\n", err); | ||
946 | snd_pcm_oss_plugin_clear(substream); | 947 | snd_pcm_oss_plugin_clear(substream); |
947 | goto failure; | 948 | goto failure; |
948 | } | 949 | } |
949 | if (runtime->oss.plugin_first) { | 950 | if (runtime->oss.plugin_first) { |
950 | struct snd_pcm_plugin *plugin; | 951 | struct snd_pcm_plugin *plugin; |
951 | if ((err = snd_pcm_plugin_build_io(substream, sparams, &plugin)) < 0) { | 952 | if ((err = snd_pcm_plugin_build_io(substream, sparams, &plugin)) < 0) { |
952 | snd_printd("snd_pcm_plugin_build_io failed: %i\n", err); | 953 | pcm_dbg(substream->pcm, |
954 | "snd_pcm_plugin_build_io failed: %i\n", err); | ||
953 | snd_pcm_oss_plugin_clear(substream); | 955 | snd_pcm_oss_plugin_clear(substream); |
954 | goto failure; | 956 | goto failure; |
955 | } | 957 | } |
@@ -983,7 +985,7 @@ static int snd_pcm_oss_change_params(struct snd_pcm_substream *substream) | |||
983 | snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_DROP, NULL); | 985 | snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_DROP, NULL); |
984 | 986 | ||
985 | if ((err = snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_HW_PARAMS, sparams)) < 0) { | 987 | if ((err = snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_HW_PARAMS, sparams)) < 0) { |
986 | snd_printd("HW_PARAMS failed: %i\n", err); | 988 | pcm_dbg(substream->pcm, "HW_PARAMS failed: %i\n", err); |
987 | goto failure; | 989 | goto failure; |
988 | } | 990 | } |
989 | 991 | ||
@@ -1016,7 +1018,7 @@ static int snd_pcm_oss_change_params(struct snd_pcm_substream *substream) | |||
1016 | } | 1018 | } |
1017 | 1019 | ||
1018 | if ((err = snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_SW_PARAMS, sw_params)) < 0) { | 1020 | if ((err = snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_SW_PARAMS, sw_params)) < 0) { |
1019 | snd_printd("SW_PARAMS failed: %i\n", err); | 1021 | pcm_dbg(substream->pcm, "SW_PARAMS failed: %i\n", err); |
1020 | goto failure; | 1022 | goto failure; |
1021 | } | 1023 | } |
1022 | 1024 | ||
@@ -1110,7 +1112,8 @@ static int snd_pcm_oss_prepare(struct snd_pcm_substream *substream) | |||
1110 | 1112 | ||
1111 | err = snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_PREPARE, NULL); | 1113 | err = snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_PREPARE, NULL); |
1112 | if (err < 0) { | 1114 | if (err < 0) { |
1113 | snd_printd("snd_pcm_oss_prepare: SNDRV_PCM_IOCTL_PREPARE failed\n"); | 1115 | pcm_dbg(substream->pcm, |
1116 | "snd_pcm_oss_prepare: SNDRV_PCM_IOCTL_PREPARE failed\n"); | ||
1114 | return err; | 1117 | return err; |
1115 | } | 1118 | } |
1116 | runtime->oss.prepare = 0; | 1119 | runtime->oss.prepare = 0; |
@@ -1175,12 +1178,10 @@ snd_pcm_sframes_t snd_pcm_oss_write3(struct snd_pcm_substream *substream, const | |||
1175 | if (runtime->status->state == SNDRV_PCM_STATE_XRUN || | 1178 | if (runtime->status->state == SNDRV_PCM_STATE_XRUN || |
1176 | runtime->status->state == SNDRV_PCM_STATE_SUSPENDED) { | 1179 | runtime->status->state == SNDRV_PCM_STATE_SUSPENDED) { |
1177 | #ifdef OSS_DEBUG | 1180 | #ifdef OSS_DEBUG |
1178 | if (runtime->status->state == SNDRV_PCM_STATE_XRUN) | 1181 | pcm_dbg(substream->pcm, |
1179 | printk(KERN_DEBUG "pcm_oss: write: " | 1182 | "pcm_oss: write: recovering from %s\n", |
1180 | "recovering from XRUN\n"); | 1183 | runtime->status->state == SNDRV_PCM_STATE_XRUN ? |
1181 | else | 1184 | "XRUN" : "SUSPEND"); |
1182 | printk(KERN_DEBUG "pcm_oss: write: " | ||
1183 | "recovering from SUSPEND\n"); | ||
1184 | #endif | 1185 | #endif |
1185 | ret = snd_pcm_oss_prepare(substream); | 1186 | ret = snd_pcm_oss_prepare(substream); |
1186 | if (ret < 0) | 1187 | if (ret < 0) |
@@ -1213,12 +1214,10 @@ snd_pcm_sframes_t snd_pcm_oss_read3(struct snd_pcm_substream *substream, char *p | |||
1213 | if (runtime->status->state == SNDRV_PCM_STATE_XRUN || | 1214 | if (runtime->status->state == SNDRV_PCM_STATE_XRUN || |
1214 | runtime->status->state == SNDRV_PCM_STATE_SUSPENDED) { | 1215 | runtime->status->state == SNDRV_PCM_STATE_SUSPENDED) { |
1215 | #ifdef OSS_DEBUG | 1216 | #ifdef OSS_DEBUG |
1216 | if (runtime->status->state == SNDRV_PCM_STATE_XRUN) | 1217 | pcm_dbg(substream->pcm, |
1217 | printk(KERN_DEBUG "pcm_oss: read: " | 1218 | "pcm_oss: read: recovering from %s\n", |
1218 | "recovering from XRUN\n"); | 1219 | runtime->status->state == SNDRV_PCM_STATE_XRUN ? |
1219 | else | 1220 | "XRUN" : "SUSPEND"); |
1220 | printk(KERN_DEBUG "pcm_oss: read: " | ||
1221 | "recovering from SUSPEND\n"); | ||
1222 | #endif | 1221 | #endif |
1223 | ret = snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_DRAIN, NULL); | 1222 | ret = snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_DRAIN, NULL); |
1224 | if (ret < 0) | 1223 | if (ret < 0) |
@@ -1261,12 +1260,10 @@ snd_pcm_sframes_t snd_pcm_oss_writev3(struct snd_pcm_substream *substream, void | |||
1261 | if (runtime->status->state == SNDRV_PCM_STATE_XRUN || | 1260 | if (runtime->status->state == SNDRV_PCM_STATE_XRUN || |
1262 | runtime->status->state == SNDRV_PCM_STATE_SUSPENDED) { | 1261 | runtime->status->state == SNDRV_PCM_STATE_SUSPENDED) { |
1263 | #ifdef OSS_DEBUG | 1262 | #ifdef OSS_DEBUG |
1264 | if (runtime->status->state == SNDRV_PCM_STATE_XRUN) | 1263 | pcm_dbg(substream->pcm, |
1265 | printk(KERN_DEBUG "pcm_oss: writev: " | 1264 | "pcm_oss: writev: recovering from %s\n", |
1266 | "recovering from XRUN\n"); | 1265 | runtime->status->state == SNDRV_PCM_STATE_XRUN ? |
1267 | else | 1266 | "XRUN" : "SUSPEND"); |
1268 | printk(KERN_DEBUG "pcm_oss: writev: " | ||
1269 | "recovering from SUSPEND\n"); | ||
1270 | #endif | 1267 | #endif |
1271 | ret = snd_pcm_oss_prepare(substream); | 1268 | ret = snd_pcm_oss_prepare(substream); |
1272 | if (ret < 0) | 1269 | if (ret < 0) |
@@ -1299,12 +1296,10 @@ snd_pcm_sframes_t snd_pcm_oss_readv3(struct snd_pcm_substream *substream, void * | |||
1299 | if (runtime->status->state == SNDRV_PCM_STATE_XRUN || | 1296 | if (runtime->status->state == SNDRV_PCM_STATE_XRUN || |
1300 | runtime->status->state == SNDRV_PCM_STATE_SUSPENDED) { | 1297 | runtime->status->state == SNDRV_PCM_STATE_SUSPENDED) { |
1301 | #ifdef OSS_DEBUG | 1298 | #ifdef OSS_DEBUG |
1302 | if (runtime->status->state == SNDRV_PCM_STATE_XRUN) | 1299 | pcm_dbg(substream->pcm, |
1303 | printk(KERN_DEBUG "pcm_oss: readv: " | 1300 | "pcm_oss: readv: recovering from %s\n", |
1304 | "recovering from XRUN\n"); | 1301 | runtime->status->state == SNDRV_PCM_STATE_XRUN ? |
1305 | else | 1302 | "XRUN" : "SUSPEND"); |
1306 | printk(KERN_DEBUG "pcm_oss: readv: " | ||
1307 | "recovering from SUSPEND\n"); | ||
1308 | #endif | 1303 | #endif |
1309 | ret = snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_DRAIN, NULL); | 1304 | ret = snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_DRAIN, NULL); |
1310 | if (ret < 0) | 1305 | if (ret < 0) |
@@ -1561,7 +1556,7 @@ static int snd_pcm_oss_sync1(struct snd_pcm_substream *substream, size_t size) | |||
1561 | init_waitqueue_entry(&wait, current); | 1556 | init_waitqueue_entry(&wait, current); |
1562 | add_wait_queue(&runtime->sleep, &wait); | 1557 | add_wait_queue(&runtime->sleep, &wait); |
1563 | #ifdef OSS_DEBUG | 1558 | #ifdef OSS_DEBUG |
1564 | printk(KERN_DEBUG "sync1: size = %li\n", size); | 1559 | pcm_dbg(substream->pcm, "sync1: size = %li\n", size); |
1565 | #endif | 1560 | #endif |
1566 | while (1) { | 1561 | while (1) { |
1567 | result = snd_pcm_oss_write2(substream, runtime->oss.buffer, size, 1); | 1562 | result = snd_pcm_oss_write2(substream, runtime->oss.buffer, size, 1); |
@@ -1587,7 +1582,8 @@ static int snd_pcm_oss_sync1(struct snd_pcm_substream *substream, size_t size) | |||
1587 | break; | 1582 | break; |
1588 | } | 1583 | } |
1589 | if (res == 0) { | 1584 | if (res == 0) { |
1590 | snd_printk(KERN_ERR "OSS sync error - DMA timeout\n"); | 1585 | pcm_err(substream->pcm, |
1586 | "OSS sync error - DMA timeout\n"); | ||
1591 | result = -EIO; | 1587 | result = -EIO; |
1592 | break; | 1588 | break; |
1593 | } | 1589 | } |
@@ -1618,7 +1614,7 @@ static int snd_pcm_oss_sync(struct snd_pcm_oss_file *pcm_oss_file) | |||
1618 | mutex_lock(&runtime->oss.params_lock); | 1614 | mutex_lock(&runtime->oss.params_lock); |
1619 | if (runtime->oss.buffer_used > 0) { | 1615 | if (runtime->oss.buffer_used > 0) { |
1620 | #ifdef OSS_DEBUG | 1616 | #ifdef OSS_DEBUG |
1621 | printk(KERN_DEBUG "sync: buffer_used\n"); | 1617 | pcm_dbg(substream->pcm, "sync: buffer_used\n"); |
1622 | #endif | 1618 | #endif |
1623 | size = (8 * (runtime->oss.period_bytes - runtime->oss.buffer_used) + 7) / width; | 1619 | size = (8 * (runtime->oss.period_bytes - runtime->oss.buffer_used) + 7) / width; |
1624 | snd_pcm_format_set_silence(format, | 1620 | snd_pcm_format_set_silence(format, |
@@ -1631,7 +1627,7 @@ static int snd_pcm_oss_sync(struct snd_pcm_oss_file *pcm_oss_file) | |||
1631 | } | 1627 | } |
1632 | } else if (runtime->oss.period_ptr > 0) { | 1628 | } else if (runtime->oss.period_ptr > 0) { |
1633 | #ifdef OSS_DEBUG | 1629 | #ifdef OSS_DEBUG |
1634 | printk(KERN_DEBUG "sync: period_ptr\n"); | 1630 | pcm_dbg(substream->pcm, "sync: period_ptr\n"); |
1635 | #endif | 1631 | #endif |
1636 | size = runtime->oss.period_bytes - runtime->oss.period_ptr; | 1632 | size = runtime->oss.period_bytes - runtime->oss.period_ptr; |
1637 | snd_pcm_format_set_silence(format, | 1633 | snd_pcm_format_set_silence(format, |
@@ -1983,7 +1979,7 @@ static int snd_pcm_oss_set_trigger(struct snd_pcm_oss_file *pcm_oss_file, int tr | |||
1983 | int err, cmd; | 1979 | int err, cmd; |
1984 | 1980 | ||
1985 | #ifdef OSS_DEBUG | 1981 | #ifdef OSS_DEBUG |
1986 | printk(KERN_DEBUG "pcm_oss: trigger = 0x%x\n", trigger); | 1982 | pcm_dbg(substream->pcm, "pcm_oss: trigger = 0x%x\n", trigger); |
1987 | #endif | 1983 | #endif |
1988 | 1984 | ||
1989 | psubstream = pcm_oss_file->streams[SNDRV_PCM_STREAM_PLAYBACK]; | 1985 | psubstream = pcm_oss_file->streams[SNDRV_PCM_STREAM_PLAYBACK]; |
@@ -2203,9 +2199,9 @@ static int snd_pcm_oss_get_space(struct snd_pcm_oss_file *pcm_oss_file, int stre | |||
2203 | } | 2199 | } |
2204 | 2200 | ||
2205 | #ifdef OSS_DEBUG | 2201 | #ifdef OSS_DEBUG |
2206 | printk(KERN_DEBUG "pcm_oss: space: bytes = %i, fragments = %i, " | 2202 | pcm_dbg(substream->pcm, |
2207 | "fragstotal = %i, fragsize = %i\n", | 2203 | "pcm_oss: space: bytes = %i, fragments = %i, fragstotal = %i, fragsize = %i\n", |
2208 | info.bytes, info.fragments, info.fragstotal, info.fragsize); | 2204 | info.bytes, info.fragments, info.fragstotal, info.fragsize); |
2209 | #endif | 2205 | #endif |
2210 | if (copy_to_user(_info, &info, sizeof(info))) | 2206 | if (copy_to_user(_info, &info, sizeof(info))) |
2211 | return -EFAULT; | 2207 | return -EFAULT; |
@@ -2215,7 +2211,7 @@ static int snd_pcm_oss_get_space(struct snd_pcm_oss_file *pcm_oss_file, int stre | |||
2215 | static int snd_pcm_oss_get_mapbuf(struct snd_pcm_oss_file *pcm_oss_file, int stream, struct buffmem_desc __user * _info) | 2211 | static int snd_pcm_oss_get_mapbuf(struct snd_pcm_oss_file *pcm_oss_file, int stream, struct buffmem_desc __user * _info) |
2216 | { | 2212 | { |
2217 | // it won't be probably implemented | 2213 | // it won't be probably implemented |
2218 | // snd_printd("TODO: snd_pcm_oss_get_mapbuf\n"); | 2214 | // pr_debug("TODO: snd_pcm_oss_get_mapbuf\n"); |
2219 | return -EINVAL; | 2215 | return -EINVAL; |
2220 | } | 2216 | } |
2221 | 2217 | ||
@@ -2519,7 +2515,7 @@ static long snd_pcm_oss_ioctl(struct file *file, unsigned int cmd, unsigned long | |||
2519 | if (((cmd >> 8) & 0xff) != 'P') | 2515 | if (((cmd >> 8) & 0xff) != 'P') |
2520 | return -EINVAL; | 2516 | return -EINVAL; |
2521 | #ifdef OSS_DEBUG | 2517 | #ifdef OSS_DEBUG |
2522 | printk(KERN_DEBUG "pcm_oss: ioctl = 0x%x\n", cmd); | 2518 | pr_debug("pcm_oss: ioctl = 0x%x\n", cmd); |
2523 | #endif | 2519 | #endif |
2524 | switch (cmd) { | 2520 | switch (cmd) { |
2525 | case SNDCTL_DSP_RESET: | 2521 | case SNDCTL_DSP_RESET: |
@@ -2646,7 +2642,7 @@ static long snd_pcm_oss_ioctl(struct file *file, unsigned int cmd, unsigned long | |||
2646 | case SNDCTL_DSP_PROFILE: | 2642 | case SNDCTL_DSP_PROFILE: |
2647 | return 0; /* silently ignore */ | 2643 | return 0; /* silently ignore */ |
2648 | default: | 2644 | default: |
2649 | snd_printd("pcm_oss: unknown command = 0x%x\n", cmd); | 2645 | pr_debug("pcm_oss: unknown command = 0x%x\n", cmd); |
2650 | } | 2646 | } |
2651 | return -EINVAL; | 2647 | return -EINVAL; |
2652 | } | 2648 | } |
@@ -2673,8 +2669,9 @@ static ssize_t snd_pcm_oss_read(struct file *file, char __user *buf, size_t coun | |||
2673 | #else | 2669 | #else |
2674 | { | 2670 | { |
2675 | ssize_t res = snd_pcm_oss_read1(substream, buf, count); | 2671 | ssize_t res = snd_pcm_oss_read1(substream, buf, count); |
2676 | printk(KERN_DEBUG "pcm_oss: read %li bytes " | 2672 | pcm_dbg(substream->pcm, |
2677 | "(returned %li bytes)\n", (long)count, (long)res); | 2673 | "pcm_oss: read %li bytes (returned %li bytes)\n", |
2674 | (long)count, (long)res); | ||
2678 | return res; | 2675 | return res; |
2679 | } | 2676 | } |
2680 | #endif | 2677 | #endif |
@@ -2693,7 +2690,7 @@ static ssize_t snd_pcm_oss_write(struct file *file, const char __user *buf, size | |||
2693 | substream->f_flags = file->f_flags & O_NONBLOCK; | 2690 | substream->f_flags = file->f_flags & O_NONBLOCK; |
2694 | result = snd_pcm_oss_write1(substream, buf, count); | 2691 | result = snd_pcm_oss_write1(substream, buf, count); |
2695 | #ifdef OSS_DEBUG | 2692 | #ifdef OSS_DEBUG |
2696 | printk(KERN_DEBUG "pcm_oss: write %li bytes (wrote %li bytes)\n", | 2693 | pcm_dbg(substream->pcm, "pcm_oss: write %li bytes (wrote %li bytes)\n", |
2697 | (long)count, (long)result); | 2694 | (long)count, (long)result); |
2698 | #endif | 2695 | #endif |
2699 | return result; | 2696 | return result; |
@@ -2772,7 +2769,7 @@ static int snd_pcm_oss_mmap(struct file *file, struct vm_area_struct *area) | |||
2772 | int err; | 2769 | int err; |
2773 | 2770 | ||
2774 | #ifdef OSS_DEBUG | 2771 | #ifdef OSS_DEBUG |
2775 | printk(KERN_DEBUG "pcm_oss: mmap begin\n"); | 2772 | pr_debug("pcm_oss: mmap begin\n"); |
2776 | #endif | 2773 | #endif |
2777 | pcm_oss_file = file->private_data; | 2774 | pcm_oss_file = file->private_data; |
2778 | switch ((area->vm_flags & (VM_READ | VM_WRITE))) { | 2775 | switch ((area->vm_flags & (VM_READ | VM_WRITE))) { |
@@ -2822,7 +2819,7 @@ static int snd_pcm_oss_mmap(struct file *file, struct vm_area_struct *area) | |||
2822 | runtime->silence_threshold = 0; | 2819 | runtime->silence_threshold = 0; |
2823 | runtime->silence_size = 0; | 2820 | runtime->silence_size = 0; |
2824 | #ifdef OSS_DEBUG | 2821 | #ifdef OSS_DEBUG |
2825 | printk(KERN_DEBUG "pcm_oss: mmap ok, bytes = 0x%x\n", | 2822 | pr_debug("pcm_oss: mmap ok, bytes = 0x%x\n", |
2826 | runtime->oss.mmap_bytes); | 2823 | runtime->oss.mmap_bytes); |
2827 | #endif | 2824 | #endif |
2828 | /* In mmap mode we never stop */ | 2825 | /* In mmap mode we never stop */ |
@@ -3007,12 +3004,10 @@ static const struct file_operations snd_pcm_oss_f_reg = | |||
3007 | 3004 | ||
3008 | static void register_oss_dsp(struct snd_pcm *pcm, int index) | 3005 | static void register_oss_dsp(struct snd_pcm *pcm, int index) |
3009 | { | 3006 | { |
3010 | char name[128]; | ||
3011 | sprintf(name, "dsp%i%i", pcm->card->number, pcm->device); | ||
3012 | if (snd_register_oss_device(SNDRV_OSS_DEVICE_TYPE_PCM, | 3007 | if (snd_register_oss_device(SNDRV_OSS_DEVICE_TYPE_PCM, |
3013 | pcm->card, index, &snd_pcm_oss_f_reg, | 3008 | pcm->card, index, &snd_pcm_oss_f_reg, |
3014 | pcm, name) < 0) { | 3009 | pcm) < 0) { |
3015 | snd_printk(KERN_ERR "unable to register OSS PCM device %i:%i\n", | 3010 | pcm_err(pcm, "unable to register OSS PCM device %i:%i\n", |
3016 | pcm->card->number, pcm->device); | 3011 | pcm->card->number, pcm->device); |
3017 | } | 3012 | } |
3018 | } | 3013 | } |
@@ -3093,12 +3088,12 @@ static int __init alsa_pcm_oss_init(void) | |||
3093 | /* check device map table */ | 3088 | /* check device map table */ |
3094 | for (i = 0; i < SNDRV_CARDS; i++) { | 3089 | for (i = 0; i < SNDRV_CARDS; i++) { |
3095 | if (dsp_map[i] < 0 || dsp_map[i] >= SNDRV_PCM_DEVICES) { | 3090 | if (dsp_map[i] < 0 || dsp_map[i] >= SNDRV_PCM_DEVICES) { |
3096 | snd_printk(KERN_ERR "invalid dsp_map[%d] = %d\n", | 3091 | pr_err("ALSA: pcm_oss: invalid dsp_map[%d] = %d\n", |
3097 | i, dsp_map[i]); | 3092 | i, dsp_map[i]); |
3098 | dsp_map[i] = 0; | 3093 | dsp_map[i] = 0; |
3099 | } | 3094 | } |
3100 | if (adsp_map[i] < 0 || adsp_map[i] >= SNDRV_PCM_DEVICES) { | 3095 | if (adsp_map[i] < 0 || adsp_map[i] >= SNDRV_PCM_DEVICES) { |
3101 | snd_printk(KERN_ERR "invalid adsp_map[%d] = %d\n", | 3096 | pr_err("ALSA: pcm_oss: invalid adsp_map[%d] = %d\n", |
3102 | i, adsp_map[i]); | 3097 | i, adsp_map[i]); |
3103 | adsp_map[i] = 1; | 3098 | adsp_map[i] = 1; |
3104 | } | 3099 | } |
diff --git a/sound/core/pcm.c b/sound/core/pcm.c index e1e9e0c999fe..43932e8dce66 100644 --- a/sound/core/pcm.c +++ b/sound/core/pcm.c | |||
@@ -295,7 +295,7 @@ static const char *snd_pcm_state_name(snd_pcm_state_t state) | |||
295 | return snd_pcm_state_names[(__force int)state]; | 295 | return snd_pcm_state_names[(__force int)state]; |
296 | } | 296 | } |
297 | 297 | ||
298 | #if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE) | 298 | #if IS_ENABLED(CONFIG_SND_PCM_OSS) |
299 | #include <linux/soundcard.h> | 299 | #include <linux/soundcard.h> |
300 | 300 | ||
301 | static const char *snd_pcm_oss_format_name(int format) | 301 | static const char *snd_pcm_oss_format_name(int format) |
@@ -338,7 +338,8 @@ static void snd_pcm_proc_info_read(struct snd_pcm_substream *substream, | |||
338 | 338 | ||
339 | info = kmalloc(sizeof(*info), GFP_KERNEL); | 339 | info = kmalloc(sizeof(*info), GFP_KERNEL); |
340 | if (! info) { | 340 | if (! info) { |
341 | printk(KERN_DEBUG "snd_pcm_proc_info_read: cannot malloc\n"); | 341 | pcm_dbg(substream->pcm, |
342 | "snd_pcm_proc_info_read: cannot malloc\n"); | ||
342 | return; | 343 | return; |
343 | } | 344 | } |
344 | 345 | ||
@@ -398,7 +399,7 @@ static void snd_pcm_substream_proc_hw_params_read(struct snd_info_entry *entry, | |||
398 | snd_iprintf(buffer, "rate: %u (%u/%u)\n", runtime->rate, runtime->rate_num, runtime->rate_den); | 399 | snd_iprintf(buffer, "rate: %u (%u/%u)\n", runtime->rate, runtime->rate_num, runtime->rate_den); |
399 | snd_iprintf(buffer, "period_size: %lu\n", runtime->period_size); | 400 | snd_iprintf(buffer, "period_size: %lu\n", runtime->period_size); |
400 | snd_iprintf(buffer, "buffer_size: %lu\n", runtime->buffer_size); | 401 | snd_iprintf(buffer, "buffer_size: %lu\n", runtime->buffer_size); |
401 | #if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE) | 402 | #if IS_ENABLED(CONFIG_SND_PCM_OSS) |
402 | if (substream->oss.oss) { | 403 | if (substream->oss.oss) { |
403 | snd_iprintf(buffer, "OSS format: %s\n", snd_pcm_oss_format_name(runtime->oss.format)); | 404 | snd_iprintf(buffer, "OSS format: %s\n", snd_pcm_oss_format_name(runtime->oss.format)); |
404 | snd_iprintf(buffer, "OSS channels: %u\n", runtime->oss.channels); | 405 | snd_iprintf(buffer, "OSS channels: %u\n", runtime->oss.channels); |
@@ -651,7 +652,7 @@ int snd_pcm_new_stream(struct snd_pcm *pcm, int stream, int substream_count) | |||
651 | struct snd_pcm_str *pstr = &pcm->streams[stream]; | 652 | struct snd_pcm_str *pstr = &pcm->streams[stream]; |
652 | struct snd_pcm_substream *substream, *prev; | 653 | struct snd_pcm_substream *substream, *prev; |
653 | 654 | ||
654 | #if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE) | 655 | #if IS_ENABLED(CONFIG_SND_PCM_OSS) |
655 | mutex_init(&pstr->oss.setup_mutex); | 656 | mutex_init(&pstr->oss.setup_mutex); |
656 | #endif | 657 | #endif |
657 | pstr->stream = stream; | 658 | pstr->stream = stream; |
@@ -660,7 +661,7 @@ int snd_pcm_new_stream(struct snd_pcm *pcm, int stream, int substream_count) | |||
660 | if (substream_count > 0 && !pcm->internal) { | 661 | if (substream_count > 0 && !pcm->internal) { |
661 | err = snd_pcm_stream_proc_init(pstr); | 662 | err = snd_pcm_stream_proc_init(pstr); |
662 | if (err < 0) { | 663 | if (err < 0) { |
663 | snd_printk(KERN_ERR "Error in snd_pcm_stream_proc_init\n"); | 664 | pcm_err(pcm, "Error in snd_pcm_stream_proc_init\n"); |
664 | return err; | 665 | return err; |
665 | } | 666 | } |
666 | } | 667 | } |
@@ -668,7 +669,7 @@ int snd_pcm_new_stream(struct snd_pcm *pcm, int stream, int substream_count) | |||
668 | for (idx = 0, prev = NULL; idx < substream_count; idx++) { | 669 | for (idx = 0, prev = NULL; idx < substream_count; idx++) { |
669 | substream = kzalloc(sizeof(*substream), GFP_KERNEL); | 670 | substream = kzalloc(sizeof(*substream), GFP_KERNEL); |
670 | if (substream == NULL) { | 671 | if (substream == NULL) { |
671 | snd_printk(KERN_ERR "Cannot allocate PCM substream\n"); | 672 | pcm_err(pcm, "Cannot allocate PCM substream\n"); |
672 | return -ENOMEM; | 673 | return -ENOMEM; |
673 | } | 674 | } |
674 | substream->pcm = pcm; | 675 | substream->pcm = pcm; |
@@ -685,7 +686,8 @@ int snd_pcm_new_stream(struct snd_pcm *pcm, int stream, int substream_count) | |||
685 | if (!pcm->internal) { | 686 | if (!pcm->internal) { |
686 | err = snd_pcm_substream_proc_init(substream); | 687 | err = snd_pcm_substream_proc_init(substream); |
687 | if (err < 0) { | 688 | if (err < 0) { |
688 | snd_printk(KERN_ERR "Error in snd_pcm_stream_proc_init\n"); | 689 | pcm_err(pcm, |
690 | "Error in snd_pcm_stream_proc_init\n"); | ||
689 | if (prev == NULL) | 691 | if (prev == NULL) |
690 | pstr->substream = NULL; | 692 | pstr->substream = NULL; |
691 | else | 693 | else |
@@ -724,7 +726,7 @@ static int _snd_pcm_new(struct snd_card *card, const char *id, int device, | |||
724 | *rpcm = NULL; | 726 | *rpcm = NULL; |
725 | pcm = kzalloc(sizeof(*pcm), GFP_KERNEL); | 727 | pcm = kzalloc(sizeof(*pcm), GFP_KERNEL); |
726 | if (pcm == NULL) { | 728 | if (pcm == NULL) { |
727 | snd_printk(KERN_ERR "Cannot allocate PCM\n"); | 729 | dev_err(card->dev, "Cannot allocate PCM\n"); |
728 | return -ENOMEM; | 730 | return -ENOMEM; |
729 | } | 731 | } |
730 | pcm->card = card; | 732 | pcm->card = card; |
@@ -807,7 +809,7 @@ EXPORT_SYMBOL(snd_pcm_new_internal); | |||
807 | static void snd_pcm_free_stream(struct snd_pcm_str * pstr) | 809 | static void snd_pcm_free_stream(struct snd_pcm_str * pstr) |
808 | { | 810 | { |
809 | struct snd_pcm_substream *substream, *substream_next; | 811 | struct snd_pcm_substream *substream, *substream_next; |
810 | #if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE) | 812 | #if IS_ENABLED(CONFIG_SND_PCM_OSS) |
811 | struct snd_pcm_oss_setup *setup, *setupn; | 813 | struct snd_pcm_oss_setup *setup, *setupn; |
812 | #endif | 814 | #endif |
813 | substream = pstr->substream; | 815 | substream = pstr->substream; |
@@ -819,7 +821,7 @@ static void snd_pcm_free_stream(struct snd_pcm_str * pstr) | |||
819 | substream = substream_next; | 821 | substream = substream_next; |
820 | } | 822 | } |
821 | snd_pcm_stream_proc_done(pstr); | 823 | snd_pcm_stream_proc_done(pstr); |
822 | #if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE) | 824 | #if IS_ENABLED(CONFIG_SND_PCM_OSS) |
823 | for (setup = pstr->oss.setup_list; setup; setup = setupn) { | 825 | for (setup = pstr->oss.setup_list; setup; setup = setupn) { |
824 | setupn = setup->next; | 826 | setupn = setup->next; |
825 | kfree(setup->task_name); | 827 | kfree(setup->task_name); |
@@ -1016,8 +1018,20 @@ static ssize_t show_pcm_class(struct device *dev, | |||
1016 | return snprintf(buf, PAGE_SIZE, "%s\n", str); | 1018 | return snprintf(buf, PAGE_SIZE, "%s\n", str); |
1017 | } | 1019 | } |
1018 | 1020 | ||
1019 | static struct device_attribute pcm_attrs = | 1021 | static DEVICE_ATTR(pcm_class, S_IRUGO, show_pcm_class, NULL); |
1020 | __ATTR(pcm_class, S_IRUGO, show_pcm_class, NULL); | 1022 | static struct attribute *pcm_dev_attrs[] = { |
1023 | &dev_attr_pcm_class.attr, | ||
1024 | NULL | ||
1025 | }; | ||
1026 | |||
1027 | static struct attribute_group pcm_dev_attr_group = { | ||
1028 | .attrs = pcm_dev_attrs, | ||
1029 | }; | ||
1030 | |||
1031 | static const struct attribute_group *pcm_dev_attr_groups[] = { | ||
1032 | &pcm_dev_attr_group, | ||
1033 | NULL | ||
1034 | }; | ||
1021 | 1035 | ||
1022 | static int snd_pcm_dev_register(struct snd_device *device) | 1036 | static int snd_pcm_dev_register(struct snd_device *device) |
1023 | { | 1037 | { |
@@ -1067,8 +1081,18 @@ static int snd_pcm_dev_register(struct snd_device *device) | |||
1067 | mutex_unlock(®ister_mutex); | 1081 | mutex_unlock(®ister_mutex); |
1068 | return err; | 1082 | return err; |
1069 | } | 1083 | } |
1070 | snd_add_device_sysfs_file(devtype, pcm->card, pcm->device, | 1084 | |
1071 | &pcm_attrs); | 1085 | dev = snd_get_device(devtype, pcm->card, pcm->device); |
1086 | if (dev) { | ||
1087 | err = sysfs_create_groups(&dev->kobj, | ||
1088 | pcm_dev_attr_groups); | ||
1089 | if (err < 0) | ||
1090 | dev_warn(dev, | ||
1091 | "pcm %d:%d: cannot create sysfs groups\n", | ||
1092 | pcm->card->number, pcm->device); | ||
1093 | put_device(dev); | ||
1094 | } | ||
1095 | |||
1072 | for (substream = pcm->streams[cidx].substream; substream; substream = substream->next) | 1096 | for (substream = pcm->streams[cidx].substream; substream; substream = substream->next) |
1073 | snd_pcm_timer_init(substream); | 1097 | snd_pcm_timer_init(substream); |
1074 | } | 1098 | } |
diff --git a/sound/core/pcm_lib.c b/sound/core/pcm_lib.c index a2104671f51d..ce83def9f43b 100644 --- a/sound/core/pcm_lib.c +++ b/sound/core/pcm_lib.c | |||
@@ -174,7 +174,7 @@ static void xrun(struct snd_pcm_substream *substream) | |||
174 | if (xrun_debug(substream, XRUN_DEBUG_BASIC)) { | 174 | if (xrun_debug(substream, XRUN_DEBUG_BASIC)) { |
175 | char name[16]; | 175 | char name[16]; |
176 | snd_pcm_debug_name(substream, name, sizeof(name)); | 176 | snd_pcm_debug_name(substream, name, sizeof(name)); |
177 | snd_printd(KERN_DEBUG "XRUN: %s\n", name); | 177 | pcm_warn(substream->pcm, "XRUN: %s\n", name); |
178 | dump_stack_on_xrun(substream); | 178 | dump_stack_on_xrun(substream); |
179 | } | 179 | } |
180 | } | 180 | } |
@@ -184,9 +184,7 @@ static void xrun(struct snd_pcm_substream *substream) | |||
184 | do { \ | 184 | do { \ |
185 | if (xrun_debug(substream, XRUN_DEBUG_BASIC)) { \ | 185 | if (xrun_debug(substream, XRUN_DEBUG_BASIC)) { \ |
186 | xrun_log_show(substream); \ | 186 | xrun_log_show(substream); \ |
187 | if (snd_printd_ratelimit()) { \ | 187 | pr_err_ratelimited("ALSA: PCM: " fmt, ##args); \ |
188 | snd_printd("PCM: " fmt, ##args); \ | ||
189 | } \ | ||
190 | dump_stack_on_xrun(substream); \ | 188 | dump_stack_on_xrun(substream); \ |
191 | } \ | 189 | } \ |
192 | } while (0) | 190 | } while (0) |
@@ -253,7 +251,7 @@ static void xrun_log_show(struct snd_pcm_substream *substream) | |||
253 | entry = &log->entries[idx]; | 251 | entry = &log->entries[idx]; |
254 | if (entry->period_size == 0) | 252 | if (entry->period_size == 0) |
255 | break; | 253 | break; |
256 | snd_printd("hwptr log: %s: %sj=%lu, pos=%ld/%ld/%ld, " | 254 | pr_info("hwptr log: %s: %sj=%lu, pos=%ld/%ld/%ld, " |
257 | "hwptr=%ld/%ld\n", | 255 | "hwptr=%ld/%ld\n", |
258 | name, entry->in_interrupt ? "[Q] " : "", | 256 | name, entry->in_interrupt ? "[Q] " : "", |
259 | entry->jiffies, | 257 | entry->jiffies, |
@@ -342,14 +340,14 @@ static int snd_pcm_update_hw_ptr0(struct snd_pcm_substream *substream, | |||
342 | return -EPIPE; | 340 | return -EPIPE; |
343 | } | 341 | } |
344 | if (pos >= runtime->buffer_size) { | 342 | if (pos >= runtime->buffer_size) { |
345 | if (snd_printd_ratelimit()) { | 343 | if (printk_ratelimit()) { |
346 | char name[16]; | 344 | char name[16]; |
347 | snd_pcm_debug_name(substream, name, sizeof(name)); | 345 | snd_pcm_debug_name(substream, name, sizeof(name)); |
348 | xrun_log_show(substream); | 346 | xrun_log_show(substream); |
349 | snd_printd(KERN_ERR "BUG: %s, pos = %ld, " | 347 | pcm_err(substream->pcm, |
350 | "buffer size = %ld, period size = %ld\n", | 348 | "BUG: %s, pos = %ld, buffer size = %ld, period size = %ld\n", |
351 | name, pos, runtime->buffer_size, | 349 | name, pos, runtime->buffer_size, |
352 | runtime->period_size); | 350 | runtime->period_size); |
353 | } | 351 | } |
354 | pos = 0; | 352 | pos = 0; |
355 | } | 353 | } |
@@ -394,8 +392,8 @@ static int snd_pcm_update_hw_ptr0(struct snd_pcm_substream *substream, | |||
394 | XRUN_DEBUG_PERIODUPDATE : XRUN_DEBUG_HWPTRUPDATE)) { | 392 | XRUN_DEBUG_PERIODUPDATE : XRUN_DEBUG_HWPTRUPDATE)) { |
395 | char name[16]; | 393 | char name[16]; |
396 | snd_pcm_debug_name(substream, name, sizeof(name)); | 394 | snd_pcm_debug_name(substream, name, sizeof(name)); |
397 | snd_printd("%s_update: %s: pos=%u/%u/%u, " | 395 | pcm_dbg(substream->pcm, |
398 | "hwptr=%ld/%ld/%ld/%ld\n", | 396 | "%s_update: %s: pos=%u/%u/%u, hwptr=%ld/%ld/%ld/%ld\n", |
399 | in_interrupt ? "period" : "hwptr", | 397 | in_interrupt ? "period" : "hwptr", |
400 | name, | 398 | name, |
401 | (unsigned int)pos, | 399 | (unsigned int)pos, |
@@ -1242,6 +1240,7 @@ int snd_pcm_hw_constraint_mask64(struct snd_pcm_runtime *runtime, snd_pcm_hw_par | |||
1242 | return -EINVAL; | 1240 | return -EINVAL; |
1243 | return 0; | 1241 | return 0; |
1244 | } | 1242 | } |
1243 | EXPORT_SYMBOL(snd_pcm_hw_constraint_mask64); | ||
1245 | 1244 | ||
1246 | /** | 1245 | /** |
1247 | * snd_pcm_hw_constraint_integer - apply an integer constraint to an interval | 1246 | * snd_pcm_hw_constraint_integer - apply an integer constraint to an interval |
@@ -1941,8 +1940,9 @@ static int wait_for_avail(struct snd_pcm_substream *substream, | |||
1941 | continue; | 1940 | continue; |
1942 | } | 1941 | } |
1943 | if (!tout) { | 1942 | if (!tout) { |
1944 | snd_printd("%s write error (DMA or IRQ trouble?)\n", | 1943 | pcm_dbg(substream->pcm, |
1945 | is_playback ? "playback" : "capture"); | 1944 | "%s write error (DMA or IRQ trouble?)\n", |
1945 | is_playback ? "playback" : "capture"); | ||
1946 | err = -EIO; | 1946 | err = -EIO; |
1947 | break; | 1947 | break; |
1948 | } | 1948 | } |
diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c index 01a5e05ede95..b653ab001fba 100644 --- a/sound/core/pcm_native.c +++ b/sound/core/pcm_native.c | |||
@@ -190,12 +190,12 @@ int snd_pcm_hw_refine(struct snd_pcm_substream *substream, | |||
190 | if (!(params->rmask & (1 << k))) | 190 | if (!(params->rmask & (1 << k))) |
191 | continue; | 191 | continue; |
192 | #ifdef RULES_DEBUG | 192 | #ifdef RULES_DEBUG |
193 | printk(KERN_DEBUG "%s = ", snd_pcm_hw_param_names[k]); | 193 | pr_debug("%s = ", snd_pcm_hw_param_names[k]); |
194 | printk("%04x%04x%04x%04x -> ", m->bits[3], m->bits[2], m->bits[1], m->bits[0]); | 194 | pr_cont("%04x%04x%04x%04x -> ", m->bits[3], m->bits[2], m->bits[1], m->bits[0]); |
195 | #endif | 195 | #endif |
196 | changed = snd_mask_refine(m, constrs_mask(constrs, k)); | 196 | changed = snd_mask_refine(m, constrs_mask(constrs, k)); |
197 | #ifdef RULES_DEBUG | 197 | #ifdef RULES_DEBUG |
198 | printk("%04x%04x%04x%04x\n", m->bits[3], m->bits[2], m->bits[1], m->bits[0]); | 198 | pr_cont("%04x%04x%04x%04x\n", m->bits[3], m->bits[2], m->bits[1], m->bits[0]); |
199 | #endif | 199 | #endif |
200 | if (changed) | 200 | if (changed) |
201 | params->cmask |= 1 << k; | 201 | params->cmask |= 1 << k; |
@@ -210,21 +210,21 @@ int snd_pcm_hw_refine(struct snd_pcm_substream *substream, | |||
210 | if (!(params->rmask & (1 << k))) | 210 | if (!(params->rmask & (1 << k))) |
211 | continue; | 211 | continue; |
212 | #ifdef RULES_DEBUG | 212 | #ifdef RULES_DEBUG |
213 | printk(KERN_DEBUG "%s = ", snd_pcm_hw_param_names[k]); | 213 | pr_debug("%s = ", snd_pcm_hw_param_names[k]); |
214 | if (i->empty) | 214 | if (i->empty) |
215 | printk("empty"); | 215 | pr_cont("empty"); |
216 | else | 216 | else |
217 | printk("%c%u %u%c", | 217 | pr_cont("%c%u %u%c", |
218 | i->openmin ? '(' : '[', i->min, | 218 | i->openmin ? '(' : '[', i->min, |
219 | i->max, i->openmax ? ')' : ']'); | 219 | i->max, i->openmax ? ')' : ']'); |
220 | printk(" -> "); | 220 | pr_cont(" -> "); |
221 | #endif | 221 | #endif |
222 | changed = snd_interval_refine(i, constrs_interval(constrs, k)); | 222 | changed = snd_interval_refine(i, constrs_interval(constrs, k)); |
223 | #ifdef RULES_DEBUG | 223 | #ifdef RULES_DEBUG |
224 | if (i->empty) | 224 | if (i->empty) |
225 | printk("empty\n"); | 225 | pr_cont("empty\n"); |
226 | else | 226 | else |
227 | printk("%c%u %u%c\n", | 227 | pr_cont("%c%u %u%c\n", |
228 | i->openmin ? '(' : '[', i->min, | 228 | i->openmin ? '(' : '[', i->min, |
229 | i->max, i->openmax ? ')' : ']'); | 229 | i->max, i->openmax ? ')' : ']'); |
230 | #endif | 230 | #endif |
@@ -255,18 +255,18 @@ int snd_pcm_hw_refine(struct snd_pcm_substream *substream, | |||
255 | if (!doit) | 255 | if (!doit) |
256 | continue; | 256 | continue; |
257 | #ifdef RULES_DEBUG | 257 | #ifdef RULES_DEBUG |
258 | printk(KERN_DEBUG "Rule %d [%p]: ", k, r->func); | 258 | pr_debug("Rule %d [%p]: ", k, r->func); |
259 | if (r->var >= 0) { | 259 | if (r->var >= 0) { |
260 | printk("%s = ", snd_pcm_hw_param_names[r->var]); | 260 | pr_cont("%s = ", snd_pcm_hw_param_names[r->var]); |
261 | if (hw_is_mask(r->var)) { | 261 | if (hw_is_mask(r->var)) { |
262 | m = hw_param_mask(params, r->var); | 262 | m = hw_param_mask(params, r->var); |
263 | printk("%x", *m->bits); | 263 | pr_cont("%x", *m->bits); |
264 | } else { | 264 | } else { |
265 | i = hw_param_interval(params, r->var); | 265 | i = hw_param_interval(params, r->var); |
266 | if (i->empty) | 266 | if (i->empty) |
267 | printk("empty"); | 267 | pr_cont("empty"); |
268 | else | 268 | else |
269 | printk("%c%u %u%c", | 269 | pr_cont("%c%u %u%c", |
270 | i->openmin ? '(' : '[', i->min, | 270 | i->openmin ? '(' : '[', i->min, |
271 | i->max, i->openmax ? ')' : ']'); | 271 | i->max, i->openmax ? ')' : ']'); |
272 | } | 272 | } |
@@ -275,19 +275,19 @@ int snd_pcm_hw_refine(struct snd_pcm_substream *substream, | |||
275 | changed = r->func(params, r); | 275 | changed = r->func(params, r); |
276 | #ifdef RULES_DEBUG | 276 | #ifdef RULES_DEBUG |
277 | if (r->var >= 0) { | 277 | if (r->var >= 0) { |
278 | printk(" -> "); | 278 | pr_cont(" -> "); |
279 | if (hw_is_mask(r->var)) | 279 | if (hw_is_mask(r->var)) |
280 | printk("%x", *m->bits); | 280 | pr_cont("%x", *m->bits); |
281 | else { | 281 | else { |
282 | if (i->empty) | 282 | if (i->empty) |
283 | printk("empty"); | 283 | pr_cont("empty"); |
284 | else | 284 | else |
285 | printk("%c%u %u%c", | 285 | pr_cont("%c%u %u%c", |
286 | i->openmin ? '(' : '[', i->min, | 286 | i->openmin ? '(' : '[', i->min, |
287 | i->max, i->openmax ? ')' : ']'); | 287 | i->max, i->openmax ? ')' : ']'); |
288 | } | 288 | } |
289 | } | 289 | } |
290 | printk("\n"); | 290 | pr_cont("\n"); |
291 | #endif | 291 | #endif |
292 | rstamps[k] = stamp; | 292 | rstamps[k] = stamp; |
293 | if (changed && r->var >= 0) { | 293 | if (changed && r->var >= 0) { |
@@ -399,7 +399,7 @@ static int snd_pcm_hw_params(struct snd_pcm_substream *substream, | |||
399 | return -EBADFD; | 399 | return -EBADFD; |
400 | } | 400 | } |
401 | snd_pcm_stream_unlock_irq(substream); | 401 | snd_pcm_stream_unlock_irq(substream); |
402 | #if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE) | 402 | #if IS_ENABLED(CONFIG_SND_PCM_OSS) |
403 | if (!substream->oss.oss) | 403 | if (!substream->oss.oss) |
404 | #endif | 404 | #endif |
405 | if (atomic_read(&substream->mmap_count)) | 405 | if (atomic_read(&substream->mmap_count)) |
@@ -954,7 +954,7 @@ static struct action_ops snd_pcm_action_stop = { | |||
954 | * | 954 | * |
955 | * The state of each stream is then changed to the given state unconditionally. | 955 | * The state of each stream is then changed to the given state unconditionally. |
956 | * | 956 | * |
957 | * Return: Zero if succesful, or a negative error code. | 957 | * Return: Zero if successful, or a negative error code. |
958 | */ | 958 | */ |
959 | int snd_pcm_stop(struct snd_pcm_substream *substream, snd_pcm_state_t state) | 959 | int snd_pcm_stop(struct snd_pcm_substream *substream, snd_pcm_state_t state) |
960 | { | 960 | { |
@@ -1541,7 +1541,8 @@ static int snd_pcm_drain(struct snd_pcm_substream *substream, | |||
1541 | if (substream->runtime->status->state == SNDRV_PCM_STATE_SUSPENDED) | 1541 | if (substream->runtime->status->state == SNDRV_PCM_STATE_SUSPENDED) |
1542 | result = -ESTRPIPE; | 1542 | result = -ESTRPIPE; |
1543 | else { | 1543 | else { |
1544 | snd_printd("playback drain error (DMA or IRQ trouble?)\n"); | 1544 | dev_dbg(substream->pcm->card->dev, |
1545 | "playback drain error (DMA or IRQ trouble?)\n"); | ||
1545 | snd_pcm_stop(substream, SNDRV_PCM_STATE_SETUP); | 1546 | snd_pcm_stop(substream, SNDRV_PCM_STATE_SETUP); |
1546 | result = -EIO; | 1547 | result = -EIO; |
1547 | } | 1548 | } |
@@ -2066,7 +2067,7 @@ int snd_pcm_open_substream(struct snd_pcm *pcm, int stream, | |||
2066 | 2067 | ||
2067 | err = snd_pcm_hw_constraints_init(substream); | 2068 | err = snd_pcm_hw_constraints_init(substream); |
2068 | if (err < 0) { | 2069 | if (err < 0) { |
2069 | snd_printd("snd_pcm_hw_constraints_init failed\n"); | 2070 | pcm_dbg(pcm, "snd_pcm_hw_constraints_init failed\n"); |
2070 | goto error; | 2071 | goto error; |
2071 | } | 2072 | } |
2072 | 2073 | ||
@@ -2077,7 +2078,7 @@ int snd_pcm_open_substream(struct snd_pcm *pcm, int stream, | |||
2077 | 2078 | ||
2078 | err = snd_pcm_hw_constraints_complete(substream); | 2079 | err = snd_pcm_hw_constraints_complete(substream); |
2079 | if (err < 0) { | 2080 | if (err < 0) { |
2080 | snd_printd("snd_pcm_hw_constraints_complete failed\n"); | 2081 | pcm_dbg(pcm, "snd_pcm_hw_constraints_complete failed\n"); |
2081 | goto error; | 2082 | goto error; |
2082 | } | 2083 | } |
2083 | 2084 | ||
@@ -2609,7 +2610,7 @@ static int snd_pcm_common_ioctl1(struct file *file, | |||
2609 | return res; | 2610 | return res; |
2610 | } | 2611 | } |
2611 | } | 2612 | } |
2612 | snd_printd("unknown ioctl = 0x%x\n", cmd); | 2613 | pcm_dbg(substream->pcm, "unknown ioctl = 0x%x\n", cmd); |
2613 | return -ENOTTY; | 2614 | return -ENOTTY; |
2614 | } | 2615 | } |
2615 | 2616 | ||
diff --git a/sound/core/pcm_timer.c b/sound/core/pcm_timer.c index b01d9481d632..20ecd8f18080 100644 --- a/sound/core/pcm_timer.c +++ b/sound/core/pcm_timer.c | |||
@@ -53,7 +53,9 @@ void snd_pcm_timer_resolution_change(struct snd_pcm_substream *substream) | |||
53 | post *= 2; | 53 | post *= 2; |
54 | } | 54 | } |
55 | if (rate == 0) { | 55 | if (rate == 0) { |
56 | snd_printk(KERN_ERR "pcm timer resolution out of range (rate = %u, period_size = %lu)\n", runtime->rate, runtime->period_size); | 56 | pcm_err(substream->pcm, |
57 | "pcm timer resolution out of range (rate = %u, period_size = %lu)\n", | ||
58 | runtime->rate, runtime->period_size); | ||
57 | runtime->timer_resolution = -1; | 59 | runtime->timer_resolution = -1; |
58 | return; | 60 | return; |
59 | } | 61 | } |
diff --git a/sound/core/rawmidi.c b/sound/core/rawmidi.c index 7b596b5751db..6fc71a4c8a51 100644 --- a/sound/core/rawmidi.c +++ b/sound/core/rawmidi.c | |||
@@ -56,6 +56,13 @@ static int snd_rawmidi_dev_disconnect(struct snd_device *device); | |||
56 | static LIST_HEAD(snd_rawmidi_devices); | 56 | static LIST_HEAD(snd_rawmidi_devices); |
57 | static DEFINE_MUTEX(register_mutex); | 57 | static DEFINE_MUTEX(register_mutex); |
58 | 58 | ||
59 | #define rmidi_err(rmidi, fmt, args...) \ | ||
60 | dev_err((rmidi)->card->dev, fmt, ##args) | ||
61 | #define rmidi_warn(rmidi, fmt, args...) \ | ||
62 | dev_warn((rmidi)->card->dev, fmt, ##args) | ||
63 | #define rmidi_dbg(rmidi, fmt, args...) \ | ||
64 | dev_dbg((rmidi)->card->dev, fmt, ##args) | ||
65 | |||
59 | static struct snd_rawmidi *snd_rawmidi_search(struct snd_card *card, int device) | 66 | static struct snd_rawmidi *snd_rawmidi_search(struct snd_card *card, int device) |
60 | { | 67 | { |
61 | struct snd_rawmidi *rawmidi; | 68 | struct snd_rawmidi *rawmidi; |
@@ -165,6 +172,7 @@ int snd_rawmidi_drop_output(struct snd_rawmidi_substream *substream) | |||
165 | spin_unlock_irqrestore(&runtime->lock, flags); | 172 | spin_unlock_irqrestore(&runtime->lock, flags); |
166 | return 0; | 173 | return 0; |
167 | } | 174 | } |
175 | EXPORT_SYMBOL(snd_rawmidi_drop_output); | ||
168 | 176 | ||
169 | int snd_rawmidi_drain_output(struct snd_rawmidi_substream *substream) | 177 | int snd_rawmidi_drain_output(struct snd_rawmidi_substream *substream) |
170 | { | 178 | { |
@@ -180,7 +188,9 @@ int snd_rawmidi_drain_output(struct snd_rawmidi_substream *substream) | |||
180 | if (signal_pending(current)) | 188 | if (signal_pending(current)) |
181 | err = -ERESTARTSYS; | 189 | err = -ERESTARTSYS; |
182 | if (runtime->avail < runtime->buffer_size && !timeout) { | 190 | if (runtime->avail < runtime->buffer_size && !timeout) { |
183 | snd_printk(KERN_WARNING "rawmidi drain error (avail = %li, buffer_size = %li)\n", (long)runtime->avail, (long)runtime->buffer_size); | 191 | rmidi_warn(substream->rmidi, |
192 | "rawmidi drain error (avail = %li, buffer_size = %li)\n", | ||
193 | (long)runtime->avail, (long)runtime->buffer_size); | ||
184 | err = -EIO; | 194 | err = -EIO; |
185 | } | 195 | } |
186 | runtime->drain = 0; | 196 | runtime->drain = 0; |
@@ -194,6 +204,7 @@ int snd_rawmidi_drain_output(struct snd_rawmidi_substream *substream) | |||
194 | } | 204 | } |
195 | return err; | 205 | return err; |
196 | } | 206 | } |
207 | EXPORT_SYMBOL(snd_rawmidi_drain_output); | ||
197 | 208 | ||
198 | int snd_rawmidi_drain_input(struct snd_rawmidi_substream *substream) | 209 | int snd_rawmidi_drain_input(struct snd_rawmidi_substream *substream) |
199 | { | 210 | { |
@@ -208,6 +219,7 @@ int snd_rawmidi_drain_input(struct snd_rawmidi_substream *substream) | |||
208 | spin_unlock_irqrestore(&runtime->lock, flags); | 219 | spin_unlock_irqrestore(&runtime->lock, flags); |
209 | return 0; | 220 | return 0; |
210 | } | 221 | } |
222 | EXPORT_SYMBOL(snd_rawmidi_drain_input); | ||
211 | 223 | ||
212 | /* look for an available substream for the given stream direction; | 224 | /* look for an available substream for the given stream direction; |
213 | * if a specific subdevice is given, try to assign it | 225 | * if a specific subdevice is given, try to assign it |
@@ -345,6 +357,7 @@ int snd_rawmidi_kernel_open(struct snd_card *card, int device, int subdevice, | |||
345 | module_put(rmidi->card->module); | 357 | module_put(rmidi->card->module); |
346 | return err; | 358 | return err; |
347 | } | 359 | } |
360 | EXPORT_SYMBOL(snd_rawmidi_kernel_open); | ||
348 | 361 | ||
349 | static int snd_rawmidi_open(struct inode *inode, struct file *file) | 362 | static int snd_rawmidi_open(struct inode *inode, struct file *file) |
350 | { | 363 | { |
@@ -523,6 +536,7 @@ int snd_rawmidi_kernel_release(struct snd_rawmidi_file *rfile) | |||
523 | module_put(rmidi->card->module); | 536 | module_put(rmidi->card->module); |
524 | return 0; | 537 | return 0; |
525 | } | 538 | } |
539 | EXPORT_SYMBOL(snd_rawmidi_kernel_release); | ||
526 | 540 | ||
527 | static int snd_rawmidi_release(struct inode *inode, struct file *file) | 541 | static int snd_rawmidi_release(struct inode *inode, struct file *file) |
528 | { | 542 | { |
@@ -599,6 +613,7 @@ int snd_rawmidi_info_select(struct snd_card *card, struct snd_rawmidi_info *info | |||
599 | } | 613 | } |
600 | return -ENXIO; | 614 | return -ENXIO; |
601 | } | 615 | } |
616 | EXPORT_SYMBOL(snd_rawmidi_info_select); | ||
602 | 617 | ||
603 | static int snd_rawmidi_info_select_user(struct snd_card *card, | 618 | static int snd_rawmidi_info_select_user(struct snd_card *card, |
604 | struct snd_rawmidi_info __user *_info) | 619 | struct snd_rawmidi_info __user *_info) |
@@ -646,6 +661,7 @@ int snd_rawmidi_output_params(struct snd_rawmidi_substream *substream, | |||
646 | substream->active_sensing = !params->no_active_sensing; | 661 | substream->active_sensing = !params->no_active_sensing; |
647 | return 0; | 662 | return 0; |
648 | } | 663 | } |
664 | EXPORT_SYMBOL(snd_rawmidi_output_params); | ||
649 | 665 | ||
650 | int snd_rawmidi_input_params(struct snd_rawmidi_substream *substream, | 666 | int snd_rawmidi_input_params(struct snd_rawmidi_substream *substream, |
651 | struct snd_rawmidi_params * params) | 667 | struct snd_rawmidi_params * params) |
@@ -671,6 +687,7 @@ int snd_rawmidi_input_params(struct snd_rawmidi_substream *substream, | |||
671 | runtime->avail_min = params->avail_min; | 687 | runtime->avail_min = params->avail_min; |
672 | return 0; | 688 | return 0; |
673 | } | 689 | } |
690 | EXPORT_SYMBOL(snd_rawmidi_input_params); | ||
674 | 691 | ||
675 | static int snd_rawmidi_output_status(struct snd_rawmidi_substream *substream, | 692 | static int snd_rawmidi_output_status(struct snd_rawmidi_substream *substream, |
676 | struct snd_rawmidi_status * status) | 693 | struct snd_rawmidi_status * status) |
@@ -802,10 +819,9 @@ static long snd_rawmidi_ioctl(struct file *file, unsigned int cmd, unsigned long | |||
802 | return -EINVAL; | 819 | return -EINVAL; |
803 | } | 820 | } |
804 | } | 821 | } |
805 | #ifdef CONFIG_SND_DEBUG | ||
806 | default: | 822 | default: |
807 | snd_printk(KERN_WARNING "rawmidi: unknown command = 0x%x\n", cmd); | 823 | rmidi_dbg(rfile->rmidi, |
808 | #endif | 824 | "rawmidi: unknown command = 0x%x\n", cmd); |
809 | } | 825 | } |
810 | return -ENOTTY; | 826 | return -ENOTTY; |
811 | } | 827 | } |
@@ -875,7 +891,8 @@ int snd_rawmidi_receive(struct snd_rawmidi_substream *substream, | |||
875 | if (!substream->opened) | 891 | if (!substream->opened) |
876 | return -EBADFD; | 892 | return -EBADFD; |
877 | if (runtime->buffer == NULL) { | 893 | if (runtime->buffer == NULL) { |
878 | snd_printd("snd_rawmidi_receive: input is not active!!!\n"); | 894 | rmidi_dbg(substream->rmidi, |
895 | "snd_rawmidi_receive: input is not active!!!\n"); | ||
879 | return -EINVAL; | 896 | return -EINVAL; |
880 | } | 897 | } |
881 | spin_lock_irqsave(&runtime->lock, flags); | 898 | spin_lock_irqsave(&runtime->lock, flags); |
@@ -926,6 +943,7 @@ int snd_rawmidi_receive(struct snd_rawmidi_substream *substream, | |||
926 | spin_unlock_irqrestore(&runtime->lock, flags); | 943 | spin_unlock_irqrestore(&runtime->lock, flags); |
927 | return result; | 944 | return result; |
928 | } | 945 | } |
946 | EXPORT_SYMBOL(snd_rawmidi_receive); | ||
929 | 947 | ||
930 | static long snd_rawmidi_kernel_read1(struct snd_rawmidi_substream *substream, | 948 | static long snd_rawmidi_kernel_read1(struct snd_rawmidi_substream *substream, |
931 | unsigned char __user *userbuf, | 949 | unsigned char __user *userbuf, |
@@ -968,6 +986,7 @@ long snd_rawmidi_kernel_read(struct snd_rawmidi_substream *substream, | |||
968 | snd_rawmidi_input_trigger(substream, 1); | 986 | snd_rawmidi_input_trigger(substream, 1); |
969 | return snd_rawmidi_kernel_read1(substream, NULL/*userbuf*/, buf, count); | 987 | return snd_rawmidi_kernel_read1(substream, NULL/*userbuf*/, buf, count); |
970 | } | 988 | } |
989 | EXPORT_SYMBOL(snd_rawmidi_kernel_read); | ||
971 | 990 | ||
972 | static ssize_t snd_rawmidi_read(struct file *file, char __user *buf, size_t count, | 991 | static ssize_t snd_rawmidi_read(struct file *file, char __user *buf, size_t count, |
973 | loff_t *offset) | 992 | loff_t *offset) |
@@ -1034,7 +1053,8 @@ int snd_rawmidi_transmit_empty(struct snd_rawmidi_substream *substream) | |||
1034 | unsigned long flags; | 1053 | unsigned long flags; |
1035 | 1054 | ||
1036 | if (runtime->buffer == NULL) { | 1055 | if (runtime->buffer == NULL) { |
1037 | snd_printd("snd_rawmidi_transmit_empty: output is not active!!!\n"); | 1056 | rmidi_dbg(substream->rmidi, |
1057 | "snd_rawmidi_transmit_empty: output is not active!!!\n"); | ||
1038 | return 1; | 1058 | return 1; |
1039 | } | 1059 | } |
1040 | spin_lock_irqsave(&runtime->lock, flags); | 1060 | spin_lock_irqsave(&runtime->lock, flags); |
@@ -1042,6 +1062,7 @@ int snd_rawmidi_transmit_empty(struct snd_rawmidi_substream *substream) | |||
1042 | spin_unlock_irqrestore(&runtime->lock, flags); | 1062 | spin_unlock_irqrestore(&runtime->lock, flags); |
1043 | return result; | 1063 | return result; |
1044 | } | 1064 | } |
1065 | EXPORT_SYMBOL(snd_rawmidi_transmit_empty); | ||
1045 | 1066 | ||
1046 | /** | 1067 | /** |
1047 | * snd_rawmidi_transmit_peek - copy data from the internal buffer | 1068 | * snd_rawmidi_transmit_peek - copy data from the internal buffer |
@@ -1065,7 +1086,8 @@ int snd_rawmidi_transmit_peek(struct snd_rawmidi_substream *substream, | |||
1065 | struct snd_rawmidi_runtime *runtime = substream->runtime; | 1086 | struct snd_rawmidi_runtime *runtime = substream->runtime; |
1066 | 1087 | ||
1067 | if (runtime->buffer == NULL) { | 1088 | if (runtime->buffer == NULL) { |
1068 | snd_printd("snd_rawmidi_transmit_peek: output is not active!!!\n"); | 1089 | rmidi_dbg(substream->rmidi, |
1090 | "snd_rawmidi_transmit_peek: output is not active!!!\n"); | ||
1069 | return -EINVAL; | 1091 | return -EINVAL; |
1070 | } | 1092 | } |
1071 | result = 0; | 1093 | result = 0; |
@@ -1097,11 +1119,12 @@ int snd_rawmidi_transmit_peek(struct snd_rawmidi_substream *substream, | |||
1097 | spin_unlock_irqrestore(&runtime->lock, flags); | 1119 | spin_unlock_irqrestore(&runtime->lock, flags); |
1098 | return result; | 1120 | return result; |
1099 | } | 1121 | } |
1122 | EXPORT_SYMBOL(snd_rawmidi_transmit_peek); | ||
1100 | 1123 | ||
1101 | /** | 1124 | /** |
1102 | * snd_rawmidi_transmit_ack - acknowledge the transmission | 1125 | * snd_rawmidi_transmit_ack - acknowledge the transmission |
1103 | * @substream: the rawmidi substream | 1126 | * @substream: the rawmidi substream |
1104 | * @count: the tranferred count | 1127 | * @count: the transferred count |
1105 | * | 1128 | * |
1106 | * Advances the hardware pointer for the internal output buffer with | 1129 | * Advances the hardware pointer for the internal output buffer with |
1107 | * the given size and updates the condition. | 1130 | * the given size and updates the condition. |
@@ -1115,7 +1138,8 @@ int snd_rawmidi_transmit_ack(struct snd_rawmidi_substream *substream, int count) | |||
1115 | struct snd_rawmidi_runtime *runtime = substream->runtime; | 1138 | struct snd_rawmidi_runtime *runtime = substream->runtime; |
1116 | 1139 | ||
1117 | if (runtime->buffer == NULL) { | 1140 | if (runtime->buffer == NULL) { |
1118 | snd_printd("snd_rawmidi_transmit_ack: output is not active!!!\n"); | 1141 | rmidi_dbg(substream->rmidi, |
1142 | "snd_rawmidi_transmit_ack: output is not active!!!\n"); | ||
1119 | return -EINVAL; | 1143 | return -EINVAL; |
1120 | } | 1144 | } |
1121 | spin_lock_irqsave(&runtime->lock, flags); | 1145 | spin_lock_irqsave(&runtime->lock, flags); |
@@ -1131,6 +1155,7 @@ int snd_rawmidi_transmit_ack(struct snd_rawmidi_substream *substream, int count) | |||
1131 | spin_unlock_irqrestore(&runtime->lock, flags); | 1155 | spin_unlock_irqrestore(&runtime->lock, flags); |
1132 | return count; | 1156 | return count; |
1133 | } | 1157 | } |
1158 | EXPORT_SYMBOL(snd_rawmidi_transmit_ack); | ||
1134 | 1159 | ||
1135 | /** | 1160 | /** |
1136 | * snd_rawmidi_transmit - copy from the buffer to the device | 1161 | * snd_rawmidi_transmit - copy from the buffer to the device |
@@ -1152,6 +1177,7 @@ int snd_rawmidi_transmit(struct snd_rawmidi_substream *substream, | |||
1152 | return count; | 1177 | return count; |
1153 | return snd_rawmidi_transmit_ack(substream, count); | 1178 | return snd_rawmidi_transmit_ack(substream, count); |
1154 | } | 1179 | } |
1180 | EXPORT_SYMBOL(snd_rawmidi_transmit); | ||
1155 | 1181 | ||
1156 | static long snd_rawmidi_kernel_write1(struct snd_rawmidi_substream *substream, | 1182 | static long snd_rawmidi_kernel_write1(struct snd_rawmidi_substream *substream, |
1157 | const unsigned char __user *userbuf, | 1183 | const unsigned char __user *userbuf, |
@@ -1213,6 +1239,7 @@ long snd_rawmidi_kernel_write(struct snd_rawmidi_substream *substream, | |||
1213 | { | 1239 | { |
1214 | return snd_rawmidi_kernel_write1(substream, NULL, buf, count); | 1240 | return snd_rawmidi_kernel_write1(substream, NULL, buf, count); |
1215 | } | 1241 | } |
1242 | EXPORT_SYMBOL(snd_rawmidi_kernel_write); | ||
1216 | 1243 | ||
1217 | static ssize_t snd_rawmidi_write(struct file *file, const char __user *buf, | 1244 | static ssize_t snd_rawmidi_write(struct file *file, const char __user *buf, |
1218 | size_t count, loff_t *offset) | 1245 | size_t count, loff_t *offset) |
@@ -1413,7 +1440,7 @@ static int snd_rawmidi_alloc_substreams(struct snd_rawmidi *rmidi, | |||
1413 | for (idx = 0; idx < count; idx++) { | 1440 | for (idx = 0; idx < count; idx++) { |
1414 | substream = kzalloc(sizeof(*substream), GFP_KERNEL); | 1441 | substream = kzalloc(sizeof(*substream), GFP_KERNEL); |
1415 | if (substream == NULL) { | 1442 | if (substream == NULL) { |
1416 | snd_printk(KERN_ERR "rawmidi: cannot allocate substream\n"); | 1443 | rmidi_err(rmidi, "rawmidi: cannot allocate substream\n"); |
1417 | return -ENOMEM; | 1444 | return -ENOMEM; |
1418 | } | 1445 | } |
1419 | substream->stream = direction; | 1446 | substream->stream = direction; |
@@ -1458,7 +1485,7 @@ int snd_rawmidi_new(struct snd_card *card, char *id, int device, | |||
1458 | *rrawmidi = NULL; | 1485 | *rrawmidi = NULL; |
1459 | rmidi = kzalloc(sizeof(*rmidi), GFP_KERNEL); | 1486 | rmidi = kzalloc(sizeof(*rmidi), GFP_KERNEL); |
1460 | if (rmidi == NULL) { | 1487 | if (rmidi == NULL) { |
1461 | snd_printk(KERN_ERR "rawmidi: cannot allocate\n"); | 1488 | dev_err(card->dev, "rawmidi: cannot allocate\n"); |
1462 | return -ENOMEM; | 1489 | return -ENOMEM; |
1463 | } | 1490 | } |
1464 | rmidi->card = card; | 1491 | rmidi->card = card; |
@@ -1492,6 +1519,7 @@ int snd_rawmidi_new(struct snd_card *card, char *id, int device, | |||
1492 | *rrawmidi = rmidi; | 1519 | *rrawmidi = rmidi; |
1493 | return 0; | 1520 | return 0; |
1494 | } | 1521 | } |
1522 | EXPORT_SYMBOL(snd_rawmidi_new); | ||
1495 | 1523 | ||
1496 | static void snd_rawmidi_free_substreams(struct snd_rawmidi_str *stream) | 1524 | static void snd_rawmidi_free_substreams(struct snd_rawmidi_str *stream) |
1497 | { | 1525 | { |
@@ -1557,7 +1585,8 @@ static int snd_rawmidi_dev_register(struct snd_device *device) | |||
1557 | if ((err = snd_register_device(SNDRV_DEVICE_TYPE_RAWMIDI, | 1585 | if ((err = snd_register_device(SNDRV_DEVICE_TYPE_RAWMIDI, |
1558 | rmidi->card, rmidi->device, | 1586 | rmidi->card, rmidi->device, |
1559 | &snd_rawmidi_f_ops, rmidi, name)) < 0) { | 1587 | &snd_rawmidi_f_ops, rmidi, name)) < 0) { |
1560 | snd_printk(KERN_ERR "unable to register rawmidi device %i:%i\n", rmidi->card->number, rmidi->device); | 1588 | rmidi_err(rmidi, "unable to register rawmidi device %i:%i\n", |
1589 | rmidi->card->number, rmidi->device); | ||
1561 | list_del(&rmidi->list); | 1590 | list_del(&rmidi->list); |
1562 | mutex_unlock(®ister_mutex); | 1591 | mutex_unlock(®ister_mutex); |
1563 | return err; | 1592 | return err; |
@@ -1574,8 +1603,10 @@ static int snd_rawmidi_dev_register(struct snd_device *device) | |||
1574 | if ((int)rmidi->device == midi_map[rmidi->card->number]) { | 1603 | if ((int)rmidi->device == midi_map[rmidi->card->number]) { |
1575 | if (snd_register_oss_device(SNDRV_OSS_DEVICE_TYPE_MIDI, | 1604 | if (snd_register_oss_device(SNDRV_OSS_DEVICE_TYPE_MIDI, |
1576 | rmidi->card, 0, &snd_rawmidi_f_ops, | 1605 | rmidi->card, 0, &snd_rawmidi_f_ops, |
1577 | rmidi, name) < 0) { | 1606 | rmidi) < 0) { |
1578 | snd_printk(KERN_ERR "unable to register OSS rawmidi device %i:%i\n", rmidi->card->number, 0); | 1607 | rmidi_err(rmidi, |
1608 | "unable to register OSS rawmidi device %i:%i\n", | ||
1609 | rmidi->card->number, 0); | ||
1579 | } else { | 1610 | } else { |
1580 | rmidi->ossreg++; | 1611 | rmidi->ossreg++; |
1581 | #ifdef SNDRV_OSS_INFO_DEV_MIDI | 1612 | #ifdef SNDRV_OSS_INFO_DEV_MIDI |
@@ -1586,8 +1617,10 @@ static int snd_rawmidi_dev_register(struct snd_device *device) | |||
1586 | if ((int)rmidi->device == amidi_map[rmidi->card->number]) { | 1617 | if ((int)rmidi->device == amidi_map[rmidi->card->number]) { |
1587 | if (snd_register_oss_device(SNDRV_OSS_DEVICE_TYPE_MIDI, | 1618 | if (snd_register_oss_device(SNDRV_OSS_DEVICE_TYPE_MIDI, |
1588 | rmidi->card, 1, &snd_rawmidi_f_ops, | 1619 | rmidi->card, 1, &snd_rawmidi_f_ops, |
1589 | rmidi, name) < 0) { | 1620 | rmidi) < 0) { |
1590 | snd_printk(KERN_ERR "unable to register OSS rawmidi device %i:%i\n", rmidi->card->number, 1); | 1621 | rmidi_err(rmidi, |
1622 | "unable to register OSS rawmidi device %i:%i\n", | ||
1623 | rmidi->card->number, 1); | ||
1591 | } else { | 1624 | } else { |
1592 | rmidi->ossreg++; | 1625 | rmidi->ossreg++; |
1593 | } | 1626 | } |
@@ -1670,6 +1703,7 @@ void snd_rawmidi_set_ops(struct snd_rawmidi *rmidi, int stream, | |||
1670 | list_for_each_entry(substream, &rmidi->streams[stream].substreams, list) | 1703 | list_for_each_entry(substream, &rmidi->streams[stream].substreams, list) |
1671 | substream->ops = ops; | 1704 | substream->ops = ops; |
1672 | } | 1705 | } |
1706 | EXPORT_SYMBOL(snd_rawmidi_set_ops); | ||
1673 | 1707 | ||
1674 | /* | 1708 | /* |
1675 | * ENTRY functions | 1709 | * ENTRY functions |
@@ -1685,11 +1719,13 @@ static int __init alsa_rawmidi_init(void) | |||
1685 | /* check device map table */ | 1719 | /* check device map table */ |
1686 | for (i = 0; i < SNDRV_CARDS; i++) { | 1720 | for (i = 0; i < SNDRV_CARDS; i++) { |
1687 | if (midi_map[i] < 0 || midi_map[i] >= SNDRV_RAWMIDI_DEVICES) { | 1721 | if (midi_map[i] < 0 || midi_map[i] >= SNDRV_RAWMIDI_DEVICES) { |
1688 | snd_printk(KERN_ERR "invalid midi_map[%d] = %d\n", i, midi_map[i]); | 1722 | pr_err("ALSA: rawmidi: invalid midi_map[%d] = %d\n", |
1723 | i, midi_map[i]); | ||
1689 | midi_map[i] = 0; | 1724 | midi_map[i] = 0; |
1690 | } | 1725 | } |
1691 | if (amidi_map[i] < 0 || amidi_map[i] >= SNDRV_RAWMIDI_DEVICES) { | 1726 | if (amidi_map[i] < 0 || amidi_map[i] >= SNDRV_RAWMIDI_DEVICES) { |
1692 | snd_printk(KERN_ERR "invalid amidi_map[%d] = %d\n", i, amidi_map[i]); | 1727 | pr_err("ALSA: rawmidi: invalid amidi_map[%d] = %d\n", |
1728 | i, amidi_map[i]); | ||
1693 | amidi_map[i] = 1; | 1729 | amidi_map[i] = 1; |
1694 | } | 1730 | } |
1695 | } | 1731 | } |
@@ -1706,21 +1742,3 @@ static void __exit alsa_rawmidi_exit(void) | |||
1706 | 1742 | ||
1707 | module_init(alsa_rawmidi_init) | 1743 | module_init(alsa_rawmidi_init) |
1708 | module_exit(alsa_rawmidi_exit) | 1744 | module_exit(alsa_rawmidi_exit) |
1709 | |||
1710 | EXPORT_SYMBOL(snd_rawmidi_output_params); | ||
1711 | EXPORT_SYMBOL(snd_rawmidi_input_params); | ||
1712 | EXPORT_SYMBOL(snd_rawmidi_drop_output); | ||
1713 | EXPORT_SYMBOL(snd_rawmidi_drain_output); | ||
1714 | EXPORT_SYMBOL(snd_rawmidi_drain_input); | ||
1715 | EXPORT_SYMBOL(snd_rawmidi_receive); | ||
1716 | EXPORT_SYMBOL(snd_rawmidi_transmit_empty); | ||
1717 | EXPORT_SYMBOL(snd_rawmidi_transmit_peek); | ||
1718 | EXPORT_SYMBOL(snd_rawmidi_transmit_ack); | ||
1719 | EXPORT_SYMBOL(snd_rawmidi_transmit); | ||
1720 | EXPORT_SYMBOL(snd_rawmidi_new); | ||
1721 | EXPORT_SYMBOL(snd_rawmidi_set_ops); | ||
1722 | EXPORT_SYMBOL(snd_rawmidi_info_select); | ||
1723 | EXPORT_SYMBOL(snd_rawmidi_kernel_open); | ||
1724 | EXPORT_SYMBOL(snd_rawmidi_kernel_release); | ||
1725 | EXPORT_SYMBOL(snd_rawmidi_kernel_read); | ||
1726 | EXPORT_SYMBOL(snd_rawmidi_kernel_write); | ||
diff --git a/sound/core/rtctimer.c b/sound/core/rtctimer.c index e85e72baff9e..f3420d11a12f 100644 --- a/sound/core/rtctimer.c +++ b/sound/core/rtctimer.c | |||
@@ -27,7 +27,7 @@ | |||
27 | #include <sound/core.h> | 27 | #include <sound/core.h> |
28 | #include <sound/timer.h> | 28 | #include <sound/timer.h> |
29 | 29 | ||
30 | #if defined(CONFIG_RTC) || defined(CONFIG_RTC_MODULE) | 30 | #if IS_ENABLED(CONFIG_RTC) |
31 | 31 | ||
32 | #include <linux/mc146818rtc.h> | 32 | #include <linux/mc146818rtc.h> |
33 | 33 | ||
@@ -132,8 +132,7 @@ static int __init rtctimer_init(void) | |||
132 | 132 | ||
133 | if (rtctimer_freq < 2 || rtctimer_freq > 8192 || | 133 | if (rtctimer_freq < 2 || rtctimer_freq > 8192 || |
134 | !is_power_of_2(rtctimer_freq)) { | 134 | !is_power_of_2(rtctimer_freq)) { |
135 | snd_printk(KERN_ERR "rtctimer: invalid frequency %d\n", | 135 | pr_err("ALSA: rtctimer: invalid frequency %d\n", rtctimer_freq); |
136 | rtctimer_freq); | ||
137 | return -EINVAL; | 136 | return -EINVAL; |
138 | } | 137 | } |
139 | 138 | ||
@@ -185,4 +184,4 @@ MODULE_LICENSE("GPL"); | |||
185 | 184 | ||
186 | MODULE_ALIAS("snd-timer-" __stringify(SNDRV_TIMER_GLOBAL_RTC)); | 185 | MODULE_ALIAS("snd-timer-" __stringify(SNDRV_TIMER_GLOBAL_RTC)); |
187 | 186 | ||
188 | #endif /* CONFIG_RTC || CONFIG_RTC_MODULE */ | 187 | #endif /* IS_ENABLED(CONFIG_RTC) */ |
diff --git a/sound/core/seq/oss/seq_oss.c b/sound/core/seq/oss/seq_oss.c index 8d4d5e853efe..16d42679e43f 100644 --- a/sound/core/seq/oss/seq_oss.c +++ b/sound/core/seq/oss/seq_oss.c | |||
@@ -39,12 +39,6 @@ MODULE_LICENSE("GPL"); | |||
39 | MODULE_ALIAS_SNDRV_MINOR(SNDRV_MINOR_OSS_SEQUENCER); | 39 | MODULE_ALIAS_SNDRV_MINOR(SNDRV_MINOR_OSS_SEQUENCER); |
40 | MODULE_ALIAS_SNDRV_MINOR(SNDRV_MINOR_OSS_MUSIC); | 40 | MODULE_ALIAS_SNDRV_MINOR(SNDRV_MINOR_OSS_MUSIC); |
41 | 41 | ||
42 | #ifdef SNDRV_SEQ_OSS_DEBUG | ||
43 | module_param(seq_oss_debug, int, 0644); | ||
44 | MODULE_PARM_DESC(seq_oss_debug, "debug option"); | ||
45 | int seq_oss_debug = 0; | ||
46 | #endif | ||
47 | |||
48 | 42 | ||
49 | /* | 43 | /* |
50 | * prototypes | 44 | * prototypes |
@@ -231,22 +225,19 @@ register_device(void) | |||
231 | mutex_lock(®ister_mutex); | 225 | mutex_lock(®ister_mutex); |
232 | if ((rc = snd_register_oss_device(SNDRV_OSS_DEVICE_TYPE_SEQUENCER, | 226 | if ((rc = snd_register_oss_device(SNDRV_OSS_DEVICE_TYPE_SEQUENCER, |
233 | NULL, 0, | 227 | NULL, 0, |
234 | &seq_oss_f_ops, NULL, | 228 | &seq_oss_f_ops, NULL)) < 0) { |
235 | SNDRV_SEQ_OSS_DEVNAME)) < 0) { | 229 | pr_err("ALSA: seq_oss: can't register device seq\n"); |
236 | snd_printk(KERN_ERR "can't register device seq\n"); | ||
237 | mutex_unlock(®ister_mutex); | 230 | mutex_unlock(®ister_mutex); |
238 | return rc; | 231 | return rc; |
239 | } | 232 | } |
240 | if ((rc = snd_register_oss_device(SNDRV_OSS_DEVICE_TYPE_MUSIC, | 233 | if ((rc = snd_register_oss_device(SNDRV_OSS_DEVICE_TYPE_MUSIC, |
241 | NULL, 0, | 234 | NULL, 0, |
242 | &seq_oss_f_ops, NULL, | 235 | &seq_oss_f_ops, NULL)) < 0) { |
243 | SNDRV_SEQ_OSS_DEVNAME)) < 0) { | 236 | pr_err("ALSA: seq_oss: can't register device music\n"); |
244 | snd_printk(KERN_ERR "can't register device music\n"); | ||
245 | snd_unregister_oss_device(SNDRV_OSS_DEVICE_TYPE_SEQUENCER, NULL, 0); | 237 | snd_unregister_oss_device(SNDRV_OSS_DEVICE_TYPE_SEQUENCER, NULL, 0); |
246 | mutex_unlock(®ister_mutex); | 238 | mutex_unlock(®ister_mutex); |
247 | return rc; | 239 | return rc; |
248 | } | 240 | } |
249 | debug_printk(("device registered\n")); | ||
250 | mutex_unlock(®ister_mutex); | 241 | mutex_unlock(®ister_mutex); |
251 | return 0; | 242 | return 0; |
252 | } | 243 | } |
@@ -255,11 +246,10 @@ static void | |||
255 | unregister_device(void) | 246 | unregister_device(void) |
256 | { | 247 | { |
257 | mutex_lock(®ister_mutex); | 248 | mutex_lock(®ister_mutex); |
258 | debug_printk(("device unregistered\n")); | ||
259 | if (snd_unregister_oss_device(SNDRV_OSS_DEVICE_TYPE_MUSIC, NULL, 0) < 0) | 249 | if (snd_unregister_oss_device(SNDRV_OSS_DEVICE_TYPE_MUSIC, NULL, 0) < 0) |
260 | snd_printk(KERN_ERR "error unregister device music\n"); | 250 | pr_err("ALSA: seq_oss: error unregister device music\n"); |
261 | if (snd_unregister_oss_device(SNDRV_OSS_DEVICE_TYPE_SEQUENCER, NULL, 0) < 0) | 251 | if (snd_unregister_oss_device(SNDRV_OSS_DEVICE_TYPE_SEQUENCER, NULL, 0) < 0) |
262 | snd_printk(KERN_ERR "error unregister device seq\n"); | 252 | pr_err("ALSA: seq_oss: error unregister device seq\n"); |
263 | mutex_unlock(®ister_mutex); | 253 | mutex_unlock(®ister_mutex); |
264 | } | 254 | } |
265 | 255 | ||
diff --git a/sound/core/seq/oss/seq_oss_device.h b/sound/core/seq/oss/seq_oss_device.h index c0154a959d55..b43924325249 100644 --- a/sound/core/seq/oss/seq_oss_device.h +++ b/sound/core/seq/oss/seq_oss_device.h | |||
@@ -31,9 +31,6 @@ | |||
31 | #include <sound/seq_kernel.h> | 31 | #include <sound/seq_kernel.h> |
32 | #include <sound/info.h> | 32 | #include <sound/info.h> |
33 | 33 | ||
34 | /* enable debug print */ | ||
35 | #define SNDRV_SEQ_OSS_DEBUG | ||
36 | |||
37 | /* max. applications */ | 34 | /* max. applications */ |
38 | #define SNDRV_SEQ_OSS_MAX_CLIENTS 16 | 35 | #define SNDRV_SEQ_OSS_MAX_CLIENTS 16 |
39 | #define SNDRV_SEQ_OSS_MAX_SYNTH_DEVS 16 | 36 | #define SNDRV_SEQ_OSS_MAX_SYNTH_DEVS 16 |
@@ -46,7 +43,6 @@ | |||
46 | #define SNDRV_SEQ_OSS_VERSION_STR "0.1.8" | 43 | #define SNDRV_SEQ_OSS_VERSION_STR "0.1.8" |
47 | 44 | ||
48 | /* device and proc interface name */ | 45 | /* device and proc interface name */ |
49 | #define SNDRV_SEQ_OSS_DEVNAME "seq_oss" | ||
50 | #define SNDRV_SEQ_OSS_PROCNAME "oss" | 46 | #define SNDRV_SEQ_OSS_PROCNAME "oss" |
51 | 47 | ||
52 | 48 | ||
@@ -177,13 +173,4 @@ snd_seq_oss_fill_addr(struct seq_oss_devinfo *dp, struct snd_seq_event *ev, | |||
177 | /* misc. functions for proc interface */ | 173 | /* misc. functions for proc interface */ |
178 | char *enabled_str(int bool); | 174 | char *enabled_str(int bool); |
179 | 175 | ||
180 | |||
181 | /* for debug */ | ||
182 | #ifdef SNDRV_SEQ_OSS_DEBUG | ||
183 | extern int seq_oss_debug; | ||
184 | #define debug_printk(x) do { if (seq_oss_debug > 0) snd_printd x; } while (0) | ||
185 | #else | ||
186 | #define debug_printk(x) /**/ | ||
187 | #endif | ||
188 | |||
189 | #endif /* __SEQ_OSS_DEVICE_H */ | 176 | #endif /* __SEQ_OSS_DEVICE_H */ |
diff --git a/sound/core/seq/oss/seq_oss_init.c b/sound/core/seq/oss/seq_oss_init.c index b3f39b5ed742..b9184d20c39f 100644 --- a/sound/core/seq/oss/seq_oss_init.c +++ b/sound/core/seq/oss/seq_oss_init.c | |||
@@ -92,7 +92,6 @@ snd_seq_oss_create_client(void) | |||
92 | goto __error; | 92 | goto __error; |
93 | 93 | ||
94 | system_client = rc; | 94 | system_client = rc; |
95 | debug_printk(("new client = %d\n", rc)); | ||
96 | 95 | ||
97 | /* create annoucement receiver port */ | 96 | /* create annoucement receiver port */ |
98 | memset(port, 0, sizeof(*port)); | 97 | memset(port, 0, sizeof(*port)); |
@@ -190,10 +189,9 @@ snd_seq_oss_open(struct file *file, int level) | |||
190 | 189 | ||
191 | dp = kzalloc(sizeof(*dp), GFP_KERNEL); | 190 | dp = kzalloc(sizeof(*dp), GFP_KERNEL); |
192 | if (!dp) { | 191 | if (!dp) { |
193 | snd_printk(KERN_ERR "can't malloc device info\n"); | 192 | pr_err("ALSA: seq_oss: can't malloc device info\n"); |
194 | return -ENOMEM; | 193 | return -ENOMEM; |
195 | } | 194 | } |
196 | debug_printk(("oss_open: dp = %p\n", dp)); | ||
197 | 195 | ||
198 | dp->cseq = system_client; | 196 | dp->cseq = system_client; |
199 | dp->port = -1; | 197 | dp->port = -1; |
@@ -206,7 +204,7 @@ snd_seq_oss_open(struct file *file, int level) | |||
206 | 204 | ||
207 | dp->index = i; | 205 | dp->index = i; |
208 | if (i >= SNDRV_SEQ_OSS_MAX_CLIENTS) { | 206 | if (i >= SNDRV_SEQ_OSS_MAX_CLIENTS) { |
209 | snd_printk(KERN_ERR "too many applications\n"); | 207 | pr_err("ALSA: seq_oss: too many applications\n"); |
210 | rc = -ENOMEM; | 208 | rc = -ENOMEM; |
211 | goto _error; | 209 | goto _error; |
212 | } | 210 | } |
@@ -216,21 +214,19 @@ snd_seq_oss_open(struct file *file, int level) | |||
216 | snd_seq_oss_midi_setup(dp); | 214 | snd_seq_oss_midi_setup(dp); |
217 | 215 | ||
218 | if (dp->synth_opened == 0 && dp->max_mididev == 0) { | 216 | if (dp->synth_opened == 0 && dp->max_mididev == 0) { |
219 | /* snd_printk(KERN_ERR "no device found\n"); */ | 217 | /* pr_err("ALSA: seq_oss: no device found\n"); */ |
220 | rc = -ENODEV; | 218 | rc = -ENODEV; |
221 | goto _error; | 219 | goto _error; |
222 | } | 220 | } |
223 | 221 | ||
224 | /* create port */ | 222 | /* create port */ |
225 | debug_printk(("create new port\n")); | ||
226 | rc = create_port(dp); | 223 | rc = create_port(dp); |
227 | if (rc < 0) { | 224 | if (rc < 0) { |
228 | snd_printk(KERN_ERR "can't create port\n"); | 225 | pr_err("ALSA: seq_oss: can't create port\n"); |
229 | goto _error; | 226 | goto _error; |
230 | } | 227 | } |
231 | 228 | ||
232 | /* allocate queue */ | 229 | /* allocate queue */ |
233 | debug_printk(("allocate queue\n")); | ||
234 | rc = alloc_seq_queue(dp); | 230 | rc = alloc_seq_queue(dp); |
235 | if (rc < 0) | 231 | if (rc < 0) |
236 | goto _error; | 232 | goto _error; |
@@ -247,7 +243,6 @@ snd_seq_oss_open(struct file *file, int level) | |||
247 | dp->file_mode = translate_mode(file); | 243 | dp->file_mode = translate_mode(file); |
248 | 244 | ||
249 | /* initialize read queue */ | 245 | /* initialize read queue */ |
250 | debug_printk(("initialize read queue\n")); | ||
251 | if (is_read_mode(dp->file_mode)) { | 246 | if (is_read_mode(dp->file_mode)) { |
252 | dp->readq = snd_seq_oss_readq_new(dp, maxqlen); | 247 | dp->readq = snd_seq_oss_readq_new(dp, maxqlen); |
253 | if (!dp->readq) { | 248 | if (!dp->readq) { |
@@ -257,7 +252,6 @@ snd_seq_oss_open(struct file *file, int level) | |||
257 | } | 252 | } |
258 | 253 | ||
259 | /* initialize write queue */ | 254 | /* initialize write queue */ |
260 | debug_printk(("initialize write queue\n")); | ||
261 | if (is_write_mode(dp->file_mode)) { | 255 | if (is_write_mode(dp->file_mode)) { |
262 | dp->writeq = snd_seq_oss_writeq_new(dp, maxqlen); | 256 | dp->writeq = snd_seq_oss_writeq_new(dp, maxqlen); |
263 | if (!dp->writeq) { | 257 | if (!dp->writeq) { |
@@ -267,14 +261,12 @@ snd_seq_oss_open(struct file *file, int level) | |||
267 | } | 261 | } |
268 | 262 | ||
269 | /* initialize timer */ | 263 | /* initialize timer */ |
270 | debug_printk(("initialize timer\n")); | ||
271 | dp->timer = snd_seq_oss_timer_new(dp); | 264 | dp->timer = snd_seq_oss_timer_new(dp); |
272 | if (!dp->timer) { | 265 | if (!dp->timer) { |
273 | snd_printk(KERN_ERR "can't alloc timer\n"); | 266 | pr_err("ALSA: seq_oss: can't alloc timer\n"); |
274 | rc = -ENOMEM; | 267 | rc = -ENOMEM; |
275 | goto _error; | 268 | goto _error; |
276 | } | 269 | } |
277 | debug_printk(("timer initialized\n")); | ||
278 | 270 | ||
279 | /* set private data pointer */ | 271 | /* set private data pointer */ |
280 | file->private_data = dp; | 272 | file->private_data = dp; |
@@ -288,7 +280,6 @@ snd_seq_oss_open(struct file *file, int level) | |||
288 | client_table[dp->index] = dp; | 280 | client_table[dp->index] = dp; |
289 | num_clients++; | 281 | num_clients++; |
290 | 282 | ||
291 | debug_printk(("open done\n")); | ||
292 | return 0; | 283 | return 0; |
293 | 284 | ||
294 | _error: | 285 | _error: |
@@ -347,7 +338,6 @@ create_port(struct seq_oss_devinfo *dp) | |||
347 | return rc; | 338 | return rc; |
348 | 339 | ||
349 | dp->port = port.addr.port; | 340 | dp->port = port.addr.port; |
350 | debug_printk(("new port = %d\n", port.addr.port)); | ||
351 | 341 | ||
352 | return 0; | 342 | return 0; |
353 | } | 343 | } |
@@ -363,7 +353,6 @@ delete_port(struct seq_oss_devinfo *dp) | |||
363 | return 0; | 353 | return 0; |
364 | } | 354 | } |
365 | 355 | ||
366 | debug_printk(("delete_port %i\n", dp->port)); | ||
367 | return snd_seq_event_port_detach(dp->cseq, dp->port); | 356 | return snd_seq_event_port_detach(dp->cseq, dp->port); |
368 | } | 357 | } |
369 | 358 | ||
@@ -401,7 +390,7 @@ delete_seq_queue(int queue) | |||
401 | qinfo.queue = queue; | 390 | qinfo.queue = queue; |
402 | rc = call_ctl(SNDRV_SEQ_IOCTL_DELETE_QUEUE, &qinfo); | 391 | rc = call_ctl(SNDRV_SEQ_IOCTL_DELETE_QUEUE, &qinfo); |
403 | if (rc < 0) | 392 | if (rc < 0) |
404 | printk(KERN_ERR "seq-oss: unable to delete queue %d (%d)\n", queue, rc); | 393 | pr_err("ALSA: seq_oss: unable to delete queue %d (%d)\n", queue, rc); |
405 | return rc; | 394 | return rc; |
406 | } | 395 | } |
407 | 396 | ||
@@ -438,21 +427,16 @@ snd_seq_oss_release(struct seq_oss_devinfo *dp) | |||
438 | client_table[dp->index] = NULL; | 427 | client_table[dp->index] = NULL; |
439 | num_clients--; | 428 | num_clients--; |
440 | 429 | ||
441 | debug_printk(("resetting..\n")); | ||
442 | snd_seq_oss_reset(dp); | 430 | snd_seq_oss_reset(dp); |
443 | 431 | ||
444 | debug_printk(("cleaning up..\n")); | ||
445 | snd_seq_oss_synth_cleanup(dp); | 432 | snd_seq_oss_synth_cleanup(dp); |
446 | snd_seq_oss_midi_cleanup(dp); | 433 | snd_seq_oss_midi_cleanup(dp); |
447 | 434 | ||
448 | /* clear slot */ | 435 | /* clear slot */ |
449 | debug_printk(("releasing resource..\n")); | ||
450 | queue = dp->queue; | 436 | queue = dp->queue; |
451 | if (dp->port >= 0) | 437 | if (dp->port >= 0) |
452 | delete_port(dp); | 438 | delete_port(dp); |
453 | delete_seq_queue(queue); | 439 | delete_seq_queue(queue); |
454 | |||
455 | debug_printk(("release done\n")); | ||
456 | } | 440 | } |
457 | 441 | ||
458 | 442 | ||
@@ -466,7 +450,6 @@ snd_seq_oss_drain_write(struct seq_oss_devinfo *dp) | |||
466 | return; | 450 | return; |
467 | if (is_write_mode(dp->file_mode) && !is_nonblock_mode(dp->file_mode) && | 451 | if (is_write_mode(dp->file_mode) && !is_nonblock_mode(dp->file_mode) && |
468 | dp->writeq) { | 452 | dp->writeq) { |
469 | debug_printk(("syncing..\n")); | ||
470 | while (snd_seq_oss_writeq_sync(dp->writeq)) | 453 | while (snd_seq_oss_writeq_sync(dp->writeq)) |
471 | ; | 454 | ; |
472 | } | 455 | } |
diff --git a/sound/core/seq/oss/seq_oss_ioctl.c b/sound/core/seq/oss/seq_oss_ioctl.c index 5ac701c903c1..5b8520177b0e 100644 --- a/sound/core/seq/oss/seq_oss_ioctl.c +++ b/sound/core/seq/oss/seq_oss_ioctl.c | |||
@@ -90,12 +90,10 @@ snd_seq_oss_ioctl(struct seq_oss_devinfo *dp, unsigned int cmd, unsigned long ca | |||
90 | return snd_seq_oss_timer_ioctl(dp->timer, cmd, arg); | 90 | return snd_seq_oss_timer_ioctl(dp->timer, cmd, arg); |
91 | 91 | ||
92 | case SNDCTL_SEQ_PANIC: | 92 | case SNDCTL_SEQ_PANIC: |
93 | debug_printk(("panic\n")); | ||
94 | snd_seq_oss_reset(dp); | 93 | snd_seq_oss_reset(dp); |
95 | return -EINVAL; | 94 | return -EINVAL; |
96 | 95 | ||
97 | case SNDCTL_SEQ_SYNC: | 96 | case SNDCTL_SEQ_SYNC: |
98 | debug_printk(("sync\n")); | ||
99 | if (! is_write_mode(dp->file_mode) || dp->writeq == NULL) | 97 | if (! is_write_mode(dp->file_mode) || dp->writeq == NULL) |
100 | return 0; | 98 | return 0; |
101 | while (snd_seq_oss_writeq_sync(dp->writeq)) | 99 | while (snd_seq_oss_writeq_sync(dp->writeq)) |
@@ -105,55 +103,45 @@ snd_seq_oss_ioctl(struct seq_oss_devinfo *dp, unsigned int cmd, unsigned long ca | |||
105 | return 0; | 103 | return 0; |
106 | 104 | ||
107 | case SNDCTL_SEQ_RESET: | 105 | case SNDCTL_SEQ_RESET: |
108 | debug_printk(("reset\n")); | ||
109 | snd_seq_oss_reset(dp); | 106 | snd_seq_oss_reset(dp); |
110 | return 0; | 107 | return 0; |
111 | 108 | ||
112 | case SNDCTL_SEQ_TESTMIDI: | 109 | case SNDCTL_SEQ_TESTMIDI: |
113 | debug_printk(("test midi\n")); | ||
114 | if (get_user(dev, p)) | 110 | if (get_user(dev, p)) |
115 | return -EFAULT; | 111 | return -EFAULT; |
116 | return snd_seq_oss_midi_open(dp, dev, dp->file_mode); | 112 | return snd_seq_oss_midi_open(dp, dev, dp->file_mode); |
117 | 113 | ||
118 | case SNDCTL_SEQ_GETINCOUNT: | 114 | case SNDCTL_SEQ_GETINCOUNT: |
119 | debug_printk(("get in count\n")); | ||
120 | if (dp->readq == NULL || ! is_read_mode(dp->file_mode)) | 115 | if (dp->readq == NULL || ! is_read_mode(dp->file_mode)) |
121 | return 0; | 116 | return 0; |
122 | return put_user(dp->readq->qlen, p) ? -EFAULT : 0; | 117 | return put_user(dp->readq->qlen, p) ? -EFAULT : 0; |
123 | 118 | ||
124 | case SNDCTL_SEQ_GETOUTCOUNT: | 119 | case SNDCTL_SEQ_GETOUTCOUNT: |
125 | debug_printk(("get out count\n")); | ||
126 | if (! is_write_mode(dp->file_mode) || dp->writeq == NULL) | 120 | if (! is_write_mode(dp->file_mode) || dp->writeq == NULL) |
127 | return 0; | 121 | return 0; |
128 | return put_user(snd_seq_oss_writeq_get_free_size(dp->writeq), p) ? -EFAULT : 0; | 122 | return put_user(snd_seq_oss_writeq_get_free_size(dp->writeq), p) ? -EFAULT : 0; |
129 | 123 | ||
130 | case SNDCTL_SEQ_GETTIME: | 124 | case SNDCTL_SEQ_GETTIME: |
131 | debug_printk(("get time\n")); | ||
132 | return put_user(snd_seq_oss_timer_cur_tick(dp->timer), p) ? -EFAULT : 0; | 125 | return put_user(snd_seq_oss_timer_cur_tick(dp->timer), p) ? -EFAULT : 0; |
133 | 126 | ||
134 | case SNDCTL_SEQ_RESETSAMPLES: | 127 | case SNDCTL_SEQ_RESETSAMPLES: |
135 | debug_printk(("reset samples\n")); | ||
136 | if (get_user(dev, p)) | 128 | if (get_user(dev, p)) |
137 | return -EFAULT; | 129 | return -EFAULT; |
138 | return snd_seq_oss_synth_ioctl(dp, dev, cmd, carg); | 130 | return snd_seq_oss_synth_ioctl(dp, dev, cmd, carg); |
139 | 131 | ||
140 | case SNDCTL_SEQ_NRSYNTHS: | 132 | case SNDCTL_SEQ_NRSYNTHS: |
141 | debug_printk(("nr synths\n")); | ||
142 | return put_user(dp->max_synthdev, p) ? -EFAULT : 0; | 133 | return put_user(dp->max_synthdev, p) ? -EFAULT : 0; |
143 | 134 | ||
144 | case SNDCTL_SEQ_NRMIDIS: | 135 | case SNDCTL_SEQ_NRMIDIS: |
145 | debug_printk(("nr midis\n")); | ||
146 | return put_user(dp->max_mididev, p) ? -EFAULT : 0; | 136 | return put_user(dp->max_mididev, p) ? -EFAULT : 0; |
147 | 137 | ||
148 | case SNDCTL_SYNTH_MEMAVL: | 138 | case SNDCTL_SYNTH_MEMAVL: |
149 | debug_printk(("mem avail\n")); | ||
150 | if (get_user(dev, p)) | 139 | if (get_user(dev, p)) |
151 | return -EFAULT; | 140 | return -EFAULT; |
152 | val = snd_seq_oss_synth_ioctl(dp, dev, cmd, carg); | 141 | val = snd_seq_oss_synth_ioctl(dp, dev, cmd, carg); |
153 | return put_user(val, p) ? -EFAULT : 0; | 142 | return put_user(val, p) ? -EFAULT : 0; |
154 | 143 | ||
155 | case SNDCTL_FM_4OP_ENABLE: | 144 | case SNDCTL_FM_4OP_ENABLE: |
156 | debug_printk(("4op\n")); | ||
157 | if (get_user(dev, p)) | 145 | if (get_user(dev, p)) |
158 | return -EFAULT; | 146 | return -EFAULT; |
159 | snd_seq_oss_synth_ioctl(dp, dev, cmd, carg); | 147 | snd_seq_oss_synth_ioctl(dp, dev, cmd, carg); |
@@ -161,19 +149,15 @@ snd_seq_oss_ioctl(struct seq_oss_devinfo *dp, unsigned int cmd, unsigned long ca | |||
161 | 149 | ||
162 | case SNDCTL_SYNTH_INFO: | 150 | case SNDCTL_SYNTH_INFO: |
163 | case SNDCTL_SYNTH_ID: | 151 | case SNDCTL_SYNTH_ID: |
164 | debug_printk(("synth info\n")); | ||
165 | return snd_seq_oss_synth_info_user(dp, arg); | 152 | return snd_seq_oss_synth_info_user(dp, arg); |
166 | 153 | ||
167 | case SNDCTL_SEQ_OUTOFBAND: | 154 | case SNDCTL_SEQ_OUTOFBAND: |
168 | debug_printk(("out of band\n")); | ||
169 | return snd_seq_oss_oob_user(dp, arg); | 155 | return snd_seq_oss_oob_user(dp, arg); |
170 | 156 | ||
171 | case SNDCTL_MIDI_INFO: | 157 | case SNDCTL_MIDI_INFO: |
172 | debug_printk(("midi info\n")); | ||
173 | return snd_seq_oss_midi_info_user(dp, arg); | 158 | return snd_seq_oss_midi_info_user(dp, arg); |
174 | 159 | ||
175 | case SNDCTL_SEQ_THRESHOLD: | 160 | case SNDCTL_SEQ_THRESHOLD: |
176 | debug_printk(("threshold\n")); | ||
177 | if (! is_write_mode(dp->file_mode)) | 161 | if (! is_write_mode(dp->file_mode)) |
178 | return 0; | 162 | return 0; |
179 | if (get_user(val, p)) | 163 | if (get_user(val, p)) |
@@ -186,7 +170,6 @@ snd_seq_oss_ioctl(struct seq_oss_devinfo *dp, unsigned int cmd, unsigned long ca | |||
186 | return 0; | 170 | return 0; |
187 | 171 | ||
188 | case SNDCTL_MIDI_PRETIME: | 172 | case SNDCTL_MIDI_PRETIME: |
189 | debug_printk(("pretime\n")); | ||
190 | if (dp->readq == NULL || !is_read_mode(dp->file_mode)) | 173 | if (dp->readq == NULL || !is_read_mode(dp->file_mode)) |
191 | return 0; | 174 | return 0; |
192 | if (get_user(val, p)) | 175 | if (get_user(val, p)) |
@@ -199,7 +182,6 @@ snd_seq_oss_ioctl(struct seq_oss_devinfo *dp, unsigned int cmd, unsigned long ca | |||
199 | return put_user(val, p) ? -EFAULT : 0; | 182 | return put_user(val, p) ? -EFAULT : 0; |
200 | 183 | ||
201 | default: | 184 | default: |
202 | debug_printk(("others\n")); | ||
203 | if (! is_write_mode(dp->file_mode)) | 185 | if (! is_write_mode(dp->file_mode)) |
204 | return -EIO; | 186 | return -EIO; |
205 | return snd_seq_oss_synth_ioctl(dp, 0, cmd, carg); | 187 | return snd_seq_oss_synth_ioctl(dp, 0, cmd, carg); |
diff --git a/sound/core/seq/oss/seq_oss_midi.c b/sound/core/seq/oss/seq_oss_midi.c index 862d84893ee8..3a4569669efa 100644 --- a/sound/core/seq/oss/seq_oss_midi.c +++ b/sound/core/seq/oss/seq_oss_midi.c | |||
@@ -153,7 +153,6 @@ snd_seq_oss_midi_check_new_port(struct snd_seq_port_info *pinfo) | |||
153 | struct seq_oss_midi *mdev; | 153 | struct seq_oss_midi *mdev; |
154 | unsigned long flags; | 154 | unsigned long flags; |
155 | 155 | ||
156 | debug_printk(("check for MIDI client %d port %d\n", pinfo->addr.client, pinfo->addr.port)); | ||
157 | /* the port must include generic midi */ | 156 | /* the port must include generic midi */ |
158 | if (! (pinfo->type & SNDRV_SEQ_PORT_TYPE_MIDI_GENERIC)) | 157 | if (! (pinfo->type & SNDRV_SEQ_PORT_TYPE_MIDI_GENERIC)) |
159 | return 0; | 158 | return 0; |
@@ -175,7 +174,7 @@ snd_seq_oss_midi_check_new_port(struct snd_seq_port_info *pinfo) | |||
175 | * allocate midi info record | 174 | * allocate midi info record |
176 | */ | 175 | */ |
177 | if ((mdev = kzalloc(sizeof(*mdev), GFP_KERNEL)) == NULL) { | 176 | if ((mdev = kzalloc(sizeof(*mdev), GFP_KERNEL)) == NULL) { |
178 | snd_printk(KERN_ERR "can't malloc midi info\n"); | 177 | pr_err("ALSA: seq_oss: can't malloc midi info\n"); |
179 | return -ENOMEM; | 178 | return -ENOMEM; |
180 | } | 179 | } |
181 | 180 | ||
@@ -191,7 +190,7 @@ snd_seq_oss_midi_check_new_port(struct snd_seq_port_info *pinfo) | |||
191 | 190 | ||
192 | /* create MIDI coder */ | 191 | /* create MIDI coder */ |
193 | if (snd_midi_event_new(MAX_MIDI_EVENT_BUF, &mdev->coder) < 0) { | 192 | if (snd_midi_event_new(MAX_MIDI_EVENT_BUF, &mdev->coder) < 0) { |
194 | snd_printk(KERN_ERR "can't malloc midi coder\n"); | 193 | pr_err("ALSA: seq_oss: can't malloc midi coder\n"); |
195 | kfree(mdev); | 194 | kfree(mdev); |
196 | return -ENOMEM; | 195 | return -ENOMEM; |
197 | } | 196 | } |
@@ -406,7 +405,6 @@ snd_seq_oss_midi_close(struct seq_oss_devinfo *dp, int dev) | |||
406 | return 0; | 405 | return 0; |
407 | } | 406 | } |
408 | 407 | ||
409 | debug_printk(("closing client %d port %d mode %d\n", mdev->client, mdev->port, mdev->opened)); | ||
410 | memset(&subs, 0, sizeof(subs)); | 408 | memset(&subs, 0, sizeof(subs)); |
411 | if (mdev->opened & PERM_WRITE) { | 409 | if (mdev->opened & PERM_WRITE) { |
412 | subs.sender = dp->addr; | 410 | subs.sender = dp->addr; |
@@ -470,7 +468,6 @@ snd_seq_oss_midi_reset(struct seq_oss_devinfo *dp, int dev) | |||
470 | struct snd_seq_event ev; | 468 | struct snd_seq_event ev; |
471 | int c; | 469 | int c; |
472 | 470 | ||
473 | debug_printk(("resetting client %d port %d\n", mdev->client, mdev->port)); | ||
474 | memset(&ev, 0, sizeof(ev)); | 471 | memset(&ev, 0, sizeof(ev)); |
475 | ev.dest.client = mdev->client; | 472 | ev.dest.client = mdev->client; |
476 | ev.dest.port = mdev->port; | 473 | ev.dest.port = mdev->port; |
diff --git a/sound/core/seq/oss/seq_oss_readq.c b/sound/core/seq/oss/seq_oss_readq.c index 73661c4ab82a..654d17a5023c 100644 --- a/sound/core/seq/oss/seq_oss_readq.c +++ b/sound/core/seq/oss/seq_oss_readq.c | |||
@@ -48,12 +48,12 @@ snd_seq_oss_readq_new(struct seq_oss_devinfo *dp, int maxlen) | |||
48 | struct seq_oss_readq *q; | 48 | struct seq_oss_readq *q; |
49 | 49 | ||
50 | if ((q = kzalloc(sizeof(*q), GFP_KERNEL)) == NULL) { | 50 | if ((q = kzalloc(sizeof(*q), GFP_KERNEL)) == NULL) { |
51 | snd_printk(KERN_ERR "can't malloc read queue\n"); | 51 | pr_err("ALSA: seq_oss: can't malloc read queue\n"); |
52 | return NULL; | 52 | return NULL; |
53 | } | 53 | } |
54 | 54 | ||
55 | if ((q->q = kcalloc(maxlen, sizeof(union evrec), GFP_KERNEL)) == NULL) { | 55 | if ((q->q = kcalloc(maxlen, sizeof(union evrec), GFP_KERNEL)) == NULL) { |
56 | snd_printk(KERN_ERR "can't malloc read queue buffer\n"); | 56 | pr_err("ALSA: seq_oss: can't malloc read queue buffer\n"); |
57 | kfree(q); | 57 | kfree(q); |
58 | return NULL; | 58 | return NULL; |
59 | } | 59 | } |
diff --git a/sound/core/seq/oss/seq_oss_synth.c b/sound/core/seq/oss/seq_oss_synth.c index c5b773a1eea9..701feb71b700 100644 --- a/sound/core/seq/oss/seq_oss_synth.c +++ b/sound/core/seq/oss/seq_oss_synth.c | |||
@@ -106,7 +106,7 @@ snd_seq_oss_synth_register(struct snd_seq_device *dev) | |||
106 | unsigned long flags; | 106 | unsigned long flags; |
107 | 107 | ||
108 | if ((rec = kzalloc(sizeof(*rec), GFP_KERNEL)) == NULL) { | 108 | if ((rec = kzalloc(sizeof(*rec), GFP_KERNEL)) == NULL) { |
109 | snd_printk(KERN_ERR "can't malloc synth info\n"); | 109 | pr_err("ALSA: seq_oss: can't malloc synth info\n"); |
110 | return -ENOMEM; | 110 | return -ENOMEM; |
111 | } | 111 | } |
112 | rec->seq_device = -1; | 112 | rec->seq_device = -1; |
@@ -130,7 +130,7 @@ snd_seq_oss_synth_register(struct snd_seq_device *dev) | |||
130 | if (i >= max_synth_devs) { | 130 | if (i >= max_synth_devs) { |
131 | if (max_synth_devs >= SNDRV_SEQ_OSS_MAX_SYNTH_DEVS) { | 131 | if (max_synth_devs >= SNDRV_SEQ_OSS_MAX_SYNTH_DEVS) { |
132 | spin_unlock_irqrestore(®ister_lock, flags); | 132 | spin_unlock_irqrestore(®ister_lock, flags); |
133 | snd_printk(KERN_ERR "no more synth slot\n"); | 133 | pr_err("ALSA: seq_oss: no more synth slot\n"); |
134 | kfree(rec); | 134 | kfree(rec); |
135 | return -ENOMEM; | 135 | return -ENOMEM; |
136 | } | 136 | } |
@@ -138,7 +138,6 @@ snd_seq_oss_synth_register(struct snd_seq_device *dev) | |||
138 | } | 138 | } |
139 | rec->seq_device = i; | 139 | rec->seq_device = i; |
140 | synth_devs[i] = rec; | 140 | synth_devs[i] = rec; |
141 | debug_printk(("synth %s registered %d\n", rec->name, i)); | ||
142 | spin_unlock_irqrestore(®ister_lock, flags); | 141 | spin_unlock_irqrestore(®ister_lock, flags); |
143 | dev->driver_data = rec; | 142 | dev->driver_data = rec; |
144 | #ifdef SNDRV_OSS_INFO_DEV_SYNTH | 143 | #ifdef SNDRV_OSS_INFO_DEV_SYNTH |
@@ -163,7 +162,7 @@ snd_seq_oss_synth_unregister(struct snd_seq_device *dev) | |||
163 | } | 162 | } |
164 | if (index >= max_synth_devs) { | 163 | if (index >= max_synth_devs) { |
165 | spin_unlock_irqrestore(®ister_lock, flags); | 164 | spin_unlock_irqrestore(®ister_lock, flags); |
166 | snd_printk(KERN_ERR "can't unregister synth\n"); | 165 | pr_err("ALSA: seq_oss: can't unregister synth\n"); |
167 | return -EINVAL; | 166 | return -EINVAL; |
168 | } | 167 | } |
169 | synth_devs[index] = NULL; | 168 | synth_devs[index] = NULL; |
@@ -248,7 +247,7 @@ snd_seq_oss_synth_setup(struct seq_oss_devinfo *dp) | |||
248 | if (info->nr_voices > 0) { | 247 | if (info->nr_voices > 0) { |
249 | info->ch = kcalloc(info->nr_voices, sizeof(struct seq_oss_chinfo), GFP_KERNEL); | 248 | info->ch = kcalloc(info->nr_voices, sizeof(struct seq_oss_chinfo), GFP_KERNEL); |
250 | if (!info->ch) { | 249 | if (!info->ch) { |
251 | snd_printk(KERN_ERR "Cannot malloc\n"); | 250 | pr_err("ALSA: seq_oss: Cannot malloc voices\n"); |
252 | rec->oper.close(&info->arg); | 251 | rec->oper.close(&info->arg); |
253 | module_put(rec->oper.owner); | 252 | module_put(rec->oper.owner); |
254 | snd_use_lock_free(&rec->use_lock); | 253 | snd_use_lock_free(&rec->use_lock); |
@@ -256,7 +255,6 @@ snd_seq_oss_synth_setup(struct seq_oss_devinfo *dp) | |||
256 | } | 255 | } |
257 | reset_channels(info); | 256 | reset_channels(info); |
258 | } | 257 | } |
259 | debug_printk(("synth %d assigned\n", i)); | ||
260 | info->opened++; | 258 | info->opened++; |
261 | rec->opened++; | 259 | rec->opened++; |
262 | dp->synth_opened++; | 260 | dp->synth_opened++; |
@@ -326,7 +324,6 @@ snd_seq_oss_synth_cleanup(struct seq_oss_devinfo *dp) | |||
326 | if (rec == NULL) | 324 | if (rec == NULL) |
327 | continue; | 325 | continue; |
328 | if (rec->opened > 0) { | 326 | if (rec->opened > 0) { |
329 | debug_printk(("synth %d closed\n", i)); | ||
330 | rec->oper.close(&info->arg); | 327 | rec->oper.close(&info->arg); |
331 | module_put(rec->oper.owner); | 328 | module_put(rec->oper.owner); |
332 | rec->opened = 0; | 329 | rec->opened = 0; |
diff --git a/sound/core/seq/oss/seq_oss_timer.c b/sound/core/seq/oss/seq_oss_timer.c index ab59cbfbcaf2..4f24ea9fad93 100644 --- a/sound/core/seq/oss/seq_oss_timer.c +++ b/sound/core/seq/oss/seq_oss_timer.c | |||
@@ -233,7 +233,6 @@ snd_seq_oss_timer_ioctl(struct seq_oss_timer *timer, unsigned int cmd, int __use | |||
233 | int value; | 233 | int value; |
234 | 234 | ||
235 | if (cmd == SNDCTL_SEQ_CTRLRATE) { | 235 | if (cmd == SNDCTL_SEQ_CTRLRATE) { |
236 | debug_printk(("ctrl rate\n")); | ||
237 | /* if *arg == 0, just return the current rate */ | 236 | /* if *arg == 0, just return the current rate */ |
238 | if (get_user(value, arg)) | 237 | if (get_user(value, arg)) |
239 | return -EFAULT; | 238 | return -EFAULT; |
@@ -248,21 +247,16 @@ snd_seq_oss_timer_ioctl(struct seq_oss_timer *timer, unsigned int cmd, int __use | |||
248 | 247 | ||
249 | switch (cmd) { | 248 | switch (cmd) { |
250 | case SNDCTL_TMR_START: | 249 | case SNDCTL_TMR_START: |
251 | debug_printk(("timer start\n")); | ||
252 | return snd_seq_oss_timer_start(timer); | 250 | return snd_seq_oss_timer_start(timer); |
253 | case SNDCTL_TMR_STOP: | 251 | case SNDCTL_TMR_STOP: |
254 | debug_printk(("timer stop\n")); | ||
255 | return snd_seq_oss_timer_stop(timer); | 252 | return snd_seq_oss_timer_stop(timer); |
256 | case SNDCTL_TMR_CONTINUE: | 253 | case SNDCTL_TMR_CONTINUE: |
257 | debug_printk(("timer continue\n")); | ||
258 | return snd_seq_oss_timer_continue(timer); | 254 | return snd_seq_oss_timer_continue(timer); |
259 | case SNDCTL_TMR_TEMPO: | 255 | case SNDCTL_TMR_TEMPO: |
260 | debug_printk(("timer tempo\n")); | ||
261 | if (get_user(value, arg)) | 256 | if (get_user(value, arg)) |
262 | return -EFAULT; | 257 | return -EFAULT; |
263 | return snd_seq_oss_timer_tempo(timer, value); | 258 | return snd_seq_oss_timer_tempo(timer, value); |
264 | case SNDCTL_TMR_TIMEBASE: | 259 | case SNDCTL_TMR_TIMEBASE: |
265 | debug_printk(("timer timebase\n")); | ||
266 | if (get_user(value, arg)) | 260 | if (get_user(value, arg)) |
267 | return -EFAULT; | 261 | return -EFAULT; |
268 | if (value < MIN_OSS_TIMEBASE) | 262 | if (value < MIN_OSS_TIMEBASE) |
@@ -276,7 +270,6 @@ snd_seq_oss_timer_ioctl(struct seq_oss_timer *timer, unsigned int cmd, int __use | |||
276 | case SNDCTL_TMR_METRONOME: | 270 | case SNDCTL_TMR_METRONOME: |
277 | case SNDCTL_TMR_SELECT: | 271 | case SNDCTL_TMR_SELECT: |
278 | case SNDCTL_TMR_SOURCE: | 272 | case SNDCTL_TMR_SOURCE: |
279 | debug_printk(("timer XXX\n")); | ||
280 | /* not supported */ | 273 | /* not supported */ |
281 | return 0; | 274 | return 0; |
282 | } | 275 | } |
diff --git a/sound/core/seq/seq_clientmgr.c b/sound/core/seq/seq_clientmgr.c index 4dc6bae80e15..9ca5e647e54b 100644 --- a/sound/core/seq/seq_clientmgr.c +++ b/sound/core/seq/seq_clientmgr.c | |||
@@ -123,7 +123,7 @@ static inline int snd_seq_write_pool_allocated(struct snd_seq_client *client) | |||
123 | static struct snd_seq_client *clientptr(int clientid) | 123 | static struct snd_seq_client *clientptr(int clientid) |
124 | { | 124 | { |
125 | if (clientid < 0 || clientid >= SNDRV_SEQ_MAX_CLIENTS) { | 125 | if (clientid < 0 || clientid >= SNDRV_SEQ_MAX_CLIENTS) { |
126 | snd_printd("Seq: oops. Trying to get pointer to client %d\n", | 126 | pr_debug("ALSA: seq: oops. Trying to get pointer to client %d\n", |
127 | clientid); | 127 | clientid); |
128 | return NULL; | 128 | return NULL; |
129 | } | 129 | } |
@@ -136,7 +136,7 @@ struct snd_seq_client *snd_seq_client_use_ptr(int clientid) | |||
136 | struct snd_seq_client *client; | 136 | struct snd_seq_client *client; |
137 | 137 | ||
138 | if (clientid < 0 || clientid >= SNDRV_SEQ_MAX_CLIENTS) { | 138 | if (clientid < 0 || clientid >= SNDRV_SEQ_MAX_CLIENTS) { |
139 | snd_printd("Seq: oops. Trying to get pointer to client %d\n", | 139 | pr_debug("ALSA: seq: oops. Trying to get pointer to client %d\n", |
140 | clientid); | 140 | clientid); |
141 | return NULL; | 141 | return NULL; |
142 | } | 142 | } |
@@ -291,8 +291,8 @@ static void seq_free_client(struct snd_seq_client * client) | |||
291 | mutex_lock(®ister_mutex); | 291 | mutex_lock(®ister_mutex); |
292 | switch (client->type) { | 292 | switch (client->type) { |
293 | case NO_CLIENT: | 293 | case NO_CLIENT: |
294 | snd_printk(KERN_WARNING "Seq: Trying to free unused client %d\n", | 294 | pr_warn("ALSA: seq: Trying to free unused client %d\n", |
295 | client->number); | 295 | client->number); |
296 | break; | 296 | break; |
297 | case USER_CLIENT: | 297 | case USER_CLIENT: |
298 | case KERNEL_CLIENT: | 298 | case KERNEL_CLIENT: |
@@ -301,7 +301,7 @@ static void seq_free_client(struct snd_seq_client * client) | |||
301 | break; | 301 | break; |
302 | 302 | ||
303 | default: | 303 | default: |
304 | snd_printk(KERN_ERR "Seq: Trying to free client %d with undefined type = %d\n", | 304 | pr_err("ALSA: seq: Trying to free client %d with undefined type = %d\n", |
305 | client->number, client->type); | 305 | client->number, client->type); |
306 | } | 306 | } |
307 | mutex_unlock(®ister_mutex); | 307 | mutex_unlock(®ister_mutex); |
@@ -773,7 +773,7 @@ static int broadcast_event(struct snd_seq_client *client, | |||
773 | static int multicast_event(struct snd_seq_client *client, struct snd_seq_event *event, | 773 | static int multicast_event(struct snd_seq_client *client, struct snd_seq_event *event, |
774 | int atomic, int hop) | 774 | int atomic, int hop) |
775 | { | 775 | { |
776 | snd_printd("seq: multicast not supported yet.\n"); | 776 | pr_debug("ALSA: seq: multicast not supported yet.\n"); |
777 | return 0; /* ignored */ | 777 | return 0; /* ignored */ |
778 | } | 778 | } |
779 | #endif /* SUPPORT_BROADCAST */ | 779 | #endif /* SUPPORT_BROADCAST */ |
@@ -794,7 +794,7 @@ static int snd_seq_deliver_event(struct snd_seq_client *client, struct snd_seq_e | |||
794 | 794 | ||
795 | hop++; | 795 | hop++; |
796 | if (hop >= SNDRV_SEQ_MAX_HOPS) { | 796 | if (hop >= SNDRV_SEQ_MAX_HOPS) { |
797 | snd_printd("too long delivery path (%d:%d->%d:%d)\n", | 797 | pr_debug("ALSA: seq: too long delivery path (%d:%d->%d:%d)\n", |
798 | event->source.client, event->source.port, | 798 | event->source.client, event->source.port, |
799 | event->dest.client, event->dest.port); | 799 | event->dest.client, event->dest.port); |
800 | return -EMLINK; | 800 | return -EMLINK; |
@@ -2196,7 +2196,7 @@ static int snd_seq_do_ioctl(struct snd_seq_client *client, unsigned int cmd, | |||
2196 | if (p->cmd == cmd) | 2196 | if (p->cmd == cmd) |
2197 | return p->func(client, arg); | 2197 | return p->func(client, arg); |
2198 | } | 2198 | } |
2199 | snd_printd("seq unknown ioctl() 0x%x (type='%c', number=0x%02x)\n", | 2199 | pr_debug("ALSA: seq unknown ioctl() 0x%x (type='%c', number=0x%02x)\n", |
2200 | cmd, _IOC_TYPE(cmd), _IOC_NR(cmd)); | 2200 | cmd, _IOC_TYPE(cmd), _IOC_NR(cmd)); |
2201 | return -ENOTTY; | 2201 | return -ENOTTY; |
2202 | } | 2202 | } |
diff --git a/sound/core/seq/seq_device.c b/sound/core/seq/seq_device.c index 040c60e1da28..91a786a783e1 100644 --- a/sound/core/seq/seq_device.c +++ b/sound/core/seq/seq_device.c | |||
@@ -168,7 +168,7 @@ void snd_seq_device_load_drivers(void) | |||
168 | 168 | ||
169 | /* | 169 | /* |
170 | * register a sequencer device | 170 | * register a sequencer device |
171 | * card = card info (NULL allowed) | 171 | * card = card info |
172 | * device = device number (if any) | 172 | * device = device number (if any) |
173 | * id = id of driver | 173 | * id = id of driver |
174 | * result = return pointer (NULL allowed if unnecessary) | 174 | * result = return pointer (NULL allowed if unnecessary) |
@@ -325,7 +325,7 @@ int snd_seq_device_register_driver(char *id, struct snd_seq_dev_ops *entry, | |||
325 | return -ENOMEM; | 325 | return -ENOMEM; |
326 | } | 326 | } |
327 | if (ops->driver & DRIVER_LOADED) { | 327 | if (ops->driver & DRIVER_LOADED) { |
328 | snd_printk(KERN_WARNING "driver_register: driver '%s' already exists\n", id); | 328 | pr_warn("ALSA: seq: driver_register: driver '%s' already exists\n", id); |
329 | unlock_driver(ops); | 329 | unlock_driver(ops); |
330 | snd_seq_autoload_unlock(); | 330 | snd_seq_autoload_unlock(); |
331 | return -EBUSY; | 331 | return -EBUSY; |
@@ -398,7 +398,7 @@ int snd_seq_device_unregister_driver(char *id) | |||
398 | return -ENXIO; | 398 | return -ENXIO; |
399 | if (! (ops->driver & DRIVER_LOADED) || | 399 | if (! (ops->driver & DRIVER_LOADED) || |
400 | (ops->driver & DRIVER_LOCKED)) { | 400 | (ops->driver & DRIVER_LOCKED)) { |
401 | snd_printk(KERN_ERR "driver_unregister: cannot unload driver '%s': status=%x\n", | 401 | pr_err("ALSA: seq: driver_unregister: cannot unload driver '%s': status=%x\n", |
402 | id, ops->driver); | 402 | id, ops->driver); |
403 | unlock_driver(ops); | 403 | unlock_driver(ops); |
404 | return -EBUSY; | 404 | return -EBUSY; |
@@ -413,7 +413,7 @@ int snd_seq_device_unregister_driver(char *id) | |||
413 | 413 | ||
414 | ops->driver = 0; | 414 | ops->driver = 0; |
415 | if (ops->num_init_devices > 0) | 415 | if (ops->num_init_devices > 0) |
416 | snd_printk(KERN_ERR "free_driver: init_devices > 0!! (%d)\n", | 416 | pr_err("ALSA: seq: free_driver: init_devices > 0!! (%d)\n", |
417 | ops->num_init_devices); | 417 | ops->num_init_devices); |
418 | mutex_unlock(&ops->reg_mutex); | 418 | mutex_unlock(&ops->reg_mutex); |
419 | 419 | ||
@@ -459,7 +459,7 @@ static int init_device(struct snd_seq_device *dev, struct ops_list *ops) | |||
459 | if (dev->status != SNDRV_SEQ_DEVICE_FREE) | 459 | if (dev->status != SNDRV_SEQ_DEVICE_FREE) |
460 | return 0; /* already initialized */ | 460 | return 0; /* already initialized */ |
461 | if (ops->argsize != dev->argsize) { | 461 | if (ops->argsize != dev->argsize) { |
462 | snd_printk(KERN_ERR "incompatible device '%s' for plug-in '%s' (%d %d)\n", | 462 | pr_err("ALSA: seq: incompatible device '%s' for plug-in '%s' (%d %d)\n", |
463 | dev->name, ops->id, ops->argsize, dev->argsize); | 463 | dev->name, ops->id, ops->argsize, dev->argsize); |
464 | return -EINVAL; | 464 | return -EINVAL; |
465 | } | 465 | } |
@@ -467,7 +467,7 @@ static int init_device(struct snd_seq_device *dev, struct ops_list *ops) | |||
467 | dev->status = SNDRV_SEQ_DEVICE_REGISTERED; | 467 | dev->status = SNDRV_SEQ_DEVICE_REGISTERED; |
468 | ops->num_init_devices++; | 468 | ops->num_init_devices++; |
469 | } else { | 469 | } else { |
470 | snd_printk(KERN_ERR "init_device failed: %s: %s\n", | 470 | pr_err("ALSA: seq: init_device failed: %s: %s\n", |
471 | dev->name, dev->id); | 471 | dev->name, dev->id); |
472 | } | 472 | } |
473 | 473 | ||
@@ -486,7 +486,7 @@ static int free_device(struct snd_seq_device *dev, struct ops_list *ops) | |||
486 | if (dev->status != SNDRV_SEQ_DEVICE_REGISTERED) | 486 | if (dev->status != SNDRV_SEQ_DEVICE_REGISTERED) |
487 | return 0; /* not registered */ | 487 | return 0; /* not registered */ |
488 | if (ops->argsize != dev->argsize) { | 488 | if (ops->argsize != dev->argsize) { |
489 | snd_printk(KERN_ERR "incompatible device '%s' for plug-in '%s' (%d %d)\n", | 489 | pr_err("ALSA: seq: incompatible device '%s' for plug-in '%s' (%d %d)\n", |
490 | dev->name, ops->id, ops->argsize, dev->argsize); | 490 | dev->name, ops->id, ops->argsize, dev->argsize); |
491 | return -EINVAL; | 491 | return -EINVAL; |
492 | } | 492 | } |
@@ -495,7 +495,7 @@ static int free_device(struct snd_seq_device *dev, struct ops_list *ops) | |||
495 | dev->driver_data = NULL; | 495 | dev->driver_data = NULL; |
496 | ops->num_init_devices--; | 496 | ops->num_init_devices--; |
497 | } else { | 497 | } else { |
498 | snd_printk(KERN_ERR "free_device failed: %s: %s\n", | 498 | pr_err("ALSA: seq: free_device failed: %s: %s\n", |
499 | dev->name, dev->id); | 499 | dev->name, dev->id); |
500 | } | 500 | } |
501 | 501 | ||
@@ -559,7 +559,7 @@ static void __exit alsa_seq_device_exit(void) | |||
559 | snd_info_free_entry(info_entry); | 559 | snd_info_free_entry(info_entry); |
560 | #endif | 560 | #endif |
561 | if (num_ops) | 561 | if (num_ops) |
562 | snd_printk(KERN_ERR "drivers not released (%d)\n", num_ops); | 562 | pr_err("ALSA: seq: drivers not released (%d)\n", num_ops); |
563 | } | 563 | } |
564 | 564 | ||
565 | module_init(alsa_seq_device_init) | 565 | module_init(alsa_seq_device_init) |
diff --git a/sound/core/seq/seq_dummy.c b/sound/core/seq/seq_dummy.c index dbc550716790..ec667f158f19 100644 --- a/sound/core/seq/seq_dummy.c +++ b/sound/core/seq/seq_dummy.c | |||
@@ -198,7 +198,7 @@ register_client(void) | |||
198 | int i; | 198 | int i; |
199 | 199 | ||
200 | if (ports < 1) { | 200 | if (ports < 1) { |
201 | snd_printk(KERN_ERR "invalid number of ports %d\n", ports); | 201 | pr_err("ALSA: seq_dummy: invalid number of ports %d\n", ports); |
202 | return -EINVAL; | 202 | return -EINVAL; |
203 | } | 203 | } |
204 | 204 | ||
diff --git a/sound/core/seq/seq_fifo.c b/sound/core/seq/seq_fifo.c index 0d75afa786bc..559989992bef 100644 --- a/sound/core/seq/seq_fifo.c +++ b/sound/core/seq/seq_fifo.c | |||
@@ -34,7 +34,7 @@ struct snd_seq_fifo *snd_seq_fifo_new(int poolsize) | |||
34 | 34 | ||
35 | f = kzalloc(sizeof(*f), GFP_KERNEL); | 35 | f = kzalloc(sizeof(*f), GFP_KERNEL); |
36 | if (f == NULL) { | 36 | if (f == NULL) { |
37 | snd_printd("malloc failed for snd_seq_fifo_new() \n"); | 37 | pr_debug("ALSA: seq: malloc failed for snd_seq_fifo_new() \n"); |
38 | return NULL; | 38 | return NULL; |
39 | } | 39 | } |
40 | 40 | ||
diff --git a/sound/core/seq/seq_lock.c b/sound/core/seq/seq_lock.c index 2cfe50c71a9d..3b693e924db7 100644 --- a/sound/core/seq/seq_lock.c +++ b/sound/core/seq/seq_lock.c | |||
@@ -31,12 +31,12 @@ void snd_use_lock_sync_helper(snd_use_lock_t *lockp, const char *file, int line) | |||
31 | int max_count = 5 * HZ; | 31 | int max_count = 5 * HZ; |
32 | 32 | ||
33 | if (atomic_read(lockp) < 0) { | 33 | if (atomic_read(lockp) < 0) { |
34 | printk(KERN_WARNING "seq_lock: lock trouble [counter = %d] in %s:%d\n", atomic_read(lockp), file, line); | 34 | pr_warn("ALSA: seq_lock: lock trouble [counter = %d] in %s:%d\n", atomic_read(lockp), file, line); |
35 | return; | 35 | return; |
36 | } | 36 | } |
37 | while (atomic_read(lockp) > 0) { | 37 | while (atomic_read(lockp) > 0) { |
38 | if (max_count == 0) { | 38 | if (max_count == 0) { |
39 | snd_printk(KERN_WARNING "seq_lock: timeout [%d left] in %s:%d\n", atomic_read(lockp), file, line); | 39 | pr_warn("ALSA: seq_lock: timeout [%d left] in %s:%d\n", atomic_read(lockp), file, line); |
40 | break; | 40 | break; |
41 | } | 41 | } |
42 | schedule_timeout_uninterruptible(1); | 42 | schedule_timeout_uninterruptible(1); |
diff --git a/sound/core/seq/seq_memory.c b/sound/core/seq/seq_memory.c index f478f770bf52..1e206de0c2dd 100644 --- a/sound/core/seq/seq_memory.c +++ b/sound/core/seq/seq_memory.c | |||
@@ -236,7 +236,7 @@ static int snd_seq_cell_alloc(struct snd_seq_pool *pool, | |||
236 | init_waitqueue_entry(&wait, current); | 236 | init_waitqueue_entry(&wait, current); |
237 | spin_lock_irqsave(&pool->lock, flags); | 237 | spin_lock_irqsave(&pool->lock, flags); |
238 | if (pool->ptr == NULL) { /* not initialized */ | 238 | if (pool->ptr == NULL) { /* not initialized */ |
239 | snd_printd("seq: pool is not initialized\n"); | 239 | pr_debug("ALSA: seq: pool is not initialized\n"); |
240 | err = -EINVAL; | 240 | err = -EINVAL; |
241 | goto __error; | 241 | goto __error; |
242 | } | 242 | } |
@@ -388,7 +388,7 @@ int snd_seq_pool_init(struct snd_seq_pool *pool) | |||
388 | 388 | ||
389 | pool->ptr = vmalloc(sizeof(struct snd_seq_event_cell) * pool->size); | 389 | pool->ptr = vmalloc(sizeof(struct snd_seq_event_cell) * pool->size); |
390 | if (pool->ptr == NULL) { | 390 | if (pool->ptr == NULL) { |
391 | snd_printd("seq: malloc for sequencer events failed\n"); | 391 | pr_debug("ALSA: seq: malloc for sequencer events failed\n"); |
392 | return -ENOMEM; | 392 | return -ENOMEM; |
393 | } | 393 | } |
394 | 394 | ||
@@ -431,7 +431,7 @@ int snd_seq_pool_done(struct snd_seq_pool *pool) | |||
431 | 431 | ||
432 | while (atomic_read(&pool->counter) > 0) { | 432 | while (atomic_read(&pool->counter) > 0) { |
433 | if (max_count == 0) { | 433 | if (max_count == 0) { |
434 | snd_printk(KERN_WARNING "snd_seq_pool_done timeout: %d cells remain\n", atomic_read(&pool->counter)); | 434 | pr_warn("ALSA: snd_seq_pool_done timeout: %d cells remain\n", atomic_read(&pool->counter)); |
435 | break; | 435 | break; |
436 | } | 436 | } |
437 | schedule_timeout_uninterruptible(1); | 437 | schedule_timeout_uninterruptible(1); |
@@ -464,7 +464,7 @@ struct snd_seq_pool *snd_seq_pool_new(int poolsize) | |||
464 | /* create pool block */ | 464 | /* create pool block */ |
465 | pool = kzalloc(sizeof(*pool), GFP_KERNEL); | 465 | pool = kzalloc(sizeof(*pool), GFP_KERNEL); |
466 | if (pool == NULL) { | 466 | if (pool == NULL) { |
467 | snd_printd("seq: malloc failed for pool\n"); | 467 | pr_debug("ALSA: seq: malloc failed for pool\n"); |
468 | return NULL; | 468 | return NULL; |
469 | } | 469 | } |
470 | spin_lock_init(&pool->lock); | 470 | spin_lock_init(&pool->lock); |
diff --git a/sound/core/seq/seq_midi.c b/sound/core/seq/seq_midi.c index 64069dbf89ca..3e05c55a2880 100644 --- a/sound/core/seq/seq_midi.c +++ b/sound/core/seq/seq_midi.c | |||
@@ -121,7 +121,7 @@ static int dump_midi(struct snd_rawmidi_substream *substream, const char *buf, i | |||
121 | runtime = substream->runtime; | 121 | runtime = substream->runtime; |
122 | if ((tmp = runtime->avail) < count) { | 122 | if ((tmp = runtime->avail) < count) { |
123 | if (printk_ratelimit()) | 123 | if (printk_ratelimit()) |
124 | snd_printk(KERN_ERR "MIDI output buffer overrun\n"); | 124 | pr_err("ALSA: seq_midi: MIDI output buffer overrun\n"); |
125 | return -ENOMEM; | 125 | return -ENOMEM; |
126 | } | 126 | } |
127 | if (snd_rawmidi_kernel_write(substream, buf, count) < count) | 127 | if (snd_rawmidi_kernel_write(substream, buf, count) < count) |
@@ -145,7 +145,7 @@ static int event_process_midi(struct snd_seq_event *ev, int direct, | |||
145 | if (ev->type == SNDRV_SEQ_EVENT_SYSEX) { /* special case, to save space */ | 145 | if (ev->type == SNDRV_SEQ_EVENT_SYSEX) { /* special case, to save space */ |
146 | if ((ev->flags & SNDRV_SEQ_EVENT_LENGTH_MASK) != SNDRV_SEQ_EVENT_LENGTH_VARIABLE) { | 146 | if ((ev->flags & SNDRV_SEQ_EVENT_LENGTH_MASK) != SNDRV_SEQ_EVENT_LENGTH_VARIABLE) { |
147 | /* invalid event */ | 147 | /* invalid event */ |
148 | snd_printd("seq_midi: invalid sysex event flags = 0x%x\n", ev->flags); | 148 | pr_debug("ALSA: seq_midi: invalid sysex event flags = 0x%x\n", ev->flags); |
149 | return 0; | 149 | return 0; |
150 | } | 150 | } |
151 | snd_seq_dump_var_event(ev, (snd_seq_dump_func_t)dump_midi, substream); | 151 | snd_seq_dump_var_event(ev, (snd_seq_dump_func_t)dump_midi, substream); |
@@ -189,7 +189,7 @@ static int midisynth_subscribe(void *private_data, struct snd_seq_port_subscribe | |||
189 | msynth->subdevice, | 189 | msynth->subdevice, |
190 | SNDRV_RAWMIDI_LFLG_INPUT, | 190 | SNDRV_RAWMIDI_LFLG_INPUT, |
191 | &msynth->input_rfile)) < 0) { | 191 | &msynth->input_rfile)) < 0) { |
192 | snd_printd("midi input open failed!!!\n"); | 192 | pr_debug("ALSA: seq_midi: midi input open failed!!!\n"); |
193 | return err; | 193 | return err; |
194 | } | 194 | } |
195 | runtime = msynth->input_rfile.input->runtime; | 195 | runtime = msynth->input_rfile.input->runtime; |
@@ -231,7 +231,7 @@ static int midisynth_use(void *private_data, struct snd_seq_port_subscribe *info | |||
231 | msynth->subdevice, | 231 | msynth->subdevice, |
232 | SNDRV_RAWMIDI_LFLG_OUTPUT, | 232 | SNDRV_RAWMIDI_LFLG_OUTPUT, |
233 | &msynth->output_rfile)) < 0) { | 233 | &msynth->output_rfile)) < 0) { |
234 | snd_printd("midi output open failed!!!\n"); | 234 | pr_debug("ALSA: seq_midi: midi output open failed!!!\n"); |
235 | return err; | 235 | return err; |
236 | } | 236 | } |
237 | memset(¶ms, 0, sizeof(params)); | 237 | memset(¶ms, 0, sizeof(params)); |
diff --git a/sound/core/seq/seq_midi_emul.c b/sound/core/seq/seq_midi_emul.c index 6f64471ddde3..9b6470cdcf24 100644 --- a/sound/core/seq/seq_midi_emul.c +++ b/sound/core/seq/seq_midi_emul.c | |||
@@ -89,7 +89,7 @@ snd_midi_process_event(struct snd_midi_op *ops, | |||
89 | int dest_channel = 0; | 89 | int dest_channel = 0; |
90 | 90 | ||
91 | if (ev == NULL || chanset == NULL) { | 91 | if (ev == NULL || chanset == NULL) { |
92 | snd_printd("ev or chanbase NULL (snd_midi_process_event)\n"); | 92 | pr_debug("ALSA: seq_midi_emul: ev or chanbase NULL (snd_midi_process_event)\n"); |
93 | return; | 93 | return; |
94 | } | 94 | } |
95 | if (chanset->channels == NULL) | 95 | if (chanset->channels == NULL) |
@@ -98,7 +98,7 @@ snd_midi_process_event(struct snd_midi_op *ops, | |||
98 | if (snd_seq_ev_is_channel_type(ev)) { | 98 | if (snd_seq_ev_is_channel_type(ev)) { |
99 | dest_channel = ev->data.note.channel; | 99 | dest_channel = ev->data.note.channel; |
100 | if (dest_channel >= chanset->max_channels) { | 100 | if (dest_channel >= chanset->max_channels) { |
101 | snd_printd("dest channel is %d, max is %d\n", | 101 | pr_debug("ALSA: seq_midi_emul: dest channel is %d, max is %d\n", |
102 | dest_channel, chanset->max_channels); | 102 | dest_channel, chanset->max_channels); |
103 | return; | 103 | return; |
104 | } | 104 | } |
@@ -232,7 +232,7 @@ snd_midi_process_event(struct snd_midi_op *ops, | |||
232 | case SNDRV_SEQ_EVENT_ECHO: | 232 | case SNDRV_SEQ_EVENT_ECHO: |
233 | not_yet: | 233 | not_yet: |
234 | default: | 234 | default: |
235 | /*snd_printd("Unimplemented event %d\n", ev->type);*/ | 235 | /*pr_debug("ALSA: seq_midi_emul: Unimplemented event %d\n", ev->type);*/ |
236 | break; | 236 | break; |
237 | } | 237 | } |
238 | } | 238 | } |
diff --git a/sound/core/seq/seq_ports.c b/sound/core/seq/seq_ports.c index 9516e5ce3aad..794a341bf0e5 100644 --- a/sound/core/seq/seq_ports.c +++ b/sound/core/seq/seq_ports.c | |||
@@ -135,14 +135,14 @@ struct snd_seq_client_port *snd_seq_create_port(struct snd_seq_client *client, | |||
135 | return NULL; | 135 | return NULL; |
136 | 136 | ||
137 | if (client->num_ports >= SNDRV_SEQ_MAX_PORTS - 1) { | 137 | if (client->num_ports >= SNDRV_SEQ_MAX_PORTS - 1) { |
138 | snd_printk(KERN_WARNING "too many ports for client %d\n", client->number); | 138 | pr_warn("ALSA: seq: too many ports for client %d\n", client->number); |
139 | return NULL; | 139 | return NULL; |
140 | } | 140 | } |
141 | 141 | ||
142 | /* create a new port */ | 142 | /* create a new port */ |
143 | new_port = kzalloc(sizeof(*new_port), GFP_KERNEL); | 143 | new_port = kzalloc(sizeof(*new_port), GFP_KERNEL); |
144 | if (! new_port) { | 144 | if (! new_port) { |
145 | snd_printd("malloc failed for registering client port\n"); | 145 | pr_debug("ALSA: seq: malloc failed for registering client port\n"); |
146 | return NULL; /* failure, out of memory */ | 146 | return NULL; /* failure, out of memory */ |
147 | } | 147 | } |
148 | /* init port data */ | 148 | /* init port data */ |
diff --git a/sound/core/seq/seq_prioq.c b/sound/core/seq/seq_prioq.c index 29896ab23403..021b02bc9330 100644 --- a/sound/core/seq/seq_prioq.c +++ b/sound/core/seq/seq_prioq.c | |||
@@ -60,7 +60,7 @@ struct snd_seq_prioq *snd_seq_prioq_new(void) | |||
60 | 60 | ||
61 | f = kzalloc(sizeof(*f), GFP_KERNEL); | 61 | f = kzalloc(sizeof(*f), GFP_KERNEL); |
62 | if (f == NULL) { | 62 | if (f == NULL) { |
63 | snd_printd("oops: malloc failed for snd_seq_prioq_new()\n"); | 63 | pr_debug("ALSA: seq: malloc failed for snd_seq_prioq_new()\n"); |
64 | return NULL; | 64 | return NULL; |
65 | } | 65 | } |
66 | 66 | ||
@@ -79,7 +79,7 @@ void snd_seq_prioq_delete(struct snd_seq_prioq **fifo) | |||
79 | *fifo = NULL; | 79 | *fifo = NULL; |
80 | 80 | ||
81 | if (f == NULL) { | 81 | if (f == NULL) { |
82 | snd_printd("oops: snd_seq_prioq_delete() called with NULL prioq\n"); | 82 | pr_debug("ALSA: seq: snd_seq_prioq_delete() called with NULL prioq\n"); |
83 | return; | 83 | return; |
84 | } | 84 | } |
85 | 85 | ||
@@ -197,7 +197,7 @@ int snd_seq_prioq_cell_in(struct snd_seq_prioq * f, | |||
197 | cur = cur->next; | 197 | cur = cur->next; |
198 | if (! --count) { | 198 | if (! --count) { |
199 | spin_unlock_irqrestore(&f->lock, flags); | 199 | spin_unlock_irqrestore(&f->lock, flags); |
200 | snd_printk(KERN_ERR "cannot find a pointer.. infinite loop?\n"); | 200 | pr_err("ALSA: seq: cannot find a pointer.. infinite loop?\n"); |
201 | return -EINVAL; | 201 | return -EINVAL; |
202 | } | 202 | } |
203 | } | 203 | } |
@@ -223,7 +223,7 @@ struct snd_seq_event_cell *snd_seq_prioq_cell_out(struct snd_seq_prioq *f) | |||
223 | unsigned long flags; | 223 | unsigned long flags; |
224 | 224 | ||
225 | if (f == NULL) { | 225 | if (f == NULL) { |
226 | snd_printd("oops: snd_seq_prioq_cell_in() called with NULL prioq\n"); | 226 | pr_debug("ALSA: seq: snd_seq_prioq_cell_in() called with NULL prioq\n"); |
227 | return NULL; | 227 | return NULL; |
228 | } | 228 | } |
229 | spin_lock_irqsave(&f->lock, flags); | 229 | spin_lock_irqsave(&f->lock, flags); |
@@ -248,7 +248,7 @@ struct snd_seq_event_cell *snd_seq_prioq_cell_out(struct snd_seq_prioq *f) | |||
248 | int snd_seq_prioq_avail(struct snd_seq_prioq * f) | 248 | int snd_seq_prioq_avail(struct snd_seq_prioq * f) |
249 | { | 249 | { |
250 | if (f == NULL) { | 250 | if (f == NULL) { |
251 | snd_printd("oops: snd_seq_prioq_cell_in() called with NULL prioq\n"); | 251 | pr_debug("ALSA: seq: snd_seq_prioq_cell_in() called with NULL prioq\n"); |
252 | return 0; | 252 | return 0; |
253 | } | 253 | } |
254 | return f->cells; | 254 | return f->cells; |
@@ -259,7 +259,7 @@ int snd_seq_prioq_avail(struct snd_seq_prioq * f) | |||
259 | struct snd_seq_event_cell *snd_seq_prioq_cell_peek(struct snd_seq_prioq * f) | 259 | struct snd_seq_event_cell *snd_seq_prioq_cell_peek(struct snd_seq_prioq * f) |
260 | { | 260 | { |
261 | if (f == NULL) { | 261 | if (f == NULL) { |
262 | snd_printd("oops: snd_seq_prioq_cell_in() called with NULL prioq\n"); | 262 | pr_debug("ALSA: seq: snd_seq_prioq_cell_in() called with NULL prioq\n"); |
263 | return NULL; | 263 | return NULL; |
264 | } | 264 | } |
265 | return f->head; | 265 | return f->head; |
@@ -321,7 +321,7 @@ void snd_seq_prioq_leave(struct snd_seq_prioq * f, int client, int timestamp) | |||
321 | freeprev = cell; | 321 | freeprev = cell; |
322 | } else { | 322 | } else { |
323 | #if 0 | 323 | #if 0 |
324 | printk(KERN_DEBUG "type = %i, source = %i, dest = %i, " | 324 | pr_debug("ALSA: seq: type = %i, source = %i, dest = %i, " |
325 | "client = %i\n", | 325 | "client = %i\n", |
326 | cell->event.type, | 326 | cell->event.type, |
327 | cell->event.source.client, | 327 | cell->event.source.client, |
diff --git a/sound/core/seq/seq_queue.c b/sound/core/seq/seq_queue.c index f9077361c119..aad4878cee55 100644 --- a/sound/core/seq/seq_queue.c +++ b/sound/core/seq/seq_queue.c | |||
@@ -112,7 +112,7 @@ static struct snd_seq_queue *queue_new(int owner, int locked) | |||
112 | 112 | ||
113 | q = kzalloc(sizeof(*q), GFP_KERNEL); | 113 | q = kzalloc(sizeof(*q), GFP_KERNEL); |
114 | if (q == NULL) { | 114 | if (q == NULL) { |
115 | snd_printd("malloc failed for snd_seq_queue_new()\n"); | 115 | pr_debug("ALSA: seq: malloc failed for snd_seq_queue_new()\n"); |
116 | return NULL; | 116 | return NULL; |
117 | } | 117 | } |
118 | 118 | ||
diff --git a/sound/core/seq/seq_timer.c b/sound/core/seq/seq_timer.c index 24d44b2f61ac..e73605393eee 100644 --- a/sound/core/seq/seq_timer.c +++ b/sound/core/seq/seq_timer.c | |||
@@ -57,7 +57,7 @@ struct snd_seq_timer *snd_seq_timer_new(void) | |||
57 | 57 | ||
58 | tmr = kzalloc(sizeof(*tmr), GFP_KERNEL); | 58 | tmr = kzalloc(sizeof(*tmr), GFP_KERNEL); |
59 | if (tmr == NULL) { | 59 | if (tmr == NULL) { |
60 | snd_printd("malloc failed for snd_seq_timer_new() \n"); | 60 | pr_debug("ALSA: seq: malloc failed for snd_seq_timer_new() \n"); |
61 | return NULL; | 61 | return NULL; |
62 | } | 62 | } |
63 | spin_lock_init(&tmr->lock); | 63 | spin_lock_init(&tmr->lock); |
@@ -78,7 +78,7 @@ void snd_seq_timer_delete(struct snd_seq_timer **tmr) | |||
78 | *tmr = NULL; | 78 | *tmr = NULL; |
79 | 79 | ||
80 | if (t == NULL) { | 80 | if (t == NULL) { |
81 | snd_printd("oops: snd_seq_timer_delete() called with NULL timer\n"); | 81 | pr_debug("ALSA: seq: snd_seq_timer_delete() called with NULL timer\n"); |
82 | return; | 82 | return; |
83 | } | 83 | } |
84 | t->running = 0; | 84 | t->running = 0; |
@@ -199,7 +199,7 @@ int snd_seq_timer_set_ppq(struct snd_seq_timer * tmr, int ppq) | |||
199 | /* refuse to change ppq on running timers */ | 199 | /* refuse to change ppq on running timers */ |
200 | /* because it will upset the song position (ticks) */ | 200 | /* because it will upset the song position (ticks) */ |
201 | spin_unlock_irqrestore(&tmr->lock, flags); | 201 | spin_unlock_irqrestore(&tmr->lock, flags); |
202 | snd_printd("seq: cannot change ppq of a running timer\n"); | 202 | pr_debug("ALSA: seq: cannot change ppq of a running timer\n"); |
203 | return -EBUSY; | 203 | return -EBUSY; |
204 | } | 204 | } |
205 | 205 | ||
@@ -252,7 +252,7 @@ int snd_seq_timer_set_skew(struct snd_seq_timer *tmr, unsigned int skew, | |||
252 | 252 | ||
253 | /* FIXME */ | 253 | /* FIXME */ |
254 | if (base != SKEW_BASE) { | 254 | if (base != SKEW_BASE) { |
255 | snd_printd("invalid skew base 0x%x\n", base); | 255 | pr_debug("ALSA: seq: invalid skew base 0x%x\n", base); |
256 | return -EINVAL; | 256 | return -EINVAL; |
257 | } | 257 | } |
258 | spin_lock_irqsave(&tmr->lock, flags); | 258 | spin_lock_irqsave(&tmr->lock, flags); |
@@ -292,7 +292,7 @@ int snd_seq_timer_open(struct snd_seq_queue *q) | |||
292 | } | 292 | } |
293 | } | 293 | } |
294 | if (err < 0) { | 294 | if (err < 0) { |
295 | snd_printk(KERN_ERR "seq fatal error: cannot create timer (%i)\n", err); | 295 | pr_err("ALSA: seq fatal error: cannot create timer (%i)\n", err); |
296 | return err; | 296 | return err; |
297 | } | 297 | } |
298 | t->callback = snd_seq_timer_interrupt; | 298 | t->callback = snd_seq_timer_interrupt; |
diff --git a/sound/core/seq/seq_virmidi.c b/sound/core/seq/seq_virmidi.c index 4b50e604276d..56e0f4cd3f82 100644 --- a/sound/core/seq/seq_virmidi.c +++ b/sound/core/seq/seq_virmidi.c | |||
@@ -446,7 +446,7 @@ static int snd_virmidi_dev_register(struct snd_rawmidi *rmidi) | |||
446 | /* should check presence of port more strictly.. */ | 446 | /* should check presence of port more strictly.. */ |
447 | break; | 447 | break; |
448 | default: | 448 | default: |
449 | snd_printk(KERN_ERR "seq_mode is not set: %d\n", rdev->seq_mode); | 449 | pr_err("ALSA: seq_virmidi: seq_mode is not set: %d\n", rdev->seq_mode); |
450 | return -EINVAL; | 450 | return -EINVAL; |
451 | } | 451 | } |
452 | return 0; | 452 | return 0; |
diff --git a/sound/core/sound.c b/sound/core/sound.c index 437c25ea6403..38ad1a0dd3f7 100644 --- a/sound/core/sound.c +++ b/sound/core/sound.c | |||
@@ -118,7 +118,7 @@ void *snd_lookup_minor_data(unsigned int minor, int type) | |||
118 | if (mreg && mreg->type == type) { | 118 | if (mreg && mreg->type == type) { |
119 | private_data = mreg->private_data; | 119 | private_data = mreg->private_data; |
120 | if (private_data && mreg->card_ptr) | 120 | if (private_data && mreg->card_ptr) |
121 | atomic_inc(&mreg->card_ptr->refcount); | 121 | get_device(&mreg->card_ptr->card_dev); |
122 | } else | 122 | } else |
123 | private_data = NULL; | 123 | private_data = NULL; |
124 | mutex_unlock(&sound_mutex); | 124 | mutex_unlock(&sound_mutex); |
@@ -355,22 +355,25 @@ int snd_unregister_device(int type, struct snd_card *card, int dev) | |||
355 | 355 | ||
356 | EXPORT_SYMBOL(snd_unregister_device); | 356 | EXPORT_SYMBOL(snd_unregister_device); |
357 | 357 | ||
358 | int snd_add_device_sysfs_file(int type, struct snd_card *card, int dev, | 358 | /* get the assigned device to the given type and device number; |
359 | struct device_attribute *attr) | 359 | * the caller needs to release it via put_device() after using it |
360 | */ | ||
361 | struct device *snd_get_device(int type, struct snd_card *card, int dev) | ||
360 | { | 362 | { |
361 | int minor, ret = -EINVAL; | 363 | int minor; |
362 | struct device *d; | 364 | struct device *d = NULL; |
363 | 365 | ||
364 | mutex_lock(&sound_mutex); | 366 | mutex_lock(&sound_mutex); |
365 | minor = find_snd_minor(type, card, dev); | 367 | minor = find_snd_minor(type, card, dev); |
366 | if (minor >= 0 && (d = snd_minors[minor]->dev) != NULL) | 368 | if (minor >= 0) { |
367 | ret = device_create_file(d, attr); | 369 | d = snd_minors[minor]->dev; |
370 | if (d) | ||
371 | get_device(d); | ||
372 | } | ||
368 | mutex_unlock(&sound_mutex); | 373 | mutex_unlock(&sound_mutex); |
369 | return ret; | 374 | return d; |
370 | |||
371 | } | 375 | } |
372 | 376 | EXPORT_SYMBOL(snd_get_device); | |
373 | EXPORT_SYMBOL(snd_add_device_sysfs_file); | ||
374 | 377 | ||
375 | #ifdef CONFIG_PROC_FS | 378 | #ifdef CONFIG_PROC_FS |
376 | /* | 379 | /* |
@@ -458,7 +461,7 @@ static int __init alsa_sound_init(void) | |||
458 | snd_major = major; | 461 | snd_major = major; |
459 | snd_ecards_limit = cards_limit; | 462 | snd_ecards_limit = cards_limit; |
460 | if (register_chrdev(major, "alsa", &snd_fops)) { | 463 | if (register_chrdev(major, "alsa", &snd_fops)) { |
461 | snd_printk(KERN_ERR "unable to register native major device number %d\n", major); | 464 | pr_err("ALSA core: unable to register native major device number %d\n", major); |
462 | return -EIO; | 465 | return -EIO; |
463 | } | 466 | } |
464 | if (snd_info_init() < 0) { | 467 | if (snd_info_init() < 0) { |
@@ -467,7 +470,7 @@ static int __init alsa_sound_init(void) | |||
467 | } | 470 | } |
468 | snd_info_minor_register(); | 471 | snd_info_minor_register(); |
469 | #ifndef MODULE | 472 | #ifndef MODULE |
470 | printk(KERN_INFO "Advanced Linux Sound Architecture Driver Initialized.\n"); | 473 | pr_info("Advanced Linux Sound Architecture Driver Initialized.\n"); |
471 | #endif | 474 | #endif |
472 | return 0; | 475 | return 0; |
473 | } | 476 | } |
diff --git a/sound/core/sound_oss.c b/sound/core/sound_oss.c index 726a49ac9725..573a65eb2b79 100644 --- a/sound/core/sound_oss.c +++ b/sound/core/sound_oss.c | |||
@@ -21,7 +21,7 @@ | |||
21 | 21 | ||
22 | #ifdef CONFIG_SND_OSSEMUL | 22 | #ifdef CONFIG_SND_OSSEMUL |
23 | 23 | ||
24 | #if !defined(CONFIG_SOUND) && !(defined(MODULE) && defined(CONFIG_SOUND_MODULE)) | 24 | #if !IS_ENABLED(CONFIG_SOUND) |
25 | #error "Enable the OSS soundcore multiplexer (CONFIG_SOUND) in the kernel." | 25 | #error "Enable the OSS soundcore multiplexer (CONFIG_SOUND) in the kernel." |
26 | #endif | 26 | #endif |
27 | 27 | ||
@@ -55,7 +55,7 @@ void *snd_lookup_oss_minor_data(unsigned int minor, int type) | |||
55 | if (mreg && mreg->type == type) { | 55 | if (mreg && mreg->type == type) { |
56 | private_data = mreg->private_data; | 56 | private_data = mreg->private_data; |
57 | if (private_data && mreg->card_ptr) | 57 | if (private_data && mreg->card_ptr) |
58 | atomic_inc(&mreg->card_ptr->refcount); | 58 | get_device(&mreg->card_ptr->card_dev); |
59 | } else | 59 | } else |
60 | private_data = NULL; | 60 | private_data = NULL; |
61 | mutex_unlock(&sound_oss_mutex); | 61 | mutex_unlock(&sound_oss_mutex); |
@@ -105,8 +105,7 @@ static int snd_oss_kernel_minor(int type, struct snd_card *card, int dev) | |||
105 | } | 105 | } |
106 | 106 | ||
107 | int snd_register_oss_device(int type, struct snd_card *card, int dev, | 107 | int snd_register_oss_device(int type, struct snd_card *card, int dev, |
108 | const struct file_operations *f_ops, void *private_data, | 108 | const struct file_operations *f_ops, void *private_data) |
109 | const char *name) | ||
110 | { | 109 | { |
111 | int minor = snd_oss_kernel_minor(type, card, dev); | 110 | int minor = snd_oss_kernel_minor(type, card, dev); |
112 | int minor_unit; | 111 | int minor_unit; |
diff --git a/sound/core/timer.c b/sound/core/timer.c index 6ddcf06f52f9..cfd455a8ac1a 100644 --- a/sound/core/timer.c +++ b/sound/core/timer.c | |||
@@ -35,9 +35,9 @@ | |||
35 | #include <sound/initval.h> | 35 | #include <sound/initval.h> |
36 | #include <linux/kmod.h> | 36 | #include <linux/kmod.h> |
37 | 37 | ||
38 | #if defined(CONFIG_SND_HRTIMER) || defined(CONFIG_SND_HRTIMER_MODULE) | 38 | #if IS_ENABLED(CONFIG_SND_HRTIMER) |
39 | #define DEFAULT_TIMER_LIMIT 4 | 39 | #define DEFAULT_TIMER_LIMIT 4 |
40 | #elif defined(CONFIG_SND_RTCTIMER) || defined(CONFIG_SND_RTCTIMER_MODULE) | 40 | #elif IS_ENABLED(CONFIG_SND_RTCTIMER) |
41 | #define DEFAULT_TIMER_LIMIT 2 | 41 | #define DEFAULT_TIMER_LIMIT 2 |
42 | #else | 42 | #else |
43 | #define DEFAULT_TIMER_LIMIT 1 | 43 | #define DEFAULT_TIMER_LIMIT 1 |
@@ -240,7 +240,8 @@ int snd_timer_open(struct snd_timer_instance **ti, | |||
240 | /* open a slave instance */ | 240 | /* open a slave instance */ |
241 | if (tid->dev_sclass <= SNDRV_TIMER_SCLASS_NONE || | 241 | if (tid->dev_sclass <= SNDRV_TIMER_SCLASS_NONE || |
242 | tid->dev_sclass > SNDRV_TIMER_SCLASS_OSS_SEQUENCER) { | 242 | tid->dev_sclass > SNDRV_TIMER_SCLASS_OSS_SEQUENCER) { |
243 | snd_printd("invalid slave class %i\n", tid->dev_sclass); | 243 | pr_debug("ALSA: timer: invalid slave class %i\n", |
244 | tid->dev_sclass); | ||
244 | return -EINVAL; | 245 | return -EINVAL; |
245 | } | 246 | } |
246 | mutex_lock(®ister_mutex); | 247 | mutex_lock(®ister_mutex); |
@@ -774,7 +775,7 @@ int snd_timer_new(struct snd_card *card, char *id, struct snd_timer_id *tid, | |||
774 | *rtimer = NULL; | 775 | *rtimer = NULL; |
775 | timer = kzalloc(sizeof(*timer), GFP_KERNEL); | 776 | timer = kzalloc(sizeof(*timer), GFP_KERNEL); |
776 | if (timer == NULL) { | 777 | if (timer == NULL) { |
777 | snd_printk(KERN_ERR "timer: cannot allocate\n"); | 778 | pr_err("ALSA: timer: cannot allocate\n"); |
778 | return -ENOMEM; | 779 | return -ENOMEM; |
779 | } | 780 | } |
780 | timer->tmr_class = tid->dev_class; | 781 | timer->tmr_class = tid->dev_class; |
@@ -813,7 +814,7 @@ static int snd_timer_free(struct snd_timer *timer) | |||
813 | if (! list_empty(&timer->open_list_head)) { | 814 | if (! list_empty(&timer->open_list_head)) { |
814 | struct list_head *p, *n; | 815 | struct list_head *p, *n; |
815 | struct snd_timer_instance *ti; | 816 | struct snd_timer_instance *ti; |
816 | snd_printk(KERN_WARNING "timer %p is busy?\n", timer); | 817 | pr_warn("ALSA: timer %p is busy?\n", timer); |
817 | list_for_each_safe(p, n, &timer->open_list_head) { | 818 | list_for_each_safe(p, n, &timer->open_list_head) { |
818 | list_del_init(p); | 819 | list_del_init(p); |
819 | ti = list_entry(p, struct snd_timer_instance, open_list); | 820 | ti = list_entry(p, struct snd_timer_instance, open_list); |
@@ -1955,12 +1956,10 @@ static int __init alsa_timer_init(void) | |||
1955 | #endif | 1956 | #endif |
1956 | 1957 | ||
1957 | if ((err = snd_timer_register_system()) < 0) | 1958 | if ((err = snd_timer_register_system()) < 0) |
1958 | snd_printk(KERN_ERR "unable to register system timer (%i)\n", | 1959 | pr_err("ALSA: unable to register system timer (%i)\n", err); |
1959 | err); | ||
1960 | if ((err = snd_register_device(SNDRV_DEVICE_TYPE_TIMER, NULL, 0, | 1960 | if ((err = snd_register_device(SNDRV_DEVICE_TYPE_TIMER, NULL, 0, |
1961 | &snd_timer_f_ops, NULL, "timer")) < 0) | 1961 | &snd_timer_f_ops, NULL, "timer")) < 0) |
1962 | snd_printk(KERN_ERR "unable to register timer device (%i)\n", | 1962 | pr_err("ALSA: unable to register timer device (%i)\n", err); |
1963 | err); | ||
1964 | snd_timer_proc_init(); | 1963 | snd_timer_proc_init(); |
1965 | return 0; | 1964 | return 0; |
1966 | } | 1965 | } |
diff --git a/sound/core/vmaster.c b/sound/core/vmaster.c index 842a97d5fc3a..6c58e6f73a01 100644 --- a/sound/core/vmaster.c +++ b/sound/core/vmaster.c | |||
@@ -101,7 +101,7 @@ static int slave_init(struct link_slave *slave) | |||
101 | if (slave->info.count > 2 || | 101 | if (slave->info.count > 2 || |
102 | (slave->info.type != SNDRV_CTL_ELEM_TYPE_INTEGER && | 102 | (slave->info.type != SNDRV_CTL_ELEM_TYPE_INTEGER && |
103 | slave->info.type != SNDRV_CTL_ELEM_TYPE_BOOLEAN)) { | 103 | slave->info.type != SNDRV_CTL_ELEM_TYPE_BOOLEAN)) { |
104 | snd_printk(KERN_ERR "invalid slave element\n"); | 104 | pr_err("ALSA: vmaster: invalid slave element\n"); |
105 | kfree(uinfo); | 105 | kfree(uinfo); |
106 | return -EINVAL; | 106 | return -EINVAL; |
107 | } | 107 | } |