Skip to content

Commit

Permalink
[media] imon: don't parse scancodes until intf configured
Browse files Browse the repository at this point in the history
The imon devices have either 1 or 2 usb interfaces on them, each wired
up to its own urb callback. The interface 0 urb callback is wired up
before the imon context's rc_dev pointer is filled in, which is
necessary for imon 0xffdc device auto-detection to work properly, but we
need to make sure we don't actually run the callback routines until
we've entirely filled in the necessary bits for each given interface,
lest we wind up oopsing. Technically, any imon device could have hit
this, but the issue is exacerbated on the 0xffdc devices, which send a
constant stream of interrupts, even when they have no valid key data.

CC: Andy Walls <awalls@md.metrocast.net>
CC: Chris W <lkml@psychogeeks.com>
Reported-by: Chris W <lkml@psychogeeks.com>
Signed-off-by: Jarod Wilson <jarod@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
  • Loading branch information
Jarod Wilson authored and Mauro Carvalho Chehab committed Sep 21, 2011
1 parent 59152b1 commit 6f6b90c
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions drivers/media/rc/imon.c
Original file line number Diff line number Diff line change
Expand Up @@ -1658,7 +1658,7 @@ static void usb_rx_callback_intf0(struct urb *urb)
return;

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

switch (urb->status) {
Expand Down Expand Up @@ -1690,7 +1690,7 @@ static void usb_rx_callback_intf1(struct urb *urb)
return;

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

switch (urb->status) {
Expand Down Expand Up @@ -2118,7 +2118,6 @@ static struct imon_context *imon_init_intf0(struct usb_interface *intf)

ictx->dev = dev;
ictx->usbdev_intf0 = usb_get_dev(interface_to_usbdev(intf));
ictx->dev_present_intf0 = true;
ictx->rx_urb_intf0 = rx_urb;
ictx->tx_urb = tx_urb;
ictx->rf_device = false;
Expand Down Expand Up @@ -2157,6 +2156,8 @@ static struct imon_context *imon_init_intf0(struct usb_interface *intf)
goto rdev_setup_failed;
}

ictx->dev_present_intf0 = true;

mutex_unlock(&ictx->lock);
return ictx;

Expand Down Expand Up @@ -2200,7 +2201,6 @@ static struct imon_context *imon_init_intf1(struct usb_interface *intf,
}

ictx->usbdev_intf1 = usb_get_dev(interface_to_usbdev(intf));
ictx->dev_present_intf1 = true;
ictx->rx_urb_intf1 = rx_urb;

ret = -ENODEV;
Expand Down Expand Up @@ -2229,6 +2229,8 @@ static struct imon_context *imon_init_intf1(struct usb_interface *intf,
goto urb_submit_failed;
}

ictx->dev_present_intf1 = true;

mutex_unlock(&ictx->lock);
return ictx;

Expand Down

0 comments on commit 6f6b90c

Please sign in to comment.