-static struct sysfs_class_device *get_class_dev(const char *device_name)
-{
- char dev_path[SYSFS_PATH_MAX];
- struct sysfs_class_device *class_dev = NULL;
-
- strfieldcpy(dev_path, sysfs_path);
- strfieldcat(dev_path, device_name);
- dbg("looking at '%s'", dev_path);
-
- /* open up the sysfs class device for this thing... */
- class_dev = sysfs_open_class_device_path(dev_path);
- if (class_dev == NULL) {
- dbg ("sysfs_open_class_device_path failed");
- goto exit;
- }
- dbg("class_dev->name='%s'", class_dev->name);
-
-exit:
- return class_dev;
-}
-
-/* wait for the "dev" file to show up in the directory in sysfs.
- * If it doesn't happen in about 10 seconds, give up.
- */
-#define SECONDS_TO_WAIT_FOR_FILE 10
-static int sleep_for_file(const char *path, char* file)
-{
- char filename[SYSFS_PATH_MAX + 6];
- int loop = SECONDS_TO_WAIT_FOR_FILE;
- 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 */
- sleep(1);
- }
- retval = -ENODEV;
-exit:
- return retval;
-}
-
-static int rename_net_if(struct udevice *dev, int fake)