Re: [PATCH 0/4] Some IR fixes for I2C devices on em28xx

2013-01-08 Thread Frank Schäfer
Am 07.01.2013 18:04, schrieb Mauro Carvalho Chehab:
> Em Sun, 06 Jan 2013 21:20:31 +0100
> Frank Schäfer  escreveu:
>
>> Am 05.01.2013 16:06, schrieb Mauro Carvalho Chehab:
>>> Em Sat, 05 Jan 2013 14:22:08 +0100
>>> Frank Schäfer  escreveu:
>>>
 Am 04.01.2013 22:15, schrieb Mauro Carvalho Chehab:
> Frank pointed that IR was not working with I2C devices. So, I took some
> time to fix them.
>
> Tested with Hauppauge WinTV USB2.
>
> Mauro Carvalho Chehab (4):
>   [media] em28xx: initialize button/I2C IR earlier
>   [media] em28xx: autoload em28xx-rc if the device has an I2C IR
>   [media] em28xx: simplify IR names on I2C devices
>   [media] em28xx: tell ir-kbd-i2c that WinTV uses an RC5 protocol
>
>  drivers/media/usb/em28xx/em28xx-cards.c |  2 +-
>  drivers/media/usb/em28xx/em28xx-input.c | 29 
> -
>  2 files changed, 17 insertions(+), 14 deletions(-)
>
 While these patches make I2C IR remote controls working again, they
 leave several issues unaddressed which should really be fixed:
 1) the i2c client isn't unregistered on module unload. This was the
 reason for patch 2 in my series. There is also a FIXME comment about
 this in em28xx_release_resources() (although this is the wrong place to
 do it).
>>> AFAIKT, this is not really needed, as the I2C clients are unregistered
>>> when the I2C bus is unregistered.
>>>
>>> So, a device disconnect will release it. Also, an em28xx driver unload.
>>>
>>> The only difference might be if just ir-kbd-i2c and em28xx-rc are
>>> unloaded, but em28xx is still loaded, but I think that, even on this
>>> case, calling the .release code for an I2C bus will release it.
>>>
>>> So, I don't see any need for such patch. I might be wrong, of course, but,
>>> in order to proof that a release code is needed, you'll need to check if
>>> some memory are lost after module load/unload.
>> Mauro, just because code luckily 'works' in the current constellation,
>> it isn't necessarily good code.
> It doesn't luckly 'works'. It is rock solid. 

I disagree here.

> There were really few bug
> reports for ir-kbd-i2c during all those years.

Yeah, but not because the code is so good. ;)
Getting no bug reports doesn't mean that the code is good quality / bug
free (in fact is was broken for a long time).
The 3 main reasons are
1) noone uses the hardware (because it's old, because it's completely
broken, ...)
2) noone want's to report bugs (because they don't know where, think
it's a waste of time, ...)
3) the bugs are reported somewhere else (distros) but not processed /
forwared properly

>> It's this kind of issues that can easily cause regressions if the code
>> changes somewhere else.
> Nah. What causes regression is touching on a code that works for no
> good reason and without enough testing.
>
> Btw, I was told that audio on HVR-950 seemed to stop working.

Yes, and there was another similar bug report recently...

> Not sure what broke it, but, as I tested it some time ago, I suspect
> was due to one of those recent patches (v4l2-compliance, vb2 or your
> patches - we need to bisect to discover what broke it). 

I don't think it was one of those changes.
AFAICS, the bug reports arrived before thes patches were applied.

> None of those
> touched on em28xx-alsa directly, but perhaps one of the patches had
> a bad side effect.

I've done a quick test with my devices but can't reproduce it. And I
didn't look into the audio code too deep yet.
We should ask for further details.


[...]

 3) All RC maps should be assigned at the same place, no matter if the
 receiver/demodulator is built in or external. Spreading them over the
 code is inconsistent and makes the code bug prone.
