pci: layerscape: add pci driver based on DM
[platform/kernel/u-boot.git] / common / stdio.c
index ab9b05d..4d30017 100644 (file)
@@ -37,7 +37,7 @@ char *stdio_names[MAX_FILES] = { "stdin", "stdout", "stderr" };
 #define        CONFIG_SYS_DEVICE_NULLDEV       1
 #endif
 
-#ifdef CONFIG_SYS_STDIO_DEREGISTER
+#if CONFIG_IS_ENABLED(SYS_STDIO_DEREGISTER)
 #define        CONFIG_SYS_DEVICE_NULLDEV       1
 #endif
 
@@ -151,9 +151,10 @@ static int stdio_probe_device(const char *name, enum uclass_id id,
        *sdevp = NULL;
        seq = trailing_strtoln(name, NULL);
        if (seq == -1)
+               seq = 0;
+       ret = uclass_get_device_by_seq(id, seq, &dev);
+       if (ret == -ENODEV)
                ret = uclass_first_device_err(id, &dev);
-       else
-               ret = uclass_get_device_by_seq(id, seq, &dev);
        if (ret) {
                debug("No %s device for seq %d (%s)\n", uclass_get_name(id),
                      seq, name);
@@ -173,12 +174,12 @@ static int stdio_probe_device(const char *name, enum uclass_id id,
 }
 #endif
 
-struct stdio_devstdio_get_by_name(const char *name)
+struct stdio_dev *stdio_get_by_name(const char *name)
 {
        struct list_head *pos;
        struct stdio_dev *sdev;
 
-       if(!name)
+       if (!name)
                return NULL;
 
        list_for_each(pos, &(devs.list)) {
@@ -245,7 +246,7 @@ int stdio_register(struct stdio_dev *dev)
 /* deregister the device "devname".
  * returns 0 if success, -1 if device is assigned and 1 if devname not found
  */
-#ifdef CONFIG_SYS_STDIO_DEREGISTER
+#if CONFIG_IS_ENABLED(SYS_STDIO_DEREGISTER)
 int stdio_deregister_dev(struct stdio_dev *dev, int force)
 {
        int l;
@@ -292,7 +293,7 @@ int stdio_deregister(const char *devname, int force)
 
        return stdio_deregister_dev(dev, force);
 }
-#endif /* CONFIG_SYS_STDIO_DEREGISTER */
+#endif /* CONFIG_IS_ENABLED(SYS_STDIO_DEREGISTER) */
 
 int stdio_init_tables(void)
 {