of: Minor simplification for the of_parse_phandles_with_args()
authorAnton Vorontsov <avorontsov@ru.mvista.com>
Fri, 5 Dec 2008 08:15:39 +0000 (08:15 +0000)
committerPaul Mackerras <paulus@samba.org>
Sun, 21 Dec 2008 03:21:14 +0000 (14:21 +1100)
By using 'list++' in the beginning we can simplify the code a
little bit.

Suggested-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
drivers/of/base.c

index 4f884a358a7bcce37d24dce2c4a622dd41c01362..cf04d4dd4a53c7f41a2969676ed65e9c8a076f09 100644 (file)
@@ -547,14 +547,12 @@ int of_parse_phandles_with_args(struct device_node *np, const char *list_name,
                const u32 *cells;
                const phandle *phandle;
 
-               phandle = list;
-               args = list + 1;
+               phandle = list++;
+               args = list;
 
                /* one cell hole in the list = <>; */
-               if (!*phandle) {
-                       list++;
+               if (!*phandle)
                        goto next;
-               }
 
                node = of_find_node_by_phandle(*phandle);
                if (!node) {
@@ -570,8 +568,7 @@ int of_parse_phandles_with_args(struct device_node *np, const char *list_name,
                        goto err1;
                }
 
-               /* Next phandle is at offset of one phandle cell + #cells */
-               list += 1 + *cells;
+               list += *cells;
                if (list > list_end) {
                        pr_debug("%s: insufficient arguments length\n",
                                 np->full_name);