[Ksummit-discuss] [TECH TOPIC] Fix devm_kzalloc, its users, or both

Dmitry Torokhov dmitry.torokhov at gmail.com
Fri Aug 21 17:30:17 UTC 2015


On Fri, Aug 21, 2015 at 9:58 AM, Mark Brown <broonie at kernel.org> wrote:
> On Fri, Aug 21, 2015 at 09:14:09AM -0700, Dmitry Torokhov wrote:
>> On Fri, Aug 21, 2015 at 08:07:09AM -0700, Julia Lawall wrote:
>
>> > What is there too the "etc"?  Would it be better to just remove the devm
>> > functions related to interrupts?  They seem to cause a lot of subtle
>> > problems.
>
>> And regulators, clocks, gpios... Even if we won't have interrupt coming
>> in someone may submit request to the device (userspace for example) and
>> we still may try accessing powered off or half-powered-off hardware.
>
> For most of those there's no issue with devm - we're just releasing a
> reference that allows us to control the device, not doing anything that
> affects the state of the device.  We don't have managed functions for
> the state changing operations.

That is true (at least for now), but there is a demand for adding
them. In the meantime they are quite often invoked via a custom devm
action.

They are also often wrapped into other objects. For example input
device might turn off regulators/clocks in it's close() method, which
is called as part of input_unregister_device(). If input device is
managed then that state change happens "some time later".

Thanks.

-- 
Dmitry


More information about the Ksummit-discuss mailing list