From patchwork Wed Aug 1 21:20:56 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philippe De Muyter X-Patchwork-Id: 10553035 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7366E157D for ; Wed, 1 Aug 2018 21:21:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5F4C92B4D7 for ; Wed, 1 Aug 2018 21:21:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 521122B5C1; Wed, 1 Aug 2018 21:21:07 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6922D2B4D7 for ; Wed, 1 Aug 2018 21:21:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731427AbeHAXIr (ORCPT ); Wed, 1 Aug 2018 19:08:47 -0400 Received: from smtp2.macqel.be ([109.135.2.61]:62833 "EHLO smtp2.macqel.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730995AbeHAXIr (ORCPT ); Wed, 1 Aug 2018 19:08:47 -0400 Received: from localhost (localhost [127.0.0.1]) by smtp2.macqel.be (Postfix) with ESMTP id 1FBF7130D4D; Wed, 1 Aug 2018 23:21:04 +0200 (CEST) X-Virus-Scanned: amavisd-new at macqel.be Received: from smtp2.macqel.be ([127.0.0.1]) by localhost (mail.macqel.be [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id mwz1RcuMoKAz; Wed, 1 Aug 2018 23:21:02 +0200 (CEST) Received: from frolo.macqel.be (frolo.macqel [10.1.40.73]) by smtp2.macqel.be (Postfix) with ESMTP id A1356130D3E; Wed, 1 Aug 2018 23:21:02 +0200 (CEST) Received: by frolo.macqel.be (Postfix, from userid 1000) id 6530DDF0702; Wed, 1 Aug 2018 23:21:02 +0200 (CEST) From: Philippe De Muyter To: linux-media@vger.kernel.org, hans.verkuil@cisco.com Cc: Philippe De Muyter Subject: [PATCH 1/2] media: v4l2-common: v4l2_spi_subdev_init : generate unique name Date: Wed, 1 Aug 2018 23:20:56 +0200 Message-Id: <1533158457-15831-1-git-send-email-phdm@macqel.be> X-Mailer: git-send-email 1.7.10.4 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Acked-by: Hans Verkuil --- 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);