Something like devm_pm_runtime_enable desirable?
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 ..
Quoted 8 lines · Heiner Kallweit
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_disableonly.
Therefore I'm wondering whether something likedevm_pm_runtime_enablewould be desirable doing thepm_runtime_disableautomagically.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
Am 27.11.2017 um 02:21 schrieb Rafael J. Wysocki:
Quoted 7 lines · Heiner Kallweit
Quoted 6 lines
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_disableonly.
Therefore I'm wondering whether something likedevm_pm_runtime_enablewould be desirable doing thepm_runtime_disableautomagically.
Quoted 8 lines
Quoted 2 lines
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.
Quoted 3 lines
Thanks,
Rafael
Rgds, Heiner
Quoted 24 lines · Heiner Kallweit
Am 27.11.2017 um 02:21 schrieb Rafael J. Wysocki:
Quoted 7 lines · Heiner Kallweit
Quoted 6 lines
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_disableonly.
Therefore I'm wondering whether something likedevm_pm_runtime_enablewould be desirable doing thepm_runtime_disableautomagically.Quoted 8 lines
Quoted 2 lines
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_disablepm_runtime_use_autosuspend->pm_runtime_dont_use_autosuspend
Quoted 2 lines
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