Commit 2ebef69f authored by Takashi Iwai's avatar Takashi Iwai

ALSA: hwdep: 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: default avatarTakashi Iwai <tiwai@suse.de>
parent ca20d292
...@@ -375,7 +375,7 @@ int snd_hwdep_new(struct snd_card *card, char *id, int device, ...@@ -375,7 +375,7 @@ int snd_hwdep_new(struct snd_card *card, char *id, int device,
*rhwdep = NULL; *rhwdep = NULL;
hwdep = kzalloc(sizeof(*hwdep), GFP_KERNEL); hwdep = kzalloc(sizeof(*hwdep), GFP_KERNEL);
if (hwdep == NULL) { if (hwdep == NULL) {
snd_printk(KERN_ERR "hwdep: cannot allocate\n"); dev_err(card->dev, "hwdep: cannot allocate\n");
return -ENOMEM; return -ENOMEM;
} }
hwdep->card = card; hwdep->card = card;
...@@ -415,11 +415,12 @@ static int snd_hwdep_dev_free(struct snd_device *device) ...@@ -415,11 +415,12 @@ static int snd_hwdep_dev_free(struct snd_device *device)
static int snd_hwdep_dev_register(struct snd_device *device) static int snd_hwdep_dev_register(struct snd_device *device)
{ {
struct snd_hwdep *hwdep = device->device_data; struct snd_hwdep *hwdep = device->device_data;
struct snd_card *card = hwdep->card;
int err; int err;
char name[32]; char name[32];
mutex_lock(&register_mutex); mutex_lock(&register_mutex);
if (snd_hwdep_search(hwdep->card, hwdep->device)) { if (snd_hwdep_search(card, hwdep->device)) {
mutex_unlock(&register_mutex); mutex_unlock(&register_mutex);
return -EBUSY; return -EBUSY;
} }
...@@ -428,8 +429,9 @@ static int snd_hwdep_dev_register(struct snd_device *device) ...@@ -428,8 +429,9 @@ static int snd_hwdep_dev_register(struct snd_device *device)
if ((err = snd_register_device(SNDRV_DEVICE_TYPE_HWDEP, if ((err = snd_register_device(SNDRV_DEVICE_TYPE_HWDEP,
hwdep->card, hwdep->device, hwdep->card, hwdep->device,
&snd_hwdep_f_ops, hwdep, name)) < 0) { &snd_hwdep_f_ops, hwdep, name)) < 0) {
snd_printk(KERN_ERR "unable to register hardware dependent device %i:%i\n", dev_err(card->dev,
hwdep->card->number, hwdep->device); "unable to register hardware dependent device %i:%i\n",
card->number, hwdep->device);
list_del(&hwdep->list); list_del(&hwdep->list);
mutex_unlock(&register_mutex); mutex_unlock(&register_mutex);
return err; return err;
...@@ -438,13 +440,15 @@ static int snd_hwdep_dev_register(struct snd_device *device) ...@@ -438,13 +440,15 @@ static int snd_hwdep_dev_register(struct snd_device *device)
hwdep->ossreg = 0; hwdep->ossreg = 0;
if (hwdep->oss_type >= 0) { if (hwdep->oss_type >= 0) {
if ((hwdep->oss_type == SNDRV_OSS_DEVICE_TYPE_DMFM) && (hwdep->device != 0)) { if ((hwdep->oss_type == SNDRV_OSS_DEVICE_TYPE_DMFM) && (hwdep->device != 0)) {
snd_printk (KERN_WARNING "only hwdep device 0 can be registered as OSS direct FM device!\n"); dev_warn(card->dev,
"only hwdep device 0 can be registered as OSS direct FM device!\n");
} else { } else {
if (snd_register_oss_device(hwdep->oss_type, if (snd_register_oss_device(hwdep->oss_type,
hwdep->card, hwdep->device, card, hwdep->device,
&snd_hwdep_f_ops, hwdep) < 0) { &snd_hwdep_f_ops, hwdep) < 0) {
snd_printk(KERN_ERR "unable to register OSS compatibility device %i:%i\n", dev_err(card->dev,
hwdep->card->number, hwdep->device); "unable to register OSS compatibility device %i:%i\n",
card->number, hwdep->device);
} else } else
hwdep->ossreg = 1; hwdep->ossreg = 1;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment