From patchwork Wed Aug 1 21:20:57 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: 10553037 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 D3AC515E2 for ; Wed, 1 Aug 2018 21:21:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C41BD2B4D7 for ; Wed, 1 Aug 2018 21:21:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B83042B51E; Wed, 1 Aug 2018 21:21:08 +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 98D8E2B4F0 for ; Wed, 1 Aug 2018 21:21:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731622AbeHAXIr (ORCPT ); Wed, 1 Aug 2018 19:08:47 -0400 Received: from smtp2.macqel.be ([109.135.2.61]:56819 "EHLO smtp2.macqel.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729736AbeHAXIr (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 1E56E130D4A; 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 VwGmO-SgT00w; 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 9FDF2130D33; Wed, 1 Aug 2018 23:21:02 +0200 (CEST) Received: by frolo.macqel.be (Postfix, from userid 1000) id 7CD9BDF06FD; 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 2/2] media: v4l2-common: simplify v4l2_i2c_subdev_init name generation Date: Wed, 1 Aug 2018 23:20:57 +0200 Message-Id: <1533158457-15831-2-git-send-email-phdm@macqel.be> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1533158457-15831-1-git-send-email-phdm@macqel.be> References: <1533158457-15831-1-git-send-email-phdm@macqel.be> 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 When v4l2_i2c_subdev_init is called, dev_name(&client->dev) has already been set. Use it to generate subdev's name instead of recreating it with "%d-%04x". This improves the similarity in subdev's name creation between v4l2_i2c_subdev_init and v4l2_spi_subdev_init. Signed-off-by: Philippe De Muyter --- drivers/media/v4l2-core/v4l2-common.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/media/v4l2-core/v4l2-common.c b/drivers/media/v4l2-core/v4l2-common.c index 5471c6d..b062111 100644 --- a/drivers/media/v4l2-core/v4l2-common.c +++ b/drivers/media/v4l2-core/v4l2-common.c @@ -121,9 +121,8 @@ void v4l2_i2c_subdev_init(struct v4l2_subdev *sd, struct i2c_client *client, v4l2_set_subdevdata(sd, client); i2c_set_clientdata(client, sd); /* initialize name */ - snprintf(sd->name, sizeof(sd->name), "%s %d-%04x", - client->dev.driver->name, i2c_adapter_id(client->adapter), - client->addr); + snprintf(sd->name, sizeof(sd->name), "%s %s", + client->dev.driver->name, dev_name(&client->dev)); } EXPORT_SYMBOL_GPL(v4l2_i2c_subdev_init);