aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/device.h
diff options
context:
space:
mode:
authorDmitry Torokhov <dmitry.torokhov@gmail.com>2017-07-19 17:24:33 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-07-22 11:59:23 +0200
commit57b8ff070f9897b22e4f80fda775a489fc797008 (patch)
tree94f60efe6120ca7cb9214d5ed98a5e7ecb95f812 /include/linux/device.h
parentdriver core: add device_{add|remove}_group() helpers (diff)
downloadlinux-dev-57b8ff070f9897b22e4f80fda775a489fc797008.tar.xz
linux-dev-57b8ff070f9897b22e4f80fda775a489fc797008.zip
driver core: add devm_device_add_group() and friends
Many drivers create additional driver-specific device attributes when binding to the device, and providing managed version of device_create_group() will simplify unbinding and error handling in probe path for such drivers. Without managed version driver writers either have to mix manual and managed resources, which is prone to errors, or open-code this function by providing a wrapper to device_add_group() and use it with devm_add_action() or devm_add_action_or_reset(). Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'include/linux/device.h')
-rw-r--r--include/linux/device.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/include/linux/device.h b/include/linux/device.h
index 7698a513b35e..f52288c24734 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -1221,6 +1221,15 @@ static inline void device_remove_group(struct device *dev,
return device_remove_groups(dev, groups);
}
+extern int __must_check devm_device_add_groups(struct device *dev,
+ const struct attribute_group **groups);
+extern void devm_device_remove_groups(struct device *dev,
+ const struct attribute_group **groups);
+extern int __must_check devm_device_add_group(struct device *dev,
+ const struct attribute_group *grp);
+extern void devm_device_remove_group(struct device *dev,
+ const struct attribute_group *grp);
+
/*
* Platform "fixup" functions - allow the platform to have their say
* about devices and actions that the general device layer doesn't