linux-mips
[Top] [All Lists]

Re: [PATCH][2/6] led: add Cobalt Raq series LEDs support

To: Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>
Subject: Re: [PATCH][2/6] led: add Cobalt Raq series LEDs support
From: Richard Purdie <rpurdie@rpsys.net>
Date: Thu, 20 Sep 2007 23:51:10 +0100
Cc: Ralf Baechle <ralf@linux-mips.org>, linux-mips <linux-mips@linux-mips.org>
In-reply-to: <20070920230322.6600dd83.yoichi_yuasa@tripeaks.co.jp>
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <20070920230204.0ad15513.yoichi_yuasa@tripeaks.co.jp> <20070920230322.6600dd83.yoichi_yuasa@tripeaks.co.jp>
Sender: linux-mips-bounce@linux-mips.org
On Thu, 2007-09-20 at 23:03 +0900, Yoichi Yuasa wrote:
> Add Cobalt Raq series LEDs support.
> 
> Signed-off-by: Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>
> 
[...]
> diff -pruN -X mips/Documentation/dontdiff 
> mips-orig/drivers/leds/leds-cobalt-raq.c mips/drivers/leds/leds-cobalt-raq.c
> --- mips-orig/drivers/leds/leds-cobalt-raq.c  1970-01-01 09:00:00.000000000 
> +0900
> +++ mips/drivers/leds/leds-cobalt-raq.c       2007-09-14 13:06:03.900173500 
> +0900
> @@ -0,0 +1,135 @@
[...]
> +static void __iomem *led_port;
> +static u8 led_value;
> +static DEFINE_SPINLOCK(led_value_lock);
> +
> +static void raq_web_led_set(struct led_classdev *led_cdev,
> +                            enum led_brightness brightness)
> +{
> +     spin_lock_irq(&led_value_lock);
> +
> +     if (brightness)
> +             led_value |= LED_WEB;
> +     else
> +             led_value &= ~LED_WEB;
> +     writeb(led_value, led_port);
> +
> +     spin_unlock_irq(&led_value_lock);
> +}

You can't use the spin lock like that since the set function can get
called in interrupt context, you need to use irqsave/irqrestore
versions. I've already said this once...

Richard


<Prev in Thread] Current Thread [Next in Thread>