]> Git Repo - J-linux.git/commitdiff
devres: Pass unique name of the resource to devm_add_action_or_reset()
authorAndy Shevchenko <[email protected]>
Mon, 13 Mar 2023 11:31:00 +0000 (13:31 +0200)
committerGreg Kroah-Hartman <[email protected]>
Fri, 17 Mar 2023 14:09:59 +0000 (15:09 +0100)
All the same as it's done in the commit e32c80bbd2f9 ("devres:
Pass unique name of the resource to devm_add_action()") applies
to the devm_add_action_or_reset(), which this change makes real.
This helps with debug resource management.

Reported-and-tested-by: Mirsad Goran Todorovac <[email protected]>
Signed-off-by: Andy Shevchenko <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
include/linux/device.h

index 0f128520f6e511d55dad4c3b543a2f77ee96f708..12dc08aa5c0f191a7382b167196901e354ae0128 100644 (file)
@@ -250,17 +250,19 @@ int __devm_add_action(struct device *dev, void (*action)(void *), void *data, co
 #define devm_add_action(release, action, data) \
        __devm_add_action(release, action, data, #action)
 
-static inline int devm_add_action_or_reset(struct device *dev,
-                                          void (*action)(void *), void *data)
+static inline int __devm_add_action_or_reset(struct device *dev, void (*action)(void *),
+                                            void *data, const char *name)
 {
        int ret;
 
-       ret = devm_add_action(dev, action, data);
+       ret = __devm_add_action(dev, action, data, name);
        if (ret)
                action(data);
 
        return ret;
 }
+#define devm_add_action_or_reset(release, action, data) \
+       __devm_add_action_or_reset(release, action, data, #action)
 
 /**
  * devm_alloc_percpu - Resource-managed alloc_percpu
This page took 0.056605 seconds and 4 git commands to generate.