From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Rafael J. Wysocki" Subject: Re: [PATCH v3 09/15] leds: leds-gpio: Make use of device property API Date: Sat, 04 Oct 2014 02:18:10 +0200 Message-ID: <3474649.PYuASxQ0V3@vostro.rjw.lan> References: <1410868367-11056-1-git-send-email-mika.westerberg@linux.intel.com> <83082601.pjR7TmeO0m@vostro.rjw.lan> <20141003140728.GO26643@leverpostej> Mime-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7Bit Return-path: In-Reply-To: <20141003140728.GO26643@leverpostej> Sender: linux-kernel-owner@vger.kernel.org To: Mark Rutland Cc: "linux-kernel@vger.kernel.org" , Mika Westerberg , "linux-acpi@vger.kernel.org" , "devicetree@vger.kernel.org" , Greg Kroah-Hartman , Linus Walleij , Alexandre Courbot , Dmitry Torokhov , Bryan Wu , Lee Jones , "grant.likely@linaro.org" , Arnd Bergmann , Aaron Lu , Darren Hart List-Id: linux-acpi@vger.kernel.org On Friday, October 03, 2014 03:07:28 PM Mark Rutland wrote: > On Wed, Oct 01, 2014 at 03:16:25AM +0100, Rafael J. Wysocki wrote: > > From: Max Eliaser > > > > 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 > > Signed-off-by: Mika Westerberg > > Signed-off-by: Rafael J. Wysocki > > --- > > 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 > > #include > > #include > > -#include > > -#include > > -#include > > #include > > #include > > #include > > #include > > +#include > > > > 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? Yes, we do. "linux" here need not mean this is Linux-specific. -- I speak only for myself. Rafael J. Wysocki, Intel Open Source Technology Center.