[02/10] media: renesas-ceu: Use of_device_get_match_data()
diff mbox series

Message ID 20191004214334.149976-3-swboyd@chromium.org
State New
Delegated to: Kieran Bingham
Headers show
Series
  • Stop NULLifying match pointer in of_match_device()
Related show

Commit Message

Stephen Boyd Oct. 4, 2019, 9:43 p.m. UTC
This driver can use the replacement API instead of calling
of_match_device() and then dereferencing the pointer that is returned.
This nicely avoids referencing the match table when it is undefined with
configurations where CONFIG_OF=n.

Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Jacopo Mondi <jacopo@jmondi.org>
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
Cc: Rob Herring <robh+dt@kernel.org>
Cc: Frank Rowand <frowand.list@gmail.com>
Cc: <linux-media@vger.kernel.org>
Cc: <linux-renesas-soc@vger.kernel.org>
Signed-off-by: Stephen Boyd <swboyd@chromium.org>
---

Please ack or pick for immediate merge so the last patch can be merged.

 drivers/media/platform/renesas-ceu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Mauro Carvalho Chehab Oct. 9, 2019, 12:54 p.m. UTC | #1
Em Fri,  4 Oct 2019 14:43:26 -0700
Stephen Boyd <swboyd@chromium.org> escreveu:

> This driver can use the replacement API instead of calling
> of_match_device() and then dereferencing the pointer that is returned.
> This nicely avoids referencing the match table when it is undefined with
> configurations where CONFIG_OF=n.
> 
> Cc: Arnd Bergmann <arnd@arndb.de>
> Cc: Geert Uytterhoeven <geert@linux-m68k.org>
> Cc: Jacopo Mondi <jacopo@jmondi.org>
> Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
> Cc: Rob Herring <robh+dt@kernel.org>
> Cc: Frank Rowand <frowand.list@gmail.com>
> Cc: <linux-media@vger.kernel.org>
> Cc: <linux-renesas-soc@vger.kernel.org>
> Signed-off-by: Stephen Boyd <swboyd@chromium.org>
> ---
> 
> Please ack or pick for immediate merge so the last patch can be merged.

Feel free to merge it via your tree:

Acked-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>


> 
>  drivers/media/platform/renesas-ceu.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/media/platform/renesas-ceu.c b/drivers/media/platform/renesas-ceu.c
> index 197b3991330d..60518bbc2cd5 100644
> --- a/drivers/media/platform/renesas-ceu.c
> +++ b/drivers/media/platform/renesas-ceu.c
> @@ -1679,7 +1679,7 @@ static int ceu_probe(struct platform_device *pdev)
>  	v4l2_async_notifier_init(&ceudev->notifier);
>  
>  	if (IS_ENABLED(CONFIG_OF) && dev->of_node) {
> -		ceu_data = of_match_device(ceu_of_match, dev)->data;
> +		ceu_data = of_device_get_match_data(dev);
>  		num_subdevs = ceu_parse_dt(ceudev);
>  	} else if (dev->platform_data) {
>  		/* Assume SH4 if booting with platform data. */



Thanks,
Mauro
Jacopo Mondi Oct. 9, 2019, 1:14 p.m. UTC | #2
Sorry,
   totally missed it

On Wed, Oct 09, 2019 at 09:54:40AM -0300, Mauro Carvalho Chehab wrote:
> Em Fri,  4 Oct 2019 14:43:26 -0700
> Stephen Boyd <swboyd@chromium.org> escreveu:
>
> > This driver can use the replacement API instead of calling
> > of_match_device() and then dereferencing the pointer that is returned.
> > This nicely avoids referencing the match table when it is undefined with
> > configurations where CONFIG_OF=n.
> >
> > Cc: Arnd Bergmann <arnd@arndb.de>
> > Cc: Geert Uytterhoeven <geert@linux-m68k.org>
> > Cc: Jacopo Mondi <jacopo@jmondi.org>
> > Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
> > Cc: Rob Herring <robh+dt@kernel.org>
> > Cc: Frank Rowand <frowand.list@gmail.com>
> > Cc: <linux-media@vger.kernel.org>
> > Cc: <linux-renesas-soc@vger.kernel.org>
> > Signed-off-by: Stephen Boyd <swboyd@chromium.org>
> > ---
> >
> > Please ack or pick for immediate merge so the last patch can be merged.
>
> Feel free to merge it via your tree:
>
> Acked-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
>

The CEU driver does probably not need this as the dereferencing of the
pointer returned by of_match_device() is guarded by
IS_ENABLED(CONFIG_OF), but surely this does not hurt and it's nicer to
read.

With Mauro's ack mine is probably not needed, but:
Acked-by: Jacopo Mondi <jacopo+renesas@jmondi.org>

Thanks
   j
>
> >
> >  drivers/media/platform/renesas-ceu.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/media/platform/renesas-ceu.c b/drivers/media/platform/renesas-ceu.c
> > index 197b3991330d..60518bbc2cd5 100644
> > --- a/drivers/media/platform/renesas-ceu.c
> > +++ b/drivers/media/platform/renesas-ceu.c
> > @@ -1679,7 +1679,7 @@ static int ceu_probe(struct platform_device *pdev)
> >  	v4l2_async_notifier_init(&ceudev->notifier);
> >
> >  	if (IS_ENABLED(CONFIG_OF) && dev->of_node) {
> > -		ceu_data = of_match_device(ceu_of_match, dev)->data;
> > +		ceu_data = of_device_get_match_data(dev);
> >  		num_subdevs = ceu_parse_dt(ceudev);
> >  	} else if (dev->platform_data) {
> >  		/* Assume SH4 if booting with platform data. */
>
>
>
> Thanks,
> Mauro

Patch
diff mbox series

diff --git a/drivers/media/platform/renesas-ceu.c b/drivers/media/platform/renesas-ceu.c
index 197b3991330d..60518bbc2cd5 100644
--- a/drivers/media/platform/renesas-ceu.c
+++ b/drivers/media/platform/renesas-ceu.c
@@ -1679,7 +1679,7 @@  static int ceu_probe(struct platform_device *pdev)
 	v4l2_async_notifier_init(&ceudev->notifier);
 
 	if (IS_ENABLED(CONFIG_OF) && dev->of_node) {
-		ceu_data = of_match_device(ceu_of_match, dev)->data;
+		ceu_data = of_device_get_match_data(dev);
 		num_subdevs = ceu_parse_dt(ceudev);
 	} else if (dev->platform_data) {
 		/* Assume SH4 if booting with platform data. */