]> git.ipfire.org Git - people/ms/u-boot.git/blobdiff - api/api_storage.c
Cosmetic api: api_storage.c Spelling correction
[people/ms/u-boot.git] / api / api_storage.c
index d425a9ad1dbd7fce338e3065b294561c732a4120..bd4314472130c1e1fdb616aef177464b4a58df0a 100644 (file)
@@ -37,11 +37,11 @@ struct stor_spec {
        int             max_dev;
        int             enum_started;
        int             enum_ended;
-       int             type;           /* "external" type: DT_STOR_{IDE,USB,etc} */
+       int             type;   /* "external" type: DT_STOR_{IDE,USB,etc} */
        char            *name;
 };
 
-static struct stor_spec specs[ENUM_MAX] = { { 0, 0, 0, 0, "" }, };
+static struct stor_spec specs[ENUM_MAX] = { { 0, 0, 0, 0, NULL }, };
 
 
 void dev_stor_init(void)
@@ -105,6 +105,10 @@ static int dev_stor_get(int type, int first, int *more, struct device_info *di)
 
        struct blk_desc *dd;
 
+       /* Wasn't configured for this type, return 0 directly */
+       if (specs[type].name == NULL)
+               return 0;
+
        if (first) {
                di->cookie = (void *)blk_get_dev(specs[type].name, 0);
                if (di->cookie == NULL)
@@ -112,8 +116,10 @@ static int dev_stor_get(int type, int first, int *more, struct device_info *di)
                else
                        found = 1;
 
-               /* provide hint if there are more devices in
-                * this group to enumerate */
+               /*
+                * provide hint if there are more devices in
+                * this group to enumerate
+                */
                if (1 < specs[type].max_dev)
                        *more = 1;
 
@@ -121,8 +127,10 @@ static int dev_stor_get(int type, int first, int *more, struct device_info *di)
                for (i = 0; i < specs[type].max_dev; i++)
                        if (di->cookie ==
                            (void *)blk_get_dev(specs[type].name, i)) {
-                               /* previous cookie found -- advance to the
-                                * next device, if possible */
+                               /*
+                                * previous cookie found -- advance to the
+                                * next device, if possible
+                                */
 
                                if (++i >= specs[type].max_dev) {
                                        /* out of range, no more to enum */
@@ -137,8 +145,10 @@ static int dev_stor_get(int type, int first, int *more, struct device_info *di)
                                else
                                        found = 1;
 
-                               /* provide hint if there are more devices in
-                                * this group to enumerate */
+                               /*
+                                * provide hint if there are more devices in
+                                * this group to enumerate
+                                */
                                if ((i + 1) < specs[type].max_dev)
                                        *more = 1;
 
@@ -167,9 +177,8 @@ static int dev_stor_get(int type, int first, int *more, struct device_info *di)
 }
 
 
-/*
- * returns:    ENUM_IDE, ENUM_USB etc. based on struct blk_desc
- */
+/* returns: ENUM_IDE, ENUM_USB etc. based on struct blk_desc */
+
 static int dev_stor_type(struct blk_desc *dd)
 {
        int i, j;
@@ -183,9 +192,8 @@ static int dev_stor_type(struct blk_desc *dd)
 }
 
 
-/*
- * returns:    0/1 whether cookie points to some device in this group
- */
+/* returns: 0/1 whether cookie points to some device in this group */
+
 static int dev_is_stor(int type, struct device_info *di)
 {
        return (dev_stor_type(di->cookie) == type) ? 1 : 0;
@@ -216,7 +224,6 @@ static int dev_enum_stor(int type, struct device_info *di)
         */
 
        if (di->cookie == NULL) {
-
                debugf("group%d - enum restart\n", type);
 
                /*
@@ -227,7 +234,6 @@ static int dev_enum_stor(int type, struct device_info *di)
                specs[type].enum_started = 1;
 
        } else if (dev_is_stor(type, di)) {
-
                debugf("group%d - enum continued for the next device\n", type);
 
                if (specs[type].enum_ended) {
@@ -239,7 +245,6 @@ static int dev_enum_stor(int type, struct device_info *di)
                found = dev_stor_get(type, 0, &more, di);
 
        } else {
-
                if (specs[type].enum_ended) {
                        debugf("group %d - already enumerated, skipping\n", type);
                        return 0;
@@ -251,7 +256,7 @@ static int dev_enum_stor(int type, struct device_info *di)
                        /*
                         * 2b.  If enumerating devices in this group did not
                         * happen before, it means the cookie pointed to a
-                        * device frome some other group (another storage
+                        * device from some other group (another storage
                         * group, or network); in this case try to take the
                         * first available device from our group
                         */
@@ -278,7 +283,7 @@ static int dev_enum_stor(int type, struct device_info *di)
 
        if (found)
                debugf("device found, returning cookie 0x%08x\n",
-                       (u_int32_t)di->cookie);
+                      (u_int32_t)di->cookie);
        else
                debugf("no device found\n");
 
@@ -299,9 +304,7 @@ int dev_enum_storage(struct device_info *di)
 {
        int i;
 
-       /*
-        * check: ide, usb, scsi, mmc
-        */
+       /* check: ide, usb, scsi, mmc */
        for (i = ENUM_IDE; i < ENUM_MAX; i ++) {
                if (dev_enum_stor(i, di))
                        return 1;