]> git.sur5r.net Git - u-boot/blobdiff - drivers/core/uclass.c
Juno: don't print PCI debug information by default
[u-boot] / drivers / core / uclass.c
index 5c4a66dd8cf6e9616e917e8ba1d1bdc64cdb8e17..1af09472a2cb76cc82b704bb626054ad5093c1da 100644 (file)
@@ -58,7 +58,12 @@ static int uclass_add(enum uclass_id id, struct uclass **ucp)
        if (!uc_drv) {
                debug("Cannot find uclass for id %d: please add the UCLASS_DRIVER() declaration for this UCLASS_... id\n",
                      id);
-               return -ENOENT;
+               /*
+                * Use a strange error to make this case easier to find. When
+                * a uclass is not available it can prevent driver model from
+                * starting up and this failure is otherwise hard to debug.
+                */
+               return -EPFNOSUPPORT;
        }
        uc = calloc(1, sizeof(*uc));
        if (!uc)
@@ -435,7 +440,7 @@ err:
        return ret;
 }
 
-#ifdef CONFIG_DM_DEVICE_REMOVE
+#if CONFIG_IS_ENABLED(DM_DEVICE_REMOVE)
 int uclass_unbind_device(struct udevice *dev)
 {
        struct uclass *uc;
@@ -515,25 +520,18 @@ int uclass_post_probe_device(struct udevice *dev)
        return 0;
 }
 
-#ifdef CONFIG_DM_DEVICE_REMOVE
+#if CONFIG_IS_ENABLED(DM_DEVICE_REMOVE)
 int uclass_pre_remove_device(struct udevice *dev)
 {
-       struct uclass_driver *uc_drv;
        struct uclass *uc;
        int ret;
 
        uc = dev->uclass;
-       uc_drv = uc->uc_drv;
        if (uc->uc_drv->pre_remove) {
                ret = uc->uc_drv->pre_remove(dev);
                if (ret)
                        return ret;
        }
-       if (uc_drv->per_device_auto_alloc_size) {
-               free(dev->uclass_priv);
-               dev->uclass_priv = NULL;
-       }
-       dev->seq = -1;
 
        return 0;
 }