From: Mauro Carvalho Chehab <mchehab@redhat.com>
To: Jarod Wilson <jarod@redhat.com>
Cc: linux-media@vger.kernel.org, lirc@bartelmus.de
Subject: Re: [PATCH 1/3] IR: add core lirc device interface
Date: Fri, 04 Jun 2010 01:10:38 -0300 [thread overview]
Message-ID: <4C087CBE.10202@redhat.com> (raw)
In-Reply-To: <20100603220649.GC23375@redhat.com>
Em 03-06-2010 19:06, Jarod Wilson escreveu:
> On Thu, Jun 03, 2010 at 03:02:11AM -0300, Mauro Carvalho Chehab wrote:
>> Em 01-06-2010 17:51, Jarod Wilson escreveu:
>>> Add the core lirc device interface (http://lirc.org/).
>>>
>>> This is a 99.9% unaltered lirc_dev device interface (only change being
>>> the path to lirc.h), which has been carried in the Fedora kernels and
>>> has been built for numerous other distro kernels for years. In the
>>> next two patches in this series, ir-core will be wired up to make use
>>> of the lirc interface as one of many IR protocol decoder options. In
>>> this case, raw IR will be delivered to the lirc userspace daemon, which
>>> will then handle the decoding.
>>>
>>> Signed-off-by: Jarod Wilson <jarod@redhat.com>
>>> ---
>>> drivers/media/IR/Kconfig | 11 +
>>> drivers/media/IR/Makefile | 1 +
>>> drivers/media/IR/lirc_dev.c | 850 +++++++++++++++++++++++++++++++++++++++++++
>>> drivers/media/IR/lirc_dev.h | 228 ++++++++++++
>>> include/media/lirc.h | 159 ++++++++
>>> 5 files changed, 1249 insertions(+), 0 deletions(-)
>>> create mode 100644 drivers/media/IR/lirc_dev.c
>>> create mode 100644 drivers/media/IR/lirc_dev.h
>>> create mode 100644 include/media/lirc.h
>>>
> ...
>>> +#ifdef CONFIG_COMPAT
>>> +#define LIRC_GET_FEATURES_COMPAT32 _IOR('i', 0x00000000, __u32)
>>> +
>>> +#define LIRC_GET_SEND_MODE_COMPAT32 _IOR('i', 0x00000001, __u32)
>>> +#define LIRC_GET_REC_MODE_COMPAT32 _IOR('i', 0x00000002, __u32)
>>> +
>>> +#define LIRC_GET_LENGTH_COMPAT32 _IOR('i', 0x0000000f, __u32)
>>> +
>>> +#define LIRC_SET_SEND_MODE_COMPAT32 _IOW('i', 0x00000011, __u32)
>>> +#define LIRC_SET_REC_MODE_COMPAT32 _IOW('i', 0x00000012, __u32)
>>> +
>>> +long lirc_dev_fop_compat_ioctl(struct file *file,
>>> + unsigned int cmd32,
>>> + unsigned long arg)
>>> +{
>>> + mm_segment_t old_fs;
>>> + int ret;
>>> + unsigned long val;
>>> + unsigned int cmd;
>>> +
>>> + switch (cmd32) {
>>> + case LIRC_GET_FEATURES_COMPAT32:
>>> + case LIRC_GET_SEND_MODE_COMPAT32:
>>> + case LIRC_GET_REC_MODE_COMPAT32:
>>> + case LIRC_GET_LENGTH_COMPAT32:
>>> + case LIRC_SET_SEND_MODE_COMPAT32:
>>> + case LIRC_SET_REC_MODE_COMPAT32:
>>> + /*
>>> + * These commands expect (unsigned long *) arg
>>> + * but the 32-bit app supplied (__u32 *).
>>> + * Conversion is required.
>>> + */
>>> + if (get_user(val, (__u32 *)compat_ptr(arg)))
>>> + return -EFAULT;
>>> + lock_kernel();
>>
>> Hmm... BKL? Are you sure you need it here? As BKL are being removed, please rewrite
>> it to use another kind of lock.
>>
>> On a first glance, I suspect that you should be locking &ir->irctl_lock inside
>> lirc_dev_fop_ioctl() and just remove the BKL calls on lirc_dev_fop_compat_ioctl().
>
> Ew, yeah, looks like there's some missing locking in lirc_dev_fop_ioctl(),
> though its never been a problem in practice, from what I've seen... Okay,
> will add locking there.
Ok, thanks. Well, in the past, the ioctl where already blocked by BKL. So, the lock
is/will probably needed only with newer kernels.
> As for the compat bits... I actually pulled them out of the Fedora kernel
> and userspace for a while, and there were only a few people who really ran
> into issues with it, but I think if the new userspace and kernel are rolled
> out at the same time in a new distro release (i.e., Fedora 14, in our
> particular case), it should be mostly transparent to users.
For sure this will happen on all distros that follows upstream: they'll update lirc
to fulfill the minimal requirement at Documentation/Changes.
The issue will appear only to people that manually compile kernel and lirc. Those
users are likely smart enough to upgrade to a newer lirc version if they notice a
trouble, and to check at the forums.
> Christoph
> wasn't a fan of the change, and actually asked me to revert it, so I'm
> cc'ing him here for further feedback, but I'm inclined to say that if this
> is the price we pay to get upstream, so be it.
I understand Christoph view, but I think that having to deal with compat stuff forever
is a high price to pay, as the impact of this change is transitory and shouldn't
be hard to deal with.
>> Btw, as this is the first in-tree kernel driver for lirc, I would just define the
>> lirc ioctls with __u32 and remove the entire compat stuff.
>
> I've pushed a patch into my ir-wip tree, ir branch, that does this:
>
> http://git.wilsonet.com/linux-2.6-ir-wip.git/?a=shortlog;h=refs/heads/ir
>
> I've tested it out, and things still work as expected w/my mceusb port and
> the ir-lirc-codec ir-core bridge driver, after rebuilding the lirc
> userspace (64-bit host) to match up the ioctl definitions.
Patches look sane on my eyes.
>
>>> +/*
>>> + * from the next key press on the driver will send
>>> + * LIRC_MODE2_FREQUENCY packets
>>> + */
>>> +#define LIRC_MEASURE_CARRIER_ENABLE _IO('i', 0x00000021)
>>> +#define LIRC_MEASURE_CARRIER_DISABLE _IO('i', 0x00000022)
>>> +
>>> +#endif
>>
>> Wow! There are lots of ioctls that aren't currently used. IMO, the better is to add
>> at the file just the ioctls that are currently in usage, and to put some documentation
>> about them at /Documentation.
>
> Several of the ioctls were only very recently (past 4 months) added, but I
> haven't a clue what they're actually used for... Adding something to
> Documentation/ would definitely be prudent in any case.
>
The betters is to remove (or put them inside a #if 0 block) while they are not actually
used at the code. I'm against the idea of adding new userspace API ioctls without any
in-kernel driver using it. New ioctls can easily be added, but removing an ioctl can be
a problem, so better to only add the things that we have a clear idea about its usage.
Also, please add a patch against the media DocBook with the ioctls that are being added for the
LIRC API. There's already a chapter there talking about IR. They are at Documentation/DocBook/v4l.
Feel free to move to another sub-directory if you want, but the most important is to document
the API's that are currently being defined.
Cheers,
Mauro.
next prev parent reply other threads:[~2010-06-04 4:10 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-01 20:50 [PATCH 0/3] IR: add lirc support to ir-core Jarod Wilson
2010-06-01 20:51 ` [PATCH 1/3] IR: add core lirc device interface Jarod Wilson
2010-06-03 6:02 ` Mauro Carvalho Chehab
2010-06-03 22:06 ` Jarod Wilson
2010-06-04 4:10 ` Mauro Carvalho Chehab [this message]
2010-06-04 15:51 ` Christoph Bartelmus
2010-06-04 18:38 ` Mauro Carvalho Chehab
2010-06-04 18:57 ` Jon Smirl
2010-06-04 20:17 ` Jarod Wilson
2010-06-04 21:17 ` Jarod Wilson
2010-06-04 23:16 ` Jon Smirl
2010-06-05 2:45 ` Jarod Wilson
2010-06-05 12:43 ` Jarod Wilson
2010-06-05 17:43 ` Stefan Richter
2010-06-05 17:24 ` Andy Walls
2010-06-05 17:52 ` Jon Smirl
2010-06-07 18:44 ` David Härdeman
2010-06-07 19:45 ` Jarod Wilson
2010-06-08 17:40 ` David Härdeman
2010-07-03 3:27 ` Jarod Wilson
2010-06-01 20:52 ` [PATCH 2/3] IR: add an empty lirc "protocol" keymap Jarod Wilson
2010-06-01 20:52 ` [PATCH 3/3] IR: add ir-core to lirc interface bridge driver Jarod Wilson
2010-07-03 4:05 ` [PATCH v2 0/3] IR: add lirc support to ir-core Jarod Wilson
2010-07-03 4:06 ` [PATCH 1/3] IR: add lirc device interface Jarod Wilson
2010-07-03 4:07 ` [PATCH v2 2/3] IR: add ir-core to lirc userspace decoder bridge driver Jarod Wilson
2010-07-03 4:08 ` [PATCH v2 3/3] IR: add empty lirc pseudo-keymap Jarod Wilson
2010-07-03 4:10 ` [PATCH 4/3] IR/lirc: add docbook info covering lirc device interface Jarod Wilson
2010-07-04 15:31 ` Mauro Carvalho Chehab
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4C087CBE.10202@redhat.com \
--to=mchehab@redhat.com \
--cc=jarod@redhat.com \
--cc=linux-media@vger.kernel.org \
--cc=lirc@bartelmus.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.