From nobody Mon Feb 9 04:31:37 2026 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 01E61C83F2F for ; Thu, 31 Aug 2023 20:14:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343518AbjHaUOo (ORCPT ); Thu, 31 Aug 2023 16:14:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38492 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229559AbjHaUOn (ORCPT ); Thu, 31 Aug 2023 16:14:43 -0400 Received: from relmlie5.idc.renesas.com (relmlor1.renesas.com [210.160.252.171]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id E2D70E5B for ; Thu, 31 Aug 2023 13:14:39 -0700 (PDT) X-IronPort-AV: E=Sophos;i="6.02,217,1688396400"; d="scan'208";a="174633935" Received: from unknown (HELO relmlir5.idc.renesas.com) ([10.200.68.151]) by relmlie5.idc.renesas.com with ESMTP; 01 Sep 2023 05:14:39 +0900 Received: from localhost.localdomain (unknown [10.226.92.179]) by relmlir5.idc.renesas.com (Postfix) with ESMTP id 577D34005B44; Fri, 1 Sep 2023 05:14:36 +0900 (JST) From: Biju Das To: Jaroslav Kysela , Takashi Iwai Cc: Biju Das , Liam Girdwood , Mark Brown , Charles Keepax , Andy Shevchenko , =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= , patches@opensource.cirrus.com, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 1/2] ASoC: wm8580: Simplify probe() Date: Thu, 31 Aug 2023 21:14:28 +0100 Message-Id: <20230831201429.94554-2-biju.das.jz@bp.renesas.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230831201429.94554-1-biju.das.jz@bp.renesas.com> References: <20230831201429.94554-1-biju.das.jz@bp.renesas.com> 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 of_match_device->i2c_get_match_data() and extend matching support for ID table. While at it, remove comma in the terminator entry and simplify probe() by replacing dev_err()->dev_err_probe(). Signed-off-by: Biju Das Acked-by: Charles Keepax Reviewed-by: Andy Shevchenko --- v2->v3: * Added Rb tag from Andy. * Restored OF table postion and moved in patch#2 v1->v2: * Added Ack from Charles Keepax. * Removed comma in the terminator entry. * Restored original error code -EINVAL --- sound/soc/codecs/wm8580.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/sound/soc/codecs/wm8580.c b/sound/soc/codecs/wm8580.c index 6d22f7d40ec2..826c39ec4a1e 100644 --- a/sound/soc/codecs/wm8580.c +++ b/sound/soc/codecs/wm8580.c @@ -997,7 +997,6 @@ MODULE_DEVICE_TABLE(of, wm8580_of_match); =20 static int wm8580_i2c_probe(struct i2c_client *i2c) { - const struct of_device_id *of_id; struct wm8580_priv *wm8580; int ret, i; =20 @@ -1022,14 +1021,9 @@ static int wm8580_i2c_probe(struct i2c_client *i2c) =20 i2c_set_clientdata(i2c, wm8580); =20 - of_id =3D of_match_device(wm8580_of_match, &i2c->dev); - if (of_id) - wm8580->drvdata =3D of_id->data; - - if (!wm8580->drvdata) { - dev_err(&i2c->dev, "failed to find driver data\n"); - return -EINVAL; - } + wm8580->drvdata =3D i2c_get_match_data(i2c); + if (!wm8580->drvdata) + return dev_err_probe(&i2c->dev, -EINVAL, "failed to find driver data\n"); =20 ret =3D devm_snd_soc_register_component(&i2c->dev, &soc_component_dev_wm8580, wm8580_dai, ARRAY_SIZE(wm8580_dai)); --=20 2.25.1 From nobody Mon Feb 9 04:31:37 2026 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 C2051C83F2F for ; Thu, 31 Aug 2023 20:14:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345017AbjHaUOs (ORCPT ); Thu, 31 Aug 2023 16:14:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38568 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343540AbjHaUOr (ORCPT ); Thu, 31 Aug 2023 16:14:47 -0400 Received: from relmlie5.idc.renesas.com (relmlor1.renesas.com [210.160.252.171]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id E37A4E6F for ; Thu, 31 Aug 2023 13:14:43 -0700 (PDT) X-IronPort-AV: E=Sophos;i="6.02,217,1688396400"; d="scan'208";a="174633941" Received: from unknown (HELO relmlir5.idc.renesas.com) ([10.200.68.151]) by relmlie5.idc.renesas.com with ESMTP; 01 Sep 2023 05:14:43 +0900 Received: from localhost.localdomain (unknown [10.226.92.179]) by relmlir5.idc.renesas.com (Postfix) with ESMTP id 46A834005B44; Fri, 1 Sep 2023 05:14:40 +0900 (JST) From: Biju Das To: Jaroslav Kysela , Takashi Iwai Cc: Biju Das , Liam Girdwood , Mark Brown , Charles Keepax , Andy Shevchenko , =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= , patches@opensource.cirrus.com, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 2/2] ASoC: wm8580: Move OF table Date: Thu, 31 Aug 2023 21:14:29 +0100 Message-Id: <20230831201429.94554-3-biju.das.jz@bp.renesas.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230831201429.94554-1-biju.das.jz@bp.renesas.com> References: <20230831201429.94554-1-biju.das.jz@bp.renesas.com> 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" Move OF table near to the user. Signed-off-by: Biju Das --- v2: * New patch. --- sound/soc/codecs/wm8580.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/sound/soc/codecs/wm8580.c b/sound/soc/codecs/wm8580.c index 826c39ec4a1e..28c0ba348634 100644 --- a/sound/soc/codecs/wm8580.c +++ b/sound/soc/codecs/wm8580.c @@ -988,13 +988,6 @@ static const struct wm8580_driver_data wm8581_data =3D= { .num_dacs =3D 4, }; =20 -static const struct of_device_id wm8580_of_match[] =3D { - { .compatible =3D "wlf,wm8580", .data =3D &wm8580_data }, - { .compatible =3D "wlf,wm8581", .data =3D &wm8581_data }, - { }, -}; -MODULE_DEVICE_TABLE(of, wm8580_of_match); - static int wm8580_i2c_probe(struct i2c_client *i2c) { struct wm8580_priv *wm8580; @@ -1031,6 +1024,13 @@ static int wm8580_i2c_probe(struct i2c_client *i2c) return ret; } =20 +static const struct of_device_id wm8580_of_match[] =3D { + { .compatible =3D "wlf,wm8580", .data =3D &wm8580_data }, + { .compatible =3D "wlf,wm8581", .data =3D &wm8581_data }, + { } +}; +MODULE_DEVICE_TABLE(of, wm8580_of_match); + static const struct i2c_device_id wm8580_i2c_id[] =3D { { "wm8580", (kernel_ulong_t)&wm8580_data }, { "wm8581", (kernel_ulong_t)&wm8581_data }, --=20 2.25.1