From nobody Thu Dec 18 16:54:57 2025 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 9067BC83F17 for ; Mon, 28 Aug 2023 15:39:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232265AbjH1Pil (ORCPT ); Mon, 28 Aug 2023 11:38:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58608 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232358AbjH1PiQ (ORCPT ); Mon, 28 Aug 2023 11:38:16 -0400 Received: from relmlie5.idc.renesas.com (relmlor1.renesas.com [210.160.252.171]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 391AB102 for ; Mon, 28 Aug 2023 08:38:13 -0700 (PDT) X-IronPort-AV: E=Sophos;i="6.02,207,1688396400"; d="scan'208";a="174228938" Received: from unknown (HELO relmlir5.idc.renesas.com) ([10.200.68.151]) by relmlie5.idc.renesas.com with ESMTP; 29 Aug 2023 00:38:12 +0900 Received: from localhost.localdomain (unknown [10.226.92.234]) by relmlir5.idc.renesas.com (Postfix) with ESMTP id 3BC91400A677; Tue, 29 Aug 2023 00:38:10 +0900 (JST) From: Biju Das To: Lee Jones Cc: Biju Das , linux-kernel@vger.kernel.org, Andy Shevchenko Subject: [PATCH v2] mfd: max77541: Simplify probe() Date: Mon, 28 Aug 2023 16:38:05 +0100 Message-Id: <20230828153805.78421-1-biju.das.jz@bp.renesas.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Simplify probe() by replacing device_get_match_data() and ID lookup for retrieving match data by i2c_get_match_data(). While at it, drop leading commas from OF table. Signed-off-by: Biju Das --- v1->v2: * Restored error code -EINVAL. --- drivers/mfd/max77541.c | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/drivers/mfd/max77541.c b/drivers/mfd/max77541.c index 10c2e274b4af..2d50444a7b96 100644 --- a/drivers/mfd/max77541.c +++ b/drivers/mfd/max77541.c @@ -162,7 +162,6 @@ static int max77541_pmic_setup(struct device *dev) =20 static int max77541_probe(struct i2c_client *client) { - const struct i2c_device_id *id =3D i2c_client_get_device_id(client); struct device *dev =3D &client->dev; struct max77541 *max77541; =20 @@ -173,10 +172,7 @@ static int max77541_probe(struct i2c_client *client) i2c_set_clientdata(client, max77541); max77541->i2c =3D client; =20 - max77541->id =3D (uintptr_t)device_get_match_data(dev); - if (!max77541->id) - max77541->id =3D (enum max7754x_ids)id->driver_data; - + max77541->id =3D (uintptr_t)i2c_get_match_data(client); if (!max77541->id) return -EINVAL; =20 @@ -190,14 +186,8 @@ static int max77541_probe(struct i2c_client *client) } =20 static const struct of_device_id max77541_of_id[] =3D { - { - .compatible =3D "adi,max77540", - .data =3D (void *)MAX77540, - }, - { - .compatible =3D "adi,max77541", - .data =3D (void *)MAX77541, - }, + { .compatible =3D "adi,max77540", .data =3D (void *)MAX77540 }, + { .compatible =3D "adi,max77541", .data =3D (void *)MAX77541 }, { } }; MODULE_DEVICE_TABLE(of, max77541_of_id); --=20 2.25.1