diff options
author | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2013-02-23 16:11:14 -0500 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2013-02-26 02:02:42 -0500 |
commit | d6b0c58048d2c8c6f4955c37f670125b2792cd14 (patch) | |
tree | a22d3680ebcaca7681f647ac0ab050ef1f51c968 /include | |
parent | 7241443f67bb352183bcfd7e3b807b87f2777b5d (diff) |
devres: allow adding custom actions to the stack
Sometimes drivers need to execute one-off actions in their error handling
or device teardown paths. An example would be toggling a GPIO line to
reset the controlled device into predefined state.
To allow performing such actions when using managed resources let's allow
adding them to stack/group of devres resources.
Acked-by: Tejun Heo <tj@kernel.org>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/device.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/include/linux/device.h b/include/linux/device.h index 86ef6ab553b1..854b247bf5f9 100644 --- a/include/linux/device.h +++ b/include/linux/device.h | |||
@@ -567,6 +567,10 @@ extern void devm_kfree(struct device *dev, void *p); | |||
567 | void __iomem *devm_request_and_ioremap(struct device *dev, | 567 | void __iomem *devm_request_and_ioremap(struct device *dev, |
568 | struct resource *res); | 568 | struct resource *res); |
569 | 569 | ||
570 | /* allows to add/remove a custom action to devres stack */ | ||
571 | int devm_add_action(struct device *dev, void (*action)(void *), void *data); | ||
572 | void devm_remove_action(struct device *dev, void (*action)(void *), void *data); | ||
573 | |||
570 | struct device_dma_parameters { | 574 | struct device_dma_parameters { |
571 | /* | 575 | /* |
572 | * a low level driver may set these to teach IOMMU code about | 576 | * a low level driver may set these to teach IOMMU code about |