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 03/21] ASoC: adau1781: Remove use of i2c_match_id()
Date: Tue, 3 Dec 2024 13:59:43 -0600 [thread overview]
Message-ID: <20241203200001.197295-3-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/adau1781-i2c.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/sound/soc/codecs/adau1781-i2c.c b/sound/soc/codecs/adau1781-i2c.c
index 3a170fd78ff32..cb67fde8d9a84 100644
--- a/sound/soc/codecs/adau1781-i2c.c
+++ b/sound/soc/codecs/adau1781-i2c.c
@@ -14,12 +14,9 @@
#include "adau1781.h"
-static const struct i2c_device_id adau1781_i2c_ids[];
-
static int adau1781_i2c_probe(struct i2c_client *client)
{
struct regmap_config config;
- const struct i2c_device_id *id = i2c_match_id(adau1781_i2c_ids, client);
config = adau1781_regmap_config;
config.val_bits = 8;
@@ -27,7 +24,7 @@ static int adau1781_i2c_probe(struct i2c_client *client)
return adau1781_probe(&client->dev,
devm_regmap_init_i2c(client, &config),
- id->driver_data, NULL);
+ (uintptr_t)i2c_get_match_data(client), NULL);
}
static void adau1781_i2c_remove(struct i2c_client *client)
--
2.39.2
next prev 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 ` Andrew Davis [this message]
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 ` [PATCH 11/21] ASoc: pcm6240: " Andrew Davis
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-3-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