From: Sean Paul <seanpaul@chromium.org>
To: Meghana Madhyastha <meghana.madhyastha@gmail.com>
Cc: "Lee Jones" <lee.jones@linaro.org>,
"Daniel Thompson" <daniel.thompson@linaro.org>,
"Jingoo Han" <jingoohan1@gmail.com>,
"Thierry Reding" <thierry.reding@gmail.com>,
"Noralf Trønnes" <noralf@tronnes.org>,
"Tomi Valkeinen" <tomi.valkeinen@ti.com>,
"Daniel Vetter" <daniel.vetter@intel.com>,
"Sean Paul" <seanpaul@chromium.org>,
dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v19 10/10] drm/omapdrm: Use of_find_backlight helper
Date: Wed, 24 Jan 2018 14:26:48 -0500 [thread overview]
Message-ID: <20180124192648.onah24uylmskd7ul@art_vandelay> (raw)
In-Reply-To: <20180124192346.g4k72pt2cfnj4763@art_vandelay>
On Wed, Jan 24, 2018 at 02:23:46PM -0500, Sean Paul wrote:
> On Wed, Jan 24, 2018 at 04:41:38PM +0000, 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 <meghana.madhyastha@gmail.com>
> > ---
> > 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(&pdev->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 <seanpaul@chromium.org>
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", &timing);
> > if (r) {
> > dev_err(&pdev->dev, "failed to get video timing\n");
> > - goto error_free_backlight;
> > + return r;
> > }
> >
> > videomode_from_timing(&timing, &ddata->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(&pdev->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(&ddata->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(&ddata->backlight->dev);
> > -
> > return 0;
> > }
> >
> > --
> > 2.11.0
> >
>
> --
> Sean Paul, Software Engineer, Google / Chromium OS
--
Sean Paul, Software Engineer, Google / Chromium OS
next prev parent reply other threads:[~2018-01-24 19:26 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-24 16:32 [PATCH v19 00/10] Add backlight helper functions Meghana Madhyastha
2018-01-24 16:34 ` [PATCH v19 01/10] video: backlight: Add helpers to enable and disable backlight Meghana Madhyastha
2018-01-24 16:34 ` [PATCH v19 02/10] drm/tinydrm: Convert tinydrm_enable/disable_backlight to backlight_enable/disable Meghana Madhyastha
2018-01-24 16:35 ` [PATCH v19 03/10] video: backlight: Add of_find_backlight helper in backlight.c Meghana Madhyastha
2018-01-25 14:14 ` Thierry Reding
2018-01-26 9:48 ` Lee Jones
2018-01-26 17:46 ` Randy Dunlap
2018-01-29 9:11 ` Lee Jones
2018-01-29 14:43 ` Sean Paul
2018-01-30 9:02 ` Lee Jones
2018-01-30 2:30 ` Randy Dunlap
2018-01-24 16:36 ` [PATCH v19 04/10] drm/tinydrm: Replace tinydrm_of_find_backlight with of_find_backlight Meghana Madhyastha
2018-01-24 16:37 ` [PATCH v19 05/10] video: backlight: Add devres versions of of_find_backlight Meghana Madhyastha
2018-01-24 16:37 ` [PATCH v19 06/10] drm/tinydrm: Call devres version " Meghana Madhyastha
2018-01-24 16:39 ` [PATCH v19 07/10] drm/panel: Use backlight_enable/disable helpers Meghana Madhyastha
2018-01-25 14:08 ` Thierry Reding
2018-01-24 16:40 ` [PATCH v19 08/10] drm/omapdrm: " Meghana Madhyastha
2018-01-24 16:40 ` [PATCH v19 09/10] drm/panel: Use of_find_backlight helper Meghana Madhyastha
2018-01-25 14:09 ` Thierry Reding
2018-01-24 16:41 ` [PATCH v19 10/10] drm/omapdrm: " Meghana Madhyastha
2018-01-24 19:23 ` Sean Paul
2018-01-24 19:26 ` Sean Paul [this message]
2018-01-25 11:27 ` Daniel Thompson
2018-01-24 20:13 ` Noralf Trønnes
2018-01-25 14:17 ` [PATCH v19 00/10] Add backlight helper functions Thierry Reding
2018-02-20 16:16 ` Sean Paul
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180124192648.onah24uylmskd7ul@art_vandelay \
--to=seanpaul@chromium.org \
--cc=daniel.thompson@linaro.org \
--cc=daniel.vetter@intel.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=jingoohan1@gmail.com \
--cc=lee.jones@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=meghana.madhyastha@gmail.com \
--cc=noralf@tronnes.org \
--cc=thierry.reding@gmail.com \
--cc=tomi.valkeinen@ti.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®