linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sean Young <sean@mess.org>
To: "Mauro Carvalho Chehab" <mchehab@redhat.com>,
	"David Härdeman" <david@hardeman.nu>
Cc: linux-media@vger.kernel.org
Subject: [PATCH 3/3] [media] iguanair: intermittent initialization failure
Date: Sun,  6 Jan 2013 17:19:45 +0000	[thread overview]
Message-ID: <1357492785-30966-3-git-send-email-sean@mess.org> (raw)
In-Reply-To: <1357492785-30966-1-git-send-email-sean@mess.org>

Sometimes the first version request is sent before the device has fully
initialized. This seems to happen on some hardware during boot when the
iguanair is plugged into a root hub.

Signed-off-by: Sean Young <sean@mess.org>
---
 drivers/media/rc/iguanair.c | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/drivers/media/rc/iguanair.c b/drivers/media/rc/iguanair.c
index a569c69..bc3557b 100644
--- a/drivers/media/rc/iguanair.c
+++ b/drivers/media/rc/iguanair.c
@@ -224,6 +224,14 @@ static int iguanair_get_features(struct iguanair *ir)
 	ir->packet->header.cmd = CMD_GET_VERSION;
 
 	rc = iguanair_send(ir, sizeof(ir->packet->header));
+
+	/*
+	 * We might have sent the command before the device had time to
+	 * initialize. Retry if we got no response.
+	 */
+	if (rc == -ETIMEDOUT)
+		rc = iguanair_send(ir, sizeof(ir->packet->header));
+
 	if (rc) {
 		dev_info(ir->dev, "failed to get version\n");
 		goto out;
@@ -255,19 +263,14 @@ static int iguanair_get_features(struct iguanair *ir)
 	ir->packet->header.cmd = CMD_GET_FEATURES;
 
 	rc = iguanair_send(ir, sizeof(ir->packet->header));
-	if (rc) {
+	if (rc)
 		dev_info(ir->dev, "failed to get features\n");
-		goto out;
-	}
-
 out:
 	return rc;
 }
 
 static int iguanair_receiver(struct iguanair *ir, bool enable)
 {
-	int rc;
-
 	ir->packet->header.start = 0;
 	ir->packet->header.direction = DIR_OUT;
 	ir->packet->header.cmd = enable ? CMD_RECEIVER_ON : CMD_RECEIVER_OFF;
@@ -275,9 +278,7 @@ static int iguanair_receiver(struct iguanair *ir, bool enable)
 	if (enable)
 		ir_raw_event_reset(ir->rc);
 
-	rc = iguanair_send(ir, sizeof(ir->packet->header));
-
-	return rc;
+	return iguanair_send(ir, sizeof(ir->packet->header));
 }
 
 /*
-- 
1.7.11.7


  parent reply	other threads:[~2013-01-06 17:19 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-06 17:19 [PATCH 1/3] [media] winbond-cir: only enable higher sample resolution if needed Sean Young
2013-01-06 17:19 ` [PATCH 2/3] [media] iguanair: ensure transmission mask is initialized Sean Young
2013-01-06 17:19 ` Sean Young [this message]
2013-01-12 11:42   ` [PATCH 3/3] [media] iguanair: intermittent initialization failure Sean Young
2013-01-08 11:32 ` [PATCH 1/3] [media] winbond-cir: only enable higher sample resolution if needed David Härdeman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1357492785-30966-3-git-send-email-sean@mess.org \
    --to=sean@mess.org \
    --cc=david@hardeman.nu \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).