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]
Message-ID: <20110829221132.GB26846@sirena.org.uk>
Date:	Mon, 29 Aug 2011 23:11:33 +0100
From:	Mark Brown <broonie@...nsource.wolfsonmicro.com>
To:	Vivien Didelot <vivien.didelot@...oirfairelinux.com>
Cc:	x86@...nel.org,
	Jerome Oufella <jerome.oufella@...oirfairelinux.com>,
	Thomas Gleixner <tglx@...utronix.de>,
	Ingo Molnar <mingo@...hat.com>,
	"H. Peter Anvin" <hpa@...or.com>, linux-kernel@...r.kernel.org
Subject: Re: [v2 2/4] platform: (TS-5500) add GPIO support

On Fri, Aug 26, 2011 at 07:40:25PM -0400, Vivien Didelot wrote:

>  arch/x86/platform/ts5500/ts5500_gpio.c |  421 ++++++++++++++++++++++++++++++++
>  arch/x86/platform/ts5500/ts5500_gpio.h |   60 +++++

New GPIO drivers should really go under drivers/gpiolib and be called
gpio-foo.c.

> +static int ts5500_gpio_request(struct gpio_chip *chip, unsigned offset)
> +{
> +	struct ts5500_drvdata *drvdata;
> +
> +	drvdata = container_of(chip, struct ts5500_drvdata, gpio_chip);
> +
> +	mutex_lock(&drvdata->gpio_lock);
> +	if (requested_gpios[offset]) {
> +		mutex_unlock(&drvdata->gpio_lock);
> +		return -EBUSY;
> +	}
> +	requested_gpios[offset] = 1;
> +	mutex_unlock(&drvdata->gpio_lock);

gpiolib should already be making sure there's only one user at once, no
need to bother open coding it in the driver.

> +	bitno = line_to_bit_map[offset];
> +
> +	mutex_lock(&drvdata->gpio_lock);
> +	byte = inb(ioaddr);
> +	mutex_unlock(&drvdata->gpio_lock);

Do you really need the lock to do a read?
--
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