mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-19 21:21:09 +00:00
driver core: add device_{add|remove}_group() helpers
We have helpers that work with NULL terminated array of groups, but many drivers only create a single supplemental group, and do not want to declare a group array. Let's provide them with helpers working with a single group. Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
a7670d425b
commit
e323b2dddc
1 changed files with 16 additions and 0 deletions
|
@ -1205,6 +1205,22 @@ extern int __must_check device_add_groups(struct device *dev,
|
|||
extern void device_remove_groups(struct device *dev,
|
||||
const struct attribute_group **groups);
|
||||
|
||||
static inline int __must_check device_add_group(struct device *dev,
|
||||
const struct attribute_group *grp)
|
||||
{
|
||||
const struct attribute_group *groups[] = { grp, NULL };
|
||||
|
||||
return device_add_groups(dev, groups);
|
||||
}
|
||||
|
||||
static inline void device_remove_group(struct device *dev,
|
||||
const struct attribute_group *grp)
|
||||
{
|
||||
const struct attribute_group *groups[] = { grp, NULL };
|
||||
|
||||
return device_remove_groups(dev, groups);
|
||||
}
|
||||
|
||||
/*
|
||||
* 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