lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20170702142335.GA9915@lynnl.wit>
Date:   Sun, 2 Jul 2017 22:27:40 +0800
From:   Lynn Lei <lynnl.wit@...il.com>
To:     sudipm.mukherjee@...il.com
Cc:     teddy.wang@...iconmotion.com, gregkh@...uxfoundation.org,
        linux-fbdev@...r.kernel.org, devel@...verdev.osuosl.org,
        linux-kernel@...r.kernel.org
Subject: [PATCH] staging: sm750fb: refactor method and fix potential type
 inconsistence

make reg variable typed `u32' not `unsigned int'
this can fix potential type inconsistence in some platforms

refactor swPanelPowerSequence() make the code less redundant

a early check for disp to skip unnecessary delay

Signed-off-by: Lynn Lei <lynnl.wit@...il.com>
---
 drivers/staging/sm750fb/ddk750_display.c | 36 ++++++++++++++------------------
 1 file changed, 16 insertions(+), 20 deletions(-)

diff --git a/drivers/staging/sm750fb/ddk750_display.c b/drivers/staging/sm750fb/ddk750_display.c
index 9b116ed6ecc7..0f666dc2729a 100644
--- a/drivers/staging/sm750fb/ddk750_display.c
+++ b/drivers/staging/sm750fb/ddk750_display.c
@@ -86,28 +86,24 @@ static void primary_wait_vertical_sync(int delay)
 
 static void swPanelPowerSequence(int disp, int delay)
 {
-	unsigned int reg;
+	u32 reg;
+	u32 opt[] = {
+		PANEL_DISPLAY_CTRL_FPEN, PANEL_DISPLAY_CTRL_DATA,
+		PANEL_DISPLAY_CTRL_VBIASEN, PANEL_DISPLAY_CTRL_FPEN,
+	};
+	u32 size, i;
+
+	if (disp == 0)
+		return;
+
+	size = sizeof(opt) / sizeof(u32);
 
 	/* disp should be 1 to open sequence */
-	reg = peek32(PANEL_DISPLAY_CTRL);
-	reg |= (disp ? PANEL_DISPLAY_CTRL_FPEN : 0);
-	poke32(PANEL_DISPLAY_CTRL, reg);
-	primary_wait_vertical_sync(delay);
-
-	reg = peek32(PANEL_DISPLAY_CTRL);
-	reg |= (disp ? PANEL_DISPLAY_CTRL_DATA : 0);
-	poke32(PANEL_DISPLAY_CTRL, reg);
-	primary_wait_vertical_sync(delay);
-
-	reg = peek32(PANEL_DISPLAY_CTRL);
-	reg |= (disp ? PANEL_DISPLAY_CTRL_VBIASEN : 0);
-	poke32(PANEL_DISPLAY_CTRL, reg);
-	primary_wait_vertical_sync(delay);
-
-	reg = peek32(PANEL_DISPLAY_CTRL);
-	reg |= (disp ? PANEL_DISPLAY_CTRL_FPEN : 0);
-	poke32(PANEL_DISPLAY_CTRL, reg);
-	primary_wait_vertical_sync(delay);
+	for (i = 0; i < size; i++) {
+		reg = peek32(PANEL_DISPLAY_CTRL) | opt[i];
+		poke32(PANEL_DISPLAY_CTRL, reg);
+		primary_wait_vertical_sync(delay);
+	}
 }
 
 void ddk750_setLogicalDispOut(disp_output_t output)
-- 
2.13.2

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