All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/6] ASoC: fsl_ssi: Use of_device_get_match_data()
@ 2021-01-18 12:38 Fabio Estevam
  2021-01-18 12:38 ` [PATCH 2/6] ASoC: fsl_micfil: " Fabio Estevam
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Fabio Estevam @ 2021-01-18 12:38 UTC (permalink / raw)
  To: broonie; +Cc: nicoleotsuka, alsa-devel, Fabio Estevam, shengjiu.wang, timur

The retrieval of driver data via of_device_get_match_data() can make
the code simpler.

Use of_device_get_match_data() to simplify the code.

Signed-off-by: Fabio Estevam <festevam@gmail.com>
---
 sound/soc/fsl/fsl_ssi.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c
index 404be27c15fe..db4ba5f22b77 100644
--- a/sound/soc/fsl/fsl_ssi.c
+++ b/sound/soc/fsl/fsl_ssi.c
@@ -1397,18 +1397,11 @@ static int fsl_ssi_probe_from_dt(struct fsl_ssi *ssi)
 {
 	struct device *dev = ssi->dev;
 	struct device_node *np = dev->of_node;
-	const struct of_device_id *of_id;
 	const char *p, *sprop;
 	const __be32 *iprop;
 	u32 dmas[4];
 	int ret;
 
-	of_id = of_match_device(fsl_ssi_ids, dev);
-	if (!of_id || !of_id->data)
-		return -EINVAL;
-
-	ssi->soc = of_id->data;
-
 	ret = of_property_match_string(np, "clock-names", "ipg");
 	/* Get error code if not found */
 	ssi->has_ipg_clk_name = ret >= 0;
@@ -1492,6 +1485,7 @@ static int fsl_ssi_probe(struct platform_device *pdev)
 		return -ENOMEM;
 
 	ssi->dev = dev;
+	ssi->soc = of_device_get_match_data(&pdev->dev);
 
 	/* Probe from DT */
 	ret = fsl_ssi_probe_from_dt(ssi);
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/6] ASoC: fsl_micfil: Use of_device_get_match_data()
  2021-01-18 12:38 [PATCH 1/6] ASoC: fsl_ssi: Use of_device_get_match_data() Fabio Estevam
@ 2021-01-18 12:38 ` Fabio Estevam
  2021-01-18 12:38 ` [PATCH 3/6] ASoC: fsl_xcvr: Remove unused of_id variable Fabio Estevam
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Fabio Estevam @ 2021-01-18 12:38 UTC (permalink / raw)
  To: broonie; +Cc: nicoleotsuka, alsa-devel, Fabio Estevam, shengjiu.wang, timur

The retrieval of driver data via of_device_get_match_data() can make
the code simpler.

Use of_device_get_match_data() to simplify the code.

Signed-off-by: Fabio Estevam <festevam@gmail.com>
---
 sound/soc/fsl/fsl_micfil.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/sound/soc/fsl/fsl_micfil.c b/sound/soc/fsl/fsl_micfil.c
index efc5daf53bba..8aedf6590b28 100644
--- a/sound/soc/fsl/fsl_micfil.c
+++ b/sound/soc/fsl/fsl_micfil.c
@@ -637,7 +637,6 @@ static irqreturn_t micfil_err_isr(int irq, void *devid)
 static int fsl_micfil_probe(struct platform_device *pdev)
 {
 	struct device_node *np = pdev->dev.of_node;
-	const struct of_device_id *of_id;
 	struct fsl_micfil *micfil;
 	struct resource *res;
 	void __iomem *regs;
@@ -651,11 +650,7 @@ static int fsl_micfil_probe(struct platform_device *pdev)
 	micfil->pdev = pdev;
 	strncpy(micfil->name, np->name, sizeof(micfil->name) - 1);
 
-	of_id = of_match_device(fsl_micfil_dt_ids, &pdev->dev);
-	if (!of_id || !of_id->data)
-		return -EINVAL;
-
-	micfil->soc = of_id->data;
+	micfil->soc = of_device_get_match_data(&pdev->dev);
 
 	/* ipg_clk is used to control the registers
 	 * ipg_clk_app is used to operate the filter
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 3/6] ASoC: fsl_xcvr: Remove unused of_id variable
  2021-01-18 12:38 [PATCH 1/6] ASoC: fsl_ssi: Use of_device_get_match_data() Fabio Estevam
  2021-01-18 12:38 ` [PATCH 2/6] ASoC: fsl_micfil: " Fabio Estevam
@ 2021-01-18 12:38 ` Fabio Estevam
  2021-01-18 12:38 ` [PATCH 4/6] ASoC: fsl_asrc: Remove of_device_get_match_data() error check Fabio Estevam
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Fabio Estevam @ 2021-01-18 12:38 UTC (permalink / raw)
  To: broonie; +Cc: nicoleotsuka, alsa-devel, Fabio Estevam, shengjiu.wang, timur

The of_id variable is not used, so just remove it.

