public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	Linus Walleij <linus.walleij@linaro.org>,
	linux-leds@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Pavel Machek <pavel@ucw.cz>, Lee Jones <lee@kernel.org>
Subject: [PATCH v1 4/4] leds: trigger: gpio: Convert to DEVICE_ATTR_RW()
Date: Fri,  3 Nov 2023 21:53:10 +0200	[thread overview]
Message-ID: <20231103195310.948327-4-andriy.shevchenko@linux.intel.com> (raw)
In-Reply-To: <20231103195310.948327-1-andriy.shevchenko@linux.intel.com>

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(-)

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,
-- 
2.40.0.1.gaa8946217a0b


  parent reply	other threads:[~2023-11-03 20:03 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-03 19:53 [PATCH v1 1/4] leds: trigger: gpio: Replace custom code for gpiod_get_optional() Andy Shevchenko
2023-11-03 19:53 ` [PATCH v1 2/4] leds: trigger: gpio: Convert to use kstrtox() Andy Shevchenko
2023-11-04 22:26   ` Linus Walleij
2023-11-23 11:05   ` Lee Jones
2023-11-23 14:11     ` Andy Shevchenko
2023-11-23 14:47       ` Lee Jones
2023-11-03 19:53 ` [PATCH v1 3/4] leds: trigger: gpio: Use sysfs_emit() to instead of s*printf() Andy Shevchenko
2023-11-04 22:24   ` Linus Walleij
2023-11-03 19:53 ` Andy Shevchenko [this message]
2023-11-04 22:26   ` [PATCH v1 4/4] leds: trigger: gpio: Convert to DEVICE_ATTR_RW() Linus Walleij
2023-11-04 22:26 ` [PATCH v1 1/4] leds: trigger: gpio: Replace custom code for gpiod_get_optional() Linus Walleij
2023-11-23 14:48 ` Lee Jones

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231103195310.948327-4-andriy.shevchenko@linux.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=lee@kernel.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-leds@vger.kernel.org \
    --cc=pavel@ucw.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox