Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a7670d42 authored by Dmitry Torokhov's avatar Dmitry Torokhov Committed by Greg Kroah-Hartman
Browse files

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: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 1455cf8d
Loading
Loading
Loading
Loading
+0 −5
Original line number Original line Diff line number Diff line
@@ -126,11 +126,6 @@ extern int driver_add_groups(struct device_driver *drv,
extern void driver_remove_groups(struct device_driver *drv,
extern void driver_remove_groups(struct device_driver *drv,
				 const struct attribute_group **groups);
				 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 char *make_class_name(const char *name, struct kobject *kobj);


extern int devres_release_all(struct device *dev);
extern int devres_release_all(struct device *dev);
+2 −0
Original line number Original line Diff line number Diff line
@@ -1026,12 +1026,14 @@ int device_add_groups(struct device *dev, const struct attribute_group **groups)
{
{
	return sysfs_create_groups(&dev->kobj, groups);
	return sysfs_create_groups(&dev->kobj, groups);
}
}
EXPORT_SYMBOL_GPL(device_add_groups);


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


static int device_add_attrs(struct device *dev)
static int device_add_attrs(struct device *dev)
{
{
+5 −0
Original line number Original line Diff line number Diff line
@@ -1200,6 +1200,11 @@ struct device *device_create_with_groups(struct class *cls,
			     const char *fmt, ...);
			     const char *fmt, ...);
extern void device_destroy(struct class *cls, dev_t devt);
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
 * Platform "fixup" functions - allow the platform to have their say
 * about devices and actions that the general device layer doesn't
 * about devices and actions that the general device layer doesn't