Signed-off-by: Fabio Estevam <festevam@gmail.com>
---
 sound/soc/fsl/fsl_xcvr.c | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/sound/soc/fsl/fsl_xcvr.c b/sound/soc/fsl/fsl_xcvr.c
index 3d58c88ea603..dd228b421e2c 100644
--- a/sound/soc/fsl/fsl_xcvr.c
+++ b/sound/soc/fsl/fsl_xcvr.c
@@ -1130,16 +1130,11 @@ MODULE_DEVICE_TABLE(of, fsl_xcvr_dt_ids);
 static int fsl_xcvr_probe(struct platform_device *pdev)
 {
 	struct device *dev = &pdev->dev;
-	const struct of_device_id *of_id;
 	struct fsl_xcvr *xcvr;
 	struct resource *ram_res, *regs_res, *rx_res, *tx_res;
 	void __iomem *regs;
 	int ret, irq;
 
-	of_id = of_match_device(fsl_xcvr_dt_ids, dev);
-	if (!of_id)
-		return -EINVAL;
-
 	xcvr = devm_kzalloc(dev, sizeof(*xcvr), GFP_KERNEL);
 	if (!xcvr)
 		return -ENOMEM;
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 4/6] ASoC: fsl_asrc: Remove of_device_get_match_data() error check
  2021-01-18 12:38 [PATCH 1/6] ASoC: fsl_ssi: Use of_device_get_match_data() Fabio Estevam
  2021-01-18 12:38 ` [PATCH 2/6] ASoC: fsl_micfil: " Fabio Estevam
  2021-01-18 12:38 ` [PATCH 3/6] ASoC: fsl_xcvr: Remove unused of_id variable Fabio Estevam
@ 2021-01-18 12:38 ` Fabio Estevam
  2021-01-18 12:38 ` [PATCH 5/6] ASoC: fsl_esai: " Fabio Estevam
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Fabio Estevam @ 2021-01-18 12:38 UTC (permalink / raw)
  To: broonie; +Cc: nicoleotsuka, alsa-devel, Fabio Estevam, shengjiu.wang, timur

The only way this driver can be probed is via devicetree, which always
provides driver data.

Remove the unneeded of_device_get_match_data() error check, as it
can never fail.

Signed-off-by: Fabio Estevam <festevam@gmail.com>
---
 sound/soc/fsl/fsl_asrc.c | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/sound/soc/fsl/fsl_asrc.c b/sound/soc/fsl/fsl_asrc.c
index 02c81d2e34ad..c325c984d165 100644
--- a/sound/soc/fsl/fsl_asrc.c
+++ b/sound/soc/fsl/fsl_asrc.c
@@ -1083,11 +1083,6 @@ static int fsl_asrc_probe(struct platform_device *pdev)
 	}
 
 	asrc_priv->soc = of_device_get_match_data(&pdev->dev);
-	if (!asrc_priv->soc) {
-		dev_err(&pdev->dev, "failed to get soc data\n");
-		return -ENODEV;
-	}
-
 	asrc->use_edma = asrc_priv->soc->use_edma;
 	asrc->get_dma_channel = fsl_asrc_get_dma_channel;
 	asrc->request_pair = fsl_asrc_request_pair;
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 5/6] ASoC: fsl_esai: Remove of_device_get_match_data() error check
  2021-01-18 12:38 [PATCH 1/6] ASoC: fsl_ssi: Use of_device_get_match_data() Fabio Estevam
                   ` (2 preceding siblings ...)
  2021-01-18 12:38 ` [PATCH 4/6] ASoC: fsl_asrc: Remove of_device_get_match_data() error check Fabio Estevam
