[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20141003140728.GO26643@leverpostej>
Date: Fri, 3 Oct 2014 15:07:28 +0100
From: Mark Rutland <mark.rutland@....com>
To: "Rafael J. Wysocki" <rjw@...ysocki.net>
Cc: "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Mika Westerberg <mika.westerberg@...ux.intel.com>,
"linux-acpi@...r.kernel.org" <linux-acpi@...r.kernel.org>,
"devicetree@...r.kernel.org" <devicetree@...r.kernel.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Linus Walleij <linus.walleij@...aro.org>,
Alexandre Courbot <gnurou@...il.com>,
Dmitry Torokhov <dmitry.torokhov@...il.com>,
Bryan Wu <cooloney@...il.com>,
Lee Jones <lee.jones@...aro.org>,
"grant.likely@...aro.org" <grant.likely@...aro.org>,
Arnd Bergmann <arnd@...db.de>, Aaron Lu <aaron.lu@...el.com>,
Darren Hart <dvhart@...ux.intel.com>
Subject: Re: [PATCH v3 09/15] leds: leds-gpio: Make use of device property API
On Wed, Oct 01, 2014 at 03:16:25AM +0100, Rafael J. Wysocki wrote:
> From: Max Eliaser <max@...iaserlow.dyndns.tv>
>
> Make use of device property API in this driver so that both OF and ACPI
> based system can use the same driver.
>
> Signed-off-by: Max Eliaser <max.eliaser@...el.com>
> Signed-off-by: Mika Westerberg <mika.westerberg@...ux.intel.com>
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@...el.com>
> ---
> drivers/leds/leds-gpio.c | 99 +++++++++++++++++++----------------------------
> 1 file changed, 42 insertions(+), 57 deletions(-)
>
> Index: linux-pm/drivers/leds/leds-gpio.c
> ===================================================================
> --- linux-pm.orig/drivers/leds/leds-gpio.c
> +++ linux-pm/drivers/leds/leds-gpio.c
> @@ -15,13 +15,11 @@
> #include <linux/gpio.h>
> #include <linux/gpio/consumer.h>
> #include <linux/leds.h>
> -#include <linux/of.h>
> -#include <linux/of_platform.h>
> -#include <linux/of_gpio.h>
> #include <linux/slab.h>
> #include <linux/workqueue.h>
> #include <linux/module.h>
> #include <linux/err.h>
> +#include <linux/property.h>
>
> struct gpio_led_data {
> struct led_classdev cdev;
> @@ -171,65 +169,59 @@ static inline int sizeof_gpio_leds_priv(
> (sizeof(struct gpio_led_data) * num_leds);
> }
>
> -/* Code to create from OpenFirmware platform devices */
> -#ifdef CONFIG_OF_GPIO
> -static struct gpio_leds_priv *gpio_leds_create_of(struct platform_device *pdev)
> +static int gpio_leds_create_led(struct device *dev, void *child, void *data)
> +{
> + struct gpio_leds_priv *priv = data;
> + struct gpio_led led = {};
> + const char *state = NULL;
> +
> + led.gpiod = devm_get_named_gpiod_from_child(dev, child, "gpios", 0);
> + if (IS_ERR(led.gpiod))
> + return PTR_ERR(led.gpiod);
> +
> + device_child_property_read_string(dev, child, "label", &led.name);
> + device_child_property_read_string(dev, child, "linux,default-trigger",
> + &led.default_trigger);
> +
> + device_child_property_read_string(dev, child, "linux,default_state",
> + &state);
Do we really want "linux," properties in ACPI tables?
Thanks,
Mark.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists