From: Lynn Lei <lynnl.wit@gmail.com>
To: sudipm.mukherjee@gmail.com
Cc: teddy.wang@siliconmotion.com, linux-fbdev@vger.kernel.org,
linux-kernel@vger.kernel.org, devel@driverdev.osuosl.org
Subject: [PATCH] staging: sm750fb: skip unnecessary comparisons
Date: Mon, 03 Jul 2017 01:26:47 +0000 [thread overview]
Message-ID: <20170703001809.GA1480@lynnl.wit> (raw)
introduced early checks to skip unnecessary comparisons when flags set.
Signed-off-by: Lynn Lei <lynnl.wit@gmail.com>
---
drivers/staging/sm750fb/sm750.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/drivers/staging/sm750fb/sm750.c b/drivers/staging/sm750fb/sm750.c
index 386d4adcd91d..9e57a2d32465 100644
--- a/drivers/staging/sm750fb/sm750.c
+++ b/drivers/staging/sm750fb/sm750.c
@@ -1171,11 +1171,16 @@ static int __init lynxfb_setup(char *options)
*/
while ((opt = strsep(&options, ":")) != NULL) {
/* options that mean for any lynx chips are configured here */
- if (!strncmp(opt, "noaccel", strlen("noaccel"))) {
+
+ /*
+ * NOTE: the length of options is hard-coded
+ * if any of those options changed please update its length
+ */
+ if (!g_noaccel && !strncmp(opt, "noaccel", 7)) {
g_noaccel = 1;
- } else if (!strncmp(opt, "nomtrr", strlen("nomtrr"))) {
+ } else if (!g_nomtrr && !strncmp(opt, "nomtrr", 6)) {
g_nomtrr = 1;
- } else if (!strncmp(opt, "dual", strlen("dual"))) {
+ } else if (!g_dualview && !strncmp(opt, "dual", 4)) {
g_dualview = 1;
} else {
strcat(tmp, opt);
--
2.13.2
next reply other threads:[~2017-07-03 1:26 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-03 1:26 Lynn Lei [this message]
2017-07-03 6:19 ` [PATCH] staging: sm750fb: skip unnecessary comparisons Greg KH
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170703001809.GA1480@lynnl.wit \
--to=lynnl.wit@gmail.com \
--cc=devel@driverdev.osuosl.org \
--cc=linux-fbdev@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=sudipm.mukherjee@gmail.com \
--cc=teddy.wang@siliconmotion.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).