Re: [RFC 1/4] backlight: gpio_backlight: use generic device properties

2018-03-27 Thread Linus Walleij
On Thu, Mar 15, 2018 at 11:41 PM, Dmitry Torokhov
 wrote:

> 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 

Looks good to me.
Reviewed-by: Linus Walleij 

Yours,
Linus Walleij


Re: [RFC 1/4] backlight: gpio_backlight: use generic device properties

2018-03-27 Thread Linus Walleij
On Thu, Mar 15, 2018 at 11:41 PM, Dmitry Torokhov
 wrote:

> 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 

Looks good to me.
Reviewed-by: Linus Walleij 

Yours,
Linus Walleij


[RFC 1/4] backlight: gpio_backlight: use generic device properties

2018-03-15 Thread Dmitry Torokhov
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 
---
 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 = >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(>dev,
-   "failed to find platform data or device tree node.\n");
-   return -ENODEV;
-   }
-
gbl = devm_kzalloc(>dev, sizeof(*gbl), GFP_KERNEL);
if (gbl == NULL)
return -ENOMEM;
 
gbl->dev = >dev;
 
-   if (np) {
+   if (!pdata) {
ret = gpio_backlight_probe_dt(pdev, gbl);
if (ret)
return ret;
-- 
2.16.2.804.g6dcf76e118-goog



[RFC 1/4] backlight: gpio_backlight: use generic device properties

2018-03-15 Thread Dmitry Torokhov
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 
---
 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 = >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(>dev,
-   "failed to find platform data or device tree node.\n");
-   return -ENODEV;
-   }
-
gbl = devm_kzalloc(>dev, sizeof(*gbl), GFP_KERNEL);
if (gbl == NULL)
return -ENOMEM;
 
gbl->dev = >dev;
 
-   if (np) {
+   if (!pdata) {
ret = gpio_backlight_probe_dt(pdev, gbl);
if (ret)
return ret;
-- 
2.16.2.804.g6dcf76e118-goog