* [PATCH] mtd: nand: sh_flctl: Use of_device_get_match_data() helper
@ 2017-10-04 12:19 Geert Uytterhoeven
2017-10-05 7:24 ` Boris Brezillon
0 siblings, 1 reply; 2+ messages in thread
From: Geert Uytterhoeven @ 2017-10-04 12:19 UTC (permalink / raw)
To: Boris Brezillon
Cc: Richard Weinberger, David Woodhouse, Brian Norris, Marek Vasut,
Cyrille Pitchen, linux-mtd, linux-renesas-soc, Geert Uytterhoeven
Use the of_device_get_match_data() helper instead of open coding.
While at it, make config const so the cast can be dropped.
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
drivers/mtd/nand/sh_flctl.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/drivers/mtd/nand/sh_flctl.c b/drivers/mtd/nand/sh_flctl.c
index e7f3c98487e620bc..3c5008a4f5f33acc 100644
--- a/drivers/mtd/nand/sh_flctl.c
+++ b/drivers/mtd/nand/sh_flctl.c
@@ -1094,14 +1094,11 @@ MODULE_DEVICE_TABLE(of, of_flctl_match);
static struct sh_flctl_platform_data *flctl_parse_dt(struct device *dev)
{
- const struct of_device_id *match;
- struct flctl_soc_config *config;
+ const struct flctl_soc_config *config;
struct sh_flctl_platform_data *pdata;
- match = of_match_device(of_flctl_match, dev);
- if (match)
- config = (struct flctl_soc_config *)match->data;
- else {
+ config = of_device_get_match_data(dev);
+ if (!config) {
dev_err(dev, "%s: no OF configuration attached\n", __func__);
return NULL;
}
--
2.7.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] mtd: nand: sh_flctl: Use of_device_get_match_data() helper
2017-10-04 12:19 [PATCH] mtd: nand: sh_flctl: Use of_device_get_match_data() helper Geert Uytterhoeven
@ 2017-10-05 7:24 ` Boris Brezillon
0 siblings, 0 replies; 2+ messages in thread
From: Boris Brezillon @ 2017-10-05 7:24 UTC (permalink / raw)
To: Geert Uytterhoeven
Cc: Richard Weinberger, David Woodhouse, Brian Norris, Marek Vasut,
Cyrille Pitchen, linux-mtd, linux-renesas-soc
On Wed, 4 Oct 2017 14:19:03 +0200
Geert Uytterhoeven <geert+renesas@glider.be> wrote:
> Use the of_device_get_match_data() helper instead of open coding.
> While at it, make config const so the cast can be dropped.
>
Applied.
Thanks,
Boris
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> ---
> drivers/mtd/nand/sh_flctl.c | 9 +++------
> 1 file changed, 3 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/mtd/nand/sh_flctl.c b/drivers/mtd/nand/sh_flctl.c
> index e7f3c98487e620bc..3c5008a4f5f33acc 100644
> --- a/drivers/mtd/nand/sh_flctl.c
> +++ b/drivers/mtd/nand/sh_flctl.c
> @@ -1094,14 +1094,11 @@ MODULE_DEVICE_TABLE(of, of_flctl_match);
>
> static struct sh_flctl_platform_data *flctl_parse_dt(struct device *dev)
> {
> - const struct of_device_id *match;
> - struct flctl_soc_config *config;
> + const struct flctl_soc_config *config;
> struct sh_flctl_platform_data *pdata;
>
> - match = of_match_device(of_flctl_match, dev);
> - if (match)
> - config = (struct flctl_soc_config *)match->data;
> - else {
> + config = of_device_get_match_data(dev);
> + if (!config) {
> dev_err(dev, "%s: no OF configuration attached\n", __func__);
> return NULL;
> }
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-10-05 7:25 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-04 12:19 [PATCH] mtd: nand: sh_flctl: Use of_device_get_match_data() helper Geert Uytterhoeven
2017-10-05 7:24 ` Boris Brezillon
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).