292a691
From 8791d63af0cf113725ae4cb8cba9492814c59a93 Mon Sep 17 00:00:00 2001
292a691
From: Jarod Wilson <jarod@redhat.com>
292a691
Date: Thu, 26 Jan 2012 12:04:11 -0300
292a691
Subject: [PATCH] [media] imon: don't wedge hardware after early callbacks
292a691
292a691
This patch is just a minor update to one titled "imon: Input from ffdc
292a691
device type ignored" from Corinna Vinschen. An earlier patch to prevent
292a691
an oops when we got early callbacks also has the nasty side-effect of
292a691
wedging imon hardware, as we don't acknowledge the urb. Rework the check
292a691
slightly here to bypass processing the packet, as the driver isn't yet
292a691
fully initialized, but still acknowlege the urb and submit a new rx_urb.
292a691
Do this for both interfaces -- irrelevant for ffdc hardware, but
292a691
relevant for newer hardware, though newer hardware doesn't spew the
292a691
constant stream of data as soon as the hardware is initialized like the
292a691
older ffdc devices, so they'd be less likely to trigger this anyway...
292a691
292a691
Tested with both an ffdc device and an 0042 device.
292a691
292a691
Reported-by: Corinna Vinschen <vinschen@redhat.com>
292a691
Signed-off-by: Jarod Wilson <jarod@redhat.com>
292a691
CC: stable@vger.kernel.org
292a691
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
292a691
---
292a691
 drivers/media/rc/imon.c |   26 ++++++++++++++++++++++----
292a691
 1 files changed, 22 insertions(+), 4 deletions(-)
292a691
292a691
diff --git a/drivers/media/rc/imon.c b/drivers/media/rc/imon.c
292a691
index 6ed9646..3f175eb 100644
292a691
--- a/drivers/media/rc/imon.c
292a691
+++ b/drivers/media/rc/imon.c
292a691
@@ -47,7 +47,7 @@
292a691
 #define MOD_AUTHOR	"Jarod Wilson <jarod@wilsonet.com>"
292a691
 #define MOD_DESC	"Driver for SoundGraph iMON MultiMedia IR/Display"
292a691
 #define MOD_NAME	"imon"
292a691
-#define MOD_VERSION	"0.9.3"
292a691
+#define MOD_VERSION	"0.9.4"
292a691
 
292a691
 #define DISPLAY_MINOR_BASE	144
292a691
 #define DEVICE_NAME	"lcd%d"
292a691
@@ -1658,9 +1658,17 @@ static void usb_rx_callback_intf0(struct urb *urb)
292a691
 		return;
292a691
 
292a691
 	ictx = (struct imon_context *)urb->context;
292a691
-	if (!ictx || !ictx->dev_present_intf0)
292a691
+	if (!ictx)
292a691
 		return;
292a691
 
292a691
+	/*
292a691
+	 * if we get a callback before we're done configuring the hardware, we
292a691
+	 * can't yet process the data, as there's nowhere to send it, but we
292a691
+	 * still need to submit a new rx URB to avoid wedging the hardware
292a691
+	 */
292a691
+	if (!ictx->dev_present_intf0)
292a691
+		goto out;
292a691
+
292a691
 	switch (urb->status) {
292a691
 	case -ENOENT:		/* usbcore unlink successful! */
292a691
 		return;
292a691
@@ -1678,6 +1686,7 @@ static void usb_rx_callback_intf0(struct urb *urb)
292a691
 		break;
292a691
 	}
292a691
 
292a691
+out:
292a691
 	usb_submit_urb(ictx->rx_urb_intf0, GFP_ATOMIC);
292a691
 }
292a691
 
292a691
@@ -1690,9 +1699,17 @@ static void usb_rx_callback_intf1(struct urb *urb)
292a691
 		return;
292a691
 
292a691
 	ictx = (struct imon_context *)urb->context;
292a691
-	if (!ictx || !ictx->dev_present_intf1)
292a691
+	if (!ictx)
292a691
 		return;
292a691
 
292a691
+	/*
292a691
+	 * if we get a callback before we're done configuring the hardware, we
292a691
+	 * can't yet process the data, as there's nowhere to send it, but we
292a691
+	 * still need to submit a new rx URB to avoid wedging the hardware
292a691
+	 */
292a691
+	if (!ictx->dev_present_intf1)
292a691
+		goto out;
292a691
+
292a691
 	switch (urb->status) {
292a691
 	case -ENOENT:		/* usbcore unlink successful! */
292a691
 		return;
292a691
@@ -1710,6 +1727,7 @@ static void usb_rx_callback_intf1(struct urb *urb)
292a691
 		break;
292a691
 	}
292a691
 
292a691
+out:
292a691
 	usb_submit_urb(ictx->rx_urb_intf1, GFP_ATOMIC);
292a691
 }
292a691
 
292a691
@@ -2242,7 +2260,7 @@ find_endpoint_failed:
292a691
 	mutex_unlock(&ictx->lock);
292a691
 	usb_free_urb(rx_urb);
292a691
 rx_urb_alloc_failed:
292a691
-	dev_err(ictx->dev, "unable to initialize intf0, err %d\n", ret);
292a691
+	dev_err(ictx->dev, "unable to initialize intf1, err %d\n", ret);
292a691
 
292a691
 	return NULL;
292a691
 }
292a691
-- 
292a691
1.7.2.5
292a691