if (0 > sysfs_get_link(attr_path, attr_buff, sizeof(attr_buff)))
return 1;
- sdev = sysfs_open_device_path(attr_buff);
+ int loop = WAIT_MAX_SECONDS * WAIT_LOOP_PER_SECOND;
+
+ while (loop--) {
+ sdev = sysfs_open_device_path(attr_buff);
+
+ if (strlen(sdev->bus))
+ break;
+
+ sysfs_close_device(sdev);
+ usleep(1000 * 1000 / WAIT_LOOP_PER_SECOND);
+ }
if (!strncmp(sdev->bus, "scsi", 4))
curpath->bus = SYSFS_BUS_SCSI;
else if (!strncmp(sdev->bus, "ide", 3))
curpath->bus = SYSFS_BUS_IDE;
+ else
+ return 1;
sysfs_close_device(sdev);
return 1;
/*
+ * get and store hwe configlet pointer
+ */
+ pp->hwe = find_hwe(hwtable, pp->vendor_id, pp->product_id);
+
+ /*
* fetch info not available through sysfs
*/
if (pp->fd < 0)
scsi_ioctl_pathinfo(pp, mask))
goto out;
- /* get and store hwe pointer */
- pp->hwe = find_hwe(hwtable, pp->vendor_id, pp->product_id);
-
/*
* get path state, no message collection, no context
*/