Staging: panel: Make code more readable
authorKsenija Stanojevic <ksenija.stanojevic@gmail.com>
Sun, 3 Jan 2016 19:44:44 +0000 (20:44 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 29 Jan 2016 06:23:38 +0000 (22:23 -0800)
Repace 'for' statement by strchr() function to make code more readable.

Signed-off-by: Ksenija Stanojevic <ksenija.stanojevic@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/panel/panel.c

index fcfcda7..1219ff7 100644 (file)
@@ -2043,7 +2043,7 @@ static void init_scan_timer(void)
 static u8 input_name2mask(const char *name, __u64 *mask, __u64 *value,
                          u8 *imask, u8 *omask)
 {
-       static char sigtab[10] = "EeSsPpAaBb";
+       const char sigtab[] = "EeSsPpAaBb";
        u8 im, om;
        __u64 m, v;
 
@@ -2053,13 +2053,13 @@ static u8 input_name2mask(const char *name, __u64 *mask, __u64 *value,
        v = 0ULL;
        while (*name) {
                int in, out, bit, neg;
+               const char *idx;
 
-               for (in = 0; (in < sizeof(sigtab)) && (sigtab[in] != *name);
-                    in++)
-                       ;
-
-               if (in >= sizeof(sigtab))
+               idx = strchr(sigtab, *name);
+               if (!idx)
                        return 0;       /* input name not found */
+
+               in = idx - sigtab;
                neg = (in & 1); /* odd (lower) names are negated */
                in >>= 1;
                im |= BIT(in);