>>> I don't agree. It is better to keep RC maps for those devices together
>>> with the RC protocol setting, get_key config, etc. At boards config,
>>> it is very easy to identify I2C IR's, as there's an special field there
>>> to mark those devices (has_ir_i2c). So, if the board has_ir_i2c, the
>>> IR config is inside em28xx-input. 
>> ... which is exactly what made it so easy to cause this regression !!!
>>
>> It's not obvious for programmers that no RC map has to be specified for
>> i2c RCs in the board data.
>> It's also not obvious that em28xx-input silently overwrites the rc-map
>> assigned at board level.
>> In general, it's not obvious that two completely different code areas
>> have to be touched for these devices.
>> That's why we really should avoid those board specific code parts spread
>> all over the driver as much as possible.
>> In case of the RC map it's really easy.
>>
>> I also fail to see what you would loose in em28xx-input. We would still
>> assign the RC map to dev->init_data.
>> If you prefer seeing the used RC map in the em28xx-input code directly,
>> then the same should apply for devices with built-in IR
>> recceiver/decoder (which means moving all rc-map assignme

Re: [PATCH 0/4] Some IR fixes for I2C devices on em28xx

2013-01-07 Thread Mauro Carvalho Chehab
Em Sun, 06 Jan 2013 21:20:31 +0100
Frank Schäfer  escreveu:

> Am 05.01.2013 16:06, schrieb Mauro Carvalho Chehab:
> > Em Sat, 05 Jan 2013 14:22:08 +0100
> > Frank Schäfer  escreveu:
> >
> >> Am 04.01.2013 22:15, schrieb Mauro Carvalho Chehab:
> >>> Frank pointed that IR was not working with I2C devices. So, I took some
> >>> time to fix them.
> >>>
> >>> Tested with Hauppauge WinTV USB2.
> >>>
> >>> Mauro Carvalho Chehab (4):
> >>>   [media] em28xx: initialize button/I2C IR earlier
> >>>   [media] em28xx: autoload em28xx-rc if the device has an I2C IR
> >>>   [media] em28xx: simplify IR names on I2C devices
> >>>   [media] em28xx: tell ir-kbd-i2c that WinTV uses an RC5 protocol
> >>>
> >>>  drivers/media/usb/em28xx/em28xx-cards.c |  2 +-
> >>>  drivers/media/usb/em28xx/em28xx-input.c | 29 
> >>> -
> >>>  2 files changed, 17 insertions(+), 14 deletions(-)
> >>>
> >> While these patches make I2C IR remote controls working again, they
> >> leave several issues unaddressed which should really be fixed:
> >> 1) the i2c client isn't unregistered on module unload. This was the
> >> reason for patch 2 in my series. There is also a FIXME comment about
> >> this in em28xx_release_resources() (although this is the wrong place to
> >> do it).
> > AFAIKT, this is not really needed, as the I2C clients are unregistered
> > when the I2C bus is unregistered.
> >
> > So, a device disconnect will release it. Also, an em28xx driver unload.
> >
> > The only difference might be if just ir-kbd-i2c and em28xx-rc are
> > unloaded, but em28xx is still loaded, but I think that, even on this
> > case, calling the .release code for an I2C bus will release it.
> >
> > So, I don't see any need for such patch. I might be wrong, of course, but,
> > in order to proof that a release code is needed, you'll need to check if
> > some memory are lost after module load/unload.
> 
> Mauro, just because code luckily 'works' in the current constellation,
> it isn't necessarily good code.

It doesn't luckly 'works'. It is rock solid. There were really few bug
reports for ir-kbd-i2c during all those years.

> It's this kind of issues that can easily cause regressions if the code
> changes somewhere else.

Nah. What causes regression is touching on a code that works for no
good reason and without enough testing.

Btw, I was told that audio on HVR-950 seemed to stop working.

Not sure what broke it, but, as I tested it some time ago, I suspect
was due to one of those recent patches (v4l2-compliance, vb2 or your
patches - we need to bisect to discover what broke it). None of those
touched on em28xx-alsa directly, but perhaps one of the patches had
a bad side effect.

> em28xx-input registers the i2c device, so it should unregister it on
> uninit/close/unload, too.
> Pretty simple and easy to fix (+5 - 2 = 3 additional lines of code).

Fair enough. Please send us a patch, after enough testing.

> >> 2) there is no error checking in em28xx_register_i2c_ir().
> >> em28xx_ir_init should really bail out if no i2c device is found.
> > A failure to initialize IR should not be fatal for the driver, as the
> > rest of the hardware still works.
> 
> I'm talking about em28xx-input and the RC part only. Of course not the
> whole driver.
> Do you really want to load module ir-kbd-i2c even though there is no
> device ?
> 
> 
> > Also, there's no way to warrant that the I2C code is actually running,
> > as ir-i2c-kbd may not even be compiled.
> >
> > So, returning 0 there doesn't mean that IR is working.
> 
> You can check the success of request_module.

> The whole thing is really easy to fix, I fail to see why you don't want
> to do it.

Ok, such change may make sense, but only as a separate patch, and not as
a big "fix" patch that does something else.

> 
> >> 3) All RC maps should be assigned at the same place, no matter if the
> >> receiver/demodulator is built in or external. Spreading them over the
> >> code is inconsistent and makes the code bug prone.
> > I don't agree. It is better to keep RC maps for those devices together
> > with the RC protocol setting, get_key config, etc. At boards config,
> > it is very easy to identify I2C IR's, as there's an special field there
> > to mark those devices (has_ir_i2c). So, if the board has_ir_i2c, the
> > IR config is inside em28xx-input. 
> 
> ... which is exactly what made it so easy to cause this regression !!!
> 
> It's not obvious for programmers that no RC map has to be specified for
> i2c RCs in the board data.
> It's also not obvious that em28xx-input silently overwrites the rc-map
> assigned at board level.
> In general, it's not obvious that two completely different code areas
> have to be touched for these devices.
> That's why we really should avoid those board specific code parts spread
> all over the driver as much as possible.
> In case of the RC map it's really easy.
> 
> I also fail to see what you would loose in em28xx-input. We would still
> assign the RC map to dev->ini

Re: [PATCH 0/4] Some IR fixes for I2C devices on em28xx

2013-01-07 Thread Mauro Carvalho Chehab
Em Sun, 06 Jan 2013 21:26:46 +0100
Frank Schäfer  escreveu:

> Am 05.01.2013 16:35, schrieb Mauro Carvalho Chehab:
> > Em Sat, 05 Jan 2013 14:42:10 +0100
> > Frank Schäfer  escreveu:
> >
> >> Am 05.01.2013 14:22, schrieb Frank Schäfer:
> >>> Am 04.01.2013 22:15, schrieb Mauro Carvalho Chehab:
>  Frank pointed that IR was not working with I2C devices. So, I took some
>  time to fix them.
> 
>  Tested with Hauppauge WinTV USB2.
> 
>  Mauro Carvalho Chehab (4):
>    [media] em28xx: initialize button/I2C IR earlier
>    [media] em28xx: autoload em28xx-rc if the device has an I2C IR
>    [media] em28xx: simplify IR names on I2C devices
>    [media] em28xx: tell ir-kbd-i2c that WinTV uses an RC5 protocol
> 
>   drivers/media/usb/em28xx/em28xx-cards.c |  2 +-
>   drivers/media/usb/em28xx/em28xx-input.c | 29 
>  -
>   2 files changed, 17 insertions(+), 14 deletions(-)
> 
> >>> While these patches make I2C IR remote controls working again, they
> >>> leave several issues unaddressed which should really be fixed:
> >>> 1) the i2c client isn't unregistered on module unload. This was the
> >>> reason for patch 2 in my series. There is also a FIXME comment about
> >>> this in em28xx_release_resources() (although this is the wrong place to
> >>> do it).
> >>> 2) there is no error checking in em28xx_register_i2c_ir().
> >>> em28xx_ir_init should really bail out if no i2c device is found.
> >>> 3) All RC maps should be assigned at the same place, no matter if the
> >>> receiver/demodulator is built in or external. Spreading them over the
> >>> code is inconsistent and makes the code bug prone.
> >>> 4) the list of known i2c devices in em28xx-i2c.c misses client address
> >>> 0x3e >> 1 = 0x1f. See client list in em28xx_register_i2c_ir().
> >>> 5) there should be a warning message for the case that we call
> >>> ir-kbd-i2c with an unknown rc device.
> >>> 6) because we use our own key polling functions with ir-kbd-i2c, we
> >>> should also select the polling interval value manually. That makes
> >>> things consistent and avoids confusion.
> >>>
> >>> The rest is a matter of taste / prefered code layout. I'm fine with it.
> >>>
> >>> Regards,
> >>> Frank
> >> It seems like already applied them... :(
> >>
> >> While I certainly appreciate patches beeing applied as soon as possible,
> >> I think there should really be a chance to review them before this happens.
> >> Especially when the changes are non-trivial and someone else has posted
> >> patches addressing the same issues before (other contributers might feel
> >> offended ;) ).
> > All the 4 applied patches are really trivial:
> > - patch 1: just reorder existing code;
> > - patch 2: one-line patch adding another condition to an existing if;
> > - patch 3: pure string rename;
> > - patch 4: one line patch properly reporting the RC5 protocol on WinTV.
> 
> Just because a patch "just reorders existing code" or "just changes a
> single line" it's not automatically trivial.

True, but this is not the case of all the above ones: all of them are obvious,
and do what are described there.

> I'm sure you have seen more cases than me in which it were patches like
> this who caused big trouble. ;)

Trivial patches are known to cause troubles, just like any other code change.

The thing is that trivial patches are:
1) easy to review, especially when properly described;
2) when they're wrong, easy to fix;
3) easy to get them accepted/merged at stable kernels.

In any case, if you found any breakage caused by the above patches, feel
free to send a patch fixing it.

If you're concerned with other things that aren't there, send in separate.

The rule is one patch by each logical change.

> Yeah, I understand your time problems and I really appreciate patches
> beeing applied as soon as possible (after they have been reviewed).
> But delaying a patch for a few days really shouldn't cause too much
> extra work.

It causes, as my main work is unrelated to drivers/media maintenance.
So, it may take weeks for me to be able to get a time slice big enough
for installing a kernel on my test machines and re-test some code.

Cheers,
Mauro
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 0/4] Some IR fixes for I2C devices on em28xx

2013-01-06 Thread Frank Schäfer
Am 05.01.2013 16:35, schrieb Mauro Carvalho Chehab:
> Em Sat, 05 Jan 2013 14:42:10 +0100
> Frank Schäfer  escreveu:
>
>> Am 05.01.2013 14:22, schrieb Frank Schäfer:
>>> Am 04.01.2013 22:15, schrieb Mauro Carvalho Chehab:
 Frank pointed that IR was not working with I2C devices. So, I took some
 time to fix them.

 Tested with Hauppauge WinTV USB2.

 Mauro Carvalho Chehab (4):
   [media] em28xx: initialize button/I2C IR earlier
   [media] em28xx: autoload em28xx-rc if the device has an I2C IR
   [media] em28xx: simplify IR names on I2C devices
   [media] em28xx: tell ir-kbd-i2c that WinTV uses an RC5 protocol

  drivers/media/usb/em28xx/em28xx-cards.c |  2 +-
  drivers/media/usb/em28xx/em28xx-input.c | 29 -
  2 files changed, 17 insertions(+), 14 deletions(-)

>>> While these patches make I2C IR remote controls working again, they
>>> leave several issues unaddressed which should really be fixed:
>>> 1) the i2c client isn't unregistered on module unload. This was the
>>> reason for patch 2 in my series. There is also a FIXME comment about
>>> this in em28xx_release_resources() (although this is the wrong place to
>>> do it).
>>> 2) there is no error checking in em28xx_register_i2c_ir().
>>> em28xx_ir_init should really bail out if no i2c device is found.
>>> 3) All RC maps should be assigned at the same place, no matter if the
>>> receiver/demodulator is built in or external. Spreading them over the
>>> code is inconsistent and makes the code bug prone.
>>> 4) the list of known i2c devices in em28xx-i2c.c misses client address
>>> 0x3e >> 1 = 0x1f. See client list in em28xx_register_i2c_ir().
>>> 5) there should be a warning message for the case that we call
>>> ir-kbd-i2c with an unknown rc device.
>>> 6) because we use our own key polling functions with ir-kbd-i2c, we
>>> should also select the polling interval value manually. That makes
>>> things consistent and avoids confusion.
>>>
>>> The rest is a matter of taste / prefered code layout. I'm fine with it.
>>>
>>> Regards,
>>> Frank
>> It seems like already applied them... :(
>>
>> While I certainly appreciate patches beeing applied as soon as possible,
>> I think there should really be a chance to review them before this happens.
>> Especially when the changes are non-trivial and someone else has posted
>> patches addressing the same issues before (other contributers might feel
>> offended ;) ).
> All the 4 applied patches are really trivial:
>   - patch 1: just reorder existing code;
>   - patch 2: one-line patch adding another condition to an existing if;
>   - patch 3: pure string rename;
>   - patch 4: one line patch properly reporting the RC5 protocol on WinTV.

Just because a patch "just reorders existing code" or "just changes a
single line" it's not automatically trivial.
I'm sure you have seen more cases than me in which it were patches like
this who caused big trouble. ;)

And especially in cases where the changes are under discussion (which I
would say is the case when someone else has posted patches addressing
the same issues before) there should be a minimum chance to react on them.
Isn't that what you would expect from others, too ? ;)

Apart from that, there are also lots of other 'trivial' patches rotting
at patchwork or bugzilla...

> Also, my time is very limited, especially when I need to test a driver, as
> I need to allocate a bigger time window. On such cases, I just reorder the
> patches to to apply all of them at the same time, to optimize my time.

Yeah, I understand your time problems and I really appreciate patches
beeing applied as soon as possible (after they have been reviewed).
But delaying a patch for a few days really shouldn't cause too much
extra work.

> Also, both Devin and you are working right now at the same driver, and you
> both have pending work. Merging the patches quicker helps to avoid merge
> conflicts.

100% agreement, although I don't think these patches are causing any
problems here.

Regards,
Frank

> Regards,
> Mauro

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 0/4] Some IR fixes for I2C devices on em28xx

2013-01-06 Thread Frank Schäfer
Am 05.01.2013 16:06, schrieb Mauro Carvalho Chehab:
> Em Sat, 05 Jan 2013 14:22:08 +0100
> Frank Schäfer  escreveu:
>
>> Am 04.01.2013 22:15, schrieb Mauro Carvalho Chehab:
>>> Frank pointed that IR was not working with I2C devices. So, I took some
>>> time to fix them.
>>>
>>> Tested with Hauppauge WinTV USB2.
>>>
>>> Mauro Carvalho Chehab (4):
>>>   [media] em28xx: initialize button/I2C IR earlier
>>>   [media] em28xx: autoload em28xx-rc if the device has an I2C IR
>>>   [media] em28xx: simplify IR names on I2C devices
>>>   [media] em28xx: tell ir-kbd-i2c that WinTV uses an RC5 protocol
>>>
>>>  drivers/media/usb/em28xx/em28xx-cards.c |  2 +-
>>>  drivers/media/usb/em28xx/em28xx-input.c | 29 -
>>>  2 files changed, 17 insertions(+), 14 deletions(-)
>>>
>> While these patches make I2C IR remote controls working again, they
>> leave several issues unaddressed which should really be fixed:
>> 1) the i2c client isn't unregistered on module unload. This was the
>> reason for patch 2 in my series. There is also a FIXME comment about
>> this in em28xx_release_resources() (although this is the wrong place to
>> do it).
> AFAIKT, this is not really needed, as the I2C clients are unregistered
> when the I2C bus is unregistered.
>
> So, a device disconnect will release it. Also, an em28xx driver unload.
>
> The only difference might be if just ir-kbd-i2c and em28xx-rc are
> unloaded, but em28xx is still loaded, but I think that, even on this
> case, calling the .release code for an I2C bus will release it.
>
> So, I don't see any need for such patch. I might be wrong, of course, but,
> in order to proof that a release code is needed, you'll need to check if
> some memory are lost after module load/unload.

Mauro, just because code luckily 'works' in the current constellation,
it isn't necessarily good code.
It's this kind of issues that can easily cause regressions if the code
changes somewhere else.

em28xx-input registers the i2c device, so it should unregister it on
uninit/close/unload, too.
Pretty simple and easy to fix (+5 - 2 = 3 additional lines of code).

>> 2) there is no error checking in em28xx_register_i2c_ir().
>> em28xx_ir_init should really bail out if no i2c device is found.
> A failure to initialize IR should not be fatal for the driver, as the
> rest of the hardware still works.

I'm talking about em28xx-input and the RC part only. Of course not the
whole driver.
Do you really want to load module ir-kbd-i2c even though there is no
device ?


> Also, there's no way to warrant that the I2C code is actually running,
> as ir-i2c-kbd may not even be compiled.
>
> So, returning 0 there doesn't mean that IR is working.

You can check the success of request_module.

The whole thing is really easy to fix, I fail to see why you don't want
to do it.

>> 3) All RC maps should be assigned at the same place, no matter if the
>> receiver/demodulator is built in or external. Spreading them over the
>> code is inconsistent and makes the code bug prone.
> I don't agree. It is better to keep RC maps for those devices together
> with the RC protocol setting, get_key config, etc. At boards config,
> it is very easy to identify I2C IR's, as there's an special field there
> to mark those devices (has_ir_i2c). So, if the board has_ir_i2c, the
> IR config is inside em28xx-input. 

... which is exactly what made it so easy to cause this regression !!!

It's not obvious for programmers that no RC map has to be specified for
i2c RCs in the board data.
It's also not obvious that em28xx-input silently overwrites the rc-map
assigned at board level.
In general, it's not obvious that two completely different code areas
have to be touched for these devices.
That's why we really should avoid those board specific code parts spread
all over the driver as much as possible.
In case of the RC map it's really easy.

I also fail to see what you would loose in em28xx-input. We would still
assign the RC map to dev->init_data.
If you prefer seeing the used RC map in the em28xx-input code directly,
then the same should apply for devices with built-in IR
recceiver/decoder (which means moving all rc-map assignments to
em28xx-input).
You could also get rid of field ir_codes this way.

> That's the same logic that it is
> there for has_dvb: if this field is true, the DVB specifics is inside
> em28xx-dvb.

Different case.
Avoiding board specific code parts there likely isn't possible (and
reasonable), although it should be the goal.

>> 4) the list of known i2c devices in em28xx-i2c.c misses client address
>> 0x3e >> 1 = 0x1f. See client list in em28xx_register_i2c_ir().
> Ok. Separate patch, please.

Coming soon.

>> 5) there should be a warning message for the case that we call
>> ir-kbd-i2c with an unknown rc device.
> Why? All boards with has_ir_i2c have entries there. I double-checked.
> Adding will just bloat the code with no reason. We just need to take
> care if we get a patch adding I2C IR support for an old c

Re: [PATCH 0/4] Some IR fixes for I2C devices on em28xx

2013-01-05 Thread Mauro Carvalho Chehab
Em Sat, 05 Jan 2013 14:42:10 +0100
Frank Schäfer  escreveu:

> Am 05.01.2013 14:22, schrieb Frank Schäfer:
> > Am 04.01.2013 22:15, schrieb Mauro Carvalho Chehab:
> >> Frank pointed that IR was not working with I2C devices. So, I took some
> >> time to fix them.
> >>
> >> Tested with Hauppauge WinTV USB2.
> >>
> >> Mauro Carvalho Chehab (4):
> >>   [media] em28xx: initialize button/I2C IR earlier
> >>   [media] em28xx: autoload em28xx-rc if the device has an I2C IR
> >>   [media] em28xx: simplify IR names on I2C devices
> >>   [media] em28xx: tell ir-kbd-i2c that WinTV uses an RC5 protocol
> >>
> >>  drivers/media/usb/em28xx/em28xx-cards.c |  2 +-
> >>  drivers/media/usb/em28xx/em28xx-input.c | 29 -
> >>  2 files changed, 17 insertions(+), 14 deletions(-)
> >>
> > While these patches make I2C IR remote controls working again, they
> > leave several issues unaddressed which should really be fixed:
> > 1) the i2c client isn't unregistered on module unload. This was the
> > reason for patch 2 in my series. There is also a FIXME comment about
> > this in em28xx_release_resources() (although this is the wrong place to
> > do it).
> > 2) there is no error checking in em28xx_register_i2c_ir().
> > em28xx_ir_init should really bail out if no i2c device is found.
> > 3) All RC maps should be assigned at the same place, no matter if the
> > receiver/demodulator is built in or external. Spreading them over the
> > code is inconsistent and makes the code bug prone.
> > 4) the list of known i2c devices in em28xx-i2c.c misses client address
> > 0x3e >> 1 = 0x1f. See client list in em28xx_register_i2c_ir().
> > 5) there should be a warning message for the case that we call
> > ir-kbd-i2c with an unknown rc device.
> > 6) because we use our own key polling functions with ir-kbd-i2c, we
> > should also select the polling interval value manually. That makes
> > things consistent and avoids confusion.
> >
> > The rest is a matter of taste / prefered code layout. I'm fine with it.
> >
> > Regards,
> > Frank
> 
> It seems like already applied them... :(
> 
> While I certainly appreciate patches beeing applied as soon as possible,
> I think there should really be a chance to review them before this happens.
> Especially when the changes are non-trivial and someone else has posted
> patches addressing the same issues before (other contributers might feel
> offended ;) ).

All the 4 applied patches are really trivial:
- patch 1: just reorder existing code;
- patch 2: one-line patch adding another condition to an existing if;
- patch 3: pure string rename;
- patch 4: one line patch properly reporting the RC5 protocol on WinTV.

Also, my time is very limited, especially when I need to test a driver, as
I need to allocate a bigger time window. On such cases, I just reorder the
patches to to apply all of them at the same time, to optimize my time.

Also, both Devin and you are working right now at the same driver, and you
both have pending work. Merging the patches quicker helps to avoid merge
conflicts.

Regards,
Mauro
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 0/4] Some IR fixes for I2C devices on em28xx

2013-01-05 Thread Mauro Carvalho Chehab
Em Sat, 05 Jan 2013 14:22:08 +0100
Frank Schäfer  escreveu:

> Am 04.01.2013 22:15, schrieb Mauro Carvalho Chehab:
> > Frank pointed that IR was not working with I2C devices. So, I took some
> > time to fix them.
> >
> > Tested with Hauppauge WinTV USB2.
> >
> > Mauro Carvalho Chehab (4):
> >   [media] em28xx: initialize button/I2C IR earlier
> >   [media] em28xx: autoload em28xx-rc if the device has an I2C IR
> >   [media] em28xx: simplify IR names on I2C devices
> >   [media] em28xx: tell ir-kbd-i2c that WinTV uses an RC5 protocol
> >
> >  drivers/media/usb/em28xx/em28xx-cards.c |  2 +-
> >  drivers/media/usb/em28xx/em28xx-input.c | 29 -
> >  2 files changed, 17 insertions(+), 14 deletions(-)
> >
> 
> While these patches make I2C IR remote controls working again, they
> leave several issues unaddressed which should really be fixed:
> 1) the i2c client isn't unregistered on module unload. This was the
> reason for patch 2 in my series. There is also a FIXME comment about
> this in em28xx_release_resources() (although this is the wrong place to
> do it).

AFAIKT, this is not really needed, as the I2C clients are unregistered
when the I2C bus is unregistered.

So, a device disconnect will release it. Also, an em28xx driver unload.

The only difference might be if just ir-kbd-i2c and em28xx-rc are
unloaded, but em28xx is still loaded, but I think that, even on this
case, calling the .release code for an I2C bus will release it.

So, I don't see any need for such patch. I might be wrong, of course, but,
in order to proof that a release code is needed, you'll need to check if
some memory are lost after module load/unload.

> 2) there is no error checking in em28xx_register_i2c_ir().
> em28xx_ir_init should really bail out if no i2c device is found.

A failure to initialize IR should not be fatal for the driver, as the
rest of the hardware still works.

Also, there's no way to warrant that the I2C code is actually running,
as ir-i2c-kbd may not even be compiled.

So, returning 0 there doesn't mean that IR is working.

> 3) All RC maps should be assigned at the same place, no matter if the
> receiver/demodulator is built in or external. Spreading them over the
> code is inconsistent and makes the code bug prone.

I don't agree. It is better to keep RC maps for those devices together
with the RC protocol setting, get_key config, etc. At boards config,
it is very easy to identify I2C IR's, as there's an special field there
to mark those devices (has_ir_i2c). So, if the board has_ir_i2c, the
IR config is inside em28xx-input. That's the same logic that it is
there for has_dvb: if this field is true, the DVB specifics is inside
em28xx-dvb.

> 4) the list of known i2c devices in em28xx-i2c.c misses client address
> 0x3e >> 1 = 0x1f. See client list in em28xx_register_i2c_ir().

Ok. Separate patch, please.

> 5) there should be a warning message for the case that we call
> ir-kbd-i2c with an unknown rc device.

Why? All boards with has_ir_i2c have entries there. I double-checked.
Adding will just bloat the code with no reason. We just need to take
care if we get a patch adding I2C IR support for an old card, to be
sure that data is filled on both places.

Considering that we don't receive any IR I2C code for several years,
and that newer devices won't use that part of the code, it seems highly
unlikely that such code would be ever used.

> 6) because we use our own key polling functions with ir-kbd-i2c, we
> should also select the polling interval value manually. That makes
> things consistent and avoids confusion.

I disagree. The polling interval is mainly dictated by the RC protocol
used (e. g. the minimal time for a repeat code) and by the speed that 
users can type things. It is typically ~100 ms everywhere, except when
there are some exceptional cases, like GPIO polling.

Regards,
Mauro
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 0/4] Some IR fixes for I2C devices on em28xx

2013-01-05 Thread Frank Schäfer
Am 05.01.2013 14:22, schrieb Frank Schäfer:
> Am 04.01.2013 22:15, schrieb Mauro Carvalho Chehab:
>> Frank pointed that IR was not working with I2C devices. So, I took some
>> time to fix them.
>>
>> Tested with Hauppauge WinTV USB2.
>>
>> Mauro Carvalho Chehab (4):
>>   [media] em28xx: initialize button/I2C IR earlier
>>   [media] em28xx: autoload em28xx-rc if the device has an I2C IR
>>   [media] em28xx: simplify IR names on I2C devices
>>   [media] em28xx: tell ir-kbd-i2c that WinTV uses an RC5 protocol
>>
>>  drivers/media/usb/em28xx/em28xx-cards.c |  2 +-
>>  drivers/media/usb/em28xx/em28xx-input.c | 29 -
>>  2 files changed, 17 insertions(+), 14 deletions(-)
>>
> While these patches make I2C IR remote controls working again, they
> leave several issues unaddressed which should really be fixed:
> 1) the i2c client isn't unregistered on module unload. This was the
> reason for patch 2 in my series. There is also a FIXME comment about
> this in em28xx_release_resources() (although this is the wrong place to
> do it).
> 2) there is no error checking in em28xx_register_i2c_ir().
> em28xx_ir_init should really bail out if no i2c device is found.
> 3) All RC maps should be assigned at the same place, no matter if the
> receiver/demodulator is built in or external. Spreading them over the
> code is inconsistent and makes the code bug prone.
> 4) the list of known i2c devices in em28xx-i2c.c misses client address
> 0x3e >> 1 = 0x1f. See client list in em28xx_register_i2c_ir().
> 5) there should be a warning message for the case that we call
> ir-kbd-i2c with an unknown rc device.
> 6) because we use our own key polling functions with ir-kbd-i2c, we
> should also select the polling interval value manually. That makes
> things consistent and avoids confusion.
>
> The rest is a matter of taste / prefered code layout. I'm fine with it.
>
> Regards,
> Frank

It seems like already applied them... :(

While I certainly appreciate patches beeing applied as soon as possible,
I think there should really be a chance to review them before this happens.
Especially when the changes are non-trivial and someone else has posted
patches addressing the same issues before (other contributers might feel
offended ;) ).

Care to fix these issues ?

Regards,
Frank



--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 0/4] Some IR fixes for I2C devices on em28xx

2013-01-05 Thread Frank Schäfer
Am 04.01.2013 22:15, schrieb Mauro Carvalho Chehab:
> Frank pointed that IR was not working with I2C devices. So, I took some
> time to fix them.
>
> Tested with Hauppauge WinTV USB2.
>
> Mauro Carvalho Chehab (4):
>   [media] em28xx: initialize button/I2C IR earlier
>   [media] em28xx: autoload em28xx-rc if the device has an I2C IR
>   [media] em28xx: simplify IR names on I2C devices
>   [media] em28xx: tell ir-kbd-i2c that WinTV uses an RC5 protocol
>
>  drivers/media/usb/em28xx/em28xx-cards.c |  2 +-
>  drivers/media/usb/em28xx/em28xx-input.c | 29 -
>  2 files changed, 17 insertions(+), 14 deletions(-)
>

While these patches make I2C IR remote controls working again, they
leave several issues unaddressed which should really be fixed:
1) the i2c client isn't unregistered on module unload. This was the
reason for patch 2 in my series. There is also a FIXME comment about
this in em28xx_release_resources() (although this is the wrong place to
do it).
2) there is no error checking in em28xx_register_i2c_ir().
em28xx_ir_init should really bail out if no i2c device is found.
3) All RC maps should be assigned at the same place, no matter if the
receiver/demodulator is built in or external. Spreading them over the
code is inconsistent and makes the code bug prone.
4) the list of known i2c devices in em28xx-i2c.c misses client address
0x3e >> 1 = 0x1f. See client list in em28xx_register_i2c_ir().
5) there should be a warning message for the case that we call
ir-kbd-i2c with an unknown rc device.
6) because we use our own key polling functions with ir-kbd-i2c, we
should also select the polling interval value manually. That makes
things consistent and avoids confusion.

The rest is a matter of taste / prefered code layout. I'm fine with it.

Regards,
Frank
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 0/4] Some IR fixes for I2C devices on em28xx

2013-01-04 Thread Mauro Carvalho Chehab
Frank pointed that IR was not working with I2C devices. So, I took some
time to fix them.

Tested with Hauppauge WinTV USB2.

Mauro Carvalho Chehab (4):
  [media] em28xx: initialize button/I2C IR earlier
  [media] em28xx: autoload em28xx-rc if the device has an I2C IR
  [media] em28xx: simplify IR names on I2C devices
  [media] em28xx: tell ir-kbd-i2c that WinTV uses an RC5 protocol

 drivers/media/usb/em28xx/em28xx-cards.c |  2 +-
 drivers/media/usb/em28xx/em28xx-input.c | 29 -
 2 files changed, 17 insertions(+), 14 deletions(-)

-- 
1.7.11.7

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html