diff options
author | Takashi Iwai <tiwai@suse.de> | 2014-02-04 12:21:03 -0500 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2014-02-14 02:14:15 -0500 |
commit | f2f9307a4f26a9fbe47fff486a9cee5885af748f (patch) | |
tree | 52e3cf57d91763c7f284e654c9d10a4152214656 /sound/core | |
parent | 09e56df8b37f5e751614a0d140b8bf8250812912 (diff) |
ALSA: core: Use standard printk helpers
Use dev_err() & co as much as possible. If not available (no device
assigned at the calling point), use pr_xxx() helpers instead.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/core')
-rw-r--r-- | sound/core/device.c | 21 | ||||
-rw-r--r-- | sound/core/info.c | 11 | ||||
-rw-r--r-- | sound/core/init.c | 24 | ||||
-rw-r--r-- | sound/core/isadma.c | 2 | ||||
-rw-r--r-- | sound/core/memalloc.c | 4 | ||||
-rw-r--r-- | sound/core/seq/seq_device.c | 2 | ||||
-rw-r--r-- | sound/core/sound.c | 4 | ||||
-rw-r--r-- | sound/core/vmaster.c | 2 |
8 files changed, 38 insertions, 32 deletions
diff --git a/sound/core/device.c b/sound/core/device.c index df88defed176..ad9869dfa10c 100644 --- a/sound/core/device.c +++ b/sound/core/device.c | |||
@@ -50,7 +50,7 @@ int snd_device_new(struct snd_card *card, snd_device_type_t type, | |||
50 | return -ENXIO; | 50 | return -ENXIO; |
51 | dev = kzalloc(sizeof(*dev), GFP_KERNEL); | 51 | dev = kzalloc(sizeof(*dev), GFP_KERNEL); |
52 | if (dev == NULL) { | 52 | if (dev == NULL) { |
53 | snd_printk(KERN_ERR "Cannot allocate device\n"); | 53 | dev_err(card->dev, "Cannot allocate device, type=%d\n", type); |
54 | return -ENOMEM; | 54 | return -ENOMEM; |
55 | } | 55 | } |
56 | dev->card = card; | 56 | dev->card = card; |
@@ -90,17 +90,17 @@ int snd_device_free(struct snd_card *card, void *device_data) | |||
90 | if (dev->state == SNDRV_DEV_REGISTERED && | 90 | if (dev->state == SNDRV_DEV_REGISTERED && |
91 | dev->ops->dev_disconnect) | 91 | dev->ops->dev_disconnect) |
92 | if (dev->ops->dev_disconnect(dev)) | 92 | if (dev->ops->dev_disconnect(dev)) |
93 | snd_printk(KERN_ERR | 93 | dev_err(card->dev, |
94 | "device disconnect failure\n"); | 94 | "device disconnect failure\n"); |
95 | if (dev->ops->dev_free) { | 95 | if (dev->ops->dev_free) { |
96 | if (dev->ops->dev_free(dev)) | 96 | if (dev->ops->dev_free(dev)) |
97 | snd_printk(KERN_ERR "device free failure\n"); | 97 | dev_err(card->dev, "device free failure\n"); |
98 | } | 98 | } |
99 | kfree(dev); | 99 | kfree(dev); |
100 | return 0; | 100 | return 0; |
101 | } | 101 | } |
102 | snd_printd("device free %p (from %pF), not found\n", device_data, | 102 | dev_dbg(card->dev, "device free %p (from %pF), not found\n", |
103 | __builtin_return_address(0)); | 103 | device_data, __builtin_return_address(0)); |
104 | return -ENXIO; | 104 | return -ENXIO; |
105 | } | 105 | } |
106 | 106 | ||
@@ -131,13 +131,14 @@ int snd_device_disconnect(struct snd_card *card, void *device_data) | |||
131 | if (dev->state == SNDRV_DEV_REGISTERED && | 131 | if (dev->state == SNDRV_DEV_REGISTERED && |
132 | dev->ops->dev_disconnect) { | 132 | dev->ops->dev_disconnect) { |
133 | if (dev->ops->dev_disconnect(dev)) | 133 | if (dev->ops->dev_disconnect(dev)) |
134 | snd_printk(KERN_ERR "device disconnect failure\n"); | 134 | dev_err(card->dev, |
135 | "device disconnect failure\n"); | ||
135 | dev->state = SNDRV_DEV_DISCONNECTED; | 136 | dev->state = SNDRV_DEV_DISCONNECTED; |
136 | } | 137 | } |
137 | return 0; | 138 | return 0; |
138 | } | 139 | } |
139 | snd_printd("device disconnect %p (from %pF), not found\n", device_data, | 140 | dev_dbg(card->dev, "device disconnect %p (from %pF), not found\n", |
140 | __builtin_return_address(0)); | 141 | device_data, __builtin_return_address(0)); |
141 | return -ENXIO; | 142 | return -ENXIO; |
142 | } | 143 | } |
143 | 144 | ||
@@ -170,7 +171,7 @@ int snd_device_register(struct snd_card *card, void *device_data) | |||
170 | dev->state = SNDRV_DEV_REGISTERED; | 171 | dev->state = SNDRV_DEV_REGISTERED; |
171 | return 0; | 172 | return 0; |
172 | } | 173 | } |
173 | snd_printd("snd_device_register busy\n"); | 174 | dev_dbg(card->dev, "snd_device_register busy\n"); |
174 | return -EBUSY; | 175 | return -EBUSY; |
175 | } | 176 | } |
176 | snd_BUG(); | 177 | snd_BUG(); |
diff --git a/sound/core/info.c b/sound/core/info.c index 7916c07b9324..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); |
diff --git a/sound/core/init.c b/sound/core/init.c index 5b7c4eb46c10..0095a530ff12 100644 --- a/sound/core/init.c +++ b/sound/core/init.c | |||
@@ -113,11 +113,11 @@ static inline int init_info_for_card(struct snd_card *card) | |||
113 | struct snd_info_entry *entry; | 113 | struct snd_info_entry *entry; |
114 | 114 | ||
115 | if ((err = snd_info_card_register(card)) < 0) { | 115 | if ((err = snd_info_card_register(card)) < 0) { |
116 | snd_printd("unable to create card info\n"); | 116 | dev_dbg(card->dev, "unable to create card info\n"); |
117 | return err; | 117 | return err; |
118 | } | 118 | } |
119 | 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) { |
120 | snd_printd("unable to create card entry\n"); | 120 | dev_dbg(card->dev, "unable to create card entry\n"); |
121 | return err; | 121 | return err; |
122 | } | 122 | } |
123 | entry->c.text.read = snd_card_id_read; | 123 | entry->c.text.read = snd_card_id_read; |
@@ -217,7 +217,7 @@ int snd_card_new(struct device *parent, int idx, const char *xid, | |||
217 | err = -ENODEV; | 217 | err = -ENODEV; |
218 | if (err < 0) { | 218 | if (err < 0) { |
219 | mutex_unlock(&snd_card_mutex); | 219 | mutex_unlock(&snd_card_mutex); |
220 | 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", |
221 | idx, snd_ecards_limit - 1, err); | 221 | idx, snd_ecards_limit - 1, err); |
222 | kfree(card); | 222 | kfree(card); |
223 | return err; | 223 | return err; |
@@ -254,12 +254,12 @@ int snd_card_new(struct device *parent, int idx, const char *xid, | |||
254 | /* 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 */ |
255 | err = snd_ctl_create(card); | 255 | err = snd_ctl_create(card); |
256 | if (err < 0) { | 256 | if (err < 0) { |
257 | snd_printk(KERN_ERR "unable to register control minors\n"); | 257 | dev_err(parent, "unable to register control minors\n"); |
258 | goto __error; | 258 | goto __error; |
259 | } | 259 | } |
260 | err = snd_info_card_create(card); | 260 | err = snd_info_card_create(card); |
261 | if (err < 0) { | 261 | if (err < 0) { |
262 | snd_printk(KERN_ERR "unable to create card info\n"); | 262 | dev_err(parent, "unable to create card info\n"); |
263 | goto __error_ctl; | 263 | goto __error_ctl; |
264 | } | 264 | } |
265 | *card_ret = card; | 265 | *card_ret = card; |
@@ -422,7 +422,7 @@ int snd_card_disconnect(struct snd_card *card) | |||
422 | /* notify all devices that we are disconnected */ | 422 | /* notify all devices that we are disconnected */ |
423 | err = snd_device_disconnect_all(card); | 423 | err = snd_device_disconnect_all(card); |
424 | if (err < 0) | 424 | if (err < 0) |
425 | 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); |
426 | 426 | ||
427 | snd_info_card_disconnect(card); | 427 | snd_info_card_disconnect(card); |
428 | if (card->registered) { | 428 | if (card->registered) { |
@@ -455,22 +455,22 @@ static int snd_card_do_free(struct snd_card *card) | |||
455 | snd_mixer_oss_notify_callback(card, SND_MIXER_OSS_NOTIFY_FREE); | 455 | snd_mixer_oss_notify_callback(card, SND_MIXER_OSS_NOTIFY_FREE); |
456 | #endif | 456 | #endif |
457 | if (snd_device_free_all(card, SNDRV_DEV_CMD_PRE) < 0) { | 457 | if (snd_device_free_all(card, SNDRV_DEV_CMD_PRE) < 0) { |
458 | snd_printk(KERN_ERR "unable to free all devices (pre)\n"); | 458 | dev_err(card->dev, "unable to free all devices (pre)\n"); |
459 | /* Fatal, but this situation should never occur */ | 459 | /* Fatal, but this situation should never occur */ |
460 | } | 460 | } |
461 | if (snd_device_free_all(card, SNDRV_DEV_CMD_NORMAL) < 0) { | 461 | if (snd_device_free_all(card, SNDRV_DEV_CMD_NORMAL) < 0) { |
462 | snd_printk(KERN_ERR "unable to free all devices (normal)\n"); | 462 | dev_err(card->dev, "unable to free all devices (normal)\n"); |
463 | /* Fatal, but this situation should never occur */ | 463 | /* Fatal, but this situation should never occur */ |
464 | } | 464 | } |
465 | if (snd_device_free_all(card, SNDRV_DEV_CMD_POST) < 0) { | 465 | if (snd_device_free_all(card, SNDRV_DEV_CMD_POST) < 0) { |
466 | snd_printk(KERN_ERR "unable to free all devices (post)\n"); | 466 | dev_err(card->dev, "unable to free all devices (post)\n"); |
467 | /* Fatal, but this situation should never occur */ | 467 | /* Fatal, but this situation should never occur */ |
468 | } | 468 | } |
469 | if (card->private_free) | 469 | if (card->private_free) |
470 | card->private_free(card); | 470 | card->private_free(card); |
471 | snd_info_free_entry(card->proc_id); | 471 | snd_info_free_entry(card->proc_id); |
472 | if (snd_info_card_free(card) < 0) { | 472 | if (snd_info_card_free(card) < 0) { |
473 | snd_printk(KERN_WARNING "unable to free card info\n"); | 473 | dev_warn(card->dev, "unable to free card info\n"); |
474 | /* Not fatal error */ | 474 | /* Not fatal error */ |
475 | } | 475 | } |
476 | if (card->release_completion) | 476 | if (card->release_completion) |
@@ -596,7 +596,7 @@ static void snd_card_set_id_no_lock(struct snd_card *card, const char *src, | |||
596 | goto again; | 596 | goto again; |
597 | } | 597 | } |
598 | /* last resort... */ | 598 | /* last resort... */ |
599 | snd_printk(KERN_ERR "unable to set card id (%s)\n", id); | 599 | dev_err(card->dev, "unable to set card id (%s)\n", id); |
600 | if (card->proc_root->name) | 600 | if (card->proc_root->name) |
601 | strlcpy(card->id, card->proc_root->name, sizeof(card->id)); | 601 | strlcpy(card->id, card->proc_root->name, sizeof(card->id)); |
602 | } | 602 | } |
@@ -948,7 +948,7 @@ int snd_card_file_remove(struct snd_card *card, struct file *file) | |||
948 | } | 948 | } |
949 | spin_unlock(&card->files_lock); | 949 | spin_unlock(&card->files_lock); |
950 | if (!found) { | 950 | if (!found) { |
951 | snd_printk(KERN_ERR "ALSA card file remove problem (%p)\n", file); | 951 | dev_err(card->dev, "card file remove problem (%p)\n", file); |
952 | return -ENOENT; | 952 | return -ENOENT; |
953 | } | 953 | } |
954 | kfree(found); | 954 | kfree(found); |
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/seq/seq_device.c b/sound/core/seq/seq_device.c index 040c60e1da28..a1f00caf5da3 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) |
diff --git a/sound/core/sound.c b/sound/core/sound.c index 4aaa53161644..60ab9b1f44b9 100644 --- a/sound/core/sound.c +++ b/sound/core/sound.c | |||
@@ -458,7 +458,7 @@ static int __init alsa_sound_init(void) | |||
458 | snd_major = major; | 458 | snd_major = major; |
459 | snd_ecards_limit = cards_limit; | 459 | snd_ecards_limit = cards_limit; |
460 | if (register_chrdev(major, "alsa", &snd_fops)) { | 460 | if (register_chrdev(major, "alsa", &snd_fops)) { |
461 | snd_printk(KERN_ERR "unable to register native major device number %d\n", major); | 461 | pr_err("ALSA core: unable to register native major device number %d\n", major); |
462 | return -EIO; | 462 | return -EIO; |
463 | } | 463 | } |
464 | if (snd_info_init() < 0) { | 464 | if (snd_info_init() < 0) { |
@@ -467,7 +467,7 @@ static int __init alsa_sound_init(void) | |||
467 | } | 467 | } |
468 | snd_info_minor_register(); | 468 | snd_info_minor_register(); |
469 | #ifndef MODULE | 469 | #ifndef MODULE |
470 | printk(KERN_INFO "Advanced Linux Sound Architecture Driver Initialized.\n"); | 470 | pr_info("Advanced Linux Sound Architecture Driver Initialized.\n"); |
471 | #endif | 471 | #endif |
472 | return 0; | 472 | return 0; |
473 | } | 473 | } |
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 | } |