Skip to contentSkip to conversation

driver core: remove devm_device_remove_groups()

PATCH In review Greg Kroah-Hartman 3 participants 7 messages Nov 9, 2022 – Nov 10, 2022 Driver core

lore
Share & tools
lore

Greg Kroah-Hartman

author maintainer
#0 lore raw

PATCH 1/2 driver core: remove devm_device_remove_groups()

There is no in-kernel user of this function, so it is not needed anymore and can be removed.

Cc Dmitry Torokhov <[email protected]>
Cc "Rafael J. Wysocki" <[email protected]>
---
 drivers/base/core.c    | 17 -----------------
 include/linux/device.h |  2 --
 2 files changed, 19 deletions(-)
drivers/base/core.c +0 -17
index d02501933467..6137de5073b1 100644
@@ -2693,23 +2693,6 @@ int devm_device_add_groups(struct device *dev,
 }
 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;
include/linux/device.h +0 -2
index 023ea50b1916..4efc607c008c 100644
@@ -1062,8 +1062,6 @@ static inline void device_remove_group(struct device *dev,
 
 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,
Signature · 1 line
2.38.1
author maintainer
#1 lore raw

PATCH 2/2 driver core: remove devm_device_remove_group()

There is no in-kernel user of this function, so it is not needed anymore and can be removed.

Cc Dmitry Torokhov <[email protected]>
Cc "Rafael J. Wysocki" <[email protected]>
---
 drivers/base/core.c    | 22 ----------------------
 include/linux/device.h |  2 --
 2 files changed, 24 deletions(-)
drivers/base/core.c +0 -22
index 6137de5073b1..a7a18d44542c 100644
@@ -2585,11 +2585,6 @@ union device_attr_group_devres {
 	const struct attribute_group **groups;
 };
 
-static int devm_attr_group_match(struct device *dev, void *res, void *data)
-{
-	return ((union device_attr_group_devres *)res)->group == data;
-}
-
 static void devm_attr_group_remove(struct device *dev, void *res)
 {
 	union device_attr_group_devres *devres = res;
@@ -2640,23 +2635,6 @@ int devm_device_add_group(struct device *dev, const struct attribute_group *grp)
 }
 EXPORT_SYMBOL_GPL(devm_device_add_group);
 
-/**
- * devm_device_remove_group: remove a managed group from a device
- * @dev:	device to remove the group from
- * @grp:	group to remove
- *
- * This function removes a group of attributes from a device. The attributes
- * previously have to have been created for this group, otherwise it will fail.
- */
-void devm_device_remove_group(struct device *dev,
-			      const struct attribute_group *grp)
-{
-	WARN_ON(devres_release(dev, devm_attr_group_remove,
-			       devm_attr_group_match,
-			       /* cast away const */ (void *)grp));
-}
-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
include/linux/device.h +0 -2
index 4efc607c008c..84ae52de6746 100644
@@ -1064,8 +1064,6 @@ int __must_check devm_device_add_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,
-			      const struct attribute_group *grp);
 
 /*
  * Platform "fixup" functions - allow the platform to have their say
Signature · 1 line
2.38.1
maintainer Reviewed-by on v1 1/2
#2 lore raw
In reply to Greg Kroah-Hartman
Quoted 7 lines · Greg Kroah-Hartman

There is no in-kernel user of this function, so it is not needed anymore and can be removed.

Cc Dmitry Torokhov <[email protected]>
Cc "Rafael J. Wysocki" <[email protected]>

For both patches in the series:

Quoted 49 lines
---
 drivers/base/core.c    | 17 -----------------
 include/linux/device.h |  2 --
 2 files changed, 19 deletions(-)
drivers/base/core.c +0 -17
index d02501933467..6137de5073b1 100644
@@ -2693,23 +2693,6 @@ int devm_device_add_groups(struct device *dev,
 }
 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;
include/linux/device.h +0 -3
index 023ea50b1916..4efc607c008c 100644
@@ -1062,8 +1062,6 @@ static inline void device_remove_group(struct device *dev,
 
 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.1

#3 lore raw
Quoted 6 lines · Rafael J. Wysocki
Quoted 4 lines · Greg Kroah-Hartman

There is no in-kernel user of this function, so it is not needed anymore and can be removed.

Quoted 7 lines
Quoted 3 lines
Cc Dmitry Torokhov <[email protected]>
Cc "Rafael J. Wysocki" <[email protected]>

For both patches in the series:

I find it really weird to have an asymmetric core API...

Thanks.

Signature · 1 line
Dmitry
author maintainer
#4 lore raw
Quoted 11 lines · Dmitry Torokhov
Quoted 10 lines · Rafael J. Wysocki
Quoted 7 lines · Greg Kroah-Hartman

There is no in-kernel user of this function, so it is not needed anymore and can be removed.

Cc Dmitry Torokhov <[email protected]>
Cc "Rafael J. Wysocki" <[email protected]>
Quoted 5 lines
Quoted 3 lines

For both patches in the series:

I find it really weird to have an asymmetric core API...

I'm working on fixing up that asymmetric-ness. We have only one user of devm_device_add_groups() and only a handful of devm_device_add_group() left in the tree.

But it turns out that no one ever called these functions anyway, so they aren't needed even if we did keep the "add" functions. So they should be dropped no matter what.

thanks,

greg k-h

#5 lore raw
Quoted 19 lines · Greg Kroah-Hartman
Quoted 11 lines · Dmitry Torokhov
Quoted 10 lines · Rafael J. Wysocki
Quoted 7 lines · Greg Kroah-Hartman

There is no in-kernel user of this function, so it is not needed anymore and can be removed.

Cc Dmitry Torokhov <[email protected]>
Cc "Rafael J. Wysocki" <[email protected]>
Quoted 5 lines
Quoted 3 lines

For both patches in the series:

I find it really weird to have an asymmetric core API...

Quoted 7 lines

I'm working on fixing up that asymmetric-ness. We have only one user of devm_device_add_groups() and only a handful of devm_device_add_group() left in the tree.

But it turns out that no one ever called these functions anyway, so they aren't needed even if we did keep the "add" functions. So they should be dropped no matter what.

Totally agreed.

#6 lore raw
Quoted 25 lines · Rafael J. Wysocki
Quoted 23 lines · Greg Kroah-Hartman
Quoted 11 lines · Dmitry Torokhov
Quoted 10 lines · Rafael J. Wysocki
Quoted 7 lines · Greg Kroah-Hartman

There is no in-kernel user of this function, so it is not needed anymore and can be removed.

Cc Dmitry Torokhov <[email protected]>
Cc "Rafael J. Wysocki" <[email protected]>
Quoted 5 lines
Quoted 3 lines

For both patches in the series:

I find it really weird to have an asymmetric core API...

I'm working on fixing up that asymmetric-ness. We have only one user of devm_device_add_groups() and only a handful of devm_device_add_group() left in the tree.

Quoted 5 lines
Quoted 3 lines

But it turns out that no one ever called these functions anyway, so they aren't needed even if we did keep the "add" functions. So they should be dropped no matter what.

Totally agreed.

OK, fair enough.

Thanks.

Signature · 1 line
Dmitry