Skip to contentSkip to conversation

ARM: omap_hdq: Fix some error/debug handling.

PATCH In review NeilBrown 1 participant 1 message Apr 25, 2012 W1 dallas's 1-wire bus

lore
Share & tools
lore

NeilBrown

author
#0 lore raw

PATCH 1/2 ARM: omap_hdq: Fix some error/debug handling.

- some debug messages missed spaces. The did this because they broke a string onto 2 lines - badly. That practice is currently out of favour, so join the two strings together, insert the space, and put newlines elsewhere.
- sometimes no error was returned when it should have been
- sometimes a message is printed when there is no error, rather than when there is one.

---
 drivers/w1/masters/omap_hdq.c |   29 +++++++++++++++++------------
 1 file changed, 17 insertions(+), 12 deletions(-)
drivers/w1/masters/omap_hdq.c +17 -12
index 5ef385b..3356d75 100644
@@ -180,14 +180,16 @@ static int hdq_write_byte(struct hdq_data *hdq_data, u8 val, u8 *status)
 		hdq_data->hdq_irqstatus, OMAP_HDQ_TIMEOUT);
 	if (ret == 0) {
 		dev_dbg(hdq_data->dev, "TX wait elapsed\n");
+		ret = -ETIMEDOUT;
 		goto out;
 	}
 
 	*status = hdq_data->hdq_irqstatus;
 	/* check irqstatus */
 	if (!(*status & OMAP_HDQ_INT_STATUS_TXCOMPLETE)) {
-		dev_dbg(hdq_data->dev, "timeout waiting for"
-			"TXCOMPLETE/RXCOMPLETE, %x", *status);
+		dev_dbg(hdq_data->dev,
+			"timeout waiting for TXCOMPLETE/RXCOMPLETE, %x",
+			*status);
 		ret = -ETIMEDOUT;
 		goto out;
 	}
@@ -197,8 +199,9 @@ static int hdq_write_byte(struct hdq_data *hdq_data, u8 val, u8 *status)
 			OMAP_HDQ_CTRL_STATUS_GO,
 			OMAP_HDQ_FLAG_CLEAR, &tmp_status);
 	if (ret) {
-		dev_dbg(hdq_data->dev, "timeout waiting GO bit"
-			"return to zero, %x", tmp_status);
+		dev_dbg(hdq_data->dev,
+			"timeout waiting GO bit return to zero, %x",
+			tmp_status);
 	}
 
 out:
@@ -340,8 +343,9 @@ static int omap_hdq_break(struct hdq_data *hdq_data)
 			OMAP_HDQ_CTRL_STATUS_GO, OMAP_HDQ_FLAG_CLEAR,
 			&tmp_status);
 	if (ret)
-		dev_dbg(hdq_data->dev, "timeout waiting INIT&GO bits"
-			"return to zero, %x", tmp_status);
+		dev_dbg(hdq_data->dev,
+			"timeout waiting INIT&GO bits return to zero, %x",
+			tmp_status);
 
 out:
 	mutex_unlock(&hdq_data->hdq_mutex);
@@ -385,8 +389,9 @@ static int hdq_read_byte(struct hdq_data *hdq_data, u8 *val)
 		status = hdq_data->hdq_irqstatus;
 		/* check irqstatus */
 		if (!(status & OMAP_HDQ_INT_STATUS_RXCOMPLETE)) {
-			dev_dbg(hdq_data->dev, "timeout waiting for"
-				"RXCOMPLETE, %x", status);
+			dev_dbg(hdq_data->dev,
+				"timeout waiting for RXCOMPLETE, %x",
+				status);
 			ret = -ETIMEDOUT;
 			goto out;
 		}
@@ -396,7 +401,7 @@ static int hdq_read_byte(struct hdq_data *hdq_data, u8 *val)
 out:
 	mutex_unlock(&hdq_data->hdq_mutex);
 rtn:
-	return 0;
+	return ret;
 
 }
 
@@ -469,8 +474,8 @@ static int omap_hdq_put(struct hdq_data *hdq_data)
 		return -EINTR;
 
 	if (0 == hdq_data->hdq_usecount) {
-		dev_dbg(hdq_data->dev, "attempt to decrement use count"
-			"when it is zero");
+		dev_dbg(hdq_data->dev,
+			"attempt to decrement use count when it is zero");
 		ret = -EINVAL;
 	} else {
 		hdq_data->hdq_usecount--;
@@ -540,7 +545,7 @@ static void omap_w1_write_byte(void *_hdq, u8 byte)
 	mutex_unlock(&hdq_data->hdq_mutex);
 
 	ret = hdq_write_byte(hdq_data, byte, &status);
-	if (ret == 0) {
+	if (ret < 0) {
 		dev_dbg(hdq_data->dev, "TX failure:Ctrl status %x\n", status);
 		return;
 	}
Signature · 1 line
1.7.10