Re: [PATCH v19 10/10] drm/omapdrm: Use of_find_backlight helper
On Wed, Jan 24, 2018 at 02:26:48PM -0500, Sean Paul wrote: > So, > > Reviewed-by: Sean Paul> > I think every other patch has R-b, so if no one objects in the next day or so, > I'll apply this to drm-misc-next No problems on my side... but please make sure Lee J. gets a PR. Daniel.
Re: [PATCH v19 10/10] drm/omapdrm: Use of_find_backlight helper
On Wed, Jan 24, 2018 at 02:26:48PM -0500, Sean Paul wrote: > So, > > Reviewed-by: Sean Paul > > I think every other patch has R-b, so if no one objects in the next day or so, > I'll apply this to drm-misc-next No problems on my side... but please make sure Lee J. gets a PR. Daniel.
Re: [PATCH v19 10/10] drm/omapdrm: Use of_find_backlight helper
Den 24.01.2018 17.41, skrev Meghana Madhyastha: Replace of_find_backlight_by_node and of the code around it with of_find_backlight helper to avoid repetition of code. Signed-off-by: Meghana Madhyastha--- Reviewed-by: Noralf Trønnes Changes in v19: -Changed to devm version of of_find_backlight in omapdrm (patch 10) -removed assigning pdev->dev to variable dev in omapdrm (patch 10) drivers/gpu/drm/omapdrm/displays/panel-dpi.c | 25 + 1 file changed, 5 insertions(+), 20 deletions(-) diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dpi.c b/drivers/gpu/drm/omapdrm/displays/panel-dpi.c index ac9596251..b4a4006a2 100644 --- a/drivers/gpu/drm/omapdrm/displays/panel-dpi.c +++ b/drivers/gpu/drm/omapdrm/displays/panel-dpi.c @@ -157,7 +157,6 @@ static int panel_dpi_probe_of(struct platform_device *pdev) { struct panel_drv_data *ddata = platform_get_drvdata(pdev); struct device_node *node = pdev->dev.of_node; - struct device_node *bl_node; struct omap_dss_device *in; int r; struct display_timing timing; @@ -183,19 +182,15 @@ static int panel_dpi_probe_of(struct platform_device *pdev) if (IS_ERR(ddata->vcc_supply)) return PTR_ERR(ddata->vcc_supply); - bl_node = of_parse_phandle(node, "backlight", 0); - if (bl_node) { - ddata->backlight = of_find_backlight_by_node(bl_node); - of_node_put(bl_node); + ddata->backlight = devm_of_find_backlight(>dev); - if (!ddata->backlight) - return -EPROBE_DEFER; - } + if (IS_ERR(ddata->backlight)) + return PTR_ERR(ddata->backlight); r = of_get_display_timing(node, "panel-timing", ); if (r) { dev_err(>dev, "failed to get video timing\n"); - goto error_free_backlight; + return r; } videomode_from_timing(, >vm); @@ -203,19 +198,12 @@ static int panel_dpi_probe_of(struct platform_device *pdev) in = omapdss_of_find_source_for_first_ep(node); if (IS_ERR(in)) { dev_err(>dev, "failed to find video source\n"); - r = PTR_ERR(in); - goto error_free_backlight; + return PTR_ERR(in); } ddata->in = in; return 0; - -error_free_backlight: - if (ddata->backlight) - put_device(>backlight->dev); - - return r; } static int panel_dpi_probe(struct platform_device *pdev) @@ -270,9 +258,6 @@ static int __exit panel_dpi_remove(struct platform_device *pdev) omap_dss_put_device(in); - if (ddata->backlight) - put_device(>backlight->dev); - return 0; }
Re: [PATCH v19 10/10] drm/omapdrm: Use of_find_backlight helper
Den 24.01.2018 17.41, skrev Meghana Madhyastha: Replace of_find_backlight_by_node and of the code around it with of_find_backlight helper to avoid repetition of code. Signed-off-by: Meghana Madhyastha --- Reviewed-by: Noralf Trønnes Changes in v19: -Changed to devm version of of_find_backlight in omapdrm (patch 10) -removed assigning pdev->dev to variable dev in omapdrm (patch 10) drivers/gpu/drm/omapdrm/displays/panel-dpi.c | 25 + 1 file changed, 5 insertions(+), 20 deletions(-) diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dpi.c b/drivers/gpu/drm/omapdrm/displays/panel-dpi.c index ac9596251..b4a4006a2 100644 --- a/drivers/gpu/drm/omapdrm/displays/panel-dpi.c +++ b/drivers/gpu/drm/omapdrm/displays/panel-dpi.c @@ -157,7 +157,6 @@ static int panel_dpi_probe_of(struct platform_device *pdev) { struct panel_drv_data *ddata = platform_get_drvdata(pdev); struct device_node *node = pdev->dev.of_node; - struct device_node *bl_node; struct omap_dss_device *in; int r; struct display_timing timing; @@ -183,19 +182,15 @@ static int panel_dpi_probe_of(struct platform_device *pdev) if (IS_ERR(ddata->vcc_supply)) return PTR_ERR(ddata->vcc_supply); - bl_node = of_parse_phandle(node, "backlight", 0); - if (bl_node) { - ddata->backlight = of_find_backlight_by_node(bl_node); - of_node_put(bl_node); + ddata->backlight = devm_of_find_backlight(>dev); - if (!ddata->backlight) - return -EPROBE_DEFER; - } + if (IS_ERR(ddata->backlight)) + return PTR_ERR(ddata->backlight); r = of_get_display_timing(node, "panel-timing", ); if (r) { dev_err(>dev, "failed to get video timing\n"); - goto error_free_backlight; + return r; } videomode_from_timing(, >vm); @@ -203,19 +198,12 @@ static int panel_dpi_probe_of(struct platform_device *pdev) in = omapdss_of_find_source_for_first_ep(node); if (IS_ERR(in)) { dev_err(>dev, "failed to find video source\n"); - r = PTR_ERR(in); - goto error_free_backlight; + return PTR_ERR(in); } ddata->in = in; return 0; - -error_free_backlight: - if (ddata->backlight) - put_device(>backlight->dev); - - return r; } static int panel_dpi_probe(struct platform_device *pdev) @@ -270,9 +258,6 @@ static int __exit panel_dpi_remove(struct platform_device *pdev) omap_dss_put_device(in); - if (ddata->backlight) - put_device(>backlight->dev); - return 0; }
Re: [PATCH v19 10/10] drm/omapdrm: Use of_find_backlight helper
On Wed, Jan 24, 2018 at 02:23:46PM -0500, Sean Paul wrote: > On Wed, Jan 24, 2018 at 04:41:38PM +, Meghana Madhyastha wrote: > > Replace of_find_backlight_by_node and of the code around it > > with of_find_backlight helper to avoid repetition of code. > > > > Signed-off-by: Meghana Madhyastha> > --- > > Changes in v19: > > -Changed to devm version of of_find_backlight in omapdrm (patch 10) > > -removed assigning pdev->dev to variable dev in omapdrm (patch 10) > > > > drivers/gpu/drm/omapdrm/displays/panel-dpi.c | 25 + > > 1 file changed, 5 insertions(+), 20 deletions(-) > > > > diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dpi.c > > b/drivers/gpu/drm/omapdrm/displays/panel-dpi.c > > index ac9596251..b4a4006a2 100644 > > --- a/drivers/gpu/drm/omapdrm/displays/panel-dpi.c > > +++ b/drivers/gpu/drm/omapdrm/displays/panel-dpi.c > > @@ -157,7 +157,6 @@ static int panel_dpi_probe_of(struct platform_device > > *pdev) > > { > > struct panel_drv_data *ddata = platform_get_drvdata(pdev); > > struct device_node *node = pdev->dev.of_node; > > - struct device_node *bl_node; > > struct omap_dss_device *in; > > int r; > > struct display_timing timing; > > @@ -183,19 +182,15 @@ static int panel_dpi_probe_of(struct platform_device > > *pdev) > > if (IS_ERR(ddata->vcc_supply)) > > return PTR_ERR(ddata->vcc_supply); > > > > - bl_node = of_parse_phandle(node, "backlight", 0); > > - if (bl_node) { > > - ddata->backlight = of_find_backlight_by_node(bl_node); > > - of_node_put(bl_node); > > + ddata->backlight = devm_of_find_backlight(>dev); > > > > - if (!ddata->backlight) > > - return -EPROBE_DEFER; > > - } > > + if (IS_ERR(ddata->backlight)) > > AFAICT, devm_of_find_backlight can return NULL. As such, you should be > checking > IS_ERR_OR_NULL here instead of just IS_ERR. Looks like you also made this > same mistake in other patches in the series, so please fix those up as well. > annnd I should spend more time reading the context of the code. Looks like backlight is optional here, so this is a valid code path. I'm sorry about that. So, Reviewed-by: Sean Paul I think every other patch has R-b, so if no one objects in the next day or so, I'll apply this to drm-misc-next Sean > Sean > > > + return PTR_ERR(ddata->backlight); > > > > r = of_get_display_timing(node, "panel-timing", ); > > if (r) { > > dev_err(>dev, "failed to get video timing\n"); > > - goto error_free_backlight; > > + return r; > > } > > > > videomode_from_timing(, >vm); > > @@ -203,19 +198,12 @@ static int panel_dpi_probe_of(struct platform_device > > *pdev) > > in = omapdss_of_find_source_for_first_ep(node); > > if (IS_ERR(in)) { > > dev_err(>dev, "failed to find video source\n"); > > - r = PTR_ERR(in); > > - goto error_free_backlight; > > + return PTR_ERR(in); > > } > > > > ddata->in = in; > > > > return 0; > > - > > -error_free_backlight: > > - if (ddata->backlight) > > - put_device(>backlight->dev); > > - > > - return r; > > } > > > > static int panel_dpi_probe(struct platform_device *pdev) > > @@ -270,9 +258,6 @@ static int __exit panel_dpi_remove(struct > > platform_device *pdev) > > > > omap_dss_put_device(in); > > > > - if (ddata->backlight) > > - put_device(>backlight->dev); > > - > > return 0; > > } > > > > -- > > 2.11.0 > > > > -- > Sean Paul, Software Engineer, Google / Chromium OS -- Sean Paul, Software Engineer, Google / Chromium OS
Re: [PATCH v19 10/10] drm/omapdrm: Use of_find_backlight helper
On Wed, Jan 24, 2018 at 02:23:46PM -0500, Sean Paul wrote: > On Wed, Jan 24, 2018 at 04:41:38PM +, Meghana Madhyastha wrote: > > Replace of_find_backlight_by_node and of the code around it > > with of_find_backlight helper to avoid repetition of code. > > > > Signed-off-by: Meghana Madhyastha > > --- > > Changes in v19: > > -Changed to devm version of of_find_backlight in omapdrm (patch 10) > > -removed assigning pdev->dev to variable dev in omapdrm (patch 10) > > > > drivers/gpu/drm/omapdrm/displays/panel-dpi.c | 25 + > > 1 file changed, 5 insertions(+), 20 deletions(-) > > > > diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dpi.c > > b/drivers/gpu/drm/omapdrm/displays/panel-dpi.c > > index ac9596251..b4a4006a2 100644 > > --- a/drivers/gpu/drm/omapdrm/displays/panel-dpi.c > > +++ b/drivers/gpu/drm/omapdrm/displays/panel-dpi.c > > @@ -157,7 +157,6 @@ static int panel_dpi_probe_of(struct platform_device > > *pdev) > > { > > struct panel_drv_data *ddata = platform_get_drvdata(pdev); > > struct device_node *node = pdev->dev.of_node; > > - struct device_node *bl_node; > > struct omap_dss_device *in; > > int r; > > struct display_timing timing; > > @@ -183,19 +182,15 @@ static int panel_dpi_probe_of(struct platform_device > > *pdev) > > if (IS_ERR(ddata->vcc_supply)) > > return PTR_ERR(ddata->vcc_supply); > > > > - bl_node = of_parse_phandle(node, "backlight", 0); > > - if (bl_node) { > > - ddata->backlight = of_find_backlight_by_node(bl_node); > > - of_node_put(bl_node); > > + ddata->backlight = devm_of_find_backlight(>dev); > > > > - if (!ddata->backlight) > > - return -EPROBE_DEFER; > > - } > > + if (IS_ERR(ddata->backlight)) > > AFAICT, devm_of_find_backlight can return NULL. As such, you should be > checking > IS_ERR_OR_NULL here instead of just IS_ERR. Looks like you also made this > same mistake in other patches in the series, so please fix those up as well. > annnd I should spend more time reading the context of the code. Looks like backlight is optional here, so this is a valid code path. I'm sorry about that. So, Reviewed-by: Sean Paul I think every other patch has R-b, so if no one objects in the next day or so, I'll apply this to drm-misc-next Sean > Sean > > > + return PTR_ERR(ddata->backlight); > > > > r = of_get_display_timing(node, "panel-timing", ); > > if (r) { > > dev_err(>dev, "failed to get video timing\n"); > > - goto error_free_backlight; > > + return r; > > } > > > > videomode_from_timing(, >vm); > > @@ -203,19 +198,12 @@ static int panel_dpi_probe_of(struct platform_device > > *pdev) > > in = omapdss_of_find_source_for_first_ep(node); > > if (IS_ERR(in)) { > > dev_err(>dev, "failed to find video source\n"); > > - r = PTR_ERR(in); > > - goto error_free_backlight; > > + return PTR_ERR(in); > > } > > > > ddata->in = in; > > > > return 0; > > - > > -error_free_backlight: > > - if (ddata->backlight) > > - put_device(>backlight->dev); > > - > > - return r; > > } > > > > static int panel_dpi_probe(struct platform_device *pdev) > > @@ -270,9 +258,6 @@ static int __exit panel_dpi_remove(struct > > platform_device *pdev) > > > > omap_dss_put_device(in); > > > > - if (ddata->backlight) > > - put_device(>backlight->dev); > > - > > return 0; > > } > > > > -- > > 2.11.0 > > > > -- > Sean Paul, Software Engineer, Google / Chromium OS -- Sean Paul, Software Engineer, Google / Chromium OS
Re: [PATCH v19 10/10] drm/omapdrm: Use of_find_backlight helper
On Wed, Jan 24, 2018 at 04:41:38PM +, Meghana Madhyastha wrote: > Replace of_find_backlight_by_node and of the code around it > with of_find_backlight helper to avoid repetition of code. > > Signed-off-by: Meghana Madhyastha> --- > Changes in v19: > -Changed to devm version of of_find_backlight in omapdrm (patch 10) > -removed assigning pdev->dev to variable dev in omapdrm (patch 10) > > drivers/gpu/drm/omapdrm/displays/panel-dpi.c | 25 + > 1 file changed, 5 insertions(+), 20 deletions(-) > > diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dpi.c > b/drivers/gpu/drm/omapdrm/displays/panel-dpi.c > index ac9596251..b4a4006a2 100644 > --- a/drivers/gpu/drm/omapdrm/displays/panel-dpi.c > +++ b/drivers/gpu/drm/omapdrm/displays/panel-dpi.c > @@ -157,7 +157,6 @@ static int panel_dpi_probe_of(struct platform_device > *pdev) > { > struct panel_drv_data *ddata = platform_get_drvdata(pdev); > struct device_node *node = pdev->dev.of_node; > - struct device_node *bl_node; > struct omap_dss_device *in; > int r; > struct display_timing timing; > @@ -183,19 +182,15 @@ static int panel_dpi_probe_of(struct platform_device > *pdev) > if (IS_ERR(ddata->vcc_supply)) > return PTR_ERR(ddata->vcc_supply); > > - bl_node = of_parse_phandle(node, "backlight", 0); > - if (bl_node) { > - ddata->backlight = of_find_backlight_by_node(bl_node); > - of_node_put(bl_node); > + ddata->backlight = devm_of_find_backlight(>dev); > > - if (!ddata->backlight) > - return -EPROBE_DEFER; > - } > + if (IS_ERR(ddata->backlight)) AFAICT, devm_of_find_backlight can return NULL. As such, you should be checking IS_ERR_OR_NULL here instead of just IS_ERR. Looks like you also made this same mistake in other patches in the series, so please fix those up as well. Sean > + return PTR_ERR(ddata->backlight); > > r = of_get_display_timing(node, "panel-timing", ); > if (r) { > dev_err(>dev, "failed to get video timing\n"); > - goto error_free_backlight; > + return r; > } > > videomode_from_timing(, >vm); > @@ -203,19 +198,12 @@ static int panel_dpi_probe_of(struct platform_device > *pdev) > in = omapdss_of_find_source_for_first_ep(node); > if (IS_ERR(in)) { > dev_err(>dev, "failed to find video source\n"); > - r = PTR_ERR(in); > - goto error_free_backlight; > + return PTR_ERR(in); > } > > ddata->in = in; > > return 0; > - > -error_free_backlight: > - if (ddata->backlight) > - put_device(>backlight->dev); > - > - return r; > } > > static int panel_dpi_probe(struct platform_device *pdev) > @@ -270,9 +258,6 @@ static int __exit panel_dpi_remove(struct platform_device > *pdev) > > omap_dss_put_device(in); > > - if (ddata->backlight) > - put_device(>backlight->dev); > - > return 0; > } > > -- > 2.11.0 > -- Sean Paul, Software Engineer, Google / Chromium OS
Re: [PATCH v19 10/10] drm/omapdrm: Use of_find_backlight helper
On Wed, Jan 24, 2018 at 04:41:38PM +, Meghana Madhyastha wrote: > Replace of_find_backlight_by_node and of the code around it > with of_find_backlight helper to avoid repetition of code. > > Signed-off-by: Meghana Madhyastha > --- > Changes in v19: > -Changed to devm version of of_find_backlight in omapdrm (patch 10) > -removed assigning pdev->dev to variable dev in omapdrm (patch 10) > > drivers/gpu/drm/omapdrm/displays/panel-dpi.c | 25 + > 1 file changed, 5 insertions(+), 20 deletions(-) > > diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dpi.c > b/drivers/gpu/drm/omapdrm/displays/panel-dpi.c > index ac9596251..b4a4006a2 100644 > --- a/drivers/gpu/drm/omapdrm/displays/panel-dpi.c > +++ b/drivers/gpu/drm/omapdrm/displays/panel-dpi.c > @@ -157,7 +157,6 @@ static int panel_dpi_probe_of(struct platform_device > *pdev) > { > struct panel_drv_data *ddata = platform_get_drvdata(pdev); > struct device_node *node = pdev->dev.of_node; > - struct device_node *bl_node; > struct omap_dss_device *in; > int r; > struct display_timing timing; > @@ -183,19 +182,15 @@ static int panel_dpi_probe_of(struct platform_device > *pdev) > if (IS_ERR(ddata->vcc_supply)) > return PTR_ERR(ddata->vcc_supply); > > - bl_node = of_parse_phandle(node, "backlight", 0); > - if (bl_node) { > - ddata->backlight = of_find_backlight_by_node(bl_node); > - of_node_put(bl_node); > + ddata->backlight = devm_of_find_backlight(>dev); > > - if (!ddata->backlight) > - return -EPROBE_DEFER; > - } > + if (IS_ERR(ddata->backlight)) AFAICT, devm_of_find_backlight can return NULL. As such, you should be checking IS_ERR_OR_NULL here instead of just IS_ERR. Looks like you also made this same mistake in other patches in the series, so please fix those up as well. Sean > + return PTR_ERR(ddata->backlight); > > r = of_get_display_timing(node, "panel-timing", ); > if (r) { > dev_err(>dev, "failed to get video timing\n"); > - goto error_free_backlight; > + return r; > } > > videomode_from_timing(, >vm); > @@ -203,19 +198,12 @@ static int panel_dpi_probe_of(struct platform_device > *pdev) > in = omapdss_of_find_source_for_first_ep(node); > if (IS_ERR(in)) { > dev_err(>dev, "failed to find video source\n"); > - r = PTR_ERR(in); > - goto error_free_backlight; > + return PTR_ERR(in); > } > > ddata->in = in; > > return 0; > - > -error_free_backlight: > - if (ddata->backlight) > - put_device(>backlight->dev); > - > - return r; > } > > static int panel_dpi_probe(struct platform_device *pdev) > @@ -270,9 +258,6 @@ static int __exit panel_dpi_remove(struct platform_device > *pdev) > > omap_dss_put_device(in); > > - if (ddata->backlight) > - put_device(>backlight->dev); > - > return 0; > } > > -- > 2.11.0 > -- Sean Paul, Software Engineer, Google / Chromium OS