[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMz4kuK2WR+Ckb+f0Lt+S2s9rmnf+YQeAP1-bv2huxVpPOB=9w@mail.gmail.com>
Date: Tue, 31 Oct 2017 19:47:57 +0800
From: Baolin Wang <baolin.wang@...aro.org>
To: Mark Brown <broonie@...nel.org>
Cc: Greg KH <gregkh@...uxfoundation.org>,
Lee Jones <lee.jones@...aro.org>,
Arnd Bergmann <arnd@...db.de>,
LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 1/2] regmap: Add hardware spinlock support
On 31 October 2017 at 19:37, Mark Brown <broonie@...nel.org> wrote:
> On Tue, Oct 31, 2017 at 07:31:57PM +0800, Baolin Wang wrote:
>> On 31 October 2017 at 18:38, Mark Brown <broonie@...nel.org> wrote:
>
>> > Given that we have no error handling path on the locks should we be
>> > supporting timeout mode at all? Otherwise we should probably add a
>> > set of error handling paths whenever we take the lock...
>
>> It will be more helpful to use the timeout to try more times to get
>> the hwlock, and we usually do not use hwspin_trylock_xxx(), so we can
>> remove hwspin_trylock_xxx() support and set timeout as MAX value as
>> default to avoid adding 'hwlock_timeout' config,
>> is this OK for you?
>
> I *think* so - but let's see the code. It might make sense to do two
> patches, one with the base hwspinlock support then another adding the
> timeout functionality. That way if there's any problem we can still
> merge the non-timeout code and there's less to review next time.
What I mean is we only introduce the timeout functions, since we do
not want to get the hwlocks failed to avoid error handling path:
static void regmap_lock_hwlock(void *__map)
{
struct regmap *map = __map;
hwspin_lock_timeout(map->hwlock, ~0U);
}
static void regmap_lock_hwlock_irq(void *__map)
{
struct regmap *map = __map;
hwspin_lock_timeout_irq(map->hwlock, ~0U);
}
static void regmap_lock_hwlock_irqsave(void *__map)
{
struct regmap *map = __map;
hwspin_lock_timeout_irqsave(map->hwlock, ~0U, &map->spinlock_flags);
}
--
Baolin.wang
Best Regards
Powered by blists - more mailing lists