LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] i2c: mediatek: use of_device_get_match_data()
@ 2018-04-16  2:32 Ryder Lee
  2018-04-16  2:33 ` [PATCH] spi: mediatek: Use of_device_get_match_data() Ryder Lee
                   ` (7 more replies)
  0 siblings, 8 replies; 17+ messages in thread
From: Ryder Lee @ 2018-04-16  2:32 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: Jun Gao, linux-i2c, 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_i2c_probe() is to match an entry in
mtk_i2c_of_match[], so of_id cannot be NULL.

Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
---
 drivers/i2c/busses/i2c-mt65xx.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/i2c/busses/i2c-mt65xx.c b/drivers/i2c/busses/i2c-mt65xx.c
index cf23a74..1e57f58 100644
--- a/drivers/i2c/busses/i2c-mt65xx.c
+++ b/drivers/i2c/busses/i2c-mt65xx.c
@@ -27,6 +27,7 @@
 #include <linux/mm.h>
 #include <linux/module.h>
 #include <linux/of_address.h>
+#include <linux/of_device.h>
 #include <linux/of_irq.h>
 #include <linux/platform_device.h>
 #include <linux/scatterlist.h>
@@ -734,7 +735,6 @@ static int mtk_i2c_parse_dt(struct device_node *np, struct mtk_i2c *i2c)
 
 static int mtk_i2c_probe(struct platform_device *pdev)
 {
-	const struct of_device_id *of_id;
 	int ret = 0;
 	struct mtk_i2c *i2c;
 	struct clk *clk;
@@ -761,11 +761,7 @@ static int mtk_i2c_probe(struct platform_device *pdev)
 
 	init_completion(&i2c->msg_complete);
 
-	of_id = of_match_node(mtk_i2c_of_match, pdev->dev.of_node);
-	if (!of_id)
-		return -EINVAL;
-
-	i2c->dev_comp = of_id->data;
+	i2c->dev_comp = of_device_get_match_data(&pdev->dev);
 	i2c->adap.dev.of_node = pdev->dev.of_node;
 	i2c->dev = &pdev->dev;
 	i2c->adap.dev.parent = &pdev->dev;
-- 
1.9.1

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

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

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-16  2:32 [PATCH] i2c: mediatek: use of_device_get_match_data() Ryder Lee
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
2018-04-16  2:33 ` [PATCH] soc: mediatek: use of_device_get_match_data() Ryder Lee
2018-04-17 14:37   ` Matthias Brugger
2018-04-16  2:33 ` [PATCH] net: " Ryder Lee
2018-04-16 17:43   ` David Miller
2018-04-16  2:33 ` [PATCH] mmc: " Ryder Lee
2018-04-19 13:18   ` Ulf Hansson
2018-04-16  2:33 ` [PATCH] mtd: nand: mtk: " Ryder Lee
2018-04-16  4:27   ` xiaolei li
2018-04-22 17:27   ` Boris Brezillon
2018-04-16  2:34 ` [PATCH] thermal: mediatek: " Ryder Lee
2018-04-16  2:34 ` [PATCH] media: rc: mtk-cir: " Ryder Lee
2018-04-17  3:58   ` Sean Wang
2018-04-28 13:12 ` [PATCH] i2c: mediatek: " Wolfram Sang

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