X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=libudev%2Flibudev-device.c;h=dffeed0b79bc95f5fbfa190cbd46205264cc2139;hb=b73bf332c2da4f539d029d5e9a09af76df12181f;hp=5d1ad9f223acb307adc65c9dec6f0af681807a1d;hpb=6c29f2b942358d4dd9d3e7c65c13c3612dded3cc;p=elogind.git diff --git a/libudev/libudev-device.c b/libudev/libudev-device.c index 5d1ad9f22..dffeed0b7 100644 --- a/libudev/libudev-device.c +++ b/libudev/libudev-device.c @@ -508,20 +508,9 @@ static struct udev_device *device_new_from_parent(struct udev_device *udev_devic char path[UTIL_PATH_SIZE]; const char *subdir; - /* follow "device" link in deprecated sys layout */ - if (strncmp(udev_device->devpath, "/class/", 7) == 0 || - strncmp(udev_device->devpath, "/block/", 7) == 0) { - util_strscpyl(path, sizeof(path), udev_device->syspath, "/device", NULL); - if (util_resolve_sys_link(udev_device->udev, path, sizeof(path)) == 0) { - udev_device_parent = udev_device_new_from_syspath(udev_device->udev, path); - if (udev_device_parent != NULL) - return udev_device_parent; - } - } - util_strscpy(path, sizeof(path), udev_device->syspath); subdir = &path[strlen(udev_get_sys_path(udev_device->udev))+1]; - while (1) { + for (;;) { char *pos; pos = strrchr(subdir, '/'); @@ -577,6 +566,9 @@ struct udev_device *udev_device_get_parent(struct udev_device *udev_device) * value, and fill in information from the sys device and the udev * database entry. * + * If devtype is #NULL, only subsystem is checked, and any devtype will + * match. + * * The returned the device is not referenced. It is attached to the * child device, and will be cleaned up when the child device * is cleaned up.