From patchwork Thu Aug 3 10:31:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Biju Das X-Patchwork-Id: 13339687 X-Patchwork-Delegate: geert@linux-m68k.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 55727C04A94 for ; Thu, 3 Aug 2023 10:31:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234937AbjHCKbV (ORCPT ); Thu, 3 Aug 2023 06:31:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33214 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234901AbjHCKbU (ORCPT ); Thu, 3 Aug 2023 06:31:20 -0400 Received: from relmlie6.idc.renesas.com (relmlor2.renesas.com [210.160.252.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 9CCDA19B0; Thu, 3 Aug 2023 03:31:18 -0700 (PDT) X-IronPort-AV: E=Sophos;i="6.01,251,1684767600"; d="scan'208";a="175477197" Received: from unknown (HELO relmlir6.idc.renesas.com) ([10.200.68.152]) by relmlie6.idc.renesas.com with ESMTP; 03 Aug 2023 19:31:18 +0900 Received: from localhost.localdomain (unknown [10.226.93.128]) by relmlir6.idc.renesas.com (Postfix) with ESMTP id 273E541CDE2C; Thu, 3 Aug 2023 19:31:15 +0900 (JST) From: Biju Das To: Wolfram Sang Cc: Biju Das , linux-i2c@vger.kernel.org, Geert Uytterhoeven , Dmitry Torokhov , Andy Shevchenko , linux-renesas-soc@vger.kernel.org Subject: [PATCH v5 RESEND 3/4] i2c: i2c-core-of: Convert i2c_of_match_device_sysfs() to non-static Date: Thu, 3 Aug 2023 11:31:01 +0100 Message-Id: <20230803103102.323987-4-biju.das.jz@bp.renesas.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230803103102.323987-1-biju.das.jz@bp.renesas.com> References: <20230803103102.323987-1-biju.das.jz@bp.renesas.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org Currently i2c_of_match_device_sysfs() is used by i2c_of_match_device(). Convert this to non-static function for finding match data for the I2C sysfs interface using i2c_device_get_match_data() for code reuse. While at it, fix the below issues:  1) Replace 'of_device_id*'->'of_device_id *' in function definition.  2) Fix the alignment in the function definition.  3) Change the struct i2c_client parameter as const to avoid overriding the client pointer. Suggested-by: Andy Shevchenko Suggested-by: Dmitry Torokhov Signed-off-by: Biju Das Reviewed-by: Andy Shevchenko --- v5: * Split from patch #3 * Removed export symbol --- drivers/i2c/i2c-core-of.c | 4 ++-- drivers/i2c/i2c-core.h | 9 +++++++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/drivers/i2c/i2c-core-of.c b/drivers/i2c/i2c-core-of.c index a6c407d36800..33832622f436 100644 --- a/drivers/i2c/i2c-core-of.c +++ b/drivers/i2c/i2c-core-of.c @@ -113,9 +113,9 @@ void of_i2c_register_devices(struct i2c_adapter *adap) of_node_put(bus); } -static const struct of_device_id* +const struct of_device_id * i2c_of_match_device_sysfs(const struct of_device_id *matches, - struct i2c_client *client) + const struct i2c_client *client) { const char *name; diff --git a/drivers/i2c/i2c-core.h b/drivers/i2c/i2c-core.h index 1247e6e6e975..e4d397b67989 100644 --- a/drivers/i2c/i2c-core.h +++ b/drivers/i2c/i2c-core.h @@ -82,8 +82,17 @@ static inline void i2c_acpi_remove_space_handler(struct i2c_adapter *adapter) { #ifdef CONFIG_OF void of_i2c_register_devices(struct i2c_adapter *adap); +const struct of_device_id * +i2c_of_match_device_sysfs(const struct of_device_id *matches, + const struct i2c_client *client); #else static inline void of_i2c_register_devices(struct i2c_adapter *adap) { } +static inline const struct of_device_id * +i2c_of_match_device_sysfs(const struct of_device_id *matches, + const struct i2c_client *client) +{ + return NULL; +} #endif extern struct notifier_block i2c_of_notifier;