From: Paul Mundt <lethal@linux-sh.org>
To: kogiidena <kogiidena@eggplant.ddo.jp>
Cc: cbou@mail.ru, Richard Purdie <rpurdie@rpsys.net>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] leds:arch/sh/boards/landisk LEDs supports
Date: Thu, 10 May 2007 23:04:15 +0900 [thread overview]
Message-ID: <20070510140415.GA19167@linux-sh.org> (raw)
In-Reply-To: <1249.192.168.1.10.1178797933.squirrel@eggplant.ddo.jp>
kogiidena-san,
On Thu, May 10, 2007 at 08:52:13PM +0900, kogiidena wrote:
> diff -urpN OLD/drivers/leds/leds-landisk.c NEW/drivers/leds/leds-landisk.c
> --- OLD/drivers/leds/leds-landisk.c 1970-01-01 09:00:00.000000000 +0900
> +++ NEW/drivers/leds/leds-landisk.c 2007-05-10 20:07:11.000000000 +0900
[snip]
> +spinlock_t landisk_led_lock;
DEFINE_SPINLOCK(), please.
> +static int landisk_arch; /* 0:LANDISK, LANTank 1:USL-5P */
> +
If you're going to do this, enums are probably the cleaner way to go.
Checking landisk_arch == 0 all over the place is non-obvious without
seeing this comment.
> +static void landisk_led_set(struct led_classdev *led_cdev,
> + enum led_brightness value)
> +{
> + u8 tmp;
> + int bitmask;
> + unsigned long flags;
> +
> + bitmask = 0x01 << (led_cdev - &landisk_leds[0]);
> +
> + spin_lock_irqsave(&landisk_led_lock, flags);
> + tmp = ctrl_inb(PA_LED);
> + if (value)
> + tmp |= bitmask;
> + else
> + tmp &= ~bitmask;
> + ctrl_outb(tmp, PA_LED);
You may also want some sanity checking here, while PA_LED is only 8-bits,
your bitmask is not.
next prev parent reply other threads:[~2007-05-10 14:05 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-05-08 12:26 kogiidena
2007-05-08 12:54 ` Richard Purdie
2007-05-09 14:26 ` kogiidena
2007-05-09 15:13 ` Richard Purdie
2007-05-09 16:03 ` Anton Vorontsov
2007-05-10 11:52 ` kogiidena
2007-05-10 14:04 ` Paul Mundt [this message]
2007-05-11 15:03 ` kogiidena
2007-05-12 4:01 ` kogiidena
2007-05-13 23:16 ` Richard Purdie
2007-05-14 19:56 ` Anton Vorontsov
2007-05-14 20:12 ` Anton Vorontsov
2007-05-14 20:33 ` Richard Purdie
2007-05-14 21:13 ` Anton Vorontsov
2007-05-09 21:48 ` kogiidena
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=20070510140415.GA19167@linux-sh.org \
--to=lethal@linux-sh.org \
--cc=cbou@mail.ru \
--cc=kogiidena@eggplant.ddo.jp \
--cc=linux-kernel@vger.kernel.org \
--cc=rpurdie@rpsys.net \
/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
Powered by JetHome