alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: alsa-devel@alsa-project.org
Subject: [PATCH 06/10] ALSA: hwdep: Use standard printk helpers
Date: Wed, 12 Feb 2014 12:33:08 +0100	[thread overview]
Message-ID: <1392204792-12655-7-git-send-email-tiwai@suse.de> (raw)
In-Reply-To: <1392204792-12655-1-git-send-email-tiwai@suse.de>

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>
---
 sound/core/hwdep.c | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/sound/core/hwdep.c b/sound/core/hwdep.c
index 0f73f6951110..8c778659fa03 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,
 		*rhwdep = NULL;
 	hwdep = kzalloc(sizeof(*hwdep), GFP_KERNEL);
 	if (hwdep == NULL) {
-		snd_printk(KERN_ERR "hwdep: cannot allocate\n");
+		dev_err(card->dev, "hwdep: cannot allocate\n");
 		return -ENOMEM;
 	}
 	hwdep->card = card;
@@ -415,11 +415,12 @@ static int snd_hwdep_dev_free(struct snd_device *device)
 static int snd_hwdep_dev_register(struct snd_device *device)
 {
 	struct snd_hwdep *hwdep = device->device_data;
+	struct snd_card *card = hwdep->card;
 	int err;
 	char name[32];
 
 	mutex_lock(&register_mutex);
-	if (snd_hwdep_search(hwdep->card, hwdep->device)) {
+	if (snd_hwdep_search(card, hwdep->device)) {
 		mutex_unlock(&register_mutex);
 		return -EBUSY;
 	}
@@ -428,8 +429,9 @@ static int snd_hwdep_dev_register(struct snd_device *device)
 	if ((err = snd_register_device(SNDRV_DEVICE_TYPE_HWDEP,
 				       hwdep->card, hwdep->device,
 				       &snd_hwdep_f_ops, hwdep, name)) < 0) {
-		snd_printk(KERN_ERR "unable to register hardware dependent device %i:%i\n",
-			   hwdep->card->number, hwdep->device);
+		dev_err(card->dev,
+			"unable to register hardware dependent device %i:%i\n",
+			card->number, hwdep->device);
 		list_del(&hwdep->list);
 		mutex_unlock(&register_mutex);
 		return err;
@@ -438,13 +440,15 @@ static int snd_hwdep_dev_register(struct snd_device *device)
 	hwdep->ossreg = 0;
 	if (hwdep->oss_type >= 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 {
 			if (snd_register_oss_device(hwdep->oss_type,
-						    hwdep->card, hwdep->device,
+						    card, hwdep->device,
 						    &snd_hwdep_f_ops, hwdep) < 0) {
-				snd_printk(KERN_ERR "unable to register OSS compatibility device %i:%i\n",
-					   hwdep->card->number, hwdep->device);
+				dev_err(card->dev,
+					"unable to register OSS compatibility device %i:%i\n",
+					card->number, hwdep->device);
 			} else
 				hwdep->ossreg = 1;
 		}
-- 
1.8.5.2

  parent reply	other threads:[~2014-02-12 11:33 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-12 11:33 [PATCH RFC 00/10] Use standard printk helpers for ALSA core codes Takashi Iwai
2014-02-12 11:33 ` [PATCH 01/10] ALSA: seq_oss: Drop debug prints Takashi Iwai
2014-02-12 11:33 ` [PATCH 02/10] ALSA: control: Use standard printk helpers Takashi Iwai
2014-02-12 11:33 ` [PATCH 03/10] " Takashi Iwai
2014-02-12 18:56   ` Takashi Iwai
2014-02-12 11:33 ` [PATCH 04/10] ALSA: core: " Takashi Iwai
2014-02-12 18:57   ` Takashi Iwai
2014-02-12 11:33 ` [PATCH 05/10] ALSA: rawmidi: " Takashi Iwai
2014-02-12 11:33 ` Takashi Iwai [this message]
2014-02-12 11:33 ` [PATCH 07/10] ALSA: oss: " Takashi Iwai
2014-02-12 11:33 ` [PATCH 08/10] ALSA: timer: " Takashi Iwai
2014-02-12 11:33 ` [PATCH 09/10] ALSA: seq: " Takashi Iwai
2014-02-12 11:33 ` [PATCH 10/10] ALSA: seq_oss: " Takashi Iwai
2014-02-14 12:01 ` [PATCH RFC 00/10] Use standard printk helpers for ALSA core codes Takashi Iwai

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1392204792-12655-7-git-send-email-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=alsa-devel@alsa-project.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).