Re: [PATCH 1/2] media/rc/imon.c: make send_packet() delayconfigurable

From: Kevin Baradon
Date: Sun Mar 17 2013 - 11:07:16 EST


Le Thu, 14 Mar 2013 12:01:53 -0300,
Mauro Carvalho Chehab <mchehab@xxxxxxxxxx> a Ãcrit :

> Em Sun, 24 Feb 2013 21:19:29 +0100
> Kevin Baradon <kevin.baradon@xxxxxxxxx> escreveu:
>
> > Some imon devices (like 15c2:0036) need a higher delay between send_packet calls.
> > Default value is still 5ms to avoid regressions on already working hardware.
> >
> > Also use interruptible wait to avoid load average going too high (and let caller handle signals).
> >
> > Signed-off-by: Kevin Baradon <kevin.baradon@xxxxxxxxx>
> > ---
> > drivers/media/rc/imon.c | 14 +++++++++++---
> > 1 file changed, 11 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/media/rc/imon.c b/drivers/media/rc/imon.c
> > index 78d109b..a3e66a0 100644
> > --- a/drivers/media/rc/imon.c
> > +++ b/drivers/media/rc/imon.c
> > @@ -347,6 +347,11 @@ module_param(pad_stabilize, int, S_IRUGO | S_IWUSR);
> > MODULE_PARM_DESC(pad_stabilize, "Apply stabilization algorithm to iMON PAD "
> > "presses in arrow key mode. 0=disable, 1=enable (default).");
> >
> > +static unsigned int send_packet_delay = 5;
> > +module_param(send_packet_delay, uint, S_IRUGO | S_IWUSR);
> > +MODULE_PARM_DESC(send_packet_delay, "Minimum delay between send_packet() calls "
> > + "(default 5ms)");
> > +
>
> Users will find a hard time discovering what delay is needed for each device.
>
> If this is a per-device type property, then it should, instead, be associated
> with the device's USB ID.
>
> The better would be to encapsulate it at the USB device table, like adding a
> NEED_(extra)_DELAY flag, like:
>
> { USB_DEVICE(0x15c2, 0x0036), .driver_info = NEED_10MS_DELAY },
>
> If such flag is zero (like on all devices where .driver_info is not filled, as
> Kernel zeroes the memory on all static vars), then it will keep using 5ms.
>
> Another alternative would be to use .driver_info for the device type, and
> add a logic to handle different types with different logic. This is what
> mceusb.c does, for example.
>

Hi,

Please find below an updated patch: