[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <bb8b00faa2ac3655ea262d5f6c5b75f2053303a7.1451849644.git.ksenija.stanojevic@gmail.com>
Date: Sun, 3 Jan 2016 20:44:44 +0100
From: Ksenija Stanojevic <ksenija.stanojevic@...il.com>
To: gregkh@...uxfoundation.org
Cc: willy@...a-x.org, devel@...verdev.osuosl.org,
linux-kernel@...r.kernel.org,
Ksenija Stanojevic <ksenija.stanojevic@...il.com>
Subject: [PATCH v2 5/5] Staging: panel: Make code more readable
Repace 'for' statement by strchr() function to make code more readable.
Signed-off-by: Ksenija Stanojevic <ksenija.stanojevic@...il.com>
---
v2: use strchr().
drivers/staging/panel/panel.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/staging/panel/panel.c b/drivers/staging/panel/panel.c
index fcfcda7..1219ff7 100644
--- a/drivers/staging/panel/panel.c
+++ b/drivers/staging/panel/panel.c
@@ -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);
--
1.9.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists