Skip to content

Commit a7670d4

Browse files
dtorgregkh
authored andcommitted
driver core: make device_{add|remove}_groups() public
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 <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 1455cf8 commit a7670d4

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

drivers/base/base.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -126,11 +126,6 @@ extern int driver_add_groups(struct device_driver *drv,
126126
extern void driver_remove_groups(struct device_driver *drv,
127127
const struct attribute_group **groups);
128128

129-
extern int device_add_groups(struct device *dev,
130-
const struct attribute_group **groups);
131-
extern void device_remove_groups(struct device *dev,
132-
const struct attribute_group **groups);
133-
134129
extern char *make_class_name(const char *name, struct kobject *kobj);
135130

136131
extern int devres_release_all(struct device *dev);

drivers/base/core.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1026,12 +1026,14 @@ int device_add_groups(struct device *dev, const struct attribute_group **groups)
10261026
{
10271027
return sysfs_create_groups(&dev->kobj, groups);
10281028
}
1029+
EXPORT_SYMBOL_GPL(device_add_groups);
10291030

10301031
void device_remove_groups(struct device *dev,
10311032
const struct attribute_group **groups)
10321033
{
10331034
sysfs_remove_groups(&dev->kobj, groups);
10341035
}
1036+
EXPORT_SYMBOL_GPL(device_remove_groups);
10351037

10361038
static int device_add_attrs(struct device *dev)
10371039
{

include/linux/device.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1200,6 +1200,11 @@ struct device *device_create_with_groups(struct class *cls,
12001200
const char *fmt, ...);
12011201
extern void device_destroy(struct class *cls, dev_t devt);
12021202

1203+
extern int __must_check device_add_groups(struct device *dev,
1204+
const struct attribute_group **groups);
1205+
extern void device_remove_groups(struct device *dev,
1206+
const struct attribute_group **groups);
1207+
12031208
/*
12041209
* Platform "fixup" functions - allow the platform to have their say
12051210
* about devices and actions that the general device layer doesn't

0 commit comments

Comments
 (0)