linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] spi: mediatek: Use of_device_get_match_data()
       [not found] <31f944ab8dfcc1d7b6f03b35657a2a34825b5246.1523347340.git.ryder.lee@mediatek.com>
@ 2018-04-16  2:33 ` Ryder Lee
  2018-04-30  7:26   ` Ryder Lee
  0 siblings, 1 reply; 3+ messages in thread
From: Ryder Lee @ 2018-04-16  2:33 UTC (permalink / raw)
  To: Mark Brown
  Cc: Leilk Liu, linux-spi, linux-kernel, linux-arm-kernel,
	linux-mediatek, Ryder Lee

The usage of of_device_get_match_data() reduce the code size a bit.

Also, the only way to call mtk_spi_probe() is to match an entry in
mtk_spi_of_match[], so of_id cannot be NULL.

Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
---
 drivers/spi/spi-mt65xx.c | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)

diff --git a/drivers/spi/spi-mt65xx.c b/drivers/spi/spi-mt65xx.c
index 86bf456..3edc183 100644
--- a/drivers/spi/spi-mt65xx.c
+++ b/drivers/spi/spi-mt65xx.c
@@ -20,6 +20,7 @@
 #include <linux/ioport.h>
 #include <linux/module.h>
 #include <linux/of.h>
+#include <linux/of_device.h>
 #include <linux/of_gpio.h>
 #include <linux/platform_device.h>
 #include <linux/platform_data/spi-mt65xx.h>
@@ -578,7 +579,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;
 	struct resource *res;
 	int i, irq, ret;
 
@@ -598,15 +598,9 @@ static int mtk_spi_probe(struct platform_device *pdev)
 	master->can_dma = mtk_spi_can_dma;
 	master->setup = mtk_spi_setup;
 
-	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");
-		ret = -EINVAL;
-		goto err_put_master;
-	}
-
 	mdata = spi_master_get_devdata(master);
-	mdata->dev_comp = of_id->data;
+	mdata->dev_comp = of_device_get_match_data(&pdev->dev);
+
 	if (mdata->dev_comp->must_tx)
 		master->flags = SPI_MASTER_MUST_TX;
 
-- 
1.9.1

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

* Re: [PATCH] spi: mediatek: Use of_device_get_match_data()
  2018-04-16  2:33 ` [PATCH] spi: mediatek: Use of_device_get_match_data() Ryder Lee
@ 2018-04-30  7:26   ` Ryder Lee
  2018-05-01 20:35     ` Mark Brown
  0 siblings, 1 reply; 3+ messages in thread
From: Ryder Lee @ 2018-04-30  7:26 UTC (permalink / raw)
  To: Mark Brown
  Cc: Leilk Liu (刘磊), linux-kernel@vger.kernel.org,
	linux-spi@vger.kernel.org, linux-mediatek@lists.infradead.org,
	linux-arm-kernel@lists.infradead.org

Hi Mark,

Is it okay with you?

On Mon, 2018-04-16 at 10:33 +0800, Ryder Lee (李庚?V) wrote:
> The usage of of_device_get_match_data() reduce the code size a bit.
> 
> Also, the only way to call mtk_spi_probe() is to match an entry in
> mtk_spi_of_match[], so of_id cannot be NULL.
> 
> Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
> ---
>  drivers/spi/spi-mt65xx.c | 12 +++---------
>  1 file changed, 3 insertions(+), 9 deletions(-)
> 

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

* Re: [PATCH] spi: mediatek: Use of_device_get_match_data()
  2018-04-30  7:26   ` Ryder Lee
@ 2018-05-01 20:35     ` Mark Brown
  0 siblings, 0 replies; 3+ messages in thread
From: Mark Brown @ 2018-05-01 20:35 UTC (permalink / raw)
  To: Ryder Lee
  Cc: Leilk Liu (刘磊), linux-kernel@vger.kernel.org,
	linux-spi@vger.kernel.org, linux-mediatek@lists.infradead.org,
	linux-arm-kernel@lists.infradead.org

[-- Attachment #1: Type: text/plain, Size: 767 bytes --]

On Mon, Apr 30, 2018 at 03:26:36PM +0800, Ryder Lee wrote:
> Hi Mark,
> 
> Is it okay with you?
> 
> On Mon, 2018-04-16 at 10:33 +0800, Ryder Lee (李庚?V) wrote:
> > The usage of of_device_get_match_data() reduce the code size a bit.

Please don't send content free pings and please allow a reasonable time
for review.  People get busy, go on holiday, attend conferences and so 
on so unless there is some reason for urgency (like critical bug fixes)
please allow at least a couple of weeks for review.  If there have been
review comments then people may be waiting for those to be addressed.
Sending content free pings just adds to the mail volume (if they are
seen at all) and if something has gone wrong you'll have to resend the
patches anyway.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

end of thread, other threads:[~2018-05-01 20:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <31f944ab8dfcc1d7b6f03b35657a2a34825b5246.1523347340.git.ryder.lee@mediatek.com>
2018-04-16  2:33 ` [PATCH] spi: mediatek: Use of_device_get_match_data() Ryder Lee
2018-04-30  7:26   ` Ryder Lee
2018-05-01 20:35     ` Mark Brown

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).