From patchwork Thu Aug 31 19:17:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Biju Das X-Patchwork-Id: 13371824 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 alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 71795C83F3D for ; Thu, 31 Aug 2023 19:19:02 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 9883B74C; Thu, 31 Aug 2023 21:18:09 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 9883B74C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1693509539; bh=XFo3+bvpL0eiO7eKo6JCDhObwzNK+ngffIVy/ytT3Uw=; h=From:To:Cc:Subject:Date:List-Id:List-Archive:List-Help:List-Owner: List-Post:List-Subscribe:List-Unsubscribe:From; b=q0S8/v5I6iAZtWxrvinayfZtsS99dcBTJHoh8X/pVIl8gcyuCD0mdqakUmYHw3QyL vKHYXnRURkBUkhiLcUULQKfeot4UQ6twe6rvLwjKISbFY7NkXdAPm+hQ/DjOFKKFwb HLLGwbS6jp2pzscT4+0Y5NlduFyB+n9nazUyyK+g= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 9F93AF800D1; Thu, 31 Aug 2023 21:17:41 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 26C56F80155; Thu, 31 Aug 2023 21:17:41 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 05320F80155; Thu, 31 Aug 2023 21:17:37 +0200 (CEST) Received: from relmlie6.idc.renesas.com (relmlor2.renesas.com [210.160.252.172]) by alsa1.perex.cz (Postfix) with ESMTP id B2753F80007 for ; Thu, 31 Aug 2023 21:17:27 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz B2753F80007 X-IronPort-AV: E=Sophos;i="6.02,217,1688396400"; d="scan'208";a="178337608" Received: from unknown (HELO relmlir5.idc.renesas.com) ([10.200.68.151]) by relmlie6.idc.renesas.com with ESMTP; 01 Sep 2023 04:17:23 +0900 Received: from localhost.localdomain (unknown [10.226.92.179]) by relmlir5.idc.renesas.com (Postfix) with ESMTP id DD28C4000FA3; Fri, 1 Sep 2023 04:17:20 +0900 (JST) From: Biju Das To: Lee Jones Cc: Biju Das , Charles Keepax , Richard Fitzgerald , alsa-devel@alsa-project.org, patches@opensource.cirrus.com, linux-kernel@vger.kernel.org, Andy Shevchenko Subject: [PATCH v3] mfd: madera-i2c: Simplify probe() Date: Thu, 31 Aug 2023 20:17:17 +0100 Message-Id: <20230831191718.75509-1-biju.das.jz@bp.renesas.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Message-ID-Hash: 7EACAOE7B5KRHYFKZCUKC544ZPU2GDIN X-Message-ID-Hash: 7EACAOE7B5KRHYFKZCUKC544ZPU2GDIN X-MailFrom: biju.das.jz@bp.renesas.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.8 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Simplify probe() by replacing of_device_get_match_data() and ID lookup for retrieving match data by i2c_get_match_data(). Signed-off-by: Biju Das Acked-by: Charles Keepax --- Note: This patch is only compile tested. v2->v3: * Used uintptr_t for enum casting. v1->v2: * Added Ack tag from Charles Keepax. * Dropped blank line before switch statement. --- drivers/mfd/madera-i2c.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/drivers/mfd/madera-i2c.c b/drivers/mfd/madera-i2c.c index a404ea26bc79..0986e4a99f4a 100644 --- a/drivers/mfd/madera-i2c.c +++ b/drivers/mfd/madera-i2c.c @@ -18,21 +18,14 @@ static int madera_i2c_probe(struct i2c_client *i2c) { - const struct i2c_device_id *id = i2c_client_get_device_id(i2c); struct madera *madera; const struct regmap_config *regmap_16bit_config = NULL; const struct regmap_config *regmap_32bit_config = NULL; - const void *of_data; unsigned long type; const char *name; int ret; - of_data = of_device_get_match_data(&i2c->dev); - if (of_data) - type = (unsigned long)of_data; - else - type = id->driver_data; - + type = (uintptr_t)i2c_get_match_data(i2c); switch (type) { case CS47L15: if (IS_ENABLED(CONFIG_MFD_CS47L15)) {