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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:	Wed, 8 Aug 2012 07:52:10 +0000
From:	"Opensource [Anthony Olech]" <anthony.olech.opensource@...semi.com>
To:	Mark Brown <broonie@...nsource.wolfsonmicro.com>,
	"Opensource [Anthony Olech]" <anthony.olech.opensource@...semi.com>
CC:	LKML <linux-kernel@...r.kernel.org>
Subject: RE: [NEW DRIVER V1 5/7] DA9058 GPIO driver

> -----Original Message-----
> From: Mark Brown [mailto:broonie@...nsource.wolfsonmicro.com]
> Sent: 07 August 2012 18:15
> To: Opensource [Anthony Olech]
> Cc: LKML
> Subject: Re: [NEW DRIVER V1 5/7] DA9058 GPIO driver
> On Mon, Aug 06, 2012 at 03:15:17PM +0000, Opensource [Anthony Olech]
> wrote:
> > I do realize that REGMAP does locking on individual register accesses,
> > however, the each GPIO line is controlled by 4-bits in a register,
> > with the meaning of the most significant bit depending on the GPIO
> > direction, so it is essential that the register be read first before
> > do an update, thus two sequential register accesses must be protected
> > by a mutex to prevent another process changing the register (and hence
> > the meaning of the most-significant bit) in the middle of the two accesses.
> > I hope this explains to your satisfaction why a driver mutex is
> > required in addition to the regmap's register access mutex
> This seems a bit excessive and complicated - I'd be inclined to either just say
> that the caller is responsible for avoiding confusion here (obviously if you're
> changing the direction there's a race anyway) or store the data in a variable
> locally rather than having to do I/O on the device under lock every time it's
> interacted with.

By using a semaphore (mutex/critical region) as I do in the DA9058 GPIO
component driver, there is absolutely no set-direction-race-condition in
the driver. The driver will always be consistent, either INP or OUT for each
GPIO line. There may, indeed, be confusion between multiple users of the
GPIO lines, but that is, quite properly, their problem. Even though in practice
there will usually be only one GPIO consumer/user, it still seems to me to be
better to code for the worst case. If indeed there is only one GPIO consumer/
user then the mutex access will be fast and non-blocking.

The GPIO control register (as opposed to the status register) is marked as
non-volitile so there should be no i2c access overhead when reading it.

Tony
--
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