lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 10 May 2007 23:04:15 +0900
From:	Paul Mundt <lethal@...ux-sh.org>
To:	kogiidena <kogiidena@...plant.ddo.jp>
Cc:	cbou@...l.ru, Richard Purdie <rpurdie@...ys.net>,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/2] leds:arch/sh/boards/landisk LEDs supports

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.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