diff options
author | Kay Sievers <kay.sievers@suse.de> | 2006-01-18 04:24:48 +0100 |
---|---|---|
committer | Kay Sievers <kay.sievers@suse.de> | 2006-01-18 04:24:48 +0100 |
commit | 6ecd4d1e364ea8104c83e36b82d1c23835fb104b (patch) | |
tree | 7a049a24be855fad92d9dfbbde89fc7fadaf0a93 /udev_sysfs.c | |
parent | 7155bfb7fa7d72bc4e7341ad1481ffd4c6e39f97 (diff) |
scsi_id, usb_id: request device parent by subsystem
Request specific parents identified by subsystem and don't rely on
a predefined sequence.
Also let the devpath be longer than 72 chars, tsss ...
Signed-off-by: Kay Sievers <kay.sievers@suse.de>
Diffstat (limited to 'udev_sysfs.c')
-rw-r--r-- | udev_sysfs.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/udev_sysfs.c b/udev_sysfs.c index 9838379803..172f0ce1fd 100644 --- a/udev_sysfs.c +++ b/udev_sysfs.c @@ -306,6 +306,19 @@ device_link: return sysfs_device_get(parent_devpath); } +struct sysfs_device *sysfs_device_get_parent_with_subsystem(struct sysfs_device *dev, const char *subsystem) +{ + struct sysfs_device *dev_parent; + + dev_parent = sysfs_device_get_parent(dev); + while (dev_parent != NULL) { + if (strcmp(dev_parent->subsystem, subsystem) == 0) + return dev_parent; + dev_parent = sysfs_device_get_parent(dev_parent); + } + return NULL; +} + char *sysfs_attr_get_value(const char *devpath, const char *attr_name) { char path_full[PATH_SIZE]; |