linux-leds.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Álvaro Fernández Rojas" <noltari@gmail.com>
To: linux-leds@vger.kernel.org, j.anaszewski@samsung.com,
	jogo@openwrt.org, f.fainelli@gmail.com, cernekee@gmail.com,
	simon@fire.lp0.eu
Cc: "Álvaro Fernández Rojas" <noltari@gmail.com>
Subject: [PATCH v2 8/8] leds: bcm6358: merge bcm6358_led_mode and bcm6358_led_set
Date: Tue, 15 Dec 2015 21:03:52 +0100	[thread overview]
Message-ID: <1450209832-2742-9-git-send-email-noltari@gmail.com> (raw)
In-Reply-To: <1450209832-2742-1-git-send-email-noltari@gmail.com>

bcm6358_led_mode is now only called by bcm6358_led_set, so merge both in one
single function.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
---
 v2: introduce new patch to merge bcm6358_led_mode into bcm6358_led_set

 drivers/leds/leds-bcm6358.c | 20 ++++++--------------
 1 file changed, 6 insertions(+), 14 deletions(-)

diff --git a/drivers/leds/leds-bcm6358.c b/drivers/leds/leds-bcm6358.c
index ffc978d..7413e3e 100644
--- a/drivers/leds/leds-bcm6358.c
+++ b/drivers/leds/leds-bcm6358.c
@@ -76,12 +76,15 @@ static unsigned long bcm6358_led_busy(void __iomem *mem)
 	return val;
 }
 
-static void bcm6358_led_mode(struct bcm6358_led *led, unsigned long value)
+static void bcm6358_led_set(struct led_classdev *led_cdev,
+			    enum led_brightness value)
 {
-	unsigned long val;
+	struct bcm6358_led *led =
+		container_of(led_cdev, struct bcm6358_led, cdev);
+	unsigned long flags, val;
 
+	spin_lock_irqsave(led->lock, flags);
 	bcm6358_led_busy(led->mem);
-
 	val = bcm6358_led_read(led->mem + BCM6358_REG_MODE);
 	if ((led->active_low && value == LED_OFF) ||
 	    (!led->active_low && value != LED_OFF))
@@ -89,17 +92,6 @@ static void bcm6358_led_mode(struct bcm6358_led *led, unsigned long value)
 	else
 		val &= ~(BIT(led->pin));
 	bcm6358_led_write(led->mem + BCM6358_REG_MODE, val);
-}
-
-static void bcm6358_led_set(struct led_classdev *led_cdev,
-			    enum led_brightness value)
-{
-	struct bcm6358_led *led =
-		container_of(led_cdev, struct bcm6358_led, cdev);
-	unsigned long flags;
-
-	spin_lock_irqsave(led->lock, flags);
-	bcm6358_led_mode(led, value);
 	spin_unlock_irqrestore(led->lock, flags);
 }
 
-- 
1.9.1

  parent reply	other threads:[~2015-12-15 20:04 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-29 16:35 [PATCH 1/7] leds-bcm6328: code cleaning Álvaro Fernández Rojas
2015-11-29 16:35 ` [PATCH 2/7] leds-bcm6328: remove unneded lock when checking initial LED status Álvaro Fernández Rojas
2015-11-29 16:35 ` [PATCH 3/7] leds-bcm6358: Use bcm6358_led_set() in order to get rid of the lock Álvaro Fernández Rojas
2015-11-29 16:35 ` [PATCH 4/7] leds-bcm6358: remove unneded lock when checking initial LED status Álvaro Fernández Rojas
2015-11-29 16:35 ` [PATCH 5/7] leds-bcm6328: switch to __raw_readl() and __raw_writel() Álvaro Fernández Rojas
2015-11-29 20:25   ` Simon Arlott
2015-11-30  4:32   ` Florian Fainelli
2015-11-30 10:46     ` Jacek Anaszewski
2015-11-29 16:35 ` [PATCH 6/7] leds-bcm6358: " Álvaro Fernández Rojas
2015-11-29 16:35 ` [PATCH 7/7] leds-bcm6328: simplify duplicated unlock in bcm6328_blink_set Álvaro Fernández Rojas
2015-11-30 10:46 ` [PATCH 1/7] leds-bcm6328: code cleaning Jacek Anaszewski
2015-12-15 20:03 ` [PATCH v2 0/8] leds: bcm6328/bcm6358: several fixes and improvements Álvaro Fernández Rojas
2015-12-15 20:03   ` [PATCH v2 1/8] leds: bcm6328: code cleaning Álvaro Fernández Rojas
2015-12-15 20:03   ` [PATCH v2 2/8] leds: bcm6328: remove unneded lock when checking initial LED Álvaro Fernández Rojas
2015-12-15 20:03   ` [PATCH v2 3/8] leds: bcm6358: Use bcm6358_led_set() in order to get rid of the lock Álvaro Fernández Rojas
2015-12-15 20:03   ` [PATCH v2 4/8] leds: bcm6358: remove unneded lock when checking initial LED status Álvaro Fernández Rojas
2015-12-15 20:03   ` [PATCH v2 5/8] leds: bcm6328: add little endian support Álvaro Fernández Rojas
2015-12-15 20:03   ` [PATCH v2 6/8] leds: bcm6358: " Álvaro Fernández Rojas
2015-12-15 20:03   ` [PATCH v2 7/8] leds: bcm6328: simplify duplicated unlock in bcm6328_blink_set Álvaro Fernández Rojas
2015-12-15 20:03   ` Álvaro Fernández Rojas [this message]
2015-12-16  8:49   ` [PATCH v2 0/8] leds: bcm6328/bcm6358: several fixes and improvements Jacek Anaszewski

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=1450209832-2742-9-git-send-email-noltari@gmail.com \
    --to=noltari@gmail.com \
    --cc=cernekee@gmail.com \
    --cc=f.fainelli@gmail.com \
    --cc=j.anaszewski@samsung.com \
    --cc=jogo@openwrt.org \
    --cc=linux-leds@vger.kernel.org \
    --cc=simon@fire.lp0.eu \
    /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;
as well as URLs for NNTP newsgroup(s).