summaryrefslogtreecommitdiffstats
path: root/drivers/leds/leds-bcm6358.c
diff options
context:
space:
mode:
authorÁlvaro Fernández Rojas <noltari@gmail.com>2015-12-15 21:03:52 +0100
committerJacek Anaszewski <j.anaszewski@samsung.com>2016-01-04 09:57:40 +0100
commit6e636a0a28ffb0a504ccda5146411b219a74cc7f (patch)
treed61626ee48deeba530186bb865d73053c3156a9f /drivers/leds/leds-bcm6358.c
parentleds: bcm6328: simplify duplicated unlock in bcm6328_blink_set (diff)
downloadlinux-6e636a0a28ffb0a504ccda5146411b219a74cc7f.tar.xz
linux-6e636a0a28ffb0a504ccda5146411b219a74cc7f.zip
leds: bcm6358: merge bcm6358_led_mode and bcm6358_led_set
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> Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
Diffstat (limited to 'drivers/leds/leds-bcm6358.c')
-rw-r--r--drivers/leds/leds-bcm6358.c20
1 files changed, 6 insertions, 14 deletions
diff --git a/drivers/leds/leds-bcm6358.c b/drivers/leds/leds-bcm6358.c
index ffc978dd69f3..7413e3e71213 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);
}