diff mbox series

[v1,4/4] leds: trigger: gpio: Convert to DEVICE_ATTR_RW()

Message ID 20231103195310.948327-4-andriy.shevchenko@linux.intel.com
State New
Headers show
Series [v1,1/4] leds: trigger: gpio: Replace custom code for gpiod_get_optional() | expand

Commit Message

Andy Shevchenko Nov. 3, 2023, 7:53 p.m. UTC
Instead of custom wrapper, use DEVICE_ATTR_RW() directly.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/leds/trigger/ledtrig-gpio.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

Comments

Linus Walleij Nov. 4, 2023, 10:26 p.m. UTC | #1
On Fri, Nov 3, 2023 at 9:03 PM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:

> Instead of custom wrapper, use DEVICE_ATTR_RW() directly.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij
diff mbox series

Patch

diff --git a/drivers/leds/trigger/ledtrig-gpio.c b/drivers/leds/trigger/ledtrig-gpio.c
index 8824be19881f..7f6a2352b0ac 100644
--- a/drivers/leds/trigger/ledtrig-gpio.c
+++ b/drivers/leds/trigger/ledtrig-gpio.c
@@ -41,7 +41,7 @@  static irqreturn_t gpio_trig_irq(int irq, void *_led)
 	return IRQ_HANDLED;
 }
 
-static ssize_t gpio_trig_brightness_show(struct device *dev,
+static ssize_t desired_brightness_show(struct device *dev,
 		struct device_attribute *attr, char *buf)
 {
 	struct gpio_trig_data *gpio_data = led_trigger_get_drvdata(dev);
@@ -49,7 +49,7 @@  static ssize_t gpio_trig_brightness_show(struct device *dev,
 	return sysfs_emit(buf, "%u\n", gpio_data->desired_brightness);
 }
 
-static ssize_t gpio_trig_brightness_store(struct device *dev,
+static ssize_t desired_brightness_store(struct device *dev,
 		struct device_attribute *attr, const char *buf, size_t n)
 {
 	struct gpio_trig_data *gpio_data = led_trigger_get_drvdata(dev);
@@ -64,8 +64,7 @@  static ssize_t gpio_trig_brightness_store(struct device *dev,
 
 	return n;
 }
-static DEVICE_ATTR(desired_brightness, 0644, gpio_trig_brightness_show,
-		gpio_trig_brightness_store);
+static DEVICE_ATTR_RW(desired_brightness);
 
 static struct attribute *gpio_trig_attrs[] = {
 	&dev_attr_desired_brightness.attr,