diff options
author | Kay Sievers <kay.sievers@vrfy.org> | 2008-10-02 21:19:00 +0200 |
---|---|---|
committer | Kay Sievers <kay.sievers@vrfy.org> | 2008-10-02 21:19:00 +0200 |
commit | 98f10a9e2ada5d72a0c39b94a5b59d9da4f28753 (patch) | |
tree | b8494785e7757026e90e6daa0352e36b5cb7d104 /udev/lib/libudev-device.c | |
parent | e598c5738c2dc85a3e93c3f68cd88e8eea51215b (diff) |
libudev: device - add get_parent_with_subsystem()
Diffstat (limited to 'udev/lib/libudev-device.c')
-rw-r--r-- | udev/lib/libudev-device.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/udev/lib/libudev-device.c b/udev/lib/libudev-device.c index a512537140..8e4360a7f4 100644 --- a/udev/lib/libudev-device.c +++ b/udev/lib/libudev-device.c @@ -404,6 +404,22 @@ struct udev_device *udev_device_get_parent(struct udev_device *udev_device) return udev_device->parent_device; } +struct udev_device *udev_device_get_parent_with_subsystem(struct udev_device *udev_device, const char *subsystem) +{ + struct udev_device *parent; + + parent = udev_device_get_parent(udev_device); + while (parent != NULL) { + const char *parent_subsystem; + + parent_subsystem = udev_device_get_subsystem(parent); + if (parent_subsystem != NULL && strcmp(parent_subsystem, subsystem) == 0) + break; + parent = udev_device_get_parent(parent); + } + return parent; +} + /** * udev_device_get_udev: * @udev_device: udev device |