linux-kernel.vger.kernel.org archive mirror
 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 related	[flat|nested] 17+ messages in thread

* [PATCH] spi: mediatek: Use of_device_get_match_data()
  2018-04-16  2:32 [PATCH] i2c: mediatek: use of_device_get_match_data() Ryder Lee
@ 2018-04-16  2:33 ` Ryder Lee
  2018-04-30  7:26   ` Ryder Lee
  2018-04-16  2:33 ` [PATCH] soc: mediatek: use of_device_get_match_data() Ryder Lee
                   ` (6 subsequent siblings)
  7 siblings, 1 reply; 17+ 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] 17+ messages in thread

* [PATCH] soc: mediatek: use of_device_get_match_data()
  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-16  2:33 ` Ryder Lee
  2018-04-17 14:37   ` Matthias Brugger
  2018-04-16  2:33 ` [PATCH] net: " Ryder Lee
                   ` (5 subsequent siblings)
  7 siblings, 1 reply; 17+ messages in thread
From: Ryder Lee @ 2018-04-16  2:33 UTC (permalink / raw)
  To: Matthias Brugger
  Cc: 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 pwrap_probe() is to match an entry in
of_pwrap_match_tbl[], so of_id cannot be NULL.

Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
---
 drivers/soc/mediatek/mtk-pmic-wrap.c | 13 +++----------
 drivers/soc/mediatek/mtk-scpsys.c    |  4 +---
 2 files changed, 4 insertions(+), 13 deletions(-)

diff --git a/drivers/soc/mediatek/mtk-pmic-wrap.c b/drivers/soc/mediatek/mtk-pmic-wrap.c
index e9e054a..2afae64 100644
--- a/drivers/soc/mediatek/mtk-pmic-wrap.c
+++ b/drivers/soc/mediatek/mtk-pmic-wrap.c
@@ -1458,19 +1458,12 @@ static int pwrap_probe(struct platform_device *pdev)
 	int ret, irq;
 	struct pmic_wrapper *wrp;
 	struct device_node *np = pdev->dev.of_node;
-	const struct of_device_id *of_id =
-		of_match_device(of_pwrap_match_tbl, &pdev->dev);
 	const struct of_device_id *of_slave_id = NULL;
 	struct resource *res;
 
-	if (!of_id) {
-		dev_err(&pdev->dev, "Error: No device match found\n");
-		return -ENODEV;
-	}
+	if (np->child)
+		of_slave_id = of_match_node(of_slave_match_tbl, np->child);
 
