[pkg-fso-commits] [SCM] linux-2.6-openmoko, the Linux 2.6 kernel tree from Openmoko branch, andy-tracking, updated. upstream/20090303.gitb9de904e-140-g23b564c

Werner Almesberger werner at openmoko.org
Mon Jun 8 17:29:48 UTC 2009


The following commit has been merged in the andy-tracking branch:
commit 29bad58ada635337342eca46bf71f3b4f6dac62c
Author: Werner Almesberger <werner at openmoko.org>
Date:   Wed Mar 11 12:23:40 2009 -0300

    Fewer HDQ errors on 3D7K
    
    If no battery is connected, we periodically get a burst of HDQ error
    messages (at least on 3D7K), interrupting whatever we're doing on
    the console.
    
    This patch reduces this to only one message per sequence of errors,
    and one more message if communication with HDQ is successful later.
    
    Signed-off-by: Werner Almesberger <werner at openmoko.org>

diff --git a/drivers/power/hdq.c b/drivers/power/hdq.c
index 755a5ef..d64f8f6 100644
--- a/drivers/power/hdq.c
+++ b/drivers/power/hdq.c
@@ -33,7 +33,7 @@ enum hdq_bitbang_states {
 	HDQB_WAIT_TX,
 };
 
-struct hdq_priv {
+static struct hdq_priv {
 	u8 hdq_probed; /* nonzero after HDQ driver probed */
 	struct mutex hdq_lock; /* if you want to use hdq, you have to take lock */
 	unsigned long hdq_gpio_pin; /* GTA02 = GPD14 which pin to meddle with */
@@ -49,11 +49,26 @@ struct hdq_priv {
 	u8 hdq_shifter;
 	u8 hdq_tx_data_done;
 	enum hdq_bitbang_states hdq_state;
+	int reported_error;
 
 	struct hdq_platform_data *pdata;
 } hdq_priv;
 
 
+static void hdq_bad(void)
+{
+	if (!hdq_priv.reported_error)
+		printk(KERN_ERR "HDQ error: %d\n", hdq_priv.hdq_error);
+	hdq_priv.reported_error = 1;
+}
+
+static void hdq_good(void)
+{
+	if (hdq_priv.reported_error)
+		printk(KERN_INFO "HDQ responds again\n");
+	hdq_priv.reported_error = 0;
+}
+
 int hdq_fiq_handler(void)
 {
 	if (!hdq_priv.hdq_probed)
@@ -267,9 +282,10 @@ int hdq_read(int address)
 			continue;
 
 		if (hdq_priv.hdq_error) {
-			printk(KERN_ERR "HDQ error: %d\n", hdq_priv.hdq_error);
+			hdq_bad();
 			goto done; /* didn't see a response in good time */
 		}
+		hdq_good();
 
 		ret = hdq_priv.hdq_rx_data;
 		goto done;
@@ -308,9 +324,10 @@ int hdq_write(int address, u8 data)
 			continue; /* something bad with FIQ */
 
 		if (hdq_priv.hdq_error) {
-			printk(KERN_ERR "HDQ error: %d\n", hdq_priv.hdq_error);
+			hdq_bad();
 			goto done; /* didn't see a response in good time */
 		}
+		hdq_good();
 
 		ret = 0;
 		goto done;

-- 
linux-2.6-openmoko, the Linux 2.6 kernel tree from Openmoko



More information about the pkg-fso-commits mailing list