summaryrefslogtreecommitdiff
path: root/libsysfs/sysfs_bus.c
diff options
context:
space:
mode:
authordsteklof@us.ibm.com <dsteklof@us.ibm.com>2003-11-24 23:47:43 -0800
committerGreg KH <gregkh@suse.de>2005-04-26 21:13:04 -0700
commitff44a6b0b7e98c9f696ee13c197d982819991de8 (patch)
tree950a9ab261cb198dbb5a13c7f630b642d184ae47 /libsysfs/sysfs_bus.c
parent36043f8418c8a0e8decb090c1ea22092fe9c976a (diff)
[PATCH] libsysfs changes for sysfsutils 0.3.0
Here's the patch to up the library to the sysfsutils-0_3_0 level. The following changes: 1) adds class name to sysfs_class_device structure 2) adds bus to sysfs_device 3) gets rid of code that made assumptions as to bus addresses being unique across buses, which isn't the case. I still owe you: 1) change getpagesize->sysconf. This is in the CVS tree and part of other changes we're currently testing. Patch will follow. 2) you need a function to get a sysfs_class_device's parent. We hadn't considered class devices to have parents, the one example of a multilevel is the block class. We will add this function and send the patch to you.
Diffstat (limited to 'libsysfs/sysfs_bus.c')
-rw-r--r--libsysfs/sysfs_bus.c46
1 files changed, 2 insertions, 44 deletions
diff --git a/libsysfs/sysfs_bus.c b/libsysfs/sysfs_bus.c
index 19fc275d84..3111154cbc 100644
--- a/libsysfs/sysfs_bus.c
+++ b/libsysfs/sysfs_bus.c
@@ -25,12 +25,12 @@
static void sysfs_close_dev(void *dev)
{
- sysfs_close_device((struct sysfs_device *)dev);
+ sysfs_close_device((struct sysfs_device *)dev);
}
static void sysfs_close_drv(void *drv)
{
- sysfs_close_driver((struct sysfs_driver *)drv);
+ sysfs_close_driver((struct sysfs_driver *)drv);
}
/*
@@ -424,48 +424,6 @@ struct sysfs_device *sysfs_open_bus_device(unsigned char *busname,
}
/**
- * sysfs_find_device_bus: locates the bus a device is on.
- * @dev_id: device id.
- * @busname: buffer to copy name to
- * @bsize: buffer size
- * returns 0 with success or -1 with error
- */
-int sysfs_find_device_bus(const unsigned char *dev_id, unsigned char *busname,
- size_t bsize)
-{
- unsigned char subsys[SYSFS_NAME_LEN], *bus = NULL, *curdev = NULL;
- struct dlist *buslist = NULL, *device_list = NULL;
-
- if (dev_id == NULL || busname == NULL) {
- errno = EINVAL;
- return -1;
- }
-
- strcpy(subsys, SYSFS_BUS_DIR); /* subsys = /bus */
- buslist = sysfs_open_subsystem_list(subsys);
- if (buslist != NULL) {
- dlist_for_each_data(buslist, bus, char) {
- device_list = sysfs_open_bus_devices_list(bus);
- if (device_list != NULL) {
- dlist_for_each_data(device_list,
- curdev, char) {
- if (strcmp(dev_id, curdev) == 0) {
- strncpy(busname,
- bus, bsize);
- sysfs_close_list(device_list);
- sysfs_close_list(buslist);
- return 0;
- }
- }
- sysfs_close_list(device_list);
- }
- }
- sysfs_close_list(buslist);
- }
- return -1;
-}
-
-/**
* sysfs_find_driver_bus: locates the bus the driver is on.
* @driver: name of the driver to locate
* @busname: buffer to copy name to