mtd: rawnand: mxc: Use device_get_match_data()
Subsystems (3)
Fabio Estevam
reviewerPATCH 1/2 mtd: rawnand: mxc: Use device_get_match_data()
The retrieval of driver data can be a bit simplified by using device_get_match_data(), so switch to it.
--- drivers/mtd/nand/raw/mxc_nand.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/mtd/nand/raw/mxc_nand.c +1 -3
@@ -1714,7 +1714,6 @@ static const struct nand_controller_ops mxcnd_controller_ops = {static int mxcnd_probe (struct platform_device *pdev) { -const struct of_device_id *of_id;struct nand_chip *this;struct mtd_info *mtd;struct mxc_nand_host *host;
@@ -1756,8 +1755,7 @@ static int mxcnd_probe(struct platform_device *pdev)if (IS_ERR (host->clk))return PTR_ERR (host->clk); - of_id =of_match_device (mxcnd_dt_ids, host->dev); - host->devtype_data = of_id->data; + host->devtype_data =device_get_match_data (&pdev->dev);if (!host->devtype_data->setup_interface) this->options |=NAND_KEEP_TIMINGS ;
Signature · 6 lines
2.17.1 ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/
Fabio Estevam
reviewerPATCH 2/2 mtd: rawnand: mxc: Use a single line for of_device_id
The .compatible and .data pairs can be stored in a single line, which makes the code more concise.
--- drivers/mtd/nand/raw/mxc_nand.c | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-)
drivers/mtd/nand/raw/mxc_nand.c +5 -16
@@ -1610,22 +1610,11 @@ static inline int is_imx53_nfc(struct mxc_nand_host *host) }static const struct of_device_id mxcnd_dt_ids[] = { - { - .compatible ="fsl,imx21-nand" , - .data = &imx21_nand_devtype_data, - }, { - .compatible ="fsl,imx27-nand" , - .data = &imx27_nand_devtype_data, - }, { - .compatible ="fsl,imx25-nand" , - .data = &imx25_nand_devtype_data, - }, { - .compatible ="fsl,imx51-nand" , - .data = &imx51_nand_devtype_data, - }, { - .compatible ="fsl,imx53-nand" , - .data = &imx53_nand_devtype_data, - }, + { .compatible ="fsl,imx21-nand" , .data = &imx21_nand_devtype_data, }, + { .compatible ="fsl,imx27-nand" , .data = &imx27_nand_devtype_data, }, + { .compatible ="fsl,imx25-nand" , .data = &imx25_nand_devtype_data, }, + { .compatible ="fsl,imx51-nand" , .data = &imx51_nand_devtype_data, }, + { .compatible ="fsl,imx53-nand" , .data = &imx53_nand_devtype_data, }, {/* sentinel */ } };MODULE_DEVICE_TABLE (of, mxcnd_dt_ids);
Signature · 6 lines
2.17.1 ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/
Re: [PATCH 2/2] mtd: rawnand: mxc: Use a single line for of_device_id
Quoted 4 lines · Fabio Estevam
The .compatible and .data pairs can be stored in a single line, which makes the code more concise.
Signed-off-by Fabio Estevam <[email protected]>
Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git nand/next, thanks.
Miquel
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
Quoted 4 lines · Fabio Estevam
The retrieval of driver data can be a bit simplified by using
device_get_match_data(), so switch to it.Signed-off-by Fabio Estevam <[email protected]>
Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git nand/next, thanks.
Miquel
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/