[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4E5D2F55.2000608@zytor.com>
Date: Tue, 30 Aug 2011 11:43:33 -0700
From: "H. Peter Anvin" <hpa@...or.com>
To: Vivien Didelot <vivien.didelot@...oirfairelinux.com>
CC: Mark Brown <broonie@...nsource.wolfsonmicro.com>, x86@...nel.org,
Jerome Oufella <jerome.oufella@...oirfairelinux.com>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, linux-kernel@...r.kernel.org
Subject: Re: [v2 2/4] platform: (TS-5500) add GPIO support
On 08/30/2011 11:39 AM, Vivien Didelot wrote:
> On Mon, 29 Aug 2011 23:11:33 +0100,
> Mark Brown <broonie@...nsource.wolfsonmicro.com> wrote:
>> On Fri, Aug 26, 2011 at 07:40:25PM -0400, Vivien Didelot wrote:
>>> + 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?
>
> Is there any chance for this function to be preempted before reading the
> register, allowing a call to ts5500_gpio_direction_output to occur
> before ts5500_gpio_get is completed?
>
Wrapping an atomic operation in a mutex makes no sense no matter how you
slice it...
-hpa
--
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