From nobody Mon May 11 03:38:08 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 430DCC433F5 for ; Fri, 15 Apr 2022 16:13:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1355747AbiDOQPp (ORCPT ); Fri, 15 Apr 2022 12:15:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51674 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355741AbiDOQPn (ORCPT ); Fri, 15 Apr 2022 12:15:43 -0400 X-Greylist: delayed 2075 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Fri, 15 Apr 2022 09:13:13 PDT Received: from 17.mo561.mail-out.ovh.net (17.mo561.mail-out.ovh.net [87.98.178.58]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E15029681F for ; Fri, 15 Apr 2022 09:13:13 -0700 (PDT) Received: from player760.ha.ovh.net (unknown [10.110.208.22]) by mo561.mail-out.ovh.net (Postfix) with ESMTP id B09CB23D6E for ; Fri, 15 Apr 2022 16:06:44 +0000 (UTC) Received: from sk2.org (82-65-25-201.subs.proxad.net [82.65.25.201]) (Authenticated sender: steve@sk2.org) by player760.ha.ovh.net (Postfix) with ESMTPSA id DDC8E2986A8E3; Fri, 15 Apr 2022 16:06:38 +0000 (UTC) Authentication-Results: garm.ovh; auth=pass (GARM-101G0046e4cf2e4-4eda-47c3-9e45-5448747ece0e, 77125C2C2681624F8512B69FC7A1C9B53E6602B4) smtp.auth=steve@sk2.org X-OVh-ClientIp: 82.65.25.201 From: Stephen Kitt To: Liam Girdwood , Mark Brown Cc: Wolfram Sang , linux-kernel@vger.kernel.org, Stephen Kitt Subject: [PATCH v2 1/7] ASoC: ak*: use i2c_match_id and simple i2c probe Date: Fri, 15 Apr 2022 18:06:07 +0200 Message-Id: <20220415160613.148882-2-steve@sk2.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20220415160613.148882-1-steve@sk2.org> References: <20220415160613.148882-1-steve@sk2.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Ovh-Tracer-Id: 10958383795147736710 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvvddrudelhedgleekucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuqfggjfdpvefjgfevmfevgfenuceurghilhhouhhtmecuhedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefuthgvphhhvghnucfmihhtthcuoehsthgvvhgvsehskhdvrdhorhhgqeenucggtffrrghtthgvrhhnpeejleelvdefieeiuddtfeevkeegueehkeekvdffgedvhedugeekgfejjeekgfeugeenucfkpheptddrtddrtddrtddpkedvrdeihedrvdehrddvtddunecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmohguvgepshhmthhpohhuthdphhgvlhhopehplhgrhigvrhejiedtrdhhrgdrohhvhhdrnhgvthdpihhnvghtpedtrddtrddtrddtpdhmrghilhhfrhhomhepshhtvghvvgesshhkvddrohhrghdpnhgspghrtghpthhtohepuddprhgtphhtthhopehlihhnuhigqdhkvghrnhgvlhesvhhgvghrrdhkvghrnhgvlhdrohhrgh Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" As part of the ongoing i2c transition to the simple probe ("probe_new"), this patch uses i2c_match_id to retrieve the driver_data for the probed device. The id parameter is thus no longer necessary and the simple probe can be used instead. Signed-off-by: Stephen Kitt --- sound/soc/codecs/ak4613.c | 10 ++++++---- sound/soc/codecs/ak4642.c | 8 +++++--- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/sound/soc/codecs/ak4613.c b/sound/soc/codecs/ak4613.c index 03b829930769..55e773f92122 100644 --- a/sound/soc/codecs/ak4613.c +++ b/sound/soc/codecs/ak4613.c @@ -876,8 +876,7 @@ static void ak4613_parse_of(struct ak4613_priv *priv, AK4613_CONFIG_SDTI_set(priv, sdti_num); } =20 -static int ak4613_i2c_probe(struct i2c_client *i2c, - const struct i2c_device_id *id) +static int ak4613_i2c_probe(struct i2c_client *i2c) { struct device *dev =3D &i2c->dev; struct device_node *np =3D dev->of_node; @@ -888,8 +887,11 @@ static int ak4613_i2c_probe(struct i2c_client *i2c, regmap_cfg =3D NULL; if (np) regmap_cfg =3D of_device_get_match_data(dev); - else + else { + const struct i2c_device_id *id =3D + i2c_match_id(ak4613_i2c_id, i2c); regmap_cfg =3D (const struct regmap_config *)id->driver_data; + } =20 if (!regmap_cfg) return -EINVAL; @@ -927,7 +929,7 @@ static struct i2c_driver ak4613_i2c_driver =3D { .name =3D "ak4613-codec", .of_match_table =3D ak4613_of_match, }, - .probe =3D ak4613_i2c_probe, + .probe_new =3D ak4613_i2c_probe, .remove =3D ak4613_i2c_remove, .id_table =3D ak4613_i2c_id, }; diff --git a/sound/soc/codecs/ak4642.c b/sound/soc/codecs/ak4642.c index c284dcc5af76..3c20ff5595eb 100644 --- a/sound/soc/codecs/ak4642.c +++ b/sound/soc/codecs/ak4642.c @@ -630,8 +630,8 @@ static struct clk *ak4642_of_parse_mcko(struct device *= dev) #endif =20 static const struct of_device_id ak4642_of_match[]; -static int ak4642_i2c_probe(struct i2c_client *i2c, - const struct i2c_device_id *id) +static const struct i2c_device_id ak4642_i2c_id[]; +static int ak4642_i2c_probe(struct i2c_client *i2c) { struct device *dev =3D &i2c->dev; struct device_node *np =3D dev->of_node; @@ -651,6 +651,8 @@ static int ak4642_i2c_probe(struct i2c_client *i2c, if (of_id) drvdata =3D of_id->data; } else { + const struct i2c_device_id *id =3D + i2c_match_id(ak4642_i2c_id, i2c); drvdata =3D (const struct ak4642_drvdata *)id->driver_data; } =20 @@ -697,7 +699,7 @@ static struct i2c_driver ak4642_i2c_driver =3D { .name =3D "ak4642-codec", .of_match_table =3D ak4642_of_match, }, - .probe =3D ak4642_i2c_probe, + .probe_new =3D ak4642_i2c_probe, .id_table =3D ak4642_i2c_id, }; =20 --=20 2.27.0 From nobody Mon May 11 03:38:08 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 411B4C4332F for ; Fri, 15 Apr 2022 16:13:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1355739AbiDOQPm (ORCPT ); Fri, 15 Apr 2022 12:15:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51612 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235513AbiDOQPi (ORCPT ); Fri, 15 Apr 2022 12:15:38 -0400 Received: from 4.mo576.mail-out.ovh.net (4.mo576.mail-out.ovh.net [46.105.42.102]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BFCC18B6FE for ; Fri, 15 Apr 2022 09:13:09 -0700 (PDT) Received: from player760.ha.ovh.net (unknown [10.111.208.246]) by mo576.mail-out.ovh.net (Postfix) with ESMTP id 595F82463A for ; Fri, 15 Apr 2022 16:06:50 +0000 (UTC) Received: from sk2.org (82-65-25-201.subs.proxad.net [82.65.25.201]) (Authenticated sender: steve@sk2.org) by player760.ha.ovh.net (Postfix) with ESMTPSA id BEDC92986A90E; Fri, 15 Apr 2022 16:06:44 +0000 (UTC) Authentication-Results: garm.ovh; auth=pass (GARM-101G0044d467020-e7dc-4167-a667-403648bacf92, 77125C2C2681624F8512B69FC7A1C9B53E6602B4) smtp.auth=steve@sk2.org X-OVh-ClientIp: 82.65.25.201 From: Stephen Kitt To: Liam Girdwood , Mark Brown Cc: Wolfram Sang , linux-kernel@vger.kernel.org, Stephen Kitt Subject: [PATCH v2 2/7] ASoC: alc56*: use i2c_match_id and simple i2c probe Date: Fri, 15 Apr 2022 18:06:08 +0200 Message-Id: <20220415160613.148882-3-steve@sk2.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20220415160613.148882-1-steve@sk2.org> References: <20220415160613.148882-1-steve@sk2.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Ovh-Tracer-Id: 10960072647168853638 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvvddrudelhedgleekucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuqfggjfdpvefjgfevmfevgfenuceurghilhhouhhtmecuhedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefuthgvphhhvghnucfmihhtthcuoehsthgvvhgvsehskhdvrdhorhhgqeenucggtffrrghtthgvrhhnpeejleelvdefieeiuddtfeevkeegueehkeekvdffgedvhedugeekgfejjeekgfeugeenucfkpheptddrtddrtddrtddpkedvrdeihedrvdehrddvtddunecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmohguvgepshhmthhpohhuthdphhgvlhhopehplhgrhigvrhejiedtrdhhrgdrohhvhhdrnhgvthdpihhnvghtpedtrddtrddtrddtpdhmrghilhhfrhhomhepshhtvghvvgesshhkvddrohhrghdpnhgspghrtghpthhtohepuddprhgtphhtthhopehlihhnuhigqdhkvghrnhgvlhesvhhgvghrrdhkvghrnhgvlhdrohhrgh Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" As part of the ongoing i2c transition to the simple probe ("probe_new"), this patch uses i2c_match_id to retrieve the driver_data for the probed device. The id parameter is thus no longer necessary and the simple probe can be used instead. The i2c id tables are moved up before the probe function, as suggested by Wolfram Sang. Signed-off-by: Stephen Kitt --- sound/soc/codecs/alc5623.c | 24 +++++++++++++----------- sound/soc/codecs/alc5632.c | 20 +++++++++++--------- 2 files changed, 24 insertions(+), 20 deletions(-) diff --git a/sound/soc/codecs/alc5623.c b/sound/soc/codecs/alc5623.c index b10357a6d655..8e6235d2c544 100644 --- a/sound/soc/codecs/alc5623.c +++ b/sound/soc/codecs/alc5623.c @@ -968,14 +968,21 @@ static const struct regmap_config alc5623_regmap =3D { .cache_type =3D REGCACHE_RBTREE, }; =20 +static const struct i2c_device_id alc5623_i2c_table[] =3D { + {"alc5621", 0x21}, + {"alc5622", 0x22}, + {"alc5623", 0x23}, + {} +}; +MODULE_DEVICE_TABLE(i2c, alc5623_i2c_table); + /* * ALC5623 2 wire address is determined by A1 pin * state during powerup. * low =3D 0x1a * high =3D 0x1b */ -static int alc5623_i2c_probe(struct i2c_client *client, - const struct i2c_device_id *id) +static int alc5623_i2c_probe(struct i2c_client *client) { struct alc5623_platform_data *pdata; struct alc5623_priv *alc5623; @@ -983,6 +990,7 @@ static int alc5623_i2c_probe(struct i2c_client *client, unsigned int vid1, vid2; int ret; u32 val32; + const struct i2c_device_id *id; =20 alc5623 =3D devm_kzalloc(&client->dev, sizeof(struct alc5623_priv), GFP_KERNEL); @@ -1009,6 +1017,8 @@ static int alc5623_i2c_probe(struct i2c_client *clien= t, } vid2 >>=3D 8; =20 + id =3D i2c_match_id(alc5623_i2c_table, client); + if ((vid1 !=3D 0x10ec) || (vid2 !=3D id->driver_data)) { dev_err(&client->dev, "unknown or wrong codec\n"); dev_err(&client->dev, "Expected %x:%lx, got %x:%x\n", @@ -1060,14 +1070,6 @@ static int alc5623_i2c_probe(struct i2c_client *clie= nt, return ret; } =20 -static const struct i2c_device_id alc5623_i2c_table[] =3D { - {"alc5621", 0x21}, - {"alc5622", 0x22}, - {"alc5623", 0x23}, - {} -}; -MODULE_DEVICE_TABLE(i2c, alc5623_i2c_table); - #ifdef CONFIG_OF static const struct of_device_id alc5623_of_match[] =3D { { .compatible =3D "realtek,alc5623", }, @@ -1082,7 +1084,7 @@ static struct i2c_driver alc5623_i2c_driver =3D { .name =3D "alc562x-codec", .of_match_table =3D of_match_ptr(alc5623_of_match), }, - .probe =3D alc5623_i2c_probe, + .probe_new =3D alc5623_i2c_probe, .id_table =3D alc5623_i2c_table, }; =20 diff --git a/sound/soc/codecs/alc5632.c b/sound/soc/codecs/alc5632.c index 6d7af3736a91..641bdfddae16 100644 --- a/sound/soc/codecs/alc5632.c +++ b/sound/soc/codecs/alc5632.c @@ -1092,18 +1092,24 @@ static const struct regmap_config alc5632_regmap = =3D { .cache_type =3D REGCACHE_RBTREE, }; =20 +static const struct i2c_device_id alc5632_i2c_table[] =3D { + {"alc5632", 0x5c}, + {} +}; +MODULE_DEVICE_TABLE(i2c, alc5632_i2c_table); + /* * alc5632 2 wire address is determined by A1 pin * state during powerup. * low =3D 0x1a * high =3D 0x1b */ -static int alc5632_i2c_probe(struct i2c_client *client, - const struct i2c_device_id *id) +static int alc5632_i2c_probe(struct i2c_client *client) { struct alc5632_priv *alc5632; int ret, ret1, ret2; unsigned int vid1, vid2; + const struct i2c_device_id *id; =20 alc5632 =3D devm_kzalloc(&client->dev, sizeof(struct alc5632_priv), GFP_KERNEL); @@ -1129,6 +1135,8 @@ static int alc5632_i2c_probe(struct i2c_client *clien= t, =20 vid2 >>=3D 8; =20 + id =3D i2c_match_id(alc5632_i2c_table, client); + if ((vid1 !=3D 0x10EC) || (vid2 !=3D id->driver_data)) { dev_err(&client->dev, "Device is not a ALC5632: VID1=3D0x%x, VID2=3D0x%x\n", vid1, vid2); @@ -1161,12 +1169,6 @@ static int alc5632_i2c_probe(struct i2c_client *clie= nt, return ret; } =20 -static const struct i2c_device_id alc5632_i2c_table[] =3D { - {"alc5632", 0x5c}, - {} -}; -MODULE_DEVICE_TABLE(i2c, alc5632_i2c_table); - #ifdef CONFIG_OF static const struct of_device_id alc5632_of_match[] =3D { { .compatible =3D "realtek,alc5632", }, @@ -1181,7 +1183,7 @@ static struct i2c_driver alc5632_i2c_driver =3D { .name =3D "alc5632", .of_match_table =3D of_match_ptr(alc5632_of_match), }, - .probe =3D alc5632_i2c_probe, + .probe_new =3D alc5632_i2c_probe, .id_table =3D alc5632_i2c_table, }; =20 --=20 2.27.0 From nobody Mon May 11 03:38:08 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 B6022C433F5 for ; Fri, 15 Apr 2022 16:07:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1355708AbiDOQJb (ORCPT ); Fri, 15 Apr 2022 12:09:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46946 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239368AbiDOQJ2 (ORCPT ); Fri, 15 Apr 2022 12:09:28 -0400 Received: from 10.mo550.mail-out.ovh.net (10.mo550.mail-out.ovh.net [178.32.96.102]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4EF438A307 for ; Fri, 15 Apr 2022 09:06:59 -0700 (PDT) Received: from player760.ha.ovh.net (unknown [10.111.172.135]) by mo550.mail-out.ovh.net (Postfix) with ESMTP id 8D26D24153 for ; Fri, 15 Apr 2022 16:06:57 +0000 (UTC) Received: from sk2.org (82-65-25-201.subs.proxad.net [82.65.25.201]) (Authenticated sender: steve@sk2.org) by player760.ha.ovh.net (Postfix) with ESMTPSA id 489522986A932; Fri, 15 Apr 2022 16:06:50 +0000 (UTC) Authentication-Results: garm.ovh; auth=pass (GARM-101G0043f5dd12a-890b-4a28-832d-898a6081a301, 77125C2C2681624F8512B69FC7A1C9B53E6602B4) smtp.auth=steve@sk2.org X-OVh-ClientIp: 82.65.25.201 From: Stephen Kitt To: Liam Girdwood , Mark Brown Cc: Wolfram Sang , linux-kernel@vger.kernel.org, Stephen Kitt Subject: [PATCH v2 3/7] ASoC: max980*: use i2c_match_id and simple i2c probe Date: Fri, 15 Apr 2022 18:06:09 +0200 Message-Id: <20220415160613.148882-4-steve@sk2.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20220415160613.148882-1-steve@sk2.org> References: <20220415160613.148882-1-steve@sk2.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Ovh-Tracer-Id: 10962042969681856134 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvvddrudelhedgleekucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuqfggjfdpvefjgfevmfevgfenuceurghilhhouhhtmecuhedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefuthgvphhhvghnucfmihhtthcuoehsthgvvhgvsehskhdvrdhorhhgqeenucggtffrrghtthgvrhhnpeejleelvdefieeiuddtfeevkeegueehkeekvdffgedvhedugeekgfejjeekgfeugeenucfkpheptddrtddrtddrtddpkedvrdeihedrvdehrddvtddunecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmohguvgepshhmthhpohhuthdphhgvlhhopehplhgrhigvrhejiedtrdhhrgdrohhvhhdrnhgvthdpihhnvghtpedtrddtrddtrddtpdhmrghilhhfrhhomhepshhtvghvvgesshhkvddrohhrghdpnhgspghrtghpthhtohepuddprhgtphhtthhopehlihhnuhigqdhkvghrnhgvlhesvhhgvghrrdhkvghrnhgvlhdrohhrgh Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" As part of the ongoing i2c transition to the simple probe ("probe_new"), this patch uses i2c_match_id to retrieve the driver_data for the probed device. The id parameter is thus no longer necessary and the simple probe can be used instead. In the context of an i2c probe, i2c_match_id with the module id table and the probed client never returns null, so removing the null check on the i2c_device_id pointer is safe. The i2c id tables are moved up before the probe function, as suggested by Wolfram Sang. Signed-off-by: Stephen Kitt --- sound/soc/codecs/max98088.c | 21 +++++++++++---------- sound/soc/codecs/max98090.c | 23 ++++++++++++----------- sound/soc/codecs/max98095.c | 19 ++++++++++--------- 3 files changed, 33 insertions(+), 30 deletions(-) diff --git a/sound/soc/codecs/max98088.c b/sound/soc/codecs/max98088.c index 429717d4ac5a..5ef2e1279ee7 100644 --- a/sound/soc/codecs/max98088.c +++ b/sound/soc/codecs/max98088.c @@ -1737,11 +1737,18 @@ static const struct snd_soc_component_driver soc_co= mponent_dev_max98088 =3D { .non_legacy_dai_naming =3D 1, }; =20 -static int max98088_i2c_probe(struct i2c_client *i2c, - const struct i2c_device_id *id) +static const struct i2c_device_id max98088_i2c_id[] =3D { + { "max98088", MAX98088 }, + { "max98089", MAX98089 }, + { } +}; +MODULE_DEVICE_TABLE(i2c, max98088_i2c_id); + +static int max98088_i2c_probe(struct i2c_client *i2c) { struct max98088_priv *max98088; int ret; + const struct i2c_device_id *id; =20 max98088 =3D devm_kzalloc(&i2c->dev, sizeof(struct max98088_priv), GFP_KERNEL); @@ -1757,6 +1764,7 @@ static int max98088_i2c_probe(struct i2c_client *i2c, if (PTR_ERR(max98088->mclk) =3D=3D -EPROBE_DEFER) return PTR_ERR(max98088->mclk); =20 + id =3D i2c_match_id(max98088_i2c_id, i2c); max98088->devtype =3D id->driver_data; =20 i2c_set_clientdata(i2c, max98088); @@ -1767,13 +1775,6 @@ static int max98088_i2c_probe(struct i2c_client *i2c, return ret; } =20 -static const struct i2c_device_id max98088_i2c_id[] =3D { - { "max98088", MAX98088 }, - { "max98089", MAX98089 }, - { } -}; -MODULE_DEVICE_TABLE(i2c, max98088_i2c_id); - #if defined(CONFIG_OF) static const struct of_device_id max98088_of_match[] =3D { { .compatible =3D "maxim,max98088" }, @@ -1788,7 +1789,7 @@ static struct i2c_driver max98088_i2c_driver =3D { .name =3D "max98088", .of_match_table =3D of_match_ptr(max98088_of_match), }, - .probe =3D max98088_i2c_probe, + .probe_new =3D max98088_i2c_probe, .id_table =3D max98088_i2c_id, }; =20 diff --git a/sound/soc/codecs/max98090.c b/sound/soc/codecs/max98090.c index b45ec35cd63c..4058e147413c 100644 --- a/sound/soc/codecs/max98090.c +++ b/sound/soc/codecs/max98090.c @@ -2529,8 +2529,14 @@ static const struct regmap_config max98090_regmap = =3D { .cache_type =3D REGCACHE_RBTREE, }; =20 -static int max98090_i2c_probe(struct i2c_client *i2c, - const struct i2c_device_id *i2c_id) +static const struct i2c_device_id max98090_i2c_id[] =3D { + { "max98090", MAX98090 }, + { "max98091", MAX98091 }, + { } +}; +MODULE_DEVICE_TABLE(i2c, max98090_i2c_id); + +static int max98090_i2c_probe(struct i2c_client *i2c) { struct max98090_priv *max98090; const struct acpi_device_id *acpi_id; @@ -2552,7 +2558,9 @@ static int max98090_i2c_probe(struct i2c_client *i2c, return -EINVAL; } driver_data =3D acpi_id->driver_data; - } else if (i2c_id) { + } else { + const struct i2c_device_id *i2c_id =3D + i2c_match_id(max98090_i2c_id, i2c); driver_data =3D i2c_id->driver_data; } =20 @@ -2659,13 +2667,6 @@ static const struct dev_pm_ops max98090_pm =3D { SET_SYSTEM_SLEEP_PM_OPS(NULL, max98090_resume) }; =20 -static const struct i2c_device_id max98090_i2c_id[] =3D { - { "max98090", MAX98090 }, - { "max98091", MAX98091 }, - { } -}; -MODULE_DEVICE_TABLE(i2c, max98090_i2c_id); - #ifdef CONFIG_OF static const struct of_device_id max98090_of_match[] =3D { { .compatible =3D "maxim,max98090", }, @@ -2690,7 +2691,7 @@ static struct i2c_driver max98090_i2c_driver =3D { .of_match_table =3D of_match_ptr(max98090_of_match), .acpi_match_table =3D ACPI_PTR(max98090_acpi_match), }, - .probe =3D max98090_i2c_probe, + .probe_new =3D max98090_i2c_probe, .shutdown =3D max98090_i2c_shutdown, .remove =3D max98090_i2c_remove, .id_table =3D max98090_i2c_id, diff --git a/sound/soc/codecs/max98095.c b/sound/soc/codecs/max98095.c index 4977b00ddf5f..7bca99fa61b5 100644 --- a/sound/soc/codecs/max98095.c +++ b/sound/soc/codecs/max98095.c @@ -2106,11 +2106,17 @@ static const struct snd_soc_component_driver soc_co= mponent_dev_max98095 =3D { .non_legacy_dai_naming =3D 1, }; =20 -static int max98095_i2c_probe(struct i2c_client *i2c, - const struct i2c_device_id *id) +static const struct i2c_device_id max98095_i2c_id[] =3D { + { "max98095", MAX98095 }, + { } +}; +MODULE_DEVICE_TABLE(i2c, max98095_i2c_id); + +static int max98095_i2c_probe(struct i2c_client *i2c) { struct max98095_priv *max98095; int ret; + const struct i2c_device_id *id; =20 max98095 =3D devm_kzalloc(&i2c->dev, sizeof(struct max98095_priv), GFP_KERNEL); @@ -2126,6 +2132,7 @@ static int max98095_i2c_probe(struct i2c_client *i2c, return ret; } =20 + id =3D i2c_match_id(max98095_i2c_id, i2c); max98095->devtype =3D id->driver_data; i2c_set_clientdata(i2c, max98095); max98095->pdata =3D i2c->dev.platform_data; @@ -2136,12 +2143,6 @@ static int max98095_i2c_probe(struct i2c_client *i2c, return ret; } =20 -static const struct i2c_device_id max98095_i2c_id[] =3D { - { "max98095", MAX98095 }, - { } -}; -MODULE_DEVICE_TABLE(i2c, max98095_i2c_id); - #ifdef CONFIG_OF static const struct of_device_id max98095_of_match[] =3D { { .compatible =3D "maxim,max98095", }, @@ -2155,7 +2156,7 @@ static struct i2c_driver max98095_i2c_driver =3D { .name =3D "max98095", .of_match_table =3D of_match_ptr(max98095_of_match), }, - .probe =3D max98095_i2c_probe, + .probe_new =3D max98095_i2c_probe, .id_table =3D max98095_i2c_id, }; =20 --=20 2.27.0 From nobody Mon May 11 03:38:08 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 18CBFC433F5 for ; Fri, 15 Apr 2022 16:07:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1355723AbiDOQJi (ORCPT ); Fri, 15 Apr 2022 12:09:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46986 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355100AbiDOQJd (ORCPT ); Fri, 15 Apr 2022 12:09:33 -0400 Received: from 7.mo575.mail-out.ovh.net (7.mo575.mail-out.ovh.net [46.105.63.230]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BDC5A8BE31 for ; Fri, 15 Apr 2022 09:07:04 -0700 (PDT) Received: from player760.ha.ovh.net (unknown [10.110.103.18]) by mo575.mail-out.ovh.net (Postfix) with ESMTP id 1953D25615 for ; Fri, 15 Apr 2022 16:07:03 +0000 (UTC) Received: from sk2.org (82-65-25-201.subs.proxad.net [82.65.25.201]) (Authenticated sender: steve@sk2.org) by player760.ha.ovh.net (Postfix) with ESMTPSA id 866D12986A96D; Fri, 15 Apr 2022 16:06:57 +0000 (UTC) Authentication-Results: garm.ovh; auth=pass (GARM-101G004712937d1-ea39-4cd2-a334-326f8b3c9a7c, 77125C2C2681624F8512B69FC7A1C9B53E6602B4) smtp.auth=steve@sk2.org X-OVh-ClientIp: 82.65.25.201 From: Stephen Kitt To: Liam Girdwood , Mark Brown Cc: Wolfram Sang , linux-kernel@vger.kernel.org, Stephen Kitt Subject: [PATCH v2 4/7] ASoC: pcm186x: use i2c_match_id and simple i2c probe Date: Fri, 15 Apr 2022 18:06:10 +0200 Message-Id: <20220415160613.148882-5-steve@sk2.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20220415160613.148882-1-steve@sk2.org> References: <20220415160613.148882-1-steve@sk2.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Ovh-Tracer-Id: 10963450345294235270 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvvddrudelhedgleekucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuqfggjfdpvefjgfevmfevgfenuceurghilhhouhhtmecuhedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefuthgvphhhvghnucfmihhtthcuoehsthgvvhgvsehskhdvrdhorhhgqeenucggtffrrghtthgvrhhnpeejleelvdefieeiuddtfeevkeegueehkeekvdffgedvhedugeekgfejjeekgfeugeenucfkpheptddrtddrtddrtddpkedvrdeihedrvdehrddvtddunecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmohguvgepshhmthhpohhuthdphhgvlhhopehplhgrhigvrhejiedtrdhhrgdrohhvhhdrnhgvthdpihhnvghtpedtrddtrddtrddtpdhmrghilhhfrhhomhepshhtvghvvgesshhkvddrohhrghdpnhgspghrtghpthhtohepuddprhgtphhtthhopehlihhnuhigqdhkvghrnhgvlhesvhhgvghrrdhkvghrnhgvlhdrohhrgh Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" As part of the ongoing i2c transition to the simple probe ("probe_new"), this patch uses i2c_match_id to retrieve the driver_data for the probed device. The id parameter is thus no longer necessary and the simple probe can be used instead. The i2c id table is moved up before the probe function, as suggested by Wolfram Sang. Signed-off-by: Stephen Kitt --- sound/soc/codecs/pcm186x-i2c.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/sound/soc/codecs/pcm186x-i2c.c b/sound/soc/codecs/pcm186x-i2c.c index f8382b74391d..932c8d41c3ea 100644 --- a/sound/soc/codecs/pcm186x-i2c.c +++ b/sound/soc/codecs/pcm186x-i2c.c @@ -22,9 +22,18 @@ static const struct of_device_id pcm186x_of_match[] =3D { }; MODULE_DEVICE_TABLE(of, pcm186x_of_match); =20 -static int pcm186x_i2c_probe(struct i2c_client *i2c, - const struct i2c_device_id *id) +static const struct i2c_device_id pcm186x_i2c_id[] =3D { + { "pcm1862", PCM1862 }, + { "pcm1863", PCM1863 }, + { "pcm1864", PCM1864 }, + { "pcm1865", PCM1865 }, + { } +}; +MODULE_DEVICE_TABLE(i2c, pcm186x_i2c_id); + +static int pcm186x_i2c_probe(struct i2c_client *i2c) { + const struct i2c_device_id *id =3D i2c_match_id(pcm186x_i2c_id, i2c); const enum pcm186x_type type =3D (enum pcm186x_type)id->driver_data; int irq =3D i2c->irq; struct regmap *regmap; @@ -36,17 +45,8 @@ static int pcm186x_i2c_probe(struct i2c_client *i2c, return pcm186x_probe(&i2c->dev, type, irq, regmap); } =20 -static const struct i2c_device_id pcm186x_i2c_id[] =3D { - { "pcm1862", PCM1862 }, - { "pcm1863", PCM1863 }, - { "pcm1864", PCM1864 }, - { "pcm1865", PCM1865 }, - { } -}; -MODULE_DEVICE_TABLE(i2c, pcm186x_i2c_id); - static struct i2c_driver pcm186x_i2c_driver =3D { - .probe =3D pcm186x_i2c_probe, + .probe_new =3D pcm186x_i2c_probe, .id_table =3D pcm186x_i2c_id, .driver =3D { .name =3D "pcm186x", --=20 2.27.0 From nobody Mon May 11 03:38:08 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 442E5C433EF for ; Fri, 15 Apr 2022 16:13:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1355041AbiDOQPk (ORCPT ); Fri, 15 Apr 2022 12:15:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51610 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234771AbiDOQPi (ORCPT ); Fri, 15 Apr 2022 12:15:38 -0400 Received: from 19.mo582.mail-out.ovh.net (19.mo582.mail-out.ovh.net [188.165.56.177]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 42361517FD for ; Fri, 15 Apr 2022 09:13:09 -0700 (PDT) Received: from player760.ha.ovh.net (unknown [10.110.208.168]) by mo582.mail-out.ovh.net (Postfix) with ESMTP id E8DF8244FF for ; Fri, 15 Apr 2022 16:07:10 +0000 (UTC) Received: from sk2.org (82-65-25-201.subs.proxad.net [82.65.25.201]) (Authenticated sender: steve@sk2.org) by player760.ha.ovh.net (Postfix) with ESMTPSA id 19A4B2986A9AB; Fri, 15 Apr 2022 16:07:03 +0000 (UTC) Authentication-Results: garm.ovh; auth=pass (GARM-101G00416ca86b2-9a0f-4681-94ed-f573f58de6cb, 77125C2C2681624F8512B69FC7A1C9B53E6602B4) smtp.auth=steve@sk2.org X-OVh-ClientIp: 82.65.25.201 From: Stephen Kitt To: Liam Girdwood , Mark Brown Cc: Wolfram Sang , linux-kernel@vger.kernel.org, Stephen Kitt Subject: [PATCH v2 5/7] ASoC: tas*: use i2c_match_id and simple i2c probe Date: Fri, 15 Apr 2022 18:06:11 +0200 Message-Id: <20220415160613.148882-6-steve@sk2.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20220415160613.148882-1-steve@sk2.org> References: <20220415160613.148882-1-steve@sk2.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Ovh-Tracer-Id: 10965702145974109830 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvvddrudelhedgleekucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuqfggjfdpvefjgfevmfevgfenuceurghilhhouhhtmecuhedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefuthgvphhhvghnucfmihhtthcuoehsthgvvhgvsehskhdvrdhorhhgqeenucggtffrrghtthgvrhhnpeejleelvdefieeiuddtfeevkeegueehkeekvdffgedvhedugeekgfejjeekgfeugeenucfkpheptddrtddrtddrtddpkedvrdeihedrvdehrddvtddunecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmohguvgepshhmthhpohhuthdphhgvlhhopehplhgrhigvrhejiedtrdhhrgdrohhvhhdrnhgvthdpihhnvghtpedtrddtrddtrddtpdhmrghilhhfrhhomhepshhtvghvvgesshhkvddrohhrghdpnhgspghrtghpthhtohepuddprhgtphhtthhopehlihhnuhigqdhkvghrnhgvlhesvhhgvghrrdhkvghrnhgvlhdrohhrgh Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" As part of the ongoing i2c transition to the simple probe ("probe_new"), this patch uses i2c_match_id to retrieve the driver_data for the probed device. The id parameter is thus no longer necessary and the simple probe can be used instead. The i2c id tables are moved up before the probe function, as suggested by Wolfram Sang, except where the existing code already had a declaration for the of_device_id table. Signed-off-by: Stephen Kitt --- sound/soc/codecs/tas2562.c | 25 +++++++++++++------------ sound/soc/codecs/tas571x.c | 11 +++++++---- sound/soc/codecs/tas5720.c | 21 +++++++++++---------- 3 files changed, 31 insertions(+), 26 deletions(-) diff --git a/sound/soc/codecs/tas2562.c b/sound/soc/codecs/tas2562.c index 10302552195e..e62a3da16aed 100644 --- a/sound/soc/codecs/tas2562.c +++ b/sound/soc/codecs/tas2562.c @@ -754,17 +754,27 @@ static int tas2562_parse_dt(struct tas2562_data *tas2= 562) return ret; } =20 -static int tas2562_probe(struct i2c_client *client, - const struct i2c_device_id *id) +static const struct i2c_device_id tas2562_id[] =3D { + { "tas2562", TAS2562 }, + { "tas2563", TAS2563 }, + { "tas2564", TAS2564 }, + { "tas2110", TAS2110 }, + { } +}; +MODULE_DEVICE_TABLE(i2c, tas2562_id); + +static int tas2562_probe(struct i2c_client *client) { struct device *dev =3D &client->dev; struct tas2562_data *data; int ret; + const struct i2c_device_id *id; =20 data =3D devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); if (!data) return -ENOMEM; =20 + id =3D i2c_match_id(tas2562_id, client); data->client =3D client; data->dev =3D &client->dev; data->model_id =3D id->driver_data; @@ -792,15 +802,6 @@ static int tas2562_probe(struct i2c_client *client, =20 } =20 -static const struct i2c_device_id tas2562_id[] =3D { - { "tas2562", TAS2562 }, - { "tas2563", TAS2563 }, - { "tas2564", TAS2564 }, - { "tas2110", TAS2110 }, - { } -}; -MODULE_DEVICE_TABLE(i2c, tas2562_id); - #ifdef CONFIG_OF static const struct of_device_id tas2562_of_match[] =3D { { .compatible =3D "ti,tas2562", }, @@ -817,7 +818,7 @@ static struct i2c_driver tas2562_i2c_driver =3D { .name =3D "tas2562", .of_match_table =3D of_match_ptr(tas2562_of_match), }, - .probe =3D tas2562_probe, + .probe_new =3D tas2562_probe, .id_table =3D tas2562_id, }; =20 diff --git a/sound/soc/codecs/tas571x.c b/sound/soc/codecs/tas571x.c index a3e682376946..dd289774efb2 100644 --- a/sound/soc/codecs/tas571x.c +++ b/sound/soc/codecs/tas571x.c @@ -774,9 +774,9 @@ static struct snd_soc_dai_driver tas571x_dai =3D { }; =20 static const struct of_device_id tas571x_of_match[] __maybe_unused; +static const struct i2c_device_id tas571x_i2c_id[]; =20 -static int tas571x_i2c_probe(struct i2c_client *client, - const struct i2c_device_id *id) +static int tas571x_i2c_probe(struct i2c_client *client) { struct tas571x_private *priv; struct device *dev =3D &client->dev; @@ -791,8 +791,11 @@ static int tas571x_i2c_probe(struct i2c_client *client, of_id =3D of_match_device(tas571x_of_match, dev); if (of_id) priv->chip =3D of_id->data; - else + else { + const struct i2c_device_id *id =3D + i2c_match_id(tas571x_i2c_id, client); priv->chip =3D (void *) id->driver_data; + } =20 priv->mclk =3D devm_clk_get(dev, "mclk"); if (IS_ERR(priv->mclk) && PTR_ERR(priv->mclk) !=3D -ENOENT) { @@ -914,7 +917,7 @@ static struct i2c_driver tas571x_i2c_driver =3D { .name =3D "tas571x", .of_match_table =3D of_match_ptr(tas571x_of_match), }, - .probe =3D tas571x_i2c_probe, + .probe_new =3D tas571x_i2c_probe, .remove =3D tas571x_i2c_remove, .id_table =3D tas571x_i2c_id, }; diff --git a/sound/soc/codecs/tas5720.c b/sound/soc/codecs/tas5720.c index 9ff644ddb470..17034abef568 100644 --- a/sound/soc/codecs/tas5720.c +++ b/sound/soc/codecs/tas5720.c @@ -633,12 +633,19 @@ static struct snd_soc_dai_driver tas5720_dai[] =3D { }, }; =20 -static int tas5720_probe(struct i2c_client *client, - const struct i2c_device_id *id) +static const struct i2c_device_id tas5720_id[] =3D { + { "tas5720", TAS5720 }, + { "tas5722", TAS5722 }, + { } +}; +MODULE_DEVICE_TABLE(i2c, tas5720_id); + +static int tas5720_probe(struct i2c_client *client) { struct device *dev =3D &client->dev; struct tas5720_data *data; const struct regmap_config *regmap_config; + const struct i2c_device_id *id; int ret; int i; =20 @@ -646,6 +653,7 @@ static int tas5720_probe(struct i2c_client *client, if (!data) return -ENOMEM; =20 + id =3D i2c_match_id(tas5720_id, client); data->tas5720_client =3D client; data->devtype =3D id->driver_data; =20 @@ -704,13 +712,6 @@ static int tas5720_probe(struct i2c_client *client, return 0; } =20 -static const struct i2c_device_id tas5720_id[] =3D { - { "tas5720", TAS5720 }, - { "tas5722", TAS5722 }, - { } -}; -MODULE_DEVICE_TABLE(i2c, tas5720_id); - #if IS_ENABLED(CONFIG_OF) static const struct of_device_id tas5720_of_match[] =3D { { .compatible =3D "ti,tas5720", }, @@ -725,7 +726,7 @@ static struct i2c_driver tas5720_i2c_driver =3D { .name =3D "tas5720", .of_match_table =3D of_match_ptr(tas5720_of_match), }, - .probe =3D tas5720_probe, + .probe_new =3D tas5720_probe, .id_table =3D tas5720_id, }; =20 --=20 2.27.0 From nobody Mon May 11 03:38:08 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 F3B02C433F5 for ; Fri, 15 Apr 2022 16:07:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1355729AbiDOQJt (ORCPT ); Fri, 15 Apr 2022 12:09:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47220 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355731AbiDOQJs (ORCPT ); Fri, 15 Apr 2022 12:09:48 -0400 Received: from 14.mo581.mail-out.ovh.net (14.mo581.mail-out.ovh.net [178.33.251.19]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ABF649D4F4 for ; Fri, 15 Apr 2022 09:07:18 -0700 (PDT) Received: from player760.ha.ovh.net (unknown [10.108.16.30]) by mo581.mail-out.ovh.net (Postfix) with ESMTP id EC8D324076 for ; Fri, 15 Apr 2022 16:07:16 +0000 (UTC) Received: from sk2.org (82-65-25-201.subs.proxad.net [82.65.25.201]) (Authenticated sender: steve@sk2.org) by player760.ha.ovh.net (Postfix) with ESMTPSA id 2C08B2986A9D0; Fri, 15 Apr 2022 16:07:10 +0000 (UTC) Authentication-Results: garm.ovh; auth=pass (GARM-101G004e75f73f7-ba6f-4611-9337-3f47a91ff516, 77125C2C2681624F8512B69FC7A1C9B53E6602B4) smtp.auth=steve@sk2.org X-OVh-ClientIp: 82.65.25.201 From: Stephen Kitt To: Liam Girdwood , Mark Brown Cc: Wolfram Sang , linux-kernel@vger.kernel.org, Stephen Kitt Subject: [PATCH v2 6/7] ASoC: tlv320*: use i2c_match_id and simple i2c probe Date: Fri, 15 Apr 2022 18:06:12 +0200 Message-Id: <20220415160613.148882-7-steve@sk2.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20220415160613.148882-1-steve@sk2.org> References: <20220415160613.148882-1-steve@sk2.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Ovh-Tracer-Id: 10967390995997951622 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvvddrudelhedgleekucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuqfggjfdpvefjgfevmfevgfenuceurghilhhouhhtmecuhedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefuthgvphhhvghnucfmihhtthcuoehsthgvvhgvsehskhdvrdhorhhgqeenucggtffrrghtthgvrhhnpeejleelvdefieeiuddtfeevkeegueehkeekvdffgedvhedugeekgfejjeekgfeugeenucfkpheptddrtddrtddrtddpkedvrdeihedrvdehrddvtddunecuvehluhhsthgvrhfuihiivgepvdenucfrrghrrghmpehmohguvgepshhmthhpohhuthdphhgvlhhopehplhgrhigvrhejiedtrdhhrgdrohhvhhdrnhgvthdpihhnvghtpedtrddtrddtrddtpdhmrghilhhfrhhomhepshhtvghvvgesshhkvddrohhrghdpnhgspghrtghpthhtohepuddprhgtphhtthhopehlihhnuhigqdhkvghrnhgvlhesvhhgvghrrdhkvghrnhgvlhdrohhrgh Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" As part of the ongoing i2c transition to the simple probe ("probe_new"), this patch uses i2c_match_id to retrieve the driver_data for the probed device. The id parameter is thus no longer necessary and the simple probe can be used instead. In the context of an i2c probe, i2c_match_id with the module id table and the probed client never returns null, so removing the null check on the i2c_device_id pointer is safe. The i2c id tables are moved up before the probe function, as suggested by Wolfram Sang, except where the existing code already had a declaration for the of_device_id table. Signed-off-by: Stephen Kitt --- sound/soc/codecs/tlv320adc3xxx.c | 21 +++++++++--------- sound/soc/codecs/tlv320aic31xx.c | 32 ++++++++++++++-------------- sound/soc/codecs/tlv320aic32x4-i2c.c | 11 ++++++---- sound/soc/codecs/tlv320aic3x-i2c.c | 25 +++++++++++----------- 4 files changed, 47 insertions(+), 42 deletions(-) diff --git a/sound/soc/codecs/tlv320adc3xxx.c b/sound/soc/codecs/tlv320adc3= xxx.c index ae18982ac310..a5e9f80cfa32 100644 --- a/sound/soc/codecs/tlv320adc3xxx.c +++ b/sound/soc/codecs/tlv320adc3xxx.c @@ -1337,11 +1337,18 @@ static const struct snd_soc_component_driver soc_co= mponent_dev_adc3xxx =3D { .num_dapm_routes =3D ARRAY_SIZE(adc3xxx_intercon), }; =20 -static int adc3xxx_i2c_probe(struct i2c_client *i2c, - const struct i2c_device_id *id) +static const struct i2c_device_id adc3xxx_i2c_id[] =3D { + { "tlv320adc3001", ADC3001 }, + { "tlv320adc3101", ADC3101 }, + {} +}; +MODULE_DEVICE_TABLE(i2c, adc3xxx_i2c_id); + +static int adc3xxx_i2c_probe(struct i2c_client *i2c) { struct device *dev =3D &i2c->dev; struct adc3xxx *adc3xxx =3D NULL; + const struct i2c_device_id *id; int ret; =20 adc3xxx =3D devm_kzalloc(dev, sizeof(struct adc3xxx), GFP_KERNEL); @@ -1394,6 +1401,7 @@ static int adc3xxx_i2c_probe(struct i2c_client *i2c, =20 i2c_set_clientdata(i2c, adc3xxx); =20 + id =3D i2c_match_id(adc3xxx_i2c_id, i2c); adc3xxx->type =3D id->driver_data; =20 /* Reset codec chip */ @@ -1436,19 +1444,12 @@ static const struct of_device_id tlv320adc3xxx_of_m= atch[] =3D { }; MODULE_DEVICE_TABLE(of, tlv320adc3xxx_of_match); =20 -static const struct i2c_device_id adc3xxx_i2c_id[] =3D { - { "tlv320adc3001", ADC3001 }, - { "tlv320adc3101", ADC3101 }, - {} -}; -MODULE_DEVICE_TABLE(i2c, adc3xxx_i2c_id); - static struct i2c_driver adc3xxx_i2c_driver =3D { .driver =3D { .name =3D "tlv320adc3xxx-codec", .of_match_table =3D tlv320adc3xxx_of_match, }, - .probe =3D adc3xxx_i2c_probe, + .probe_new =3D adc3xxx_i2c_probe, .remove =3D adc3xxx_i2c_remove, .id_table =3D adc3xxx_i2c_id, }; diff --git a/sound/soc/codecs/tlv320aic31xx.c b/sound/soc/codecs/tlv320aic3= 1xx.c index 8331dc26bcd2..b2e59581c17a 100644 --- a/sound/soc/codecs/tlv320aic31xx.c +++ b/sound/soc/codecs/tlv320aic31xx.c @@ -1628,11 +1628,24 @@ static void aic31xx_configure_ocmv(struct aic31xx_p= riv *priv) } } =20 -static int aic31xx_i2c_probe(struct i2c_client *i2c, - const struct i2c_device_id *id) +static const struct i2c_device_id aic31xx_i2c_id[] =3D { + { "tlv320aic310x", AIC3100 }, + { "tlv320aic311x", AIC3110 }, + { "tlv320aic3100", AIC3100 }, + { "tlv320aic3110", AIC3110 }, + { "tlv320aic3120", AIC3120 }, + { "tlv320aic3111", AIC3111 }, + { "tlv320dac3100", DAC3100 }, + { "tlv320dac3101", DAC3101 }, + { } +}; +MODULE_DEVICE_TABLE(i2c, aic31xx_i2c_id); + +static int aic31xx_i2c_probe(struct i2c_client *i2c) { struct aic31xx_priv *aic31xx; unsigned int micbias_value =3D MICBIAS_2_0V; + const struct i2c_device_id *id =3D i2c_match_id(aic31xx_i2c_id, i2c); int i, ret; =20 dev_dbg(&i2c->dev, "## %s: %s codec_type =3D %d\n", __func__, @@ -1729,26 +1742,13 @@ static int aic31xx_i2c_probe(struct i2c_client *i2c, ARRAY_SIZE(aic31xx_dai_driver)); } =20 -static const struct i2c_device_id aic31xx_i2c_id[] =3D { - { "tlv320aic310x", AIC3100 }, - { "tlv320aic311x", AIC3110 }, - { "tlv320aic3100", AIC3100 }, - { "tlv320aic3110", AIC3110 }, - { "tlv320aic3120", AIC3120 }, - { "tlv320aic3111", AIC3111 }, - { "tlv320dac3100", DAC3100 }, - { "tlv320dac3101", DAC3101 }, - { } -}; -MODULE_DEVICE_TABLE(i2c, aic31xx_i2c_id); - static struct i2c_driver aic31xx_i2c_driver =3D { .driver =3D { .name =3D "tlv320aic31xx-codec", .of_match_table =3D of_match_ptr(tlv320aic31xx_of_match), .acpi_match_table =3D ACPI_PTR(aic31xx_acpi_match), }, - .probe =3D aic31xx_i2c_probe, + .probe_new =3D aic31xx_i2c_probe, .id_table =3D aic31xx_i2c_id, }; module_i2c_driver(aic31xx_i2c_driver); diff --git a/sound/soc/codecs/tlv320aic32x4-i2c.c b/sound/soc/codecs/tlv320= aic32x4-i2c.c index ed70e3d9baf2..0645239901b1 100644 --- a/sound/soc/codecs/tlv320aic32x4-i2c.c +++ b/sound/soc/codecs/tlv320aic32x4-i2c.c @@ -17,9 +17,9 @@ #include "tlv320aic32x4.h" =20 static const struct of_device_id aic32x4_of_id[]; +static const struct i2c_device_id aic32x4_i2c_id[]; =20 -static int aic32x4_i2c_probe(struct i2c_client *i2c, - const struct i2c_device_id *id) +static int aic32x4_i2c_probe(struct i2c_client *i2c) { struct regmap *regmap; struct regmap_config config; @@ -35,7 +35,10 @@ static int aic32x4_i2c_probe(struct i2c_client *i2c, =20 oid =3D of_match_node(aic32x4_of_id, i2c->dev.of_node); dev_set_drvdata(&i2c->dev, (void *)oid->data); - } else if (id) { + } else { + const struct i2c_device_id *id; + + id =3D i2c_match_id(aic32x4_i2c_id, i2c); dev_set_drvdata(&i2c->dev, (void *)id->driver_data); } =20 @@ -70,7 +73,7 @@ static struct i2c_driver aic32x4_i2c_driver =3D { .name =3D "tlv320aic32x4", .of_match_table =3D aic32x4_of_id, }, - .probe =3D aic32x4_i2c_probe, + .probe_new =3D aic32x4_i2c_probe, .remove =3D aic32x4_i2c_remove, .id_table =3D aic32x4_i2c_id, }; diff --git a/sound/soc/codecs/tlv320aic3x-i2c.c b/sound/soc/codecs/tlv320ai= c3x-i2c.c index 2f272bc3f5da..7bd9ce08bb7b 100644 --- a/sound/soc/codecs/tlv320aic3x-i2c.c +++ b/sound/soc/codecs/tlv320aic3x-i2c.c @@ -17,10 +17,21 @@ =20 #include "tlv320aic3x.h" =20 -static int aic3x_i2c_probe(struct i2c_client *i2c, const struct i2c_device= _id *id) +static const struct i2c_device_id aic3x_i2c_id[] =3D { + { "tlv320aic3x", AIC3X_MODEL_3X }, + { "tlv320aic33", AIC3X_MODEL_33 }, + { "tlv320aic3007", AIC3X_MODEL_3007 }, + { "tlv320aic3104", AIC3X_MODEL_3104 }, + { "tlv320aic3106", AIC3X_MODEL_3106 }, + { } +}; +MODULE_DEVICE_TABLE(i2c, aic3x_i2c_id); + +static int aic3x_i2c_probe(struct i2c_client *i2c) { struct regmap *regmap; struct regmap_config config; + const struct i2c_device_id *id =3D i2c_match_id(aic3x_i2c_id, i2c); =20 config =3D aic3x_regmap; config.reg_bits =3D 8; @@ -37,16 +48,6 @@ static int aic3x_i2c_remove(struct i2c_client *i2c) return 0; } =20 -static const struct i2c_device_id aic3x_i2c_id[] =3D { - { "tlv320aic3x", AIC3X_MODEL_3X }, - { "tlv320aic33", AIC3X_MODEL_33 }, - { "tlv320aic3007", AIC3X_MODEL_3007 }, - { "tlv320aic3104", AIC3X_MODEL_3104 }, - { "tlv320aic3106", AIC3X_MODEL_3106 }, - { } -}; -MODULE_DEVICE_TABLE(i2c, aic3x_i2c_id); - static const struct of_device_id aic3x_of_id[] =3D { { .compatible =3D "ti,tlv320aic3x", }, { .compatible =3D "ti,tlv320aic33" }, @@ -62,7 +63,7 @@ static struct i2c_driver aic3x_i2c_driver =3D { .name =3D "tlv320aic3x", .of_match_table =3D aic3x_of_id, }, - .probe =3D aic3x_i2c_probe, + .probe_new =3D aic3x_i2c_probe, .remove =3D aic3x_i2c_remove, .id_table =3D aic3x_i2c_id, }; --=20 2.27.0 From nobody Mon May 11 03:38:08 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 62D8BC433F5 for ; Fri, 15 Apr 2022 16:07:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353583AbiDOQJ4 (ORCPT ); Fri, 15 Apr 2022 12:09:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47362 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355728AbiDOQJy (ORCPT ); Fri, 15 Apr 2022 12:09:54 -0400 Received: from 14.mo581.mail-out.ovh.net (14.mo581.mail-out.ovh.net [178.33.251.19]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3DF049D4D9 for ; Fri, 15 Apr 2022 09:07:26 -0700 (PDT) Received: from player760.ha.ovh.net (unknown [10.110.115.113]) by mo581.mail-out.ovh.net (Postfix) with ESMTP id DC9C924083 for ; Fri, 15 Apr 2022 16:07:24 +0000 (UTC) Received: from sk2.org (82-65-25-201.subs.proxad.net [82.65.25.201]) (Authenticated sender: steve@sk2.org) by player760.ha.ovh.net (Postfix) with ESMTPSA id F21A82986A9F0; Fri, 15 Apr 2022 16:07:16 +0000 (UTC) Authentication-Results: garm.ovh; auth=pass (GARM-101G004a5dd2735-609b-4c2a-8ba0-a2006ce0080b, 77125C2C2681624F8512B69FC7A1C9B53E6602B4) smtp.auth=steve@sk2.org X-OVh-ClientIp: 82.65.25.201 From: Stephen Kitt To: Liam Girdwood , Mark Brown Cc: Wolfram Sang , linux-kernel@vger.kernel.org, Stephen Kitt Subject: [PATCH v2 7/7] ASoC: tpa6130: use i2c_match_id and simple i2c probe Date: Fri, 15 Apr 2022 18:06:13 +0200 Message-Id: <20220415160613.148882-8-steve@sk2.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20220415160613.148882-1-steve@sk2.org> References: <20220415160613.148882-1-steve@sk2.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Ovh-Tracer-Id: 10969642794601186950 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvvddrudelhedgleekucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuqfggjfdpvefjgfevmfevgfenuceurghilhhouhhtmecuhedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefuthgvphhhvghnucfmihhtthcuoehsthgvvhgvsehskhdvrdhorhhgqeenucggtffrrghtthgvrhhnpeejleelvdefieeiuddtfeevkeegueehkeekvdffgedvhedugeekgfejjeekgfeugeenucfkpheptddrtddrtddrtddpkedvrdeihedrvdehrddvtddunecuvehluhhsthgvrhfuihiivgepfeenucfrrghrrghmpehmohguvgepshhmthhpohhuthdphhgvlhhopehplhgrhigvrhejiedtrdhhrgdrohhvhhdrnhgvthdpihhnvghtpedtrddtrddtrddtpdhmrghilhhfrhhomhepshhtvghvvgesshhkvddrohhrghdpnhgspghrtghpthhtohepuddprhgtphhtthhopehlihhnuhigqdhkvghrnhgvlhesvhhgvghrrdhkvghrnhgvlhdrohhrgh Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" As part of the ongoing i2c transition to the simple probe ("probe_new"), this patch uses i2c_match_id to retrieve the driver_data for the probed device. The id parameter is thus no longer necessary and the simple probe can be used instead. The i2c id table is moved up before the probe function, as suggested by Wolfram Sang. Signed-off-by: Stephen Kitt --- sound/soc/codecs/tpa6130a2.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/sound/soc/codecs/tpa6130a2.c b/sound/soc/codecs/tpa6130a2.c index e2d7ae615c52..5bc486283fde 100644 --- a/sound/soc/codecs/tpa6130a2.c +++ b/sound/soc/codecs/tpa6130a2.c @@ -209,13 +209,20 @@ static const struct regmap_config tpa6130a2_regmap_co= nfig =3D { .cache_type =3D REGCACHE_RBTREE, }; =20 -static int tpa6130a2_probe(struct i2c_client *client, - const struct i2c_device_id *id) +static const struct i2c_device_id tpa6130a2_id[] =3D { + { "tpa6130a2", TPA6130A2 }, + { "tpa6140a2", TPA6140A2 }, + { } +}; +MODULE_DEVICE_TABLE(i2c, tpa6130a2_id); + +static int tpa6130a2_probe(struct i2c_client *client) { struct device *dev; struct tpa6130a2_data *data; struct tpa6130a2_platform_data *pdata =3D client->dev.platform_data; struct device_node *np =3D client->dev.of_node; + const struct i2c_device_id *id; const char *regulator; unsigned int version; int ret; @@ -244,6 +251,7 @@ static int tpa6130a2_probe(struct i2c_client *client, =20 i2c_set_clientdata(client, data); =20 + id =3D i2c_match_id(tpa6130a2_id, client); data->id =3D id->driver_data; =20 if (data->power_gpio >=3D 0) { @@ -297,13 +305,6 @@ static int tpa6130a2_probe(struct i2c_client *client, &tpa6130a2_component_driver, NULL, 0); } =20 -static const struct i2c_device_id tpa6130a2_id[] =3D { - { "tpa6130a2", TPA6130A2 }, - { "tpa6140a2", TPA6140A2 }, - { } -}; -MODULE_DEVICE_TABLE(i2c, tpa6130a2_id); - #if IS_ENABLED(CONFIG_OF) static const struct of_device_id tpa6130a2_of_match[] =3D { { .compatible =3D "ti,tpa6130a2", }, --=20 2.27.0