w1: omap_hdq: Fix some error/debug handling.
authorNeilBrown <neilb@suse.de>
Mon, 21 May 2012 23:43:02 +0000 (09:43 +1000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 13 Jun 2012 23:37:04 +0000 (16:37 -0700)
- some debug messages missed spaces
- 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.

Acked-by: Evgeniy Polyakov <zbr@ioremap.net>
Signed-off-by: NeilBrown <neilb@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/w1/masters/omap_hdq.c

index 5ef385bfed18bedb5c7c6c5852af82449c1adc90..3036b6113ffdf1fbdb34df5c171148d7f5f5c2d7 100644 (file)
@@ -180,6 +180,7 @@ 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;
        }
 
@@ -187,7 +188,7 @@ static int hdq_write_byte(struct hdq_data *hdq_data, u8 val, u8 *status)
        /* check irqstatus */
        if (!(*status & OMAP_HDQ_INT_STATUS_TXCOMPLETE)) {
                dev_dbg(hdq_data->dev, "timeout waiting for"
-                       "TXCOMPLETE/RXCOMPLETE, %x", *status);
+                       " TXCOMPLETE/RXCOMPLETE, %x", *status);
                ret = -ETIMEDOUT;
                goto out;
        }
@@ -198,7 +199,7 @@ static int hdq_write_byte(struct hdq_data *hdq_data, u8 val, u8 *status)
                        OMAP_HDQ_FLAG_CLEAR, &tmp_status);
        if (ret) {
                dev_dbg(hdq_data->dev, "timeout waiting GO bit"
-                       "return to zero, %x", tmp_status);
+                       " return to zero, %x", tmp_status);
        }
 
 out:
@@ -341,7 +342,7 @@ static int omap_hdq_break(struct hdq_data *hdq_data)
                        &tmp_status);
        if (ret)
                dev_dbg(hdq_data->dev, "timeout waiting INIT&GO bits"
-                       "return to zero, %x", tmp_status);
+                       " return to zero, %x", tmp_status);
 
 out:
        mutex_unlock(&hdq_data->hdq_mutex);
@@ -386,7 +387,7 @@ static int hdq_read_byte(struct hdq_data *hdq_data, u8 *val)
                /* check irqstatus */
                if (!(status & OMAP_HDQ_INT_STATUS_RXCOMPLETE)) {
                        dev_dbg(hdq_data->dev, "timeout waiting for"
-                               "RXCOMPLETE, %x", status);
+                               " RXCOMPLETE, %x", status);
                        ret = -ETIMEDOUT;
                        goto out;
                }
@@ -396,7 +397,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;
 
 }
 
@@ -470,7 +471,7 @@ static int omap_hdq_put(struct hdq_data *hdq_data)
 
        if (0 == hdq_data->hdq_usecount) {
                dev_dbg(hdq_data->dev, "attempt to decrement use count"
-                       "when it is zero");
+                       " when it is zero");
                ret = -EINVAL;
        } else {
                hdq_data->hdq_usecount--;
@@ -540,7 +541,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;
        }