All of lore.kernel.org
 help / color / mirror / Atom feed
From: AngeloGioacchino Del Regno  <angelogioacchino.delregno@collabora.com>
To: broonie@kernel.org
Cc: matthias.bgg@gmail.com, linux-spi@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org,
	nfraprado@collabora.com, kernel@collabora.com,
	AngeloGioacchino Del Regno 
	<angelogioacchino.delregno@collabora.com>
Subject: [PATCH v2 2/8] spi: mt65xx: Switch to device_get_match_data()
Date: Thu,  7 Apr 2022 13:44:22 +0200	[thread overview]
Message-ID: <20220407114428.167091-3-angelogioacchino.delregno@collabora.com> (raw)
In-Reply-To: <20220407114428.167091-1-angelogioacchino.delregno@collabora.com>

Instead of performing yet another match check in the probe function,
simply switch to device_get_match_data().
This is a cleanup and brings no functional change.

Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
 drivers/spi/spi-mt65xx.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/drivers/spi/spi-mt65xx.c b/drivers/spi/spi-mt65xx.c
index 4c84b67ac85c..4e0b520f9abe 100644
--- a/drivers/spi/spi-mt65xx.c
+++ b/drivers/spi/spi-mt65xx.c
@@ -1084,7 +1084,6 @@ static int mtk_spi_probe(struct platform_device *pdev)
 {
 	struct spi_master *master;
 	struct mtk_spi *mdata;
-	const struct of_device_id *of_id;
 	int i, irq, ret, addr_bits;
 
 	master = devm_spi_alloc_master(&pdev->dev, sizeof(*mdata));
@@ -1105,14 +1104,8 @@ static int mtk_spi_probe(struct platform_device *pdev)
 	master->set_cs_timing = mtk_spi_set_hw_cs_timing;
 	master->use_gpio_descriptors = true;
 
-	of_id = of_match_node(mtk_spi_of_match, pdev->dev.of_node);
-	if (!of_id) {
-		dev_err(&pdev->dev, "failed to probe of_node\n");
-		return -EINVAL;
-	}
-
 	mdata = spi_master_get_devdata(master);
-	mdata->dev_comp = of_id->data;
+	mdata->dev_comp = device_get_match_data(&pdev->dev);
 
 	if (mdata->dev_comp->enhance_timing)
 		master->mode_bits |= SPI_CS_HIGH;
-- 
2.35.1


WARNING: multiple messages have this Message-ID (diff)
From: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
To: broonie@kernel.org
Cc: matthias.bgg@gmail.com, linux-spi@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org,
	nfraprado@collabora.com, kernel@collabora.com,
	AngeloGioacchino Del Regno
	<angelogioacchino.delregno@collabora.com>
Subject: [PATCH v2 2/8] spi: mt65xx: Switch to device_get_match_data()
Date: Thu,  7 Apr 2022 13:44:22 +0200	[thread overview]
Message-ID: <20220407114428.167091-3-angelogioacchino.delregno@collabora.com> (raw)
In-Reply-To: <20220407114428.167091-1-angelogioacchino.delregno@collabora.com>

Instead of performing yet another match check in the probe function,
simply switch to device_get_match_data().
This is a cleanup and brings no functional change.

Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
 drivers/spi/spi-mt65xx.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/drivers/spi/spi-mt65xx.c b/drivers/spi/spi-mt65xx.c
index 4c84b67ac85c..4e0b520f9abe 100644
--- a/drivers/spi/spi-mt65xx.c
+++ b/drivers/spi/spi-mt65xx.c
@@ -1084,7 +1084,6 @@ static int mtk_spi_probe(struct platform_device *pdev)
 {
 	struct spi_master *master;
 	struct mtk_spi *mdata;
-	const struct of_device_id *of_id;
 	int i, irq, ret, addr_bits;
 
 	master = devm_spi_alloc_master(&pdev->dev, sizeof(*mdata));
@@ -1105,14 +1104,8 @@ static int mtk_spi_probe(struct platform_device *pdev)
 	master->set_cs_timing = mtk_spi_set_hw_cs_timing;
 	master->use_gpio_descriptors = true;
 
-	of_id = of_match_node(mtk_spi_of_match, pdev->dev.of_node);
-	if (!of_id) {
-		dev_err(&pdev->dev, "failed to probe of_node\n");
-		return -EINVAL;
-	}
-
 	mdata = spi_master_get_devdata(master);
-	mdata->dev_comp = of_id->data;
+	mdata->dev_comp = device_get_match_data(&pdev->dev);
 
 	if (mdata->dev_comp->enhance_timing)
 		master->mode_bits |= SPI_CS_HIGH;
-- 
2.35.1


_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

WARNING: multiple messages have this Message-ID (diff)
From: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
To: broonie@kernel.org
Cc: matthias.bgg@gmail.com, linux-spi@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org,
	nfraprado@collabora.com, kernel@collabora.com,
	AngeloGioacchino Del Regno
	<angelogioacchino.delregno@collabora.com>
Subject: [PATCH v2 2/8] spi: mt65xx: Switch to device_get_match_data()
Date: Thu,  7 Apr 2022 13:44:22 +0200	[thread overview]
Message-ID: <20220407114428.167091-3-angelogioacchino.delregno@collabora.com> (raw)
In-Reply-To: <20220407114428.167091-1-angelogioacchino.delregno@collabora.com>

Instead of performing yet another match check in the probe function,
simply switch to device_get_match_data().
This is a cleanup and brings no functional change.

Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
 drivers/spi/spi-mt65xx.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/drivers/spi/spi-mt65xx.c b/drivers/spi/spi-mt65xx.c
index 4c84b67ac85c..4e0b520f9abe 100644
--- a/drivers/spi/spi-mt65xx.c
+++ b/drivers/spi/spi-mt65xx.c
@@ -1084,7 +1084,6 @@ static int mtk_spi_probe(struct platform_device *pdev)
 {
 	struct spi_master *master;
 	struct mtk_spi *mdata;
-	const struct of_device_id *of_id;
 	int i, irq, ret, addr_bits;
 
 	master = devm_spi_alloc_master(&pdev->dev, sizeof(*mdata));
@@ -1105,14 +1104,8 @@ static int mtk_spi_probe(struct platform_device *pdev)
 	master->set_cs_timing = mtk_spi_set_hw_cs_timing;
 	master->use_gpio_descriptors = true;
 
-	of_id = of_match_node(mtk_spi_of_match, pdev->dev.of_node);
-	if (!of_id) {
-		dev_err(&pdev->dev, "failed to probe of_node\n");
-		return -EINVAL;
-	}
-
 	mdata = spi_master_get_devdata(master);
-	mdata->dev_comp = of_id->data;
+	mdata->dev_comp = device_get_match_data(&pdev->dev);
 
 	if (mdata->dev_comp->enhance_timing)
 		master->mode_bits |= SPI_CS_HIGH;
-- 
2.35.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  parent reply	other threads:[~2022-04-07 11:44 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-07 11:44 [PATCH v2 0/8] MediaTek SPI controller cleanups and documentation AngeloGioacchino Del Regno
2022-04-07 11:44 ` AngeloGioacchino Del Regno
2022-04-07 11:44 ` AngeloGioacchino Del Regno
2022-04-07 11:44 ` [PATCH v2 1/8] spi: mt65xx: Simplify probe function with devm_spi_alloc_master AngeloGioacchino Del Regno
2022-04-07 11:44   ` AngeloGioacchino Del Regno
2022-04-07 11:44   ` AngeloGioacchino Del Regno
2022-04-07 11:44 ` AngeloGioacchino Del Regno [this message]
2022-04-07 11:44   ` [PATCH v2 2/8] spi: mt65xx: Switch to device_get_match_data() AngeloGioacchino Del Regno
2022-04-07 11:44   ` AngeloGioacchino Del Regno
2022-04-07 11:44 ` [PATCH v2 3/8] spi: mt65xx: Add and use pointer to struct device in mtk_spi_probe() AngeloGioacchino Del Regno
2022-04-07 11:44   ` AngeloGioacchino Del Regno
2022-04-07 11:44   ` AngeloGioacchino Del Regno
2022-04-07 11:44 ` [PATCH v2 4/8] spi: mt65xx: Move clock parent setting to remove clock disable gotos AngeloGioacchino Del Regno
2022-04-07 11:44   ` AngeloGioacchino Del Regno
2022-04-07 11:44   ` AngeloGioacchino Del Regno
2022-04-07 11:44 ` [PATCH v2 5/8] spi: mt65xx: Move pm_runtime_enable() call to remove all gotos AngeloGioacchino Del Regno
2022-04-07 11:44   ` AngeloGioacchino Del Regno
2022-04-07 11:44   ` AngeloGioacchino Del Regno
2022-04-07 11:44 ` [PATCH v2 6/8] spi: mt65xx: Simplify probe function with dev_err_probe() AngeloGioacchino Del Regno
2022-04-07 11:44   ` AngeloGioacchino Del Regno
2022-04-07 11:44   ` AngeloGioacchino Del Regno
2022-04-07 11:44 ` [PATCH v2 7/8] spi: mt65xx: Add kerneldoc for driver structures AngeloGioacchino Del Regno
2022-04-07 11:44   ` AngeloGioacchino Del Regno
2022-04-07 11:44   ` AngeloGioacchino Del Regno
2022-04-07 11:44 ` [PATCH v2 8/8] spi: mt65xx: Fix definitions indentation AngeloGioacchino Del Regno
2022-04-07 11:44   ` AngeloGioacchino Del Regno
2022-04-07 11:44   ` AngeloGioacchino Del Regno
2022-04-20 21:41 ` [PATCH v2 0/8] MediaTek SPI controller cleanups and documentation Mark Brown
2022-04-20 21:41   ` Mark Brown
2022-04-20 21:41   ` 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=20220407114428.167091-3-angelogioacchino.delregno@collabora.com \
    --to=angelogioacchino.delregno@collabora.com \
    --cc=broonie@kernel.org \
    --cc=kernel@collabora.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=matthias.bgg@gmail.com \
    --cc=nfraprado@collabora.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 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.