-	if (pdev->dev.of_node->child)
-		of_slave_id = of_match_node(of_slave_match_tbl,
-					    pdev->dev.of_node->child);
 	if (!of_slave_id) {
 		dev_dbg(&pdev->dev, "slave pmic should be defined in dts\n");
 		return -EINVAL;
@@ -1482,7 +1475,7 @@ static int pwrap_probe(struct platform_device *pdev)
 
 	platform_set_drvdata(pdev, wrp);
 
-	wrp->master = of_id->data;
+	wrp->master = of_device_get_match_data(&pdev->dev);
 	wrp->slave = of_slave_id->data;
 	wrp->dev = &pdev->dev;
 
diff --git a/drivers/soc/mediatek/mtk-scpsys.c b/drivers/soc/mediatek/mtk-scpsys.c
index 435ce5e..a02a18e 100644
--- a/drivers/soc/mediatek/mtk-scpsys.c
+++ b/drivers/soc/mediatek/mtk-scpsys.c
@@ -973,15 +973,13 @@ static void mtk_register_power_domains(struct platform_device *pdev,
 
 static int scpsys_probe(struct platform_device *pdev)
 {
-	const struct of_device_id *match;
 	const struct scp_subdomain *sd;
 	const struct scp_soc_data *soc;
 	struct scp *scp;
 	struct genpd_onecell_data *pd_data;
 	int i, ret;
 
-	match = of_match_device(of_scpsys_match_tbl, &pdev->dev);
-	soc = (const struct scp_soc_data *)match->data;
+	soc = of_device_get_match_data(&pdev->dev);
 
 	scp = init_scp(pdev, soc->domains, soc->num_domains, &soc->regs,
 			soc->bus_prot_reg_update);
-- 
1.9.1

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

* [PATCH] net: mediatek: use of_device_get_match_data()
  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-16  2:33 ` [PATCH] soc: mediatek: use of_device_get_match_data() Ryder Lee
@ 2018-04-16  2:33 ` Ryder Lee
  2018-04-16 17:43   ` David Miller
  2018-04-16  2:33 ` [PATCH] mmc: " Ryder Lee
                   ` (4 subsequent siblings)
  7 siblings, 1 reply; 17+ messages in thread
From: Ryder Lee @ 2018-04-16  2:33 UTC (permalink / raw)
  To: David S. Miller
  Cc: Sean Wang, netdev, 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_probe() is to match an entry in
of_mtk_match[], so match cannot be NULL.

Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
---
 drivers/net/ethernet/mediatek/mtk_eth_soc.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
index e0b72bf..d8ebf0a 100644
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
@@ -2503,7 +2503,6 @@ static int mtk_probe(struct platform_device *pdev)
 {
 	struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	struct device_node *mac_np;
-	const struct of_device_id *match;
 	struct mtk_eth *eth;
 	int err;
 	int i;
@@ -2512,8 +2511,7 @@ static int mtk_probe(struct platform_device *pdev)
 	if (!eth)
 		return -ENOMEM;
 
-	match = of_match_device(of_mtk_match, &pdev->dev);
-	eth->soc = (struct mtk_soc_data *)match->data;
+	eth->soc = of_device_get_match_data(&pdev->dev);
 
 	eth->dev = &pdev->dev;
 	eth->base = devm_ioremap_resource(&pdev->dev, res);
-- 
1.9.1

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

* [PATCH] mmc: mediatek: use of_device_get_match_data()
  2018-04-16  2:32 [PATCH] i2c: mediatek: use of_device_get_match_data() Ryder Lee
                   ` (2 preceding siblings ...)
  2018-04-16  2:33 ` [PATCH] net: " Ryder Lee
@ 2018-04-16  2:33 ` Ryder Lee
  2018-04-19 13:18   ` Ulf Hansson
  2018-04-16  2:33 ` [PATCH] mtd: nand: mtk: " Ryder Lee
                   ` (3 subsequent siblings)
  7 siblings, 1 reply; 17+ messages in thread
From: Ryder Lee @ 2018-04-16  2:33 UTC (permalink / raw)
  To: Ulf Hansson
  Cc: Chaotian Jing, linux-mmc, 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 msdc_drv_probe() is to match an entry in
msdc_of_ids[], so of_id cannot be NULL.

Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
---
 drivers/mmc/host/mtk-sd.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/mmc/host/mtk-sd.c b/drivers/mmc/host/mtk-sd.c
index 6457a7d..67e9b57 100644
--- a/drivers/mmc/host/mtk-sd.c
+++ b/drivers/mmc/host/mtk-sd.c
@@ -19,6 +19,7 @@
 #include <linux/ioport.h>
 #include <linux/irq.h>
 #include <linux/of_address.h>
+#include <linux/of_device.h>
 #include <linux/of_irq.h>
 #include <linux/of_gpio.h>
 #include <linux/pinctrl/consumer.h>
@@ -1808,7 +1809,6 @@ static int msdc_drv_probe(struct platform_device *pdev)
 	struct mmc_host *mmc;
 	struct msdc_host *host;
 	struct resource *res;
-	const struct of_device_id *of_id;
 	int ret;
 
 	if (!pdev->dev.of_node) {
@@ -1816,9 +1816,6 @@ static int msdc_drv_probe(struct platform_device *pdev)
 		return -EINVAL;
 	}
 
-	of_id = of_match_node(msdc_of_ids, pdev->dev.of_node);
-	if (!of_id)
-		return -EINVAL;
 	/* Allocate MMC host for this device */
 	mmc = mmc_alloc_host(sizeof(struct msdc_host), &pdev->dev);
 	if (!mmc)
@@ -1887,7 +1884,7 @@ static int msdc_drv_probe(struct platform_device *pdev)
 	msdc_of_property_parse(pdev, host);
 
 	host->dev = &pdev->dev;
-	host->dev_comp = of_id->data;
+	host->dev_comp = of_device_get_match_data(&pdev->dev);
 	host->mmc = mmc;
 	host->src_clk_freq = clk_get_rate(host->src_clk);
 	/* Set host parameters to mmc */
-- 
1.9.1

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

* [PATCH] mtd: nand: mtk: use of_device_get_match_data()
  2018-04-16  2:32 [PATCH] i2c: mediatek: use of_device_get_match_data() Ryder Lee
                   ` (3 preceding siblings ...)
  2018-04-16  2:33 ` [PATCH] mmc: " Ryder Lee
@ 2018-04-16  2:33 ` 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
                   ` (2 subsequent siblings)
  7 siblings, 2 replies; 17+ messages in thread
From: Ryder Lee @ 2018-04-16  2:33 UTC (permalink / raw)
  To: Boris Brezillon
  Cc: Xiaolei Li, linux-mtd, 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 .probe() is to match an entry in
.of_match_table[], so of_device_id cannot be NULL.

Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
---
 drivers/mtd/nand/raw/mtk_ecc.c  |  7 +------
 drivers/mtd/nand/raw/mtk_nand.c | 10 +---------
 2 files changed, 2 insertions(+), 15 deletions(-)

diff --git a/drivers/mtd/nand/mtk_ecc.c b/drivers/mtd/nand/mtk_ecc.c
index 40d86a8..6432bd7 100644
--- a/drivers/mtd/nand/raw/mtk_ecc.c
+++ b/drivers/mtd/nand/raw/mtk_ecc.c
@@ -500,7 +500,6 @@ static int mtk_ecc_probe(struct platform_device *pdev)
 	struct device *dev = &pdev->dev;
 	struct mtk_ecc *ecc;
 	struct resource *res;
-	const struct of_device_id *of_ecc_id = NULL;
 	u32 max_eccdata_size;
 	int irq, ret;
 
@@ -508,11 +507,7 @@ static int mtk_ecc_probe(struct platform_device *pdev)
 	if (!ecc)
 		return -ENOMEM;
 
-	of_ecc_id = of_match_device(mtk_ecc_dt_match, &pdev->dev);
-	if (!of_ecc_id)
-		return -ENODEV;
-
-	ecc->caps = of_ecc_id->data;
+	ecc->caps = of_device_get_match_data(dev);
 
 	max_eccdata_size = ecc->caps->num_ecc_strength - 1;
 	max_eccdata_size = ecc->caps->ecc_strength[max_eccdata_size];
diff --git a/drivers/mtd/nand/mtk_nand.c b/drivers/mtd/nand/mtk_nand.c
index 6977da3..75c845a 100644
--- a/drivers/mtd/nand/raw/mtk_nand.c
+++ b/drivers/mtd/nand/raw/mtk_nand.c
@@ -1434,7 +1434,6 @@ static int mtk_nfc_probe(struct platform_device *pdev)
 	struct device_node *np = dev->of_node;
 	struct mtk_nfc *nfc;
 	struct resource *res;
-	const struct of_device_id *of_nfc_id = NULL;
 	int ret, irq;
 
 	nfc = devm_kzalloc(dev, sizeof(*nfc), GFP_KERNEL);
@@ -1452,6 +1451,7 @@ static int mtk_nfc_probe(struct platform_device *pdev)
 	else if (!nfc->ecc)
 		return -ENODEV;
 
+	nfc->caps = of_device_get_match_data(dev);
 	nfc->dev = dev;
 
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
@@ -1498,14 +1498,6 @@ static int mtk_nfc_probe(struct platform_device *pdev)
 		goto clk_disable;
 	}
 
-	of_nfc_id = of_match_device(mtk_nfc_id_table, &pdev->dev);
-	if (!of_nfc_id) {
-		ret = -ENODEV;
-		goto clk_disable;
-	}
-
-	nfc->caps = of_nfc_id->data;
-
 	platform_set_drvdata(pdev, nfc);
 
 	ret = mtk_nfc_nand_chips_init(dev, nfc);
-- 
1.9.1

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

* [PATCH] thermal: mediatek: use of_device_get_match_data()
  2018-04-16  2:32 [PATCH] i2c: mediatek: use of_device_get_match_data() Ryder Lee
                   ` (4 preceding siblings ...)
  2018-04-16  2:33 ` [PATCH] mtd: nand: mtk: " Ryder Lee
@ 2018-04-16  2:34 ` Ryder Lee
  2018-04-16  2:34 ` [PATCH] media: rc: mtk-cir: " Ryder Lee
  2018-04-28 13:12 ` [PATCH] i2c: mediatek: " Wolfram Sang
  7 siblings, 0 replies; 17+ messages in thread
From: Ryder Lee @ 2018-04-16  2:34 UTC (permalink / raw)
  To: Zhang Rui
  Cc: Dawei Chien, linux-pm, 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_thermal_probe() is to match an entry in
mtk_thermal_of_match[], so of_id cannot be NULL.

Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
---
 drivers/thermal/mtk_thermal.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/thermal/mtk_thermal.c b/drivers/thermal/mtk_thermal.c
index c75661a..12c3bc4 100644
--- a/drivers/thermal/mtk_thermal.c
+++ b/drivers/thermal/mtk_thermal.c
@@ -642,7 +642,6 @@ static int mtk_thermal_probe(struct platform_device *pdev)
 	struct device_node *auxadc, *apmixedsys, *np = pdev->dev.of_node;
 	struct mtk_thermal *mt;
 	struct resource *res;
-	const struct of_device_id *of_id;
 	u64 auxadc_phys_base, apmixed_phys_base;
 	struct thermal_zone_device *tzdev;
 
@@ -650,9 +649,7 @@ static int mtk_thermal_probe(struct platform_device *pdev)
 	if (!mt)
 		return -ENOMEM;
 
-	of_id = of_match_device(mtk_thermal_of_match, &pdev->dev);
-	if (of_id)
-		mt->conf = (const struct mtk_thermal_data *)of_id->data;
+	mt->conf = of_device_get_match_data(&pdev->dev);
 
 	mt->clk_peri_therm = devm_clk_get(&pdev->dev, "therm");
 	if (IS_ERR(mt->clk_peri_therm))
-- 
1.9.1

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

* [PATCH] media: rc: mtk-cir: use of_device_get_match_data()
  2018-04-16  2:32 [PATCH] i2c: mediatek: use of_device_get_match_data() Ryder Lee
                   ` (5 preceding siblings ...)
  2018-04-16  2:34 ` [PATCH] thermal: mediatek: " Ryder Lee
@ 2018-04-16  2:34 ` Ryder Lee
  2018-04-17  3:58   ` Sean Wang
  2018-04-28 13:12 ` [PATCH] i2c: mediatek: " Wolfram Sang
  7 siblings, 1 reply; 17+ messages in thread
From: Ryder Lee @ 2018-04-16  2:34 UTC (permalink / raw)
  To: Mauro Carvalho Chehab
  Cc: Sean Wang, linux-media, linux-kernel, linux-arm-kernel,
	linux-mediatek, Ryder Lee

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

Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
---
 drivers/media/rc/mtk-cir.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/media/rc/mtk-cir.c b/drivers/media/rc/mtk-cir.c
index e88eb64..e42efd9 100644
--- a/drivers/media/rc/mtk-cir.c
+++ b/drivers/media/rc/mtk-cir.c
@@ -299,8 +299,6 @@ static int mtk_ir_probe(struct platform_device *pdev)
 {
 	struct device *dev = &pdev->dev;
 	struct device_node *dn = dev->of_node;
-	const struct of_device_id *of_id =
-		of_match_device(mtk_ir_match, &pdev->dev);
 	struct resource *res;
 	struct mtk_ir *ir;
 	u32 val;
@@ -312,7 +310,7 @@ static int mtk_ir_probe(struct platform_device *pdev)
 		return -ENOMEM;
 
 	ir->dev = dev;
-	ir->data = of_id->data;
+	ir->data = of_device_get_match_data(dev);
 
 	ir->clk = devm_clk_get(dev, "clk");
 	if (IS_ERR(ir->clk)) {
-- 
1.9.1

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

* Re: [PATCH] mtd: nand: mtk: use of_device_get_match_data()
  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
  1 sibling, 0 replies; 17+ messages in thread
From: xiaolei li @ 2018-04-16  4:27 UTC (permalink / raw)
  To: Ryder Lee
  Cc: Boris Brezillon, linux-mtd, linux-kernel, linux-arm-kernel,
	linux-mediatek

On Mon, 2018-04-16 at 10:33 +0800, Ryder Lee wrote:
> The usage of of_device_get_match_data() reduce the code size a bit.
> 
> Also, the only way to call .probe() is to match an entry in
> .of_match_table[], so of_device_id cannot be NULL.
> 
> Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
> ---
>  drivers/mtd/nand/raw/mtk_ecc.c  |  7 +------
>  drivers/mtd/nand/raw/mtk_nand.c | 10 +---------
>  2 files changed, 2 insertions(+), 15 deletions(-)
> 
> diff --git a/drivers/mtd/nand/mtk_ecc.c b/drivers/mtd/nand/mtk_ecc.c
> index 40d86a8..6432bd7 100644
> --- a/drivers/mtd/nand/raw/mtk_ecc.c
> +++ b/drivers/mtd/nand/raw/mtk_ecc.c
> @@ -500,7 +500,6 @@ static int mtk_ecc_probe(struct platform_device *pdev)
>  	struct device *dev = &pdev->dev;
>  	struct mtk_ecc *ecc;
>  	struct resource *res;
> -	const struct of_device_id *of_ecc_id = NULL;
>  	u32 max_eccdata_size;
>  	int irq, ret;
>  
> @@ -508,11 +507,7 @@ static int mtk_ecc_probe(struct platform_device *pdev)
>  	if (!ecc)
>  		return -ENOMEM;
>  
> -	of_ecc_id = of_match_device(mtk_ecc_dt_match, &pdev->dev);
> -	if (!of_ecc_id)
> -		return -ENODEV;
> -
> -	ecc->caps = of_ecc_id->data;
> +	ecc->caps = of_device_get_match_data(dev);
>  
Thanks.

Reviewed-by: Xiaolei Li <xiaolei.li@mediatek.com>

>  	max_eccdata_size = ecc->caps->num_ecc_strength - 1;
>  	max_eccdata_size = ecc->caps->ecc_strength[max_eccdata_size];
> diff --git a/drivers/mtd/nand/mtk_nand.c b/drivers/mtd/nand/mtk_nand.c
> index 6977da3..75c845a 100644
> --- a/drivers/mtd/nand/raw/mtk_nand.c
> +++ b/drivers/mtd/nand/raw/mtk_nand.c
> @@ -1434,7 +1434,6 @@ static int mtk_nfc_probe(struct platform_device *pdev)
>  	struct device_node *np = dev->of_node;
>  	struct mtk_nfc *nfc;
>  	struct resource *res;
> -	const struct of_device_id *of_nfc_id = NULL;
>  	int ret, irq;
>  
>  	nfc = devm_kzalloc(dev, sizeof(*nfc), GFP_KERNEL);
> @@ -1452,6 +1451,7 @@ static int mtk_nfc_probe(struct platform_device *pdev)
>  	else if (!nfc->ecc)
>  		return -ENODEV;
>  
> +	nfc->caps = of_device_get_match_data(dev);
>  	nfc->dev = dev;
>  
>  	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> @@ -1498,14 +1498,6 @@ static int mtk_nfc_probe(struct platform_device *pdev)
>  		goto clk_disable;
>  	}
>  
> -	of_nfc_id = of_match_device(mtk_nfc_id_table, &pdev->dev);
> -	if (!of_nfc_id) {
> -		ret = -ENODEV;
> -		goto clk_disable;
> -	}
> -
> -	nfc->caps = of_nfc_id->data;
> -
>  	platform_set_drvdata(pdev, nfc);
>  
>  	ret = mtk_nfc_nand_chips_init(dev, nfc);

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

* Re: [PATCH] net: mediatek: use of_device_get_match_data()
  2018-04-16  2:33 ` [PATCH] net: " Ryder Lee
@ 2018-04-16 17:43   ` David Miller
  0 siblings, 0 replies; 17+ messages in thread
From: David Miller @ 2018-04-16 17:43 UTC (permalink / raw)
  To: ryder.lee
  Cc: sean.wang, netdev, linux-kernel, linux-arm-kernel, linux-mediatek

From: Ryder Lee <ryder.lee@mediatek.com>
Date: Mon, 16 Apr 2018 10:33:41 +0800

> The usage of of_device_get_match_data() reduce the code size a bit.
> 
> Also, the only way to call mtk_probe() is to match an entry in
> of_mtk_match[], so match cannot be NULL.
> 
> Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>

Applied to net-next.

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

* Re: [PATCH] media: rc: mtk-cir: use of_device_get_match_data()
  2018-04-16  2:34 ` [PATCH] media: rc: mtk-cir: " Ryder Lee
@ 2018-04-17  3:58   ` Sean Wang
  0 siblings, 0 replies; 17+ messages in thread
From: Sean Wang @ 2018-04-17  3:58 UTC (permalink / raw)
  To: Ryder Lee
  Cc: Mauro Carvalho Chehab, linux-media, linux-kernel,
	linux-arm-kernel, linux-mediatek

On Mon, 2018-04-16 at 10:34 +0800, Ryder Lee wrote:
> The usage of of_device_get_match_data() reduce the code size a bit.
> 
> Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
> ---
>  drivers/media/rc/mtk-cir.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/drivers/media/rc/mtk-cir.c b/drivers/media/rc/mtk-cir.c
> index e88eb64..e42efd9 100644
> --- a/drivers/media/rc/mtk-cir.c
> +++ b/drivers/media/rc/mtk-cir.c
> @@ -299,8 +299,6 @@ static int mtk_ir_probe(struct platform_device *pdev)
>  {
>  	struct device *dev = &pdev->dev;
>  	struct device_node *dn = dev->of_node;
> -	const struct of_device_id *of_id =
> -		of_match_device(mtk_ir_match, &pdev->dev);
>  	struct resource *res;
>  	struct mtk_ir *ir;
>  	u32 val;
> @@ -312,7 +310,7 @@ static int mtk_ir_probe(struct platform_device *pdev)
>  		return -ENOMEM;
>  
>  	ir->dev = dev;
> -	ir->data = of_id->data;
> +	ir->data = of_device_get_match_data(dev);
>  
>  	ir->clk = devm_clk_get(dev, "clk");
>  	if (IS_ERR(ir->clk)) {


Acked-by: Sean Wang <sean.wang@mediatek.com>

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

* Re: [PATCH] soc: mediatek: use of_device_get_match_data()
  2018-04-16  2:33 ` [PATCH] soc: mediatek: use of_device_get_match_data() Ryder Lee
@ 2018-04-17 14:37   ` Matthias Brugger
  0 siblings, 0 replies; 17+ messages in thread
From: Matthias Brugger @ 2018-04-17 14:37 UTC (permalink / raw)
  To: Ryder Lee; +Cc: linux-kernel, linux-arm-kernel, linux-mediatek



On 04/16/2018 04:33 AM, Ryder Lee wrote:
> The usage of of_device_get_match_data() reduce the code size a bit.
> 
> Also, the only way to call pwrap_probe() is to match an entry in
> of_pwrap_match_tbl[], so of_id cannot be NULL.
> 
> Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
> ---

Applied to v4.17-next/soc

Thanks.

>  drivers/soc/mediatek/mtk-pmic-wrap.c | 13 +++----------
>  drivers/soc/mediatek/mtk-scpsys.c    |  4 +---
>  2 files changed, 4 insertions(+), 13 deletions(-)
> 
> diff --git a/drivers/soc/mediatek/mtk-pmic-wrap.c b/drivers/soc/mediatek/mtk-pmic-wrap.c
> index e9e054a..2afae64 100644
> --- a/drivers/soc/mediatek/mtk-pmic-wrap.c
> +++ b/drivers/soc/mediatek/mtk-pmic-wrap.c
> @@ -1458,19 +1458,12 @@ static int pwrap_probe(struct platform_device *pdev)
>  	int ret, irq;
>  	struct pmic_wrapper *wrp;
>  	struct device_node *np = pdev->dev.of_node;
> -	const struct of_device_id *of_id =
> -		of_match_device(of_pwrap_match_tbl, &pdev->dev);
>  	const struct of_device_id *of_slave_id = NULL;
>  	struct resource *res;
>  
> -	if (!of_id) {
> -		dev_err(&pdev->dev, "Error: No device match found\n");
> -		return -ENODEV;
> -	}
> +	if (np->child)
> +		of_slave_id = of_match_node(of_slave_match_tbl, np->child);
>  
> -	if (pdev->dev.of_node->child)
> -		of_slave_id = of_match_node(of_slave_match_tbl,
> -					    pdev->dev.of_node->child);
>  	if (!of_slave_id) {
>  		dev_dbg(&pdev->dev, "slave pmic should be defined in dts\n");
>  		return -EINVAL;
> @@ -1482,7 +1475,7 @@ static int pwrap_probe(struct platform_device *pdev)
>  
>  	platform_set_drvdata(pdev, wrp);
>  
> -	wrp->master = of_id->data;
> +	wrp->master = of_device_get_match_data(&pdev->dev);
>  	wrp->slave = of_slave_id->data;
>  	wrp->dev = &pdev->dev;
>  
> diff --git a/drivers/soc/mediatek/mtk-scpsys.c b/drivers/soc/mediatek/mtk-scpsys.c
> index 435ce5e..a02a18e 100644
> --- a/drivers/soc/mediatek/mtk-scpsys.c
> +++ b/drivers/soc/mediatek/mtk-scpsys.c
> @@ -973,15 +973,13 @@ static void mtk_register_power_domains(struct platform_device *pdev,
>  
>  static int scpsys_probe(struct platform_device *pdev)
>  {
> -	const struct of_device_id *match;
>  	const struct scp_subdomain *sd;
>  	const struct scp_soc_data *soc;
>  	struct scp *scp;
>  	struct genpd_onecell_data *pd_data;
>  	int i, ret;
>  
> -	match = of_match_device(of_scpsys_match_tbl, &pdev->dev);
> -	soc = (const struct scp_soc_data *)match->data;
> +	soc = of_device_get_match_data(&pdev->dev);
>  
>  	scp = init_scp(pdev, soc->domains, soc->num_domains, &soc->regs,
>  			soc->bus_prot_reg_update);
> 

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

* Re: [PATCH] mmc: mediatek: use of_device_get_match_data()
  2018-04-16  2:33 ` [PATCH] mmc: " Ryder Lee
@ 2018-04-19 13:18   ` Ulf Hansson
  0 siblings, 0 replies; 17+ messages in thread
From: Ulf Hansson @ 2018-04-19 13:18 UTC (permalink / raw)
  To: Ryder Lee
  Cc: Chaotian Jing, linux-mmc, Linux Kernel Mailing List, Linux ARM,
	linux-mediatek

On 16 April 2018 at 04:33, Ryder Lee <ryder.lee@mediatek.com> wrote:
> The usage of of_device_get_match_data() reduce the code size a bit.
>
> Also, the only way to call msdc_drv_probe() is to match an entry in
> msdc_of_ids[], so of_id cannot be NULL.
>
> Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>

Thanks, applied for next!

Kind regards
Uffe

> ---
>  drivers/mmc/host/mtk-sd.c | 7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/mmc/host/mtk-sd.c b/drivers/mmc/host/mtk-sd.c
> index 6457a7d..67e9b57 100644
> --- a/drivers/mmc/host/mtk-sd.c
> +++ b/drivers/mmc/host/mtk-sd.c
> @@ -19,6 +19,7 @@
>  #include <linux/ioport.h>
>  #include <linux/irq.h>
>  #include <linux/of_address.h>
> +#include <linux/of_device.h>
>  #include <linux/of_irq.h>
>  #include <linux/of_gpio.h>
>  #include <linux/pinctrl/consumer.h>
> @@ -1808,7 +1809,6 @@ static int msdc_drv_probe(struct platform_device *pdev)
>         struct mmc_host *mmc;
>         struct msdc_host *host;
>         struct resource *res;
> -       const struct of_device_id *of_id;
>         int ret;
>
>         if (!pdev->dev.of_node) {
> @@ -1816,9 +1816,6 @@ static int msdc_drv_probe(struct platform_device *pdev)
>                 return -EINVAL;
>         }
>
> -       of_id = of_match_node(msdc_of_ids, pdev->dev.of_node);
> -       if (!of_id)
> -               return -EINVAL;
>         /* Allocate MMC host for this device */
>         mmc = mmc_alloc_host(sizeof(struct msdc_host), &pdev->dev);
>         if (!mmc)
> @@ -1887,7 +1884,7 @@ static int msdc_drv_probe(struct platform_device *pdev)
>         msdc_of_property_parse(pdev, host);
>
>         host->dev = &pdev->dev;
> -       host->dev_comp = of_id->data;
> +       host->dev_comp = of_device_get_match_data(&pdev->dev);
>         host->mmc = mmc;
>         host->src_clk_freq = clk_get_rate(host->src_clk);
>         /* Set host parameters to mmc */
> --
> 1.9.1
>

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

* Re: [PATCH] mtd: nand: mtk: use of_device_get_match_data()
  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
  1 sibling, 0 replies; 17+ messages in thread
From: Boris Brezillon @ 2018-04-22 17:27 UTC (permalink / raw)
  To: Ryder Lee
  Cc: Boris Brezillon, linux-kernel, linux-mediatek, linux-mtd,
	Xiaolei Li, linux-arm-kernel

On Mon, 16 Apr 2018 10:33:54 +0800
Ryder Lee <ryder.lee@mediatek.com> wrote:

> The usage of of_device_get_match_data() reduce the code size a bit.
> 
> Also, the only way to call .probe() is to match an entry in
> .of_match_table[], so of_device_id cannot be NULL.
> 
> Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
> ---
>  drivers/mtd/nand/raw/mtk_ecc.c  |  7 +------
>  drivers/mtd/nand/raw/mtk_nand.c | 10 +---------

Applied to nand/next after fixing the subject prefix.

Thanks,

Boris

>  2 files changed, 2 insertions(+), 15 deletions(-)
> 
> diff --git a/drivers/mtd/nand/mtk_ecc.c b/drivers/mtd/nand/mtk_ecc.c
> index 40d86a8..6432bd7 100644
> --- a/drivers/mtd/nand/raw/mtk_ecc.c
> +++ b/drivers/mtd/nand/raw/mtk_ecc.c
> @@ -500,7 +500,6 @@ static int mtk_ecc_probe(struct platform_device *pdev)
>  	struct device *dev = &pdev->dev;
>  	struct mtk_ecc *ecc;
>  	struct resource *res;
> -	const struct of_device_id *of_ecc_id = NULL;
>  	u32 max_eccdata_size;
>  	int irq, ret;
>  
> @@ -508,11 +507,7 @@ static int mtk_ecc_probe(struct platform_device *pdev)
>  	if (!ecc)
>  		return -ENOMEM;
>  
> -	of_ecc_id = of_match_device(mtk_ecc_dt_match, &pdev->dev);
> -	if (!of_ecc_id)
> -		return -ENODEV;
> -
> -	ecc->caps = of_ecc_id->data;
> +	ecc->caps = of_device_get_match_data(dev);
>  
>  	max_eccdata_size = ecc->caps->num_ecc_strength - 1;
>  	max_eccdata_size = ecc->caps->ecc_strength[max_eccdata_size];
> diff --git a/drivers/mtd/nand/mtk_nand.c b/drivers/mtd/nand/mtk_nand.c
> index 6977da3..75c845a 100644
> --- a/drivers/mtd/nand/raw/mtk_nand.c
> +++ b/drivers/mtd/nand/raw/mtk_nand.c
> @@ -1434,7 +1434,6 @@ static int mtk_nfc_probe(struct platform_device *pdev)
>  	struct device_node *np = dev->of_node;
>  	struct mtk_nfc *nfc;
>  	struct resource *res;
> -	const struct of_device_id *of_nfc_id = NULL;
>  	int ret, irq;
>  
>  	nfc = devm_kzalloc(dev, sizeof(*nfc), GFP_KERNEL);
> @@ -1452,6 +1451,7 @@ static int mtk_nfc_probe(struct platform_device *pdev)
>  	else if (!nfc->ecc)
>  		return -ENODEV;
>  
> +	nfc->caps = of_device_get_match_data(dev);
>  	nfc->dev = dev;
>  
>  	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> @@ -1498,14 +1498,6 @@ static int mtk_nfc_probe(struct platform_device *pdev)
>  		goto clk_disable;
>  	}
>  
> -	of_nfc_id = of_match_device(mtk_nfc_id_table, &pdev->dev);
> -	if (!of_nfc_id) {
> -		ret = -ENODEV;
> -		goto clk_disable;
> -	}
> -
> -	nfc->caps = of_nfc_id->data;
> -
>  	platform_set_drvdata(pdev, nfc);
>  
>  	ret = mtk_nfc_nand_chips_init(dev, nfc);

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

* Re: [PATCH] i2c: mediatek: use of_device_get_match_data()
  2018-04-16  2:32 [PATCH] i2c: mediatek: use of_device_get_match_data() Ryder Lee
                   ` (6 preceding siblings ...)
  2018-04-16  2:34 ` [PATCH] media: rc: mtk-cir: " Ryder Lee
@ 2018-04-28 13:12 ` Wolfram Sang
  7 siblings, 0 replies; 17+ messages in thread
From: Wolfram Sang @ 2018-04-28 13:12 UTC (permalink / raw)
  To: Ryder Lee
  Cc: Jun Gao, linux-i2c, linux-kernel, linux-arm-kernel, linux-mediatek

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

On Mon, Apr 16, 2018 at 10:32:52AM +0800, Ryder Lee wrote:
> 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>

Applied to for-next, thanks!

Does somebody from Mediatek maybe want to maintain this driver?


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

^ permalink raw reply	[flat|nested] 17+ 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; 17+ messages in thread
From: Ryder Lee @ 2018-04-30  7:26 UTC (permalink / raw)
  To: Mark Brown
  Cc: Leilk Liu (刘磊),
	linux-kernel, linux-spi, linux-mediatek, linux-arm-kernel

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] 17+ 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; 17+ messages in thread
From: Mark Brown @ 2018-05-01 20:35 UTC (permalink / raw)
  To: Ryder Lee
  Cc: Leilk Liu (刘磊),
	linux-kernel, linux-spi, linux-mediatek, linux-arm-kernel

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