From: Rob Herring <robh@kernel.org>
To: "Claudiu Beznea" <claudiu.beznea@tuxon.dev>,
"Mark Brown" <broonie@kernel.org>,
"Jaroslav Kysela" <perex@perex.cz>,
"Takashi Iwai" <tiwai@suse.com>,
"Nicolas Ferre" <nicolas.ferre@microchip.com>,
"Alexandre Belloni" <alexandre.belloni@bootlin.com>,
"Peter Rosin" <peda@axentia.se>, "Ray Jui" <rjui@broadcom.com>,
"Scott Branden" <sbranden@broadcom.com>,
"Lars-Peter Clausen" <lars@metafoo.de>,
"Nuno Sá" <nuno.sa@analog.com>,
"James Schulman" <james.schulman@cirrus.com>,
"David Rhodes" <david.rhodes@cirrus.com>,
"Richard Fitzgerald" <rf@opensource.cirrus.com>,
"Support Opensource" <support.opensource@diasemi.com>,
"Matthias Brugger" <matthias.bgg@gmail.com>,
"AngeloGioacchino Del Regno"
<angelogioacchino.delregno@collabora.com>,
"Shenghao Ding" <shenghao-ding@ti.com>,
"Kevin Lu" <kevin-lu@ti.com>, "Baojun Xu" <baojun.xu@ti.com>,
"Oder Chiou" <oder_chiou@realtek.com>,
"Fabio Estevam" <festevam@gmail.com>,
"Kiseok Jo" <kiseok.jo@irondevice.com>,
"Kevin Cernekee" <cernekee@chromium.org>,
"Shengjiu Wang" <shengjiu.wang@gmail.com>,
"Xiubo Li" <Xiubo.Lee@gmail.com>,
"Nicolin Chen" <nicoleotsuka@gmail.com>,
"Shawn Guo" <shawnguo@kernel.org>,
"Sascha Hauer" <s.hauer@pengutronix.de>,
"Pengutronix Kernel Team" <kernel@pengutronix.de>,
"NXP Linux Team" <linux-imx@nxp.com>,
"Srinivas Kandagatla" <srinivas.kandagatla@linaro.org>,
"Banajit Goswami" <bgoswami@quicinc.com>,
"Nicolas Frattaroli" <frattaroli.nicolas@gmail.com>,
"Heiko Stuebner" <heiko@sntech.de>,
"Sylwester Nawrocki" <s.nawrocki@samsung.com>,
"Chen-Yu Tsai" <wens@csie.org>,
"Jernej Skrabec" <jernej.skrabec@gmail.com>,
"Samuel Holland" <samuel@sholland.org>,
"Ban Tao" <fengzheng923@gmail.com>,
"Thierry Reding" <thierry.reding@gmail.com>,
"Jonathan Hunter" <jonathanh@nvidia.com>,
"Peter Ujfalusi" <peter.ujfalusi@gmail.com>,
"Jarkko Nikula" <jarkko.nikula@bitmer.com>,
"Cezary Rojewski" <cezary.rojewski@intel.com>,
"Pierre-Louis Bossart" <pierre-louis.bossart@linux.intel.com>,
"Peter Ujfalusi" <peter.ujfalusi@linux.intel.com>,
"Bard Liao" <yung-chuan.liao@linux.intel.com>
Cc: patches@opensource.cirrus.com, alsa-devel@alsa-project.org,
linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org
Subject: [PATCH RESEND 3/5] ASoC: da7218: Use i2c_get_match_data()
Date: Tue, 3 Oct 2023 13:13:12 -0500 [thread overview]
Message-ID: <20231003-dt-asoc-header-cleanups-v1-3-05b5d6447e5a@kernel.org> (raw)
In-Reply-To: <20231003-dt-asoc-header-cleanups-v1-0-05b5d6447e5a@kernel.org>
Use preferred i2c_get_match_data() instead of of_match_device() and
i2c_match_id() to get the driver match data. With this, adjust the
includes to explicitly include the correct headers.
Avoid using 0 for enum da7218_dev_id so that no match data can be
distinguished.
Signed-off-by: Rob Herring <robh@kernel.org>
---
sound/soc/codecs/da7218.c | 29 ++---------------------------
sound/soc/codecs/da7218.h | 2 +-
2 files changed, 3 insertions(+), 28 deletions(-)
diff --git a/sound/soc/codecs/da7218.c b/sound/soc/codecs/da7218.c
index 3f456b08b809..8aacd7350798 100644
--- a/sound/soc/codecs/da7218.c
+++ b/sound/soc/codecs/da7218.c
@@ -9,7 +9,7 @@
#include <linux/clk.h>
#include <linux/i2c.h>
-#include <linux/of_device.h>
+#include <linux/of.h>
#include <linux/regmap.h>
#include <linux/slab.h>
#include <linux/pm.h>
@@ -2285,16 +2285,6 @@ static const struct of_device_id da7218_of_match[] = {
};
MODULE_DEVICE_TABLE(of, da7218_of_match);
-static inline int da7218_of_get_id(struct device *dev)
-{
- const struct of_device_id *id = of_match_device(da7218_of_match, dev);
-
- if (id)
- return (uintptr_t)id->data;
- else
- return -EINVAL;
-}
-
static enum da7218_micbias_voltage
da7218_of_micbias_lvl(struct snd_soc_component *component, u32 val)
{
@@ -3253,18 +3243,6 @@ static const struct regmap_config da7218_regmap_config = {
* I2C layer
*/
-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;
@@ -3276,10 +3254,7 @@ static int da7218_i2c_probe(struct i2c_client *i2c)
i2c_set_clientdata(i2c, da7218);
- if (i2c->dev.of_node)
- da7218->dev_id = da7218_of_get_id(&i2c->dev);
- else
- da7218->dev_id = da7218_i2c_get_id(i2c);
+ da7218->dev_id = (uintptr_t)i2c_get_match_data(i2c);
if ((da7218->dev_id != DA7217_DEV_ID) &&
(da7218->dev_id != DA7218_DEV_ID)) {
diff --git a/sound/soc/codecs/da7218.h b/sound/soc/codecs/da7218.h
index 9ac2892092b5..7f6a4aea2c7a 100644
--- a/sound/soc/codecs/da7218.h
+++ b/sound/soc/codecs/da7218.h
@@ -1369,7 +1369,7 @@ enum da7218_sys_clk {
};
enum da7218_dev_id {
- DA7217_DEV_ID = 0,
+ DA7217_DEV_ID = 1,
DA7218_DEV_ID,
};
--
2.40.1
next prev parent reply other threads:[~2023-10-03 18:18 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-03 18:13 [PATCH RESEND 0/5] ASoC: DT matching and header cleanups Rob Herring
2023-10-03 18:13 ` [PATCH RESEND 1/5] ASoC: Explicitly include correct DT includes Rob Herring
2023-10-03 20:46 ` Jernej Škrabec
2023-10-03 18:13 ` [PATCH RESEND 2/5] ASoC: Drop unnecessary of_match_device() calls Rob Herring
2023-10-03 18:13 ` Rob Herring [this message]
2023-10-03 18:13 ` [PATCH RESEND 4/5] ASoC: qcom/lpass: Constify struct lpass_variant Rob Herring
2023-10-03 18:13 ` [PATCH RESEND 5/5] ASoC: Use device_get_match_data() Rob Herring
2023-10-10 18:32 ` [PATCH RESEND 0/5] ASoC: DT matching and header cleanups 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=20231003-dt-asoc-header-cleanups-v1-3-05b5d6447e5a@kernel.org \
--to=robh@kernel.org \
--cc=Xiubo.Lee@gmail.com \
--cc=alexandre.belloni@bootlin.com \
--cc=alsa-devel@alsa-project.org \
--cc=angelogioacchino.delregno@collabora.com \
--cc=baojun.xu@ti.com \
--cc=bgoswami@quicinc.com \
--cc=broonie@kernel.org \
--cc=cernekee@chromium.org \
--cc=cezary.rojewski@intel.com \
--cc=claudiu.beznea@tuxon.dev \
--cc=david.rhodes@cirrus.com \
--cc=fengzheng923@gmail.com \
--cc=festevam@gmail.com \
--cc=frattaroli.nicolas@gmail.com \
--cc=heiko@sntech.de \
--cc=james.schulman@cirrus.com \
--cc=jarkko.nikula@bitmer.com \
--cc=jernej.skrabec@gmail.com \
--cc=jonathanh@nvidia.com \
--cc=kernel@pengutronix.de \
--cc=kevin-lu@ti.com \
--cc=kiseok.jo@irondevice.com \
--cc=lars@metafoo.de \
--cc=linux-imx@nxp.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=matthias.bgg@gmail.com \
--cc=nicolas.ferre@microchip.com \
--cc=nicoleotsuka@gmail.com \
--cc=nuno.sa@analog.com \
--cc=oder_chiou@realtek.com \
--cc=patches@opensource.cirrus.com \
--cc=peda@axentia.se \
--cc=perex@perex.cz \
--cc=peter.ujfalusi@gmail.com \
--cc=peter.ujfalusi@linux.intel.com \
--cc=pierre-louis.bossart@linux.intel.com \
--cc=rf@opensource.cirrus.com \
--cc=rjui@broadcom.com \
--cc=s.hauer@pengutronix.de \
--cc=s.nawrocki@samsung.com \
--cc=samuel@sholland.org \
--cc=sbranden@broadcom.com \
--cc=shawnguo@kernel.org \
--cc=shenghao-ding@ti.com \
--cc=shengjiu.wang@gmail.com \
--cc=srinivas.kandagatla@linaro.org \
--cc=support.opensource@diasemi.com \
--cc=thierry.reding@gmail.com \
--cc=tiwai@suse.com \
--cc=wens@csie.org \
--cc=yung-chuan.liao@linux.intel.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;
as well as URLs for NNTP newsgroup(s).