Skip to content

Commit 9711873

Browse files
committed
driver core: remove devm_device_add_groups()
There is no more in-kernel users of this function, and no driver should ever be using it, so remove it from the kernel. Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> Acked-by: "Rafael J. Wysocki" <rafael@kernel.org> Link: https://lore.kernel.org/r/20230704131715.44454-8-gregkh@linuxfoundation.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent c3f38fa commit 9711873

File tree

2 files changed

+0
-47
lines changed

2 files changed

+0
-47
lines changed

drivers/base/core.c

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -2845,15 +2845,6 @@ static void devm_attr_group_remove(struct device *dev, void *res)
28452845
sysfs_remove_group(&dev->kobj, group);
28462846
}
28472847

2848-
static void devm_attr_groups_remove(struct device *dev, void *res)
2849-
{
2850-
union device_attr_group_devres *devres = res;
2851-
const struct attribute_group **groups = devres->groups;
2852-
2853-
dev_dbg(dev, "%s: removing groups %p\n", __func__, groups);
2854-
sysfs_remove_groups(&dev->kobj, groups);
2855-
}
2856-
28572848
/**
28582849
* devm_device_add_group - given a device, create a managed attribute group
28592850
* @dev: The device to create the group for
@@ -2886,42 +2877,6 @@ int devm_device_add_group(struct device *dev, const struct attribute_group *grp)
28862877
}
28872878
EXPORT_SYMBOL_GPL(devm_device_add_group);
28882879

2889-
/**
2890-
* devm_device_add_groups - create a bunch of managed attribute groups
2891-
* @dev: The device to create the group for
2892-
* @groups: The attribute groups to create, NULL terminated
2893-
*
2894-
* This function creates a bunch of managed attribute groups. If an error
2895-
* occurs when creating a group, all previously created groups will be
2896-
* removed, unwinding everything back to the original state when this
2897-
* function was called. It will explicitly warn and error if any of the
2898-
* attribute files being created already exist.
2899-
*
2900-
* Returns 0 on success or error code from sysfs_create_group on failure.
2901-
*/
2902-
int devm_device_add_groups(struct device *dev,
2903-
const struct attribute_group **groups)
2904-
{
2905-
union device_attr_group_devres *devres;
2906-
int error;
2907-
2908-
devres = devres_alloc(devm_attr_groups_remove,
2909-
sizeof(*devres), GFP_KERNEL);
2910-
if (!devres)
2911-
return -ENOMEM;
2912-
2913-
error = sysfs_create_groups(&dev->kobj, groups);
2914-
if (error) {
2915-
devres_free(devres);
2916-
return error;
2917-
}
2918-
2919-
devres->groups = groups;
2920-
devres_add(dev, devres);
2921-
return 0;
2922-
}
2923-
EXPORT_SYMBOL_GPL(devm_device_add_groups);
2924-
29252880
static int device_add_attrs(struct device *dev)
29262881
{
29272882
const struct class *class = dev->class;

include/linux/device.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1220,8 +1220,6 @@ static inline void device_remove_group(struct device *dev,
12201220
return device_remove_groups(dev, groups);
12211221
}
12221222

1223-
int __must_check devm_device_add_groups(struct device *dev,
1224-
const struct attribute_group **groups);
12251223
int __must_check devm_device_add_group(struct device *dev,
12261224
const struct attribute_group *grp);
12271225

0 commit comments

Comments
 (0)