From patchwork Sat Aug 26 09:49:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Biju Das X-Patchwork-Id: 13366565 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 38724C83F13 for ; Sat, 26 Aug 2023 10:00:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229817AbjHZJ73 (ORCPT ); Sat, 26 Aug 2023 05:59:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57956 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231725AbjHZJ7X (ORCPT ); Sat, 26 Aug 2023 05:59:23 -0400 Received: from relmlie6.idc.renesas.com (relmlor2.renesas.com [210.160.252.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 73AA1C9 for ; Sat, 26 Aug 2023 02:59:20 -0700 (PDT) X-IronPort-AV: E=Sophos;i="6.02,203,1688396400"; d="scan'208";a="177738416" Received: from unknown (HELO relmlir6.idc.renesas.com) ([10.200.68.152]) by relmlie6.idc.renesas.com with ESMTP; 26 Aug 2023 18:49:10 +0900 Received: from localhost.localdomain (unknown [10.226.92.24]) by relmlir6.idc.renesas.com (Postfix) with ESMTP id 2D5E34143434; Sat, 26 Aug 2023 18:49:07 +0900 (JST) From: Biju Das To: Lee Jones Cc: Biju Das , Geert Uytterhoeven , Andy Shevchenko , Prabhakar Mahadev Lad , linux-renesas-soc@vger.kernel.org Subject: [PATCH] mfd: max8997: Simplify probe() and drop max8997_i2c_get_driver_data() Date: Sat, 26 Aug 2023 10:49:05 +0100 Message-Id: <20230826094905.64430-1-biju.das.jz@bp.renesas.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org Simplify probe() by using i2c_get_match_data() instead of max8997_i2c_get_driver_data() for retrieving match data from OF/ID tables. Signed-off-by: Biju Das --- Note: This patch is only compile tested. --- drivers/mfd/max8997.c | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/drivers/mfd/max8997.c b/drivers/mfd/max8997.c index 110bef71f208..fcb8fd1ec25d 100644 --- a/drivers/mfd/max8997.c +++ b/drivers/mfd/max8997.c @@ -142,18 +142,8 @@ static struct max8997_platform_data *max8997_i2c_parse_dt_pdata( return pd; } -static inline unsigned long max8997_i2c_get_driver_data(struct i2c_client *i2c, - const struct i2c_device_id *id) -{ - if (i2c->dev.of_node) - return (unsigned long)of_device_get_match_data(&i2c->dev); - - return id->driver_data; -} - static int max8997_i2c_probe(struct i2c_client *i2c) { - const struct i2c_device_id *id = i2c_client_get_device_id(i2c); struct max8997_dev *max8997; struct max8997_platform_data *pdata = dev_get_platdata(&i2c->dev); int ret = 0; @@ -166,7 +156,7 @@ static int max8997_i2c_probe(struct i2c_client *i2c) i2c_set_clientdata(i2c, max8997); max8997->dev = &i2c->dev; max8997->i2c = i2c; - max8997->type = max8997_i2c_get_driver_data(i2c, id); + max8997->type = (unsigned long)i2c_get_match_data(i2c); max8997->irq = i2c->irq; if (IS_ENABLED(CONFIG_OF) && max8997->dev->of_node) {