All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Two fixes for omap_hdq
@ 2012-05-21 23:43 NeilBrown
  2012-05-21 23:43 ` [PATCH 2/2] omap_hdq: use wait_event_timeout to wait for read to complete NeilBrown
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: NeilBrown @ 2012-05-21 23:43 UTC (permalink / raw)
  To: Greg KH; +Cc: Evgeniy Polyakov, linux-kernel

Hi Greg,
 you seem to process patches for drivers/w1.  Could you please
take these two, both acked by the maintainer.

Thanks,
NeilBrown


---

NeilBrown (2):
      omap_hdq: use wait_event_timeout to wait for read to complete.
      omap_hdq: Fix some error/debug handling.


 drivers/w1/masters/omap_hdq.c |   30 ++++++++++++++----------------
 1 file changed, 14 insertions(+), 16 deletions(-)

-- 
Signature


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/2] omap_hdq: Fix some error/debug handling.
  2012-05-21 23:43 [PATCH] Two fixes for omap_hdq NeilBrown
  2012-05-21 23:43 ` [PATCH 2/2] omap_hdq: use wait_event_timeout to wait for read to complete NeilBrown
@ 2012-05-21 23:43 ` NeilBrown
  2012-05-22  0:30 ` [PATCH] Two fixes for omap_hdq Greg KH
  2 siblings, 0 replies; 4+ messages in thread
From: NeilBrown @ 2012-05-21 23:43 UTC (permalink / raw)
  To: Greg KH; +Cc: Evgeniy Polyakov, linux-kernel

- 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>
---

 drivers/w1/masters/omap_hdq.c |   15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/drivers/w1/masters/omap_hdq.c b/drivers/w1/masters/omap_hdq.c
index 5ef385b..3036b61 100644
--- a/drivers/w1/masters/omap_hdq.c
+++ b/drivers/w1/masters/omap_hdq.c
@@ -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;
 	}



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] omap_hdq: use wait_event_timeout to wait for read to complete.
  2012-05-21 23:43 [PATCH] Two fixes for omap_hdq NeilBrown
@ 2012-05-21 23:43 ` NeilBrown
  2012-05-21 23:43 ` [PATCH 1/2] omap_hdq: Fix some error/debug handling NeilBrown
  2012-05-22  0:30 ` [PATCH] Two fixes for omap_hdq Greg KH
  2 siblings, 0 replies; 4+ messages in thread
From: NeilBrown @ 2012-05-21 23:43 UTC (permalink / raw)
  To: Greg KH; +Cc: Evgeniy Polyakov, linux-kernel

There is no gain in having a loop - there is no risk of missing the
interrupt with wait_event_timeout.

Signed-off-by: NeilBrown <neilb@suse.de>
Acked-by: Evgeniy Polyakov <zbr@ioremap.net>
---

 drivers/w1/masters/omap_hdq.c |   15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/drivers/w1/masters/omap_hdq.c b/drivers/w1/masters/omap_hdq.c
index 3036b61..848399b 100644
--- a/drivers/w1/masters/omap_hdq.c
+++ b/drivers/w1/masters/omap_hdq.c
@@ -354,7 +354,6 @@ static int hdq_read_byte(struct hdq_data *hdq_data, u8 *val)
 {
 	int ret = 0;
 	u8 status;
-	unsigned long timeout = jiffies + OMAP_HDQ_TIMEOUT;
 
 	ret = mutex_lock_interruptible(&hdq_data->hdq_mutex);
 	if (ret < 0) {
@@ -372,15 +371,13 @@ static int hdq_read_byte(struct hdq_data *hdq_data, u8 *val)
 			OMAP_HDQ_CTRL_STATUS_DIR | OMAP_HDQ_CTRL_STATUS_GO,
 			OMAP_HDQ_CTRL_STATUS_DIR | OMAP_HDQ_CTRL_STATUS_GO);
 		/*
-		 * The RX comes immediately after TX. It
-		 * triggers another interrupt before we
-		 * sleep. So we have to wait for RXCOMPLETE bit.
+		 * The RX comes immediately after TX.
 		 */
-		while (!(hdq_data->hdq_irqstatus
-			& OMAP_HDQ_INT_STATUS_RXCOMPLETE)
-			&& time_before(jiffies, timeout)) {
-			schedule_timeout_uninterruptible(1);
-		}
+		wait_event_timeout(hdq_wait_queue,
+				   (hdq_data->hdq_irqstatus
+				    & OMAP_HDQ_INT_STATUS_RXCOMPLETE),
+				   OMAP_HDQ_TIMEOUT);
+
 		hdq_reg_merge(hdq_data, OMAP_HDQ_CTRL_STATUS, 0,
 			OMAP_HDQ_CTRL_STATUS_DIR);
 		status = hdq_data->hdq_irqstatus;



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] Two fixes for omap_hdq
  2012-05-21 23:43 [PATCH] Two fixes for omap_hdq NeilBrown
  2012-05-21 23:43 ` [PATCH 2/2] omap_hdq: use wait_event_timeout to wait for read to complete NeilBrown
  2012-05-21 23:43 ` [PATCH 1/2] omap_hdq: Fix some error/debug handling NeilBrown
@ 2012-05-22  0:30 ` Greg KH
  2 siblings, 0 replies; 4+ messages in thread
From: Greg KH @ 2012-05-22  0:30 UTC (permalink / raw)
  To: NeilBrown; +Cc: Evgeniy Polyakov, linux-kernel

On Tue, May 22, 2012 at 09:43:02AM +1000, NeilBrown wrote:
> Hi Greg,
>  you seem to process patches for drivers/w1.  Could you please
> take these two, both acked by the maintainer.

Ok, will queue them up after 3.5-rc1 is out, thanks.

greg k-h

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-05-22  0:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-05-21 23:43 [PATCH] Two fixes for omap_hdq NeilBrown
2012-05-21 23:43 ` [PATCH 2/2] omap_hdq: use wait_event_timeout to wait for read to complete NeilBrown
2012-05-21 23:43 ` [PATCH 1/2] omap_hdq: Fix some error/debug handling NeilBrown
2012-05-22  0:30 ` [PATCH] Two fixes for omap_hdq Greg KH

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.