[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20180315224202.96668-2-dmitry.torokhov@gmail.com>
Date: Thu, 15 Mar 2018 15:41:59 -0700
From: Dmitry Torokhov <dmitry.torokhov@...il.com>
To: Laurent Pinchart <laurent.pinchart@...asonboard.com>,
Lee Jones <lee.jones@...aro.org>
Cc: Daniel Thompson <daniel.thompson@...aro.org>,
Jingoo Han <jingoohan1@...il.com>, linux-fbdev@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-sh@...r.kernel.org,
Yoshinori Sato <ysato@...rs.sourceforge.jp>,
Rich Felker <dalias@...c.org>,
Linus Walleij <linus.walleij@...aro.org>
Subject: [RFC 1/4] backlight: gpio_backlight: use generic device properties
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@...il.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
Powered by blists - more mailing lists