public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrew Davis <afd@ti.com>
To: "Lars-Peter Clausen" <lars@metafoo.de>,
	"Nuno Sá" <nuno.sa@analog.com>,
	"Liam Girdwood" <lgirdwood@gmail.com>,
	"Mark Brown" <broonie@kernel.org>, "Marek Vasut" <marex@denx.de>
Cc: <patches@opensource.cirrus.com>, <linux-sound@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>, Andrew Davis <afd@ti.com>
Subject: [PATCH 11/21] ASoc: pcm6240: Remove use of i2c_match_id()
Date: Tue, 3 Dec 2024 13:59:51 -0600	[thread overview]
Message-ID: <20241203200001.197295-11-afd@ti.com> (raw)
In-Reply-To: <20241203200001.197295-1-afd@ti.com>

The function i2c_match_id() is used to fetch the matching ID from
the i2c_device_id table. This is often used to then retrieve the
matching driver_data. This can be done in one step with the helper
i2c_get_match_data().

This helper has a couple other benefits:
 * It doesn't need the i2c_device_id passed in so we do not need
   to have that forward declared, allowing us to remove those or
   move the i2c_device_id table down to its more natural spot
   with the other module info.
 * It also checks for device match data, which allows for OF and
   ACPI based probing. That means we do not have to manually check
   those first and can remove those checks.

Signed-off-by: Andrew Davis <afd@ti.com>
---
 sound/soc/codecs/pcm6240.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/sound/soc/codecs/pcm6240.c b/sound/soc/codecs/pcm6240.c
index 5d99877f88397..4ff39e0b95b27 100644
--- a/sound/soc/codecs/pcm6240.c
+++ b/sound/soc/codecs/pcm6240.c
@@ -2059,7 +2059,6 @@ static char *str_to_upper(char *str)
 
 static int pcmdevice_i2c_probe(struct i2c_client *i2c)
 {
-	const struct i2c_device_id *id = i2c_match_id(pcmdevice_i2c_id, i2c);
 	struct pcmdevice_priv *pcm_dev;
 	struct device_node *np;
 	unsigned int dev_addrs[PCMDEVICE_MAX_I2C_DEVICES];
@@ -2069,7 +2068,7 @@ static int pcmdevice_i2c_probe(struct i2c_client *i2c)
 	if (!pcm_dev)
 		return -ENOMEM;
 
-	pcm_dev->chip_id = (id != NULL) ? id->driver_data : 0;
+	pcm_dev->chip_id = (uintptr_t)i2c_get_match_data(i2c);
 
 	pcm_dev->dev = &i2c->dev;
 	pcm_dev->client = i2c;
-- 
2.39.2


  parent reply	other threads:[~2024-12-03 20:00 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-03 19:59 [PATCH 01/21] ASoC: ad193x: Remove use of i2c_match_id() Andrew Davis
2024-12-03 19:59 ` [PATCH 02/21] ASoC: adau1761: " Andrew Davis
2024-12-03 19:59 ` [PATCH 03/21] ASoC: adau1781: " Andrew Davis
2024-12-03 19:59 ` [PATCH 04/21] ASoC: adau1977: " Andrew Davis
2024-12-03 19:59 ` [PATCH 05/21] ASoC: alc5623: " Andrew Davis
2024-12-03 19:59 ` [PATCH 06/21] ASoC: alc5632: " Andrew Davis
2024-12-03 19:59 ` [PATCH 07/21] ASoC: max98088: " Andrew Davis
2024-12-03 19:59 ` [PATCH 08/21] ASoC: max98090: " Andrew Davis
2024-12-03 19:59 ` [PATCH 09/21] ASoC: max98095: " Andrew Davis
2024-12-03 19:59 ` [PATCH 10/21] ASoC: pcm186x: " Andrew Davis
2024-12-03 19:59 ` Andrew Davis [this message]
2024-12-03 19:59 ` [PATCH 12/21] ASoC: ssm2602: " Andrew Davis
2024-12-03 19:59 ` [PATCH 13/21] ASoC: tas2562: " Andrew Davis
2024-12-03 19:59 ` [PATCH 14/21] ASoC: tas2781: " Andrew Davis
2024-12-03 19:59 ` [PATCH 15/21] ASoC: tas5720: " Andrew Davis
2024-12-03 19:59 ` [PATCH 16/21] ASoC: tlv320adc3xxx: " Andrew Davis
2024-12-03 19:59 ` [PATCH 17/21] ASoC: tlv320aic31xx: " Andrew Davis
2024-12-03 19:59 ` [PATCH 18/21] ASoC: tlv320aic3x: " Andrew Davis
2024-12-03 19:59 ` [PATCH 19/21] ASoC: tpa6130a2: " Andrew Davis
2024-12-03 20:00 ` [PATCH 20/21] ASoC: wm8904: " Andrew Davis
2024-12-05 13:39   ` Charles Keepax
2024-12-03 20:00 ` [PATCH 21/21] ASoC: wm8985: " Andrew Davis
2024-12-05 13:39   ` Charles Keepax
2024-12-10 13:00 ` [PATCH 01/21] ASoC: ad193x: " Mark Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241203200001.197295-11-afd@ti.com \
    --to=afd@ti.com \
    --cc=broonie@kernel.org \
    --cc=lars@metafoo.de \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=marex@denx.de \
    --cc=nuno.sa@analog.com \
    --cc=patches@opensource.cirrus.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox