linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	Lee Jones <lee.jones@linaro.org>
Cc: Daniel Thompson <daniel.thompson@linaro.org>,
	Jingoo Han <jingoohan1@gmail.com>,
	linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-sh@vger.kernel.org,
	Yoshinori Sato <ysato@users.sourceforge.jp>,
	Rich Felker <dalias@libc.org>,
	Linus Walleij <linus.walleij@linaro.org>
Subject: [RFC 1/4] backlight: gpio_backlight: use generic device properties
Date: Thu, 15 Mar 2018 22:41:59 +0000	[thread overview]
Message-ID: <20180315224202.96668-2-dmitry.torokhov@gmail.com> (raw)
In-Reply-To: <20180315224202.96668-1-dmitry.torokhov@gmail.com>

Instead of using of_property_read_bool() switch to using
device_property_read_bool() This will allow switching from platform data to
device properties everywhere.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
 drivers/video/backlight/gpio_backlight.c | 12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)

diff --git a/drivers/video/backlight/gpio_backlight.c b/drivers/video/backlight/gpio_backlight.c
index e470da95d806f..173fc4aafb89b 100644
--- a/drivers/video/backlight/gpio_backlight.c
+++ b/drivers/video/backlight/gpio_backlight.c
@@ -61,11 +61,10 @@ static int gpio_backlight_probe_dt(struct platform_device *pdev,
 				   struct gpio_backlight *gbl)
 {
 	struct device *dev = &pdev->dev;
-	struct device_node *np = dev->of_node;
 	enum gpiod_flags flags;
 	int ret;
 
-	gbl->def_value = of_property_read_bool(np, "default-on");
+	gbl->def_value = device_property_read_bool(dev, "default-on");
 	flags = gbl->def_value ? GPIOD_OUT_HIGH : GPIOD_OUT_LOW;
 
 	gbl->gpiod = devm_gpiod_get(dev, NULL, flags);
@@ -89,22 +88,15 @@ static int gpio_backlight_probe(struct platform_device *pdev)
 	struct backlight_properties props;
 	struct backlight_device *bl;
 	struct gpio_backlight *gbl;
-	struct device_node *np = pdev->dev.of_node;
 	int ret;
 
-	if (!pdata && !np) {
-		dev_err(&pdev->dev,
-			"failed to find platform data or device tree node.\n");
-		return -ENODEV;
-	}
-
 	gbl = devm_kzalloc(&pdev->dev, sizeof(*gbl), GFP_KERNEL);
 	if (gbl = NULL)
 		return -ENOMEM;
 
 	gbl->dev = &pdev->dev;
 
-	if (np) {
+	if (!pdata) {
 		ret = gpio_backlight_probe_dt(pdev, gbl);
 		if (ret)
 			return ret;
-- 
2.16.2.804.g6dcf76e118-goog


  reply	other threads:[~2018-03-15 22:41 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-15 22:41 [RFC 0/4] gpio-backlight: remove platform data support Dmitry Torokhov
2018-03-15 22:41 ` Dmitry Torokhov [this message]
2018-03-27 11:53   ` [RFC 1/4] backlight: gpio_backlight: use generic device properties Linus Walleij
2018-03-15 22:42 ` [RFC 2/4] sh: ecovec24: conditionally register backlight device Dmitry Torokhov
2018-03-16 10:07   ` jacopo mondi
2018-03-16 23:38     ` Dmitry Torokhov
2018-03-17  9:25       ` jacopo mondi
2018-03-17 10:21         ` John Paul Adrian Glaubitz
2018-03-17 17:16           ` Rich Felker
2018-03-17 17:33             ` Dmitry Torokhov
2018-03-17 17:55             ` John Paul Adrian Glaubitz
2018-03-18 10:54           ` jacopo mondi
2018-03-18 11:12             ` John Paul Adrian Glaubitz
2018-03-17 17:37         ` Dmitry Torokhov
2018-03-15 22:42 ` [RFC 3/4] sh: ecovec24: convert backlight to use device properties Dmitry Torokhov
2018-03-16  8:50   ` Geert Uytterhoeven
2018-03-16 23:40     ` Dmitry Torokhov
2018-03-16 10:08   ` jacopo mondi
2018-03-15 22:42 ` [RFC 4/4] backlight: gpio_backlight: remove platform data support Dmitry Torokhov
2018-03-27 11:55   ` Linus Walleij
2018-03-16 11:11 ` [RFC 0/4] gpio-backlight: " Daniel Thompson
2018-03-27 11:59 ` Linus Walleij

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=20180315224202.96668-2-dmitry.torokhov@gmail.com \
    --to=dmitry.torokhov@gmail.com \
    --cc=dalias@libc.org \
    --cc=daniel.thompson@linaro.org \
    --cc=jingoohan1@gmail.com \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=lee.jones@linaro.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-fbdev@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sh@vger.kernel.org \
    --cc=ysato@users.sourceforge.jp \
    /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;
as well as URLs for NNTP newsgroup(s).