@ 2021-01-18 12:38 ` Fabio Estevam
  2021-01-18 12:38 ` [PATCH 6/6] ASoC: fsl_spdif: " Fabio Estevam
  2021-01-21  0:05 ` [PATCH 1/6] ASoC: fsl_ssi: Use of_device_get_match_data() Mark Brown
  5 siblings, 0 replies; 7+ messages in thread
From: Fabio Estevam @ 2021-01-18 12:38 UTC (permalink / raw)
  To: broonie; +Cc: nicoleotsuka, alsa-devel, Fabio Estevam, shengjiu.wang, timur

The only way this driver can be probed is via devicetree, which always
provides driver data.

Remove the unneeded of_device_get_match_data() error check, as it
can never fail.

Signed-off-by: Fabio Estevam <festevam@gmail.com>
---
 sound/soc/fsl/fsl_esai.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/sound/soc/fsl/fsl_esai.c b/sound/soc/fsl/fsl_esai.c
index 39637ca78cdb..614e22a95f53 100644
--- a/sound/soc/fsl/fsl_esai.c
+++ b/sound/soc/fsl/fsl_esai.c
@@ -967,10 +967,6 @@ static int fsl_esai_probe(struct platform_device *pdev)
 	snprintf(esai_priv->name, sizeof(esai_priv->name), "%pOFn", np);
 
 	esai_priv->soc = of_device_get_match_data(&pdev->dev);
-	if (!esai_priv->soc) {
-		dev_err(&pdev->dev, "failed to get soc data\n");
-		return -ENODEV;
-	}
 
 	/* Get the addresses and IRQ */
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 6/6] ASoC: fsl_spdif: Remove of_device_get_match_data() error check
  2021-01-18 12:38 [PATCH 1/6] ASoC: fsl_ssi: Use of_device_get_match_data() Fabio Estevam
                   ` (3 preceding siblings ...)
  2021-01-18 12:38 ` [PATCH 5/6] ASoC: fsl_esai: " Fabio Estevam
@ 2021-01-18 12:38 ` Fabio Estevam
  2021-01-21  0:05 ` [PATCH 1/6] ASoC: fsl_ssi: Use of_device_get_match_data() Mark Brown
  5 siblings, 0 replies; 7+ messages in thread
From: Fabio Estevam @ 2021-01-18 12:38 UTC (permalink / raw)
  To: broonie; +Cc: nicoleotsuka, alsa-devel, Fabio Estevam, shengjiu.wang, timur

The only way this driver can be probed is via devicetree, which always
provides driver data.

Remove the unneeded of_device_get_match_data() error check, as it
can never fail.

Signed-off-by: Fabio Estevam <festevam@gmail.com>
---
 sound/soc/fsl/fsl_spdif.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/sound/soc/fsl/fsl_spdif.c b/sound/soc/fsl/fsl_spdif.c
index 5fa178f3f497..b4d3b04694bf 100644
--- a/sound/soc/fsl/fsl_spdif.c
+++ b/sound/soc/fsl/fsl_spdif.c
@@ -1305,10 +1305,6 @@ static int fsl_spdif_probe(struct platform_device *pdev)
 	spdif_priv->pdev = pdev;
 
 	spdif_priv->soc = of_device_get_match_data(&pdev->dev);
-	if (!spdif_priv->soc) {
-		dev_err(&pdev->dev, "failed to get soc data\n");
-		return -ENODEV;
-	}
 
 	/* Initialize this copy of the CPU DAI driver structure */
 	memcpy(&spdif_priv->cpu_dai_drv, &fsl_spdif_dai, sizeof(fsl_spdif_dai));
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/6] ASoC: fsl_ssi: Use of_device_get_match_data()
  2021-01-18 12:38 [PATCH 1/6] ASoC: fsl_ssi: Use of_device_get_match_data() Fabio Estevam
                   ` (4 preceding siblings ...)
  2021-01-18 12:38 ` [PATCH 6/6] ASoC: fsl_spdif: " Fabio Estevam
@ 2021-01-21  0:05 ` Mark Brown
  5 siblings, 0 replies; 7+ messages in thread
From: Mark Brown @ 2021-01-21  0:05 UTC (permalink / raw)
  To: Fabio Estevam; +Cc: nicoleotsuka, alsa-devel, shengjiu.wang, timur

On Mon, 18 Jan 2021 09:38:10 -0300, Fabio Estevam wrote:
> The retrieval of driver data via of_device_get_match_data() can make
> the code simpler.
> 
> Use of_device_get_match_data() to simplify the code.

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[1/6] ASoC: fsl_ssi: Use of_device_get_match_data()
      commit: 9ce63203eb2071fe0117d2e2454c19d79af4a2f1
[2/6] ASoC: fsl_micfil: Use of_device_get_match_data()
      commit: d7388718d491463ed0fb7383a4c678b94fdda785
[3/6] ASoC: fsl_xcvr: Remove unused of_id variable
      commit: 42450175a3d21d0818976114833d23ca5035e713
[4/6] ASoC: fsl_asrc: Remove of_device_get_match_data() error check
      commit: 214172a9ca26f77c3d6912f97246dc6ec9b16141
[5/6] ASoC: fsl_esai: Remove of_device_get_match_data() error check
      commit: 1ccf6e6ef9261c0c8c0be495070c45c030adcc40
[6/6] ASoC: fsl_spdif: Remove of_device_get_match_data() error check
      commit: 4e63b56593e25937f22c01ae60574a3b0548553c

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-01-21  0:09 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-18 12:38 [PATCH 1/6] ASoC: fsl_ssi: Use of_device_get_match_data() Fabio Estevam
2021-01-18 12:38 ` [PATCH 2/6] ASoC: fsl_micfil: " Fabio Estevam
2021-01-18 12:38 ` [PATCH 3/6] ASoC: fsl_xcvr: Remove unused of_id variable Fabio Estevam
2021-01-18 12:38 ` [PATCH 4/6] ASoC: fsl_asrc: Remove of_device_get_match_data() error check Fabio Estevam
2021-01-18 12:38 ` [PATCH 5/6] ASoC: fsl_esai: " Fabio Estevam
2021-01-18 12:38 ` [PATCH 6/6] ASoC: fsl_spdif: " Fabio Estevam
2021-01-21  0:05 ` [PATCH 1/6] ASoC: fsl_ssi: Use of_device_get_match_data() Mark Brown

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.