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: <1275561288-20661-1-git-send-email-l.fu@pengutronix.de>
Date:	Thu,  3 Jun 2010 12:34:48 +0200
From:	Luotao Fu <l.fu@...gutronix.de>
To:	Sascha Hauer <kernel@...gutronix.de>
Cc:	linux-fbdev@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
	linux-kernel@...r.kernel.org, Luotao Fu <l.fu@...gutronix.de>
Subject: [PATCH] imxfb: add flag to avoid disabling clk multiple times

while the imxfb driver blanks the screen. The clock supply to the framebuffer
controller is disabled. The same callback to disable the fb is, however, also
used the remove and shutdown hooks of the imxfb platform driver. This means that
the imxfb driver can run into a WARN in clock_disable while unloading or
rebooting, if the screen is blanked previously, since the same clock will be
than eventually disabled multiple times.  This patch adds a flag to make sure
that the clock will only be disabled, if it was not already disabled before.

The remove or shutdown callbacks in the imxfb platform driver call
imxfb_disable_controller to disable the hardware,

Signed-off-by: Luotao Fu <l.fu@...gutronix.de>
---
 drivers/video/imxfb.c |   13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/drivers/video/imxfb.c b/drivers/video/imxfb.c
index 17c6b5f..6ef9817 100644
--- a/drivers/video/imxfb.c
+++ b/drivers/video/imxfb.c
@@ -35,6 +35,7 @@
 
 #include <mach/imxfb.h>
 #include <mach/hardware.h>
+#include <mach/clock.h>
 
 /*
  * Complain if VAR is out of range.
@@ -176,6 +177,7 @@ struct imxfb_info {
 
 	struct imx_fb_videomode *mode;
 	int			num_modes;
+	bool			fbclk_disabled;
 
 	void (*lcd_power)(int);
 	void (*backlight_power)(int);
@@ -466,6 +468,7 @@ static void imxfb_enable_controller(struct imxfb_info *fbi)
 	writel(RMCR_LCDC_EN, fbi->regs + LCDC_RMCR);
 
 	clk_enable(fbi->clk);
+	fbi->fbclk_disabled = 0;
 
 	if (fbi->backlight_power)
 		fbi->backlight_power(1);
@@ -482,7 +485,10 @@ static void imxfb_disable_controller(struct imxfb_info *fbi)
 	if (fbi->lcd_power)
 		fbi->lcd_power(0);
 
-	clk_disable(fbi->clk);
+	if (!fbi->fbclk_disabled) {
+		fbi->fbclk_disabled = 1;
+		clk_disable(fbi->clk);
+	}
 
 	writel(0, fbi->regs + LCDC_RMCR);
 }
@@ -863,7 +869,10 @@ static int __devexit imxfb_remove(struct platform_device *pdev)
 
 	iounmap(fbi->regs);
 	release_mem_region(res->start, resource_size(res));
-	clk_disable(fbi->clk);
+
+	if (!fbi->fbclk_disabled)
+		clk_disable(fbi->clk);
+
 	clk_put(fbi->clk);
 
 	platform_set_drvdata(pdev, NULL);
-- 
1.7.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

Powered by Openwall GNU/*/Linux Powered by OpenVZ