All of lore.kernel.org
 help / color / mirror / Atom feed
From: Philippe De Muyter <phdm@macqel.be>
To: linux-media@vger.kernel.org, hans.verkuil@cisco.com
Cc: Philippe De Muyter <phdm@macqel.be>
Subject: [PATCH 1/2] media: v4l2-common: v4l2_spi_subdev_init : generate unique name
Date: Wed,  1 Aug 2018 23:20:56 +0200	[thread overview]
Message-ID: <1533158457-15831-1-git-send-email-phdm@macqel.be> (raw)

While v4l2_i2c_subdev_init does give a unique name to the subdev, matching
the one appearing in dmesg for messages generated by dev_info and friends
(e.g. imx185 30-0010), v4l2_spi_subdev_init does a poor job, copying only
the driver name, but not the dev_name(), yielding e.g. "imx185", but
missing the "spi1.1" part, and not generating a unique name.

Fix that.

Signed-off-by: Philippe De Muyter <phdm@macqel.be>
---
 drivers/media/v4l2-core/v4l2-common.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/media/v4l2-core/v4l2-common.c b/drivers/media/v4l2-core/v4l2-common.c
index b518b92..5471c6d 100644
--- a/drivers/media/v4l2-core/v4l2-common.c
+++ b/drivers/media/v4l2-core/v4l2-common.c
@@ -255,7 +255,9 @@ void v4l2_spi_subdev_init(struct v4l2_subdev *sd, struct spi_device *spi,
 	v4l2_set_subdevdata(sd, spi);
 	spi_set_drvdata(spi, sd);
 	/* initialize name */
-	strlcpy(sd->name, spi->dev.driver->name, sizeof(sd->name));
+	snprintf(sd->name, sizeof(sd->name), "%s %s",
+		spi->dev.driver->name, dev_name(&spi->dev));
+
 }
 EXPORT_SYMBOL_GPL(v4l2_spi_subdev_init);
 
-- 
1.8.4

             reply	other threads:[~2018-08-01 23:08 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-01 21:20 Philippe De Muyter [this message]
2018-08-01 21:20 ` [PATCH 2/2] media: v4l2-common: simplify v4l2_i2c_subdev_init name generation Philippe De Muyter
2018-08-03 12:43   ` Sakari Ailus
2018-08-03 13:46     ` Philippe De Muyter
2018-08-03 14:11       ` Sakari Ailus
2018-08-08  8:43     ` Philippe De Muyter
2018-09-05  7:53 ` [PATCH 1/2] media: v4l2-common: v4l2_spi_subdev_init : generate unique name Hans Verkuil

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=1533158457-15831-1-git-send-email-phdm@macqel.be \
    --to=phdm@macqel.be \
    --cc=hans.verkuil@cisco.com \
    --cc=linux-media@vger.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.