From patchwork Sun Aug 27 08:09:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Biju Das X-Patchwork-Id: 717418 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 E7508C83F10 for ; Sun, 27 Aug 2023 08:11:16 +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 87263BC0; Sun, 27 Aug 2023 10:10:24 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 87263BC0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1693123874; bh=a79IGQNg8ZZYGq4XgfXAYG8kAPpcgW4hkZXZOG97X10=; h=From:To:Cc:Subject:Date:List-Id:List-Archive:List-Help:List-Owner: List-Post:List-Subscribe:List-Unsubscribe:From; b=u+b566nl5r2S4SSGbi9Iw9ZC5HRB1PuNFvlT5YpG3R4CG4Kznb2DD30cWEXevnFAo QlSiGMXQRACFKWAlv0FxQwxwdO4oh6bh2mZZV2WptSj1GZa0PyYVw+K1r1xDy7hKUb k+9QFbrBbIcV0Iq54CBONe4GTxDt1mslk7PMZy5w= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 8D39BF804DA; Sun, 27 Aug 2023 10:10:02 +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 24235F80158; Sun, 27 Aug 2023 10:10:02 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id F1A25F80158; Sun, 27 Aug 2023 10:09:55 +0200 (CEST) Received: from relmlie6.idc.renesas.com (relmlor2.renesas.com [210.160.252.172]) by alsa1.perex.cz (Postfix) with ESMTP id C0155F800D1 for ; Sun, 27 Aug 2023 10:09:46 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz C0155F800D1 X-IronPort-AV: E=Sophos;i="6.02,204,1688396400"; d="scan'208";a="177793568" Received: from unknown (HELO relmlir5.idc.renesas.com) ([10.200.68.151]) by relmlie6.idc.renesas.com with ESMTP; 27 Aug 2023 17:09:38 +0900 Received: from localhost.localdomain (unknown [10.226.92.26]) by relmlir5.idc.renesas.com (Postfix) with ESMTP id 78A3A4004474; Sun, 27 Aug 2023 17:09:34 +0900 (JST) From: Biju Das To: James Schulman , David Rhodes , Richard Fitzgerald , Jaroslav Kysela , Takashi Iwai Cc: Biju Das , Liam Girdwood , Mark Brown , alsa-devel@alsa-project.org, patches@opensource.cirrus.com, Geert Uytterhoeven , Andy Shevchenko , Prabhakar Mahadev Lad , linux-renesas-soc@vger.kernel.org Subject: [PATCH] ASoC: cs42xx8-i2c: Simplify probe() Date: Sun, 27 Aug 2023 09:09:31 +0100 Message-Id: <20230827080931.34524-1-biju.das.jz@bp.renesas.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Message-ID-Hash: U7VDOUACJUTQN5GJNYAU3KIYQFLCBB7U X-Message-ID-Hash: U7VDOUACJUTQN5GJNYAU3KIYQFLCBB7U 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_match_device->i2c_get_match_data() and extend matching support for ID table. Signed-off-by: Biju Das --- Note: This patch is only compile tested. --- sound/soc/codecs/cs42xx8-i2c.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/sound/soc/codecs/cs42xx8-i2c.c b/sound/soc/codecs/cs42xx8-i2c.c index a422472820fb..0f8e2d8cc876 100644 --- a/sound/soc/codecs/cs42xx8-i2c.c +++ b/sound/soc/codecs/cs42xx8-i2c.c @@ -18,21 +18,15 @@ #include "cs42xx8.h" -static const struct of_device_id cs42xx8_of_match[]; - static int cs42xx8_i2c_probe(struct i2c_client *i2c) { int ret; struct cs42xx8_driver_data *drvdata; - const struct of_device_id *of_id; - - of_id = of_match_device(cs42xx8_of_match, &i2c->dev); - if (!of_id) { - dev_err(&i2c->dev, "failed to find driver data\n"); - return -EINVAL; - } - drvdata = (struct cs42xx8_driver_data *)of_id->data; + drvdata = (struct cs42xx8_driver_data *)i2c_get_match_data(i2c); + if (!drvdata) + return dev_err_probe(&i2c->dev, -ENODEV, + "failed to find driver data\n"); ret = cs42xx8_probe(&i2c->dev, devm_regmap_init_i2c(i2c, &cs42xx8_regmap_config), drvdata);