From patchwork Mon Jul 3 01:26:47 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lynn Lei X-Patchwork-Id: 9821871 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id B45F1603B5 for ; Mon, 3 Jul 2017 01:27:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9343A27FBA for ; Mon, 3 Jul 2017 01:27:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 871AA283C5; Mon, 3 Jul 2017 01:27:14 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3E2F327FBA for ; Mon, 3 Jul 2017 01:27:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752297AbdGCB1C (ORCPT ); Sun, 2 Jul 2017 21:27:02 -0400 Received: from mail-pf0-f195.google.com ([209.85.192.195]:35043 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752207AbdGCB0y (ORCPT ); Sun, 2 Jul 2017 21:26:54 -0400 Received: by mail-pf0-f195.google.com with SMTP id s66so23899408pfs.2; Sun, 02 Jul 2017 18:26:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:mime-version:content-disposition; bh=jyQn5cRbSNOKplTTAuPbP6vnaSsyHMeCSOJYGwyPzFg=; b=D3FlGTvsROdHpOELGaQYvEi7AWBtwdZqHTIGSmy0gmU+hPRwU938UUa4xIrlgGJ0OV GrNpMeujIvi92Z2aMmC4PSe7TqxWTp7b5hyqNRHhv7gDTD8S1ybDD+pq9yzMjPUz7wvZ PRZN0mY5XkIJV6+gDT5I3rlpyGi2rOvWiBDS8WyH1aaMePzt77qE5vR1tfEMSyuA+gqt hlBa3gAW6tlq52c2wWTAQUqdKdADOW03qs9cUgDGv6zeO7rmKtPn1HRmJvviWY9LA8eB TyTqCo+9LKPHZFPb/0/BAvwUCUNfnXgYNw/dquM0fmIjkzsUn6qhqnpPAHf0jZblB0l5 gubA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition; bh=jyQn5cRbSNOKplTTAuPbP6vnaSsyHMeCSOJYGwyPzFg=; b=RX5eGFo52nOdW7pMyzMCIQKp+1uYq2It52gUAMOwdoLs8VuKZHMrXYyF5fhtweGRWV zPyy52sANxZV45DZFfoxRD8rt2dwkm9rc/BfWE2CZM15FaS7n6m5bepyl1AucicSirJ4 615J9UNJwfDN07JE1ryXdVAUWh8aRGFX1mxU0khKxO6+BmUSw0Qlb9+CI0Yp20cs0jar YPgfCTrm1knbygpTgbl/r4E2IGVyZDzmIu25dPyuoiqtK77D43rZJwG3khDcTQ3a97Gt +vt171ZXriIHrOAyK6KDqANQZyHAe0dQW6QGgR2cixp0PkfUJbCr0TDwQ5s6tN2rnlgW gVRg== X-Gm-Message-State: AIVw110WiSeptl4su8uZj1yyXYPCX70busDu1bwJ9HDzqpgx7WYgySQV ARyjuFUfdB3PBA== X-Received: by 10.99.121.77 with SMTP id u74mr7671745pgc.107.1499045213355; Sun, 02 Jul 2017 18:26:53 -0700 (PDT) Received: from lynnl.wit ([13.75.91.79]) by smtp.gmail.com with ESMTPSA id b8sm32168865pfd.65.2017.07.02.18.26.50 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 02 Jul 2017 18:26:52 -0700 (PDT) Date: Mon, 3 Jul 2017 09:26:47 +0800 From: Lynn Lei 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 Message-ID: <20170703001809.GA1480@lynnl.wit> MIME-Version: 1.0 Content-Disposition: inline Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP introduced early checks to skip unnecessary comparisons when flags set. Signed-off-by: Lynn Lei --- 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);