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 2/5] ASoC: Drop unnecessary of_match_device() calls
Date: Tue, 03 Oct 2023 11:43:08 -0500 [thread overview]
Message-ID: <20231003-dt-asoc-header-cleanups-v1-2-308666806378@kernel.org> (raw)
In-Reply-To: <20231003-dt-asoc-header-cleanups-v1-0-308666806378@kernel.org>
If probe is reached, we've already matched the device and in the case of
DT matching, the struct device_node pointer will be set. Therefore, there
is no need to call of_match_device() in probe.
Signed-off-by: Rob Herring <robh@kernel.org>
---
sound/soc/codecs/ak5386.c | 7 ++-----
sound/soc/codecs/cs4271.c | 22 ++++++----------------
sound/soc/codecs/tas5086.c | 6 +-----
3 files changed, 9 insertions(+), 26 deletions(-)
diff --git a/sound/soc/codecs/ak5386.c b/sound/soc/codecs/ak5386.c
index 0c5e00679c7d..21a44476f48d 100644
--- a/sound/soc/codecs/ak5386.c
+++ b/sound/soc/codecs/ak5386.c
@@ -10,7 +10,6 @@
#include <linux/slab.h>
#include <linux/of.h>
#include <linux/of_gpio.h>
-#include <linux/of_device.h>
#include <linux/regulator/consumer.h>
#include <sound/soc.h>
#include <sound/pcm.h>
@@ -168,7 +167,6 @@ static int ak5386_probe(struct platform_device *pdev)
if (!priv)
return -ENOMEM;
- priv->reset_gpio = -EINVAL;
dev_set_drvdata(dev, priv);
for (i = 0; i < ARRAY_SIZE(supply_names); i++)
@@ -179,9 +177,8 @@ static int ak5386_probe(struct platform_device *pdev)
if (ret < 0)
return ret;
- if (of_match_device(of_match_ptr(ak5386_dt_ids), dev))
- priv->reset_gpio = of_get_named_gpio(dev->of_node,
- "reset-gpio", 0);
+ priv->reset_gpio = of_get_named_gpio(dev->of_node,
+ "reset-gpio", 0);
if (gpio_is_valid(priv->reset_gpio))
if (devm_gpio_request_one(dev, priv->reset_gpio,
diff --git a/sound/soc/codecs/cs4271.c b/sound/soc/codecs/cs4271.c
index 188b8b43c524..9e6f8a048dd5 100644
--- a/sound/soc/codecs/cs4271.c
+++ b/sound/soc/codecs/cs4271.c
@@ -15,7 +15,6 @@
#include <linux/delay.h>
#include <linux/gpio.h>
#include <linux/of.h>
-#include <linux/of_device.h>
#include <linux/of_gpio.h>
#include <linux/regulator/consumer.h>
#include <sound/pcm.h>
@@ -563,19 +562,12 @@ static int cs4271_component_probe(struct snd_soc_component *component)
struct cs4271_private *cs4271 = snd_soc_component_get_drvdata(component);
struct cs4271_platform_data *cs4271plat = component->dev->platform_data;
int ret;
- bool amutec_eq_bmutec = false;
+ bool amutec_eq_bmutec;
-#ifdef CONFIG_OF
- if (of_match_device(cs4271_dt_ids, component->dev)) {
- if (of_get_property(component->dev->of_node,
- "cirrus,amutec-eq-bmutec", NULL))
- amutec_eq_bmutec = true;
-
- if (of_get_property(component->dev->of_node,
- "cirrus,enable-soft-reset", NULL))
- cs4271->enable_soft_reset = true;
- }
-#endif
+ amutec_eq_bmutec = of_property_read_bool(component->dev->of_node,
+ "cirrus,amutec-eq-bmutec");
+ cs4271->enable_soft_reset = of_property_read_bool(component->dev->of_node,
+ "cirrus,enable-soft-reset");
ret = regulator_bulk_enable(ARRAY_SIZE(cs4271->supplies),
cs4271->supplies);
@@ -655,9 +647,7 @@ static int cs4271_common_probe(struct device *dev,
if (!cs4271)
return -ENOMEM;
- if (of_match_device(cs4271_dt_ids, dev))
- cs4271->gpio_nreset =
- of_get_named_gpio(dev->of_node, "reset-gpio", 0);
+ cs4271->gpio_nreset = of_get_named_gpio(dev->of_node, "reset-gpio", 0);
if (cs4271plat)
cs4271->gpio_nreset = cs4271plat->gpio_nreset;
diff --git a/sound/soc/codecs/tas5086.c b/sound/soc/codecs/tas5086.c
index 60e59e993ba6..f52c14b43f28 100644
--- a/sound/soc/codecs/tas5086.c
+++ b/sound/soc/codecs/tas5086.c
@@ -940,11 +940,7 @@ static int tas5086_i2c_probe(struct i2c_client *i2c)
i2c_set_clientdata(i2c, priv);
- if (of_match_device(of_match_ptr(tas5086_dt_ids), dev)) {
- struct device_node *of_node = dev->of_node;
- gpio_nreset = of_get_named_gpio(of_node, "reset-gpio", 0);
- }
-
+ gpio_nreset = of_get_named_gpio(dev->of_node, "reset-gpio", 0);
if (gpio_is_valid(gpio_nreset))
if (devm_gpio_request(dev, gpio_nreset, "TAS5086 Reset"))
gpio_nreset = -EINVAL;
--
2.40.1
next prev parent reply other threads:[~2023-10-03 16:47 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-03 16:43 [PATCH 0/5] ASoC: DT matching and header cleanups Rob Herring
2023-10-03 16:43 ` [PATCH 1/5] ASoC: Explicitly include correct DT includes Rob Herring
2023-10-04 7:45 ` AngeloGioacchino Del Regno
2023-10-04 8:28 ` Charles Keepax
2023-10-03 16:43 ` Rob Herring [this message]
2023-10-04 8:33 ` [PATCH 2/5] ASoC: Drop unnecessary of_match_device() calls Charles Keepax
2023-10-03 16:43 ` [PATCH 3/5] ASoC: da7218: Use i2c_get_match_data() Rob Herring
2023-10-03 16:43 ` [PATCH 4/5] ASoC: qcom/lpass: Constify struct lpass_variant Rob Herring
2023-10-03 16:43 ` [PATCH 5/5] ASoC: Use device_get_match_data() Rob Herring
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-2-308666806378@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).