mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Meghana Madhyastha <meghana.madhyastha@gmail.com>
To: "Noralf Trønnes" <noralf@tronnes.org>,
	"Lee Jones" <lee.jones@linaro.org>,
	"Daniel Thompson" <daniel.thompson@linaro.org>,
	"Jingoo Han" <jingoohan1@gmail.com>,
	"Thierry Reding" <thierry.reding@gmail.com>,
	"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 v18 10/10] drm/omapdrm: Use of_find_backlight helper
Date: Tue, 23 Jan 2018 22:25:01 +0530	[thread overview]
Message-ID: <20180123165501.GA5908@meghana-HP-Pavilion-Notebook> (raw)
In-Reply-To: <394a73f6-3459-449f-6d9f-4cb52a1d3328@tronnes.org>

On Tue, Jan 23, 2018 at 03:37:38PM +0100, Noralf Trønnes wrote:
> 
> Den 22.01.2018 15.56, 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 <meghana.madhyastha@gmail.com>
> >---
> >Changes in v18:
> >-Fixed warnings resulting from passing device_node* to of_find_backlight.
> >  Fixed it by passing struct device* to of_find_backlight
> >
> >  drivers/gpu/drm/omapdrm/displays/panel-dpi.c | 33 ++++++++++------------------
> >  1 file changed, 11 insertions(+), 22 deletions(-)
> >
> >diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dpi.c b/drivers/gpu/drm/omapdrm/displays/panel-dpi.c
> >index ac9596251..93b7a176d 100644
> >--- a/drivers/gpu/drm/omapdrm/displays/panel-dpi.c
> >+++ b/drivers/gpu/drm/omapdrm/displays/panel-dpi.c
> >@@ -156,14 +156,14 @@ static struct omap_dss_driver panel_dpi_ops = {
> >  static int panel_dpi_probe_of(struct platform_device *pdev)
> >  {
> >  	struct panel_drv_data *ddata = platform_get_drvdata(pdev);
> >+	struct device *dev = &pdev->dev;
> >  	struct device_node *node = pdev->dev.of_node;
> >-	struct device_node *bl_node;
> >  	struct omap_dss_device *in;
> >  	int r;
> >  	struct display_timing timing;
> >  	struct gpio_desc *gpio;
> >-	gpio = devm_gpiod_get_optional(&pdev->dev, "enable", GPIOD_OUT_LOW);
> >+	gpio = devm_gpiod_get_optional(dev, "enable", GPIOD_OUT_LOW);
> 
> Please don't make unrelated changes like this. It clutters the patch.
> You can just as well use &pdev->dev when getting the backlight also.

I had made the change in order to be more consistent with how the other
drivers were doing this. Most of them had a variable struct device *dev.
However, I can undo this if necessary.

> >  	if (IS_ERR(gpio))
> >  		return PTR_ERR(gpio);
> >@@ -175,47 +175,36 @@ static int panel_dpi_probe_of(struct platform_device *pdev)
> >  	 * timing and order relative to the enable gpio. So for now it's just
> >  	 * ensured that the reset line isn't active.
> >  	 */
> >-	gpio = devm_gpiod_get_optional(&pdev->dev, "reset", GPIOD_OUT_LOW);
> >+	gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_LOW);
> >  	if (IS_ERR(gpio))
> >  		return PTR_ERR(gpio);
> >-	ddata->vcc_supply = devm_regulator_get(&pdev->dev, "vcc");
> >+	ddata->vcc_supply = devm_regulator_get(dev, "vcc");
> >  	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 = of_find_backlight(dev);
> 
> Any reason you don't use the devm_ version here?
> You do remove error_free_backlight...
> 
> With the devm_ version remember to drop the put_device in
> panel_dpi_remove().
> 
> Noralf.
> 
> >-		if (!ddata->backlight)
> >-			return -EPROBE_DEFER;
> >-	}
> >+	if (IS_ERR(ddata->backlight))
> >+		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;
> >+		dev_err(dev, "failed to get video timing\n");
> >+		return r;
> >  	}
> >  	videomode_from_timing(&timing, &ddata->vm);
> >  	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;
> >+		dev_err(dev, "failed to find video source\n");
> >+		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)
> 

  reply	other threads:[~2018-01-23 16:55 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-22 14:48 [PATCH v18 00/10] Add backlight helper functions Meghana Madhyastha
2018-01-22 14:49 ` [PATCH v18 01/10] video: backlight: Add helpers to enable and disable backlight Meghana Madhyastha
2018-01-23 10:00   ` Daniel Thompson
2018-01-23 14:47     ` Noralf Trønnes
2018-01-22 14:50 ` [PATCH v18 02/10] drm/tinydrm: Convert tinydrm_enable/disable_backlight to backlight_enable/disable Meghana Madhyastha
2018-01-22 14:51 ` [PATCH v18 03/10] video: backlight: Add of_find_backlight helper in backlight.c Meghana Madhyastha
2018-01-28 17:15   ` Andy Shevchenko
2018-01-22 14:51 ` [PATCH v18 04/10] drm/tinydrm: Replace tinydrm_of_find_backlight with of_find_backlight Meghana Madhyastha
2018-01-22 14:52 ` [PATCH v18 05/10] video: backlight: Add devres versions of of_find_backlight Meghana Madhyastha
2018-01-22 14:53 ` [PATCH v18 06/10] drm/tinydrm: Call devres version " Meghana Madhyastha
2018-01-22 14:54 ` [PATCH v18 07/10] drm/panel: Use backlight_enable/disable helpers Meghana Madhyastha
2018-01-23 14:19   ` Noralf Trønnes
2018-01-22 14:54 ` [PATCH v18 08/10] drm/omapdrm: " Meghana Madhyastha
2018-01-23 14:20   ` Noralf Trønnes
2018-01-22 14:55 ` [PATCH v18 09/10] drm/panel: Use of_find_backlight helper Meghana Madhyastha
2018-01-23 14:24   ` Noralf Trønnes
2018-01-22 14:56 ` [PATCH v18 10/10] drm/omapdrm: " Meghana Madhyastha
2018-01-23 14:37   ` Noralf Trønnes
2018-01-23 16:55     ` Meghana Madhyastha [this message]
2018-01-23 17:41       ` Noralf Trønnes
2018-01-23 17:43         ` Noralf Trønnes

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=20180123165501.GA5908@meghana-HP-Pavilion-Notebook \
    --to=meghana.madhyastha@gmail.com \
    --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=noralf@tronnes.org \
    --cc=seanpaul@chromium.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®