Skip to content

Commit

Permalink
[media] imon: don't wedge hardware after early callbacks
Browse files Browse the repository at this point in the history
This patch is just a minor update to one titled "imon: Input from ffdc
device type ignored" from Corinna Vinschen. An earlier patch to prevent
an oops when we got early callbacks also has the nasty side-effect of
wedging imon hardware, as we don't acknowledge the urb. Rework the check
slightly here to bypass processing the packet, as the driver isn't yet
fully initialized, but still acknowlege the urb and submit a new rx_urb.
Do this for both interfaces -- irrelevant for ffdc hardware, but
relevant for newer hardware, though newer hardware doesn't spew the
constant stream of data as soon as the hardware is initialized like the
older ffdc devices, so they'd be less likely to trigger this anyway...

Tested with both an ffdc device and an 0042 device.

Reported-by: Corinna Vinschen <[email protected]>
Signed-off-by: Jarod Wilson <[email protected]>
CC: [email protected]
Signed-off-by: Mauro Carvalho Chehab <[email protected]>
  • Loading branch information
jarodwilson authored and Mauro Carvalho Chehab committed Jan 26, 2012
1 parent c79eba9 commit 8791d63
Showing 1 changed file with 22 additions and 4 deletions.
26 changes: 22 additions & 4 deletions drivers/media/rc/imon.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
#define MOD_AUTHOR "Jarod Wilson <[email protected]>"
#define MOD_DESC "Driver for SoundGraph iMON MultiMedia IR/Display"
#define MOD_NAME "imon"
#define MOD_VERSION "0.9.3"
#define MOD_VERSION "0.9.4"

#define DISPLAY_MINOR_BASE 144
#define DEVICE_NAME "lcd%d"
Expand Down Expand Up @@ -1658,9 +1658,17 @@ static void usb_rx_callback_intf0(struct urb *urb)
return;

ictx = (struct imon_context *)urb->context;
if (!ictx || !ictx->dev_present_intf0)
if (!ictx)
return;

/*
* if we get a callback before we're done configuring the hardware, we
* can't yet process the data, as there's nowhere to send it, but we
* still need to submit a new rx URB to avoid wedging the hardware
*/
if (!ictx->dev_present_intf0)
goto out;

switch (urb->status) {
case -ENOENT: /* usbcore unlink successful! */
return;
Expand All @@ -1678,6 +1686,7 @@ static void usb_rx_callback_intf0(struct urb *urb)
break;
}

out:
usb_submit_urb(ictx->rx_urb_intf0, GFP_ATOMIC);
}

Expand All @@ -1690,9 +1699,17 @@ static void usb_rx_callback_intf1(struct urb *urb)
return;

ictx = (struct imon_context *)urb->context;
if (!ictx || !ictx->dev_present_intf1)
if (!ictx)
return;

/*
* if we get a callback before we're done configuring the hardware, we
* can't yet process the data, as there's nowhere to send it, but we
* still need to submit a new rx URB to avoid wedging the hardware
*/
if (!ictx->dev_present_intf1)
goto out;

switch (urb->status) {
case -ENOENT: /* usbcore unlink successful! */
return;
Expand All @@ -1710,6 +1727,7 @@ static void usb_rx_callback_intf1(struct urb *urb)
break;
}

out:
usb_submit_urb(ictx->rx_urb_intf1, GFP_ATOMIC);
}

Expand Down Expand Up @@ -2242,7 +2260,7 @@ static struct imon_context *imon_init_intf1(struct usb_interface *intf,
mutex_unlock(&ictx->lock);
usb_free_urb(rx_urb);
rx_urb_alloc_failed:
dev_err(ictx->dev, "unable to initialize intf0, err %d\n", ret);
dev_err(ictx->dev, "unable to initialize intf1, err %d\n", ret);

return NULL;
}
Expand Down

0 comments on commit 8791d63

Please sign in to comment.