All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ASoC: da7218: use i2c_match_id and simple i2c probe
@ 2022-03-25 17:19 Stephen Kitt
  2022-03-28  8:54 ` Adam Thomson
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Stephen Kitt @ 2022-03-25 17:19 UTC (permalink / raw)
  To: Support Opensource, Liam Girdwood, Mark Brown
  Cc: patches, Wolfram Sang, linux-kernel, Stephen Kitt

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.

This patch follows the model set by da7218_of_get_id().

Signed-off-by: Stephen Kitt <steve@sk2.org>
---
 sound/soc/codecs/da7218.c | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)

diff --git a/sound/soc/codecs/da7218.c b/sound/soc/codecs/da7218.c
index ea426d986d4c..a5d7c350a3de 100644
--- a/sound/soc/codecs/da7218.c
+++ b/sound/soc/codecs/da7218.c
@@ -3258,8 +3258,19 @@ static const struct regmap_config da7218_regmap_config = {
  * I2C layer
  */
 
-static int da7218_i2c_probe(struct i2c_client *i2c,
-			    const struct i2c_device_id *id)
+static const struct i2c_device_id da7218_i2c_id[];
+
+static inline int da7218_i2c_get_id(struct i2c_client *i2c)
+{
+	const struct i2c_device_id *id = i2c_match_id(da7218_i2c_id, i2c);
+
+	if (id)
+		return (uintptr_t)id->driver_data;
+	else
+		return -EINVAL;
+}
+
+static int da7218_i2c_probe(struct i2c_client *i2c)
 {
 	struct da7218_priv *da7218;
 	int ret;
@@ -3273,7 +3284,7 @@ static int da7218_i2c_probe(struct i2c_client *i2c,
 	if (i2c->dev.of_node)
 		da7218->dev_id = da7218_of_get_id(&i2c->dev);
 	else
-		da7218->dev_id = id->driver_data;
+		da7218->dev_id = da7218_i2c_get_id(i2c);
 
 	if ((da7218->dev_id != DA7217_DEV_ID) &&
 	    (da7218->dev_id != DA7218_DEV_ID)) {
@@ -3311,7 +3322,7 @@ static struct i2c_driver da7218_i2c_driver = {
 		.name = "da7218",
 		.of_match_table = da7218_of_match,
 	},
-	.probe		= da7218_i2c_probe,
+	.probe_new	= da7218_i2c_probe,
 	.id_table	= da7218_i2c_id,
 };
 
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* RE: [PATCH] ASoC: da7218: use i2c_match_id and simple i2c probe
  2022-03-25 17:19 [PATCH] ASoC: da7218: use i2c_match_id and simple i2c probe Stephen Kitt
@ 2022-03-28  8:54 ` Adam Thomson
  2022-03-30  9:44 ` Wolfram Sang
  2022-04-05  9:31 ` Mark Brown
  2 siblings, 0 replies; 4+ messages in thread
From: Adam Thomson @ 2022-03-28  8:54 UTC (permalink / raw)
  To: Stephen Kitt, Support Opensource, Liam Girdwood, Mark Brown
  Cc: patches, Wolfram Sang, linux-kernel

On 25 March 2022 17:19, Stephen Kitt wrote:

> 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.
> 
> This patch follows the model set by da7218_of_get_id().
> 
> Signed-off-by: Stephen Kitt <steve@sk2.org>

Reviewed-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] ASoC: da7218: use i2c_match_id and simple i2c probe
  2022-03-25 17:19 [PATCH] ASoC: da7218: use i2c_match_id and simple i2c probe Stephen Kitt
  2022-03-28  8:54 ` Adam Thomson
@ 2022-03-30  9:44 ` Wolfram Sang
  2022-04-05  9:31 ` Mark Brown
  2 siblings, 0 replies; 4+ messages in thread
From: Wolfram Sang @ 2022-03-30  9:44 UTC (permalink / raw)
  To: Stephen Kitt
  Cc: Support Opensource, Liam Girdwood, Mark Brown, patches, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 480 bytes --]

On Fri, Mar 25, 2022 at 06:19:04PM +0100, Stephen Kitt wrote:
> 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.
> 
> This patch follows the model set by da7218_of_get_id().
> 
> Signed-off-by: Stephen Kitt <steve@sk2.org>

I think the device tables should be moved up.


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] ASoC: da7218: use i2c_match_id and simple i2c probe
  2022-03-25 17:19 [PATCH] ASoC: da7218: use i2c_match_id and simple i2c probe Stephen Kitt
  2022-03-28  8:54 ` Adam Thomson
  2022-03-30  9:44 ` Wolfram Sang
@ 2022-04-05  9:31 ` Mark Brown
  2 siblings, 0 replies; 4+ messages in thread
From: Mark Brown @ 2022-04-05  9:31 UTC (permalink / raw)
  To: Liam Girdwood, steve, support.opensource; +Cc: patches, wsa, linux-kernel

On Fri, 25 Mar 2022 18:19:04 +0100, Stephen Kitt wrote:
> 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.
> 
> This patch follows the model set by da7218_of_get_id().
> 
> [...]

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[1/1] ASoC: da7218: use i2c_match_id and simple i2c probe
      commit: 5e9058ea2bc6e73aeb54b585af38d043490a8509

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-04-05 15:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-25 17:19 [PATCH] ASoC: da7218: use i2c_match_id and simple i2c probe Stephen Kitt
2022-03-28  8:54 ` Adam Thomson
2022-03-30  9:44 ` Wolfram Sang
2022-04-05  9:31 ` Mark Brown

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.