-/* wait for the "dev" file to show up in the directory in sysfs.
- * If it doesn't happen in about 10 seconds, give up.
- */
-static int sleep_for_file(const char *path, char* file)
-{
- char filename[SYSFS_PATH_MAX + 6];
- int loop = WAIT_FOR_FILE_SECONDS * WAIT_FOR_FILE_RETRY_FREQ;
- int retval;
-
- strfieldcpy(filename, sysfs_path);
- strfieldcat(filename, path);
- strfieldcat(filename, file);
-
- while (loop--) {
- struct stat buf;
-
- dbg("looking for '%s'", filename);
- retval = stat(filename, &buf);
- if (retval == 0)
- goto exit;
-
- /* sleep to give the kernel a chance to create the dev file */
- usleep(1000 * 1000 / WAIT_FOR_FILE_RETRY_FREQ);
- }
- retval = -ENODEV;
-exit:
- return retval;
-}
-