[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20231006-dt-asoc-header-cleanups-v3-3-13a4f0f7fee6@kernel.org>
Date: Fri, 06 Oct 2023 15:09:12 -0500
From: Rob Herring <robh@...nel.org>
To: Mark Brown <broonie@...nel.org>,
Claudiu Beznea <claudiu.beznea@...on.dev>,
Jaroslav Kysela <perex@...ex.cz>,
Takashi Iwai <tiwai@...e.com>, Peter Rosin <peda@...ntia.se>,
Lars-Peter Clausen <lars@...afoo.de>, nuno.sa@...log.com,
James Schulman <james.schulman@...rus.com>,
David Rhodes <david.rhodes@...rus.com>,
Richard Fitzgerald <rf@...nsource.cirrus.com>,
AngeloGioacchino Del Regno
<angelogioacchino.delregno@...labora.com>,
Shenghao Ding <shenghao-ding@...com>,
Kevin Lu <kevin-lu@...com>, Baojun Xu <baojun.xu@...com>,
Oder Chiou <oder_chiou@...ltek.com>,
Fabio Estevam <festevam@...il.com>,
Kiseok Jo <kiseok.jo@...ndevice.com>,
Kevin Cernekee <cernekee@...omium.org>,
Shengjiu Wang <shengjiu.wang@...il.com>,
Xiubo Li <Xiubo.Lee@...il.com>,
Nicolin Chen <nicoleotsuka@...il.com>,
Srinivas Kandagatla <srinivas.kandagatla@...aro.org>,
Banajit Goswami <bgoswami@...cinc.com>,
Nicolas Frattaroli <frattaroli.nicolas@...il.com>,
Sylwester Nawrocki <s.nawrocki@...sung.com>,
Ban Tao <fengzheng923@...il.com>,
Peter Ujfalusi <peter.ujfalusi@...il.com>,
Jarkko Nikula <jarkko.nikula@...mer.com>,
Cezary Rojewski <cezary.rojewski@...el.com>,
Pierre-Louis Bossart <pierre-louis.bossart@...ux.intel.com>,
Peter Ujfalusi <peter.ujfalusi@...ux.intel.com>,
Bard Liao <yung-chuan.liao@...ux.intel.com>,
Ranjani Sridharan <ranjani.sridharan@...ux.intel.com>,
Kai Vehmanen <kai.vehmanen@...ux.intel.com>,
Olivier Moysan <olivier.moysan@...s.st.com>,
Arnaud Pouliquen <arnaud.pouliquen@...s.st.com>,
Maxime Coquelin <mcoquelin.stm32@...il.com>,
Alexandre Torgue <alexandre.torgue@...s.st.com>
Cc: alsa-devel@...a-project.org, linux-kernel@...r.kernel.org,
linuxppc-dev@...ts.ozlabs.org
Subject: [PATCH v3 3/5] ASoC: da7218: Use i2c_get_match_data()
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@...nel.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
Powered by blists - more mailing lists