mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-19 21:21:09 +00:00
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>
This commit is contained in:
parent
e323b2dddc
commit
57b8ff070f
2 changed files with 139 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue