-struct sysfs_driver *sysfs_get_bus_driver(struct sysfs_bus *bus,
- unsigned char *drvname)
-{
- if (bus == NULL || drvname == NULL) {
- errno = EINVAL;
- return NULL;
- }
-
- if (bus->drivers == NULL) {
- bus->drivers = sysfs_get_bus_drivers(bus);
- if (bus->drivers == NULL)
- return NULL;
- }
-
- return (struct sysfs_driver *)dlist_find_custom(bus->drivers, drvname,
- bus_driver_name_equal);
-}
-
-/**
- * sysfs_get_bus_attributes: returns bus' dlist of attributes
- * @bus: bus to get attributes for.
- * returns dlist of attributes or NULL if there aren't any.
- */
-struct dlist *sysfs_get_bus_attributes(struct sysfs_bus *bus)
-{
- if (bus == NULL)
- return NULL;
-
- if (bus->directory == NULL) {
- bus->directory = sysfs_open_directory(bus->path);
- if (bus->directory == NULL)
- return NULL;
- }
- if (bus->directory->attributes == NULL) {
- if ((sysfs_read_dir_attributes(bus->directory)) != 0)
- return NULL;
- }
- return bus->directory->attributes;
-}
-
-/**
- * sysfs_refresh_bus_attributes: refreshes the bus's list of attributes
- * @bus: sysfs_bus whose attributes to refresh
- *
- * NOTE: Upon return, prior references to sysfs_attributes for this bus
- * _may_ not be valid
- *
- * Returns list of attributes on success and NULL on failure
- */
-struct dlist *sysfs_refresh_bus_attributes(struct sysfs_bus *bus)
-{
- if (bus == NULL) {
- errno = EINVAL;
- return NULL;
- }
-
- if (bus->directory == NULL)
- return (sysfs_get_bus_attributes(bus));
-
- if ((sysfs_refresh_dir_attributes(bus->directory)) != 0) {
- dprintf("Error refreshing bus attributes\n");
- return NULL;
- }
-
- return (bus->directory->attributes);
-}
-
-/**
- * sysfs_get_bus_attribute: gets a specific bus attribute, if buses had
- * attributes.
- * @bus: bus to retrieve attribute from
- * @attrname: attribute name to retrieve
- * returns reference to sysfs_attribute if found or NULL if not found
- */
-struct sysfs_attribute *sysfs_get_bus_attribute(struct sysfs_bus *bus,
- unsigned char *attrname)