On Mon, Feb 11, 2013 at 4:28 AM, Alex Courbot <acour...@nvidia.com> wrote:
> On 02/09/2013 07:34 PM, Grant Likely wrote:
>>
>> The debugfs files really need to hold the gpiolib spinlock before
>> accessing the list. Otherwise chip addition/removal will cause an oops.
>>
>> Cc: Alexandre Courbot <acour...@nvidia.com>
>> Cc: Linus Walleij <linus.wall...@linaro.org>
>> Signed-off-by: Grant Likely <grant.lik...@secretlab.ca>
>
>
> Tested-by: Alexandre Courbot <acour...@nvidia.com>
>
> Just wondering: if we manage to change this spinlock into a mutex in the
> future, wouldn't it be better to acquire it only once in gpiolib_seq_start()
> and release it in gpiolib_seq_stop()?
>
> Even though the protection introduced by this patch definitely improves the
> situation, it seems to me that chips could still be removed while being
> displayed by gpiolib_seq_show().

Probably, but need to first verify that the mutex won't end up getting
held between read() syscalls. Otherwise it would be possible to block
addition/removal by holding the file open. I cursory read of seq_file
looks like ->stop() is always called, but I would appreciate someone
more cluefull to give an opinion here.

I've also got a draft patch that turns gpio chips into first-class
kobjects which means we can do proper reference counting on them and
prevent the structure from actually disappearing while other drivers
still hold references.

g.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to