All of lore.kernel.org
 help / color / mirror / Atom feed
* Something like devm_pm_runtime_enable desirable?
@ 2017-11-26 23:13 Heiner Kallweit
  2017-11-27  1:21 ` Rafael J. Wysocki
  0 siblings, 1 reply; 4+ messages in thread
From: Heiner Kallweit @ 2017-11-26 23:13 UTC (permalink / raw)
  To: Rafael J. Wysocki; +Cc: linux-pm

I have a runtime pm enabled driver which uses device-managed resources
only and therefore wouldn't need a remove callback. The remove callback
does pm_runtime_disable only.
Therefore I'm wondering whether something like devm_pm_runtime_enable
would be desirable doing the pm_runtime_disable automagically.

I can't really imagine that I'm the first one with this idea so I
guess there is some reason why it doesn't exist yet ..

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Something like devm_pm_runtime_enable desirable?
  2017-11-26 23:13 Something like devm_pm_runtime_enable desirable? Heiner Kallweit
@ 2017-11-27  1:21 ` Rafael J. Wysocki
  2017-11-28 21:12   ` Heiner Kallweit
  0 siblings, 1 reply; 4+ messages in thread
From: Rafael J. Wysocki @ 2017-11-27  1:21 UTC (permalink / raw)
  To: Heiner Kallweit; +Cc: Rafael J. Wysocki, Linux PM

On Mon, Nov 27, 2017 at 12:13 AM, Heiner Kallweit <hkallweit1@gmail.com> wrote:
> I have a runtime pm enabled driver which uses device-managed resources
> only and therefore wouldn't need a remove callback. The remove callback
> does pm_runtime_disable only.
> Therefore I'm wondering whether something like devm_pm_runtime_enable
> would be desirable doing the pm_runtime_disable automagically.
>
> I can't really imagine that I'm the first one with this idea so I
> guess there is some reason why it doesn't exist yet ..

You also need to ensure that the device is left in the state in which
your driver will expect it to be in on the next probe in case the
driver module is unloaded and loaded again.  I'm not sure if devm_ can
do that generically enough.

Thanks,
Rafael

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Something like devm_pm_runtime_enable desirable?
  2017-11-27  1:21 ` Rafael J. Wysocki
@ 2017-11-28 21:12   ` Heiner Kallweit
  2017-11-28 22:04     ` Rafael J. Wysocki
  0 siblings, 1 reply; 4+ messages in thread
From: Heiner Kallweit @ 2017-11-28 21:12 UTC (permalink / raw)
  To: Rafael J. Wysocki; +Cc: Rafael J. Wysocki, Linux PM

Am 27.11.2017 um 02:21 schrieb Rafael J. Wysocki:
> On Mon, Nov 27, 2017 at 12:13 AM, Heiner Kallweit <hkallweit1@gmail.com> wrote:
>> I have a runtime pm enabled driver which uses device-managed resources
>> only and therefore wouldn't need a remove callback. The remove callback
>> does pm_runtime_disable only.
>> Therefore I'm wondering whether something like devm_pm_runtime_enable
>> would be desirable doing the pm_runtime_disable automagically.
>>
>> I can't really imagine that I'm the first one with this idea so I
>> guess there is some reason why it doesn't exist yet ..
> 
> You also need to ensure that the device is left in the state in which
> your driver will expect it to be in on the next probe in case the
> driver module is unloaded and loaded again.  I'm not sure if devm_ can
> do that generically enough.
> 
Sure, the device state needs to be managed properly. I just see that lots
of drivers which have the reversed rpm calls in their probe error path and
in remove, what in several cases could be simplified by using the devm
mechanism.
I see this at least for the following function pairs:
pm_runtime_enable -> pm_runtime_disable
pm_runtime_use_autosuspend -> pm_runtime_dont_use_autosuspend

One example would be drivers/i2c/busses/i2c-omap.c, with some IMO
uncritical reordering of rpm calls.

> Thanks,
> Rafael
> 
Rgds, Heiner

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Something like devm_pm_runtime_enable desirable?
  2017-11-28 21:12   ` Heiner Kallweit
@ 2017-11-28 22:04     ` Rafael J. Wysocki
  0 siblings, 0 replies; 4+ messages in thread
From: Rafael J. Wysocki @ 2017-11-28 22:04 UTC (permalink / raw)
  To: Heiner Kallweit; +Cc: Rafael J. Wysocki, Rafael J. Wysocki, Linux PM

On Tue, Nov 28, 2017 at 10:12 PM, Heiner Kallweit <hkallweit1@gmail.com> wrote:
> Am 27.11.2017 um 02:21 schrieb Rafael J. Wysocki:
>> On Mon, Nov 27, 2017 at 12:13 AM, Heiner Kallweit <hkallweit1@gmail.com> wrote:
>>> I have a runtime pm enabled driver which uses device-managed resources
>>> only and therefore wouldn't need a remove callback. The remove callback
>>> does pm_runtime_disable only.
>>> Therefore I'm wondering whether something like devm_pm_runtime_enable
>>> would be desirable doing the pm_runtime_disable automagically.
>>>
>>> I can't really imagine that I'm the first one with this idea so I
>>> guess there is some reason why it doesn't exist yet ..
>>
>> You also need to ensure that the device is left in the state in which
>> your driver will expect it to be in on the next probe in case the
>> driver module is unloaded and loaded again.  I'm not sure if devm_ can
>> do that generically enough.
>>
> Sure, the device state needs to be managed properly. I just see that lots
> of drivers which have the reversed rpm calls in their probe error path and
> in remove, what in several cases could be simplified by using the devm
> mechanism.
> I see this at least for the following function pairs:
> pm_runtime_enable -> pm_runtime_disable
> pm_runtime_use_autosuspend -> pm_runtime_dont_use_autosuspend
>
> One example would be drivers/i2c/busses/i2c-omap.c, with some IMO
> uncritical reordering of rpm calls.

If there are patterns that are sufficiently common to be covered by
devm_ things, I guess it would make sense to do that except that you'd
need one devm_ variant per pattern so to speak.

Thanks,
Rafael

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-11-28 22:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-26 23:13 Something like devm_pm_runtime_enable desirable? Heiner Kallweit
2017-11-27  1:21 ` Rafael J. Wysocki
2017-11-28 21:12   ` Heiner Kallweit
2017-11-28 22:04     ` Rafael J. Wysocki

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.