* [PATCH] driver core: remove devm_device_add_groups() and devm_device_remove_groups()
@ 2022-10-08 15:43 Greg Kroah-Hartman
2022-10-10 6:42 ` Dmitry Torokhov
0 siblings, 1 reply; 3+ messages in thread
From: Greg Kroah-Hartman @ 2022-10-08 15:43 UTC (permalink / raw)
To: linux-kernel; +Cc: Greg Kroah-Hartman, Dmitry Torokhov, Rafael J. Wysocki
There are no more in-kernel users of these functions, and no drivers
should be ever using them anyway, so remove them as they are not needed.
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: "Rafael J. Wysocki" <rafael@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/base/core.c | 62 ------------------------------------------
include/linux/device.h | 4 ---
2 files changed, 66 deletions(-)
diff --git a/drivers/base/core.c b/drivers/base/core.c
index d02501933467..219826bbd2b6 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -2599,15 +2599,6 @@ static void devm_attr_group_remove(struct device *dev, void *res)
sysfs_remove_group(&dev->kobj, group);
}
-static void devm_attr_groups_remove(struct device *dev, void *res)
-{
- union device_attr_group_devres *devres = res;
- const struct attribute_group **groups = devres->groups;
-
- dev_dbg(dev, "%s: removing groups %p\n", __func__, groups);
- sysfs_remove_groups(&dev->kobj, groups);
-}
-
/**
* devm_device_add_group - given a device, create a managed attribute group
* @dev: The device to create the group for
@@ -2657,59 +2648,6 @@ void devm_device_remove_group(struct device *dev,
}
EXPORT_SYMBOL_GPL(devm_device_remove_group);
-/**
- * devm_device_add_groups - create a bunch of managed attribute groups
- * @dev: The device to create the group for
- * @groups: The attribute groups to create, NULL terminated
- *
- * This function creates a bunch of managed attribute groups. If an error
- * occurs when creating a group, all previously created groups will be
- * removed, unwinding everything back to the original state when this
- * function was called. It will explicitly warn and error if any of the
- * attribute files being created already exist.
- *
- * Returns 0 on success or error code from sysfs_create_group on failure.
- */
-int devm_device_add_groups(struct device *dev,
- const struct attribute_group **groups)
-{
- union device_attr_group_devres *devres;
- int error;
-
- devres = devres_alloc(devm_attr_groups_remove,
- sizeof(*devres), GFP_KERNEL);
- if (!devres)
- return -ENOMEM;
-
- error = sysfs_create_groups(&dev->kobj, groups);
- if (error) {
- devres_free(devres);
- return error;
- }
-
- devres->groups = groups;
- devres_add(dev, devres);
- return 0;
-}
-EXPORT_SYMBOL_GPL(devm_device_add_groups);
-
-/**
- * devm_device_remove_groups - remove a list of managed groups
- *
- * @dev: The device for the groups to be removed from
- * @groups: NULL terminated list of groups to be removed
- *
- * If groups is not NULL, remove the specified groups from the device.
- */
-void devm_device_remove_groups(struct device *dev,
- const struct attribute_group **groups)
-{
- WARN_ON(devres_release(dev, devm_attr_groups_remove,
- devm_attr_group_match,
- /* cast away const */ (void *)groups));
-}
-EXPORT_SYMBOL_GPL(devm_device_remove_groups);
-
static int device_add_attrs(struct device *dev)
{
struct class *class = dev->class;
diff --git a/include/linux/device.h b/include/linux/device.h
index 424b55df0272..fe11db1fd062 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -1044,10 +1044,6 @@ static inline void device_remove_group(struct device *dev,
return device_remove_groups(dev, groups);
}
-int __must_check devm_device_add_groups(struct device *dev,
- const struct attribute_group **groups);
-void devm_device_remove_groups(struct device *dev,
- const struct attribute_group **groups);
int __must_check devm_device_add_group(struct device *dev,
const struct attribute_group *grp);
void devm_device_remove_group(struct device *dev,
--
2.38.0
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] driver core: remove devm_device_add_groups() and devm_device_remove_groups()
2022-10-08 15:43 [PATCH] driver core: remove devm_device_add_groups() and devm_device_remove_groups() Greg Kroah-Hartman
@ 2022-10-10 6:42 ` Dmitry Torokhov
2022-10-10 6:52 ` Greg Kroah-Hartman
0 siblings, 1 reply; 3+ messages in thread
From: Dmitry Torokhov @ 2022-10-10 6:42 UTC (permalink / raw)
To: Greg Kroah-Hartman; +Cc: linux-kernel, Rafael J. Wysocki
Hi Greg,
On Sat, Oct 08, 2022 at 05:43:10PM +0200, Greg Kroah-Hartman wrote:
> There are no more in-kernel users of these functions, and no drivers
> should be ever using them anyway, so remove them as they are not needed.
I still see call to devm_device_add_groups() in
drivers/soundwire/sysfs_slave.c in the latest linux-next. Once it is
gone you can add my
Reviewed-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Thanks.
--
Dmitry
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] driver core: remove devm_device_add_groups() and devm_device_remove_groups()
2022-10-10 6:42 ` Dmitry Torokhov
@ 2022-10-10 6:52 ` Greg Kroah-Hartman
0 siblings, 0 replies; 3+ messages in thread
From: Greg Kroah-Hartman @ 2022-10-10 6:52 UTC (permalink / raw)
To: Dmitry Torokhov; +Cc: linux-kernel, Rafael J. Wysocki
On Sun, Oct 09, 2022 at 11:42:15PM -0700, Dmitry Torokhov wrote:
> Hi Greg,
>
> On Sat, Oct 08, 2022 at 05:43:10PM +0200, Greg Kroah-Hartman wrote:
> > There are no more in-kernel users of these functions, and no drivers
> > should be ever using them anyway, so remove them as they are not needed.
>
> I still see call to devm_device_add_groups() in
> drivers/soundwire/sysfs_slave.c in the latest linux-next. Once it is
> gone you can add my
>
> Reviewed-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Thanks, that patch is in a series in my tree, sorry I missed that. I'll
work to get that merged before submitting this one.
greg k-h
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-10-10 6:51 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-10-08 15:43 [PATCH] driver core: remove devm_device_add_groups() and devm_device_remove_groups() Greg Kroah-Hartman
2022-10-10 6:42 ` Dmitry Torokhov
2022-10-10 6:52 ` Greg Kroah-Hartman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox