All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mauro Carvalho Chehab <mchehab@s-opensource.com>
To: Linux Media Mailing List <linux-media@vger.kernel.org>
Cc: Mauro Carvalho Chehab <mchehab@s-opensource.com>,
	Mauro Carvalho Chehab <mchehab@infradead.org>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Arnd Bergmann <arnd@arndb.de>,
	Hans Verkuil <hans.verkuil@cisco.com>
Subject: [PATCH 28/35] [media] msp3400-driver: don't use KERN_CONT
Date: Wed, 16 Nov 2016 14:43:00 -0200	[thread overview]
Message-ID: <cfd923aa95ee579f1e9271c0548d7c697b343196.1479314177.git.mchehab@s-opensource.com> (raw)
In-Reply-To: <cover.1479314177.git.mchehab@s-opensource.com>
In-Reply-To: <cover.1479314177.git.mchehab@s-opensource.com>

Drivers using dev_foo() macro should not use KERN_CONT, as, internally,
those macros work as if all strings were terminated by a \n. So, doing:

	dev_info(&client->dev, "%s ", client->name);
	printk(KERN_CONT "supports radio, mode is autodetect and autoselect");

Would produce the following output:

	msp3400 6-0044: msp3400
	supports radio, mode is autodetect and autoselect

As there's no good reason to use KERN_CONT, let's rewrite the code
to avoid that, allowing this driver to be converted to dev_foo().

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
---
 drivers/media/i2c/msp3400-driver.c | 36 ++++++++++++++++++------------------
 1 file changed, 18 insertions(+), 18 deletions(-)

diff --git a/drivers/media/i2c/msp3400-driver.c b/drivers/media/i2c/msp3400-driver.c
index 503b7c4f0a9b..8b5913188bc8 100644
--- a/drivers/media/i2c/msp3400-driver.c
+++ b/drivers/media/i2c/msp3400-driver.c
@@ -670,6 +670,13 @@ static const struct v4l2_subdev_ops msp_ops = {
 
 /* ----------------------------------------------------------------------- */
 
+
+static const char const *opmode_str[] = {
+	[OPMODE_MANUAL] = "manual",
+	[OPMODE_AUTODETECT] = "autodetect",
+	[OPMODE_AUTOSELECT] = "autodetect and autoselect",
+};
+
 static int msp_probe(struct i2c_client *client, const struct i2c_device_id *id)
 {
 	struct msp_state *state;
@@ -791,7 +798,8 @@ static int msp_probe(struct i2c_client *client, const struct i2c_device_id *id)
 		msp_family == 3 && msp_revision == 'G' && msp_prod_hi == 3;
 
 	state->opmode = opmode;
-	if (state->opmode == OPMODE_AUTO) {
+	if (state->opmode < OPMODE_MANUAL
+	    || state->opmode > OPMODE_AUTOSELECT) {
 		/* MSP revision G and up have both autodetect and autoselect */
 		if (msp_revision >= 'G')
 			state->opmode = OPMODE_AUTOSELECT;
@@ -829,36 +837,28 @@ static int msp_probe(struct i2c_client *client, const struct i2c_device_id *id)
 	v4l2_ctrl_cluster(2, &state->volume);
 	v4l2_ctrl_handler_setup(hdl);
 
-	/* hello world :-) */
-	v4l_info(client, "MSP%d4%02d%c-%c%d found @ 0x%x (%s)\n",
-			msp_family, msp_product,
-			msp_revision, msp_hard, msp_rom,
-			client->addr << 1, client->adapter->name);
-	v4l_info(client, "%s ", client->name);
-	if (state->has_nicam && state->has_radio)
-		printk(KERN_CONT "supports nicam and radio, ");
-	else if (state->has_nicam)
-		printk(KERN_CONT "supports nicam, ");
-	else if (state->has_radio)
-		printk(KERN_CONT "supports radio, ");
-	printk(KERN_CONT "mode is ");
+	dev_info(&client->dev,
+		 "MSP%d4%02d%c-%c%d found on %s: supports %s%s%s, mode is %s\n",
+		 msp_family, msp_product,
+		 msp_revision, msp_hard, msp_rom,
+		 client->adapter->name,
+		 (state->has_nicam) ? "nicam" : "",
+		 (state->has_nicam && state->has_radio) ? " and " : "",
+		 (state->has_radio) ? "radio" : "",
+		 opmode_str[state->opmode]);
 
 	/* version-specific initialization */
 	switch (state->opmode) {
 	case OPMODE_MANUAL:
-		printk(KERN_CONT "manual");
 		thread_func = msp3400c_thread;
 		break;
 	case OPMODE_AUTODETECT:
-		printk(KERN_CONT "autodetect");
 		thread_func = msp3410d_thread;
 		break;
 	case OPMODE_AUTOSELECT:
-		printk(KERN_CONT "autodetect and autoselect");
 		thread_func = msp34xxg_thread;
 		break;
 	}
-	printk(KERN_CONT "\n");
 
 	/* startup control thread if needed */
 	if (thread_func) {
-- 
2.7.4



  parent reply	other threads:[~2016-11-16 16:43 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-16 16:42 [PATCH 00/35] Some printk fixups and improvements Mauro Carvalho Chehab
2016-11-16 16:42 ` [PATCH 01/35] [media] stb0899_drv: get rid of continuation lines Mauro Carvalho Chehab
2016-11-16 16:42 ` [PATCH 02/35] [media] stv090x: " Mauro Carvalho Chehab
2016-11-16 16:42 ` [PATCH 03/35] [media] bt8xx/dst: use a more standard way to print messages Mauro Carvalho Chehab
2016-11-16 16:42 ` [PATCH 04/35] [media] bt8xx: use pr_foo() macros instead of printk() Mauro Carvalho Chehab
2016-11-16 16:42 ` [PATCH 05/35] [media] cx23885: use KERN_CONT where needed Mauro Carvalho Chehab
2016-11-16 16:42 ` [PATCH 06/35] [media] cx23885: convert it to use pr_foo() macros Mauro Carvalho Chehab
2016-11-16 16:42 ` [PATCH 07/35] [media] cx88: use KERN_CONT where needed Mauro Carvalho Chehab
2016-11-16 16:42 ` [PATCH 08/35] [media] cx88: convert it to use pr_foo() macros Mauro Carvalho Chehab
2016-11-18 22:27   ` Andrey Utkin
2016-11-19 12:16     ` Mauro Carvalho Chehab
2016-11-16 16:42 ` [PATCH 09/35] [media] cx88: make checkpatch happier Mauro Carvalho Chehab
2016-11-18 22:25   ` Andrey Utkin
2016-11-19 12:14     ` Mauro Carvalho Chehab
2016-11-16 16:42 ` [PATCH 10/35] [media] pluto2: use KERN_CONT where needed Mauro Carvalho Chehab
2016-11-16 16:42 ` [PATCH 11/35] [media] zoran: " Mauro Carvalho Chehab
2016-11-16 16:42 ` [PATCH 12/35] [media] wl128x: use KERNEL_CONT " Mauro Carvalho Chehab
2016-11-16 16:42 ` [PATCH 13/35] [media] pvrusb2: " Mauro Carvalho Chehab
2016-11-16 16:42 ` [PATCH 14/35] [media] ttusb_dec: " Mauro Carvalho Chehab
2016-11-16 16:42 ` [PATCH 15/35] [media] ttpci: cleanup debug macros and remove dead code Mauro Carvalho Chehab
2016-11-16 16:42 ` [PATCH 16/35] [media] dib0070: use pr_foo() instead of printk() Mauro Carvalho Chehab
2016-11-16 16:42 ` [PATCH 17/35] [media] dib0090: " Mauro Carvalho Chehab
2016-11-16 16:42 ` [PATCH 18/35] [media] dib3000mb: " Mauro Carvalho Chehab
2016-11-16 16:42 ` [PATCH 19/35] [media] dib3000mc: " Mauro Carvalho Chehab
2016-11-16 16:42 ` [PATCH 20/35] [media] dib7000m: " Mauro Carvalho Chehab
2016-11-16 16:42 ` [PATCH 21/35] [media] dib7000p: " Mauro Carvalho Chehab
2016-11-16 16:42 ` [PATCH 22/35] [media] dib8000: " Mauro Carvalho Chehab
2016-11-16 16:42 ` [PATCH 23/35] [media] dib9000: " Mauro Carvalho Chehab
2016-11-16 16:42 ` [PATCH 24/35] [media] dibx000_common: " Mauro Carvalho Chehab
2016-11-16 16:42 ` [PATCH 25/35] [media] af9005: remove a printk that would require a KERN_CONT Mauro Carvalho Chehab
2016-11-16 16:42 ` [PATCH 26/35] [media] tuner-core: use pr_foo, instead of internal printk macros Mauro Carvalho Chehab
2016-11-16 16:42 ` [PATCH 27/35] [media] v4l2-common: add a debug macro to be used with dev_foo() Mauro Carvalho Chehab
2016-11-16 16:43 ` Mauro Carvalho Chehab [this message]
2016-11-16 16:43 ` [PATCH 29/35] [media] msp3400: convert it to use dev_foo() macros Mauro Carvalho Chehab
2016-11-16 16:43 ` [PATCH 30/35] [media] em28xx: convert it from pr_foo() to dev_foo() Mauro Carvalho Chehab
2016-11-16 16:43 ` [PATCH 31/35] [media] tvp5150: convert it to use dev_foo() macros Mauro Carvalho Chehab
2016-11-16 16:43 ` [PATCH 32/35] [media] tvp5150: Get rid of direct calls to printk() Mauro Carvalho Chehab
2016-11-16 16:43 ` [PATCH 33/35] [media] tvp5150: get rid of KERN_CONT Mauro Carvalho Chehab
2016-11-16 16:43 ` [PATCH 34/35] [media] rc-main: use pr_foo() macros Mauro Carvalho Chehab
2016-11-16 16:43 ` [PATCH 35/35] [media] tveeprom: print log messages using pr_foo() Mauro Carvalho Chehab

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=cfd923aa95ee579f1e9271c0548d7c697b343196.1479314177.git.mchehab@s-opensource.com \
    --to=mchehab@s-opensource.com \
    --cc=arnd@arndb.de \
    --cc=hans.verkuil@cisco.com \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@infradead.org \
    --cc=mchehab@kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.