Skip to content

Commit b4e4613

Browse files
committed
driver-core: remove struct bus_type.bus_attrs
Now that all in-kernel users of bus_type.bus_attrs have been converted to use bus_groups instead, the bus_attrs field, and logic surrounding it, can be removed. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 9d3fde8 commit b4e4613

2 files changed

Lines changed: 0 additions & 44 deletions

File tree

‎drivers/base/bus.c‎

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -846,42 +846,6 @@ struct bus_type *find_bus(char *name)
846846
}
847847
#endif /* 0 */
848848

849-
850-
/**
851-
* bus_add_attrs - Add default attributes for this bus.
852-
* @bus: Bus that has just been registered.
853-
*/
854-
855-
static int bus_add_attrs(struct bus_type *bus)
856-
{
857-
int error = 0;
858-
int i;
859-
860-
if (bus->bus_attrs) {
861-
for (i = 0; bus->bus_attrs[i].attr.name; i++) {
862-
error = bus_create_file(bus, &bus->bus_attrs[i]);
863-
if (error)
864-
goto err;
865-
}
866-
}
867-
done:
868-
return error;
869-
err:
870-
while (--i >= 0)
871-
bus_remove_file(bus, &bus->bus_attrs[i]);
872-
goto done;
873-
}
874-
875-
static void bus_remove_attrs(struct bus_type *bus)
876-
{
877-
int i;
878-
879-
if (bus->bus_attrs) {
880-
for (i = 0; bus->bus_attrs[i].attr.name; i++)
881-
bus_remove_file(bus, &bus->bus_attrs[i]);
882-
}
883-
}
884-
885849
static int bus_add_groups(struct bus_type *bus,
886850
const struct attribute_group **groups)
887851
{
@@ -983,9 +947,6 @@ int bus_register(struct bus_type *bus)
983947
if (retval)
984948
goto bus_probe_files_fail;
985949

986-
retval = bus_add_attrs(bus);
987-
if (retval)
988-
goto bus_attrs_fail;
989950
retval = bus_add_groups(bus, bus->bus_groups);
990951
if (retval)
991952
goto bus_groups_fail;
@@ -994,8 +955,6 @@ int bus_register(struct bus_type *bus)
994955
return 0;
995956

996957
bus_groups_fail:
997-
bus_remove_attrs(bus);
998-
bus_attrs_fail:
999958
remove_probe_files(bus);
1000959
bus_probe_files_fail:
1001960
kset_unregister(bus->p->drivers_kset);
@@ -1024,7 +983,6 @@ void bus_unregister(struct bus_type *bus)
1024983
pr_debug("bus: '%s': unregistering\n", bus->name);
1025984
if (bus->dev_root)
1026985
device_unregister(bus->dev_root);
1027-
bus_remove_attrs(bus);
1028986
bus_remove_groups(bus, bus->bus_groups);
1029987
remove_probe_files(bus);
1030988
kset_unregister(bus->p->drivers_kset);

‎include/linux/device.h‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ extern void bus_remove_file(struct bus_type *, struct bus_attribute *);
6363
* @name: The name of the bus.
6464
* @dev_name: Used for subsystems to enumerate devices like ("foo%u", dev->id).
6565
* @dev_root: Default device to use as the parent.
66-
* @bus_attrs: Default attributes of the bus.
6766
* @dev_attrs: Default attributes of the devices on the bus.
6867
* @drv_attrs: Default attributes of the device drivers on the bus.
6968
* @bus_groups: Default attributes of the bus.
@@ -106,7 +105,6 @@ struct bus_type {
106105
const char *name;
107106
const char *dev_name;
108107
struct device *dev_root;
109-
struct bus_attribute *bus_attrs; /* use bus_groups instead */
110108
struct device_attribute *dev_attrs; /* use dev_groups instead */
111109
struct driver_attribute *drv_attrs; /* use drv_groups instead */
112110
const struct attribute_group **bus_groups;

0 commit comments

Comments
 (0)