Skip to content

Commit

Permalink
driver core: make device_{add|remove}_groups() public
Browse files Browse the repository at this point in the history
Many drivers create additional driver-specific device attributes when
binding to the device. To avoid them calling SYSFS API directly, let's
export these helpers.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Dmitry Torokhov authored and Greg Kroah-Hartman committed Jul 22, 2017
1 parent 1455cf8 commit a7670d4
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
5 changes: 0 additions & 5 deletions drivers/base/base.h
Original file line number Diff line number Diff line change
Expand Up @@ -126,11 +126,6 @@ extern int driver_add_groups(struct device_driver *drv,
extern void driver_remove_groups(struct device_driver *drv,
const struct attribute_group **groups);

extern int device_add_groups(struct device *dev,
const struct attribute_group **groups);
extern void device_remove_groups(struct device *dev,
const struct attribute_group **groups);

extern char *make_class_name(const char *name, struct kobject *kobj);

extern int devres_release_all(struct device *dev);
Expand Down
2 changes: 2 additions & 0 deletions drivers/base/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1026,12 +1026,14 @@ int device_add_groups(struct device *dev, const struct attribute_group **groups)
{
return sysfs_create_groups(&dev->kobj, groups);
}
EXPORT_SYMBOL_GPL(device_add_groups);

void device_remove_groups(struct device *dev,
const struct attribute_group **groups)
{
sysfs_remove_groups(&dev->kobj, groups);
}
EXPORT_SYMBOL_GPL(device_remove_groups);

static int device_add_attrs(struct device *dev)
{
Expand Down
5 changes: 5 additions & 0 deletions include/linux/device.h
Original file line number Diff line number Diff line change
Expand Up @@ -1200,6 +1200,11 @@ struct device *device_create_with_groups(struct class *cls,
const char *fmt, ...);
extern void device_destroy(struct class *cls, dev_t devt);

extern int __must_check device_add_groups(struct device *dev,
const struct attribute_group **groups);
extern void device_remove_groups(struct device *dev,
const struct attribute_group **groups);

/*
* Platform "fixup" functions - allow the platform to have their say
* about devices and actions that the general device layer doesn't
Expand Down

0 comments on commit a7670d4

Please sign in to comment.