* [PATCH] media: rc: Pospone ir raw decoders loading until really needed
@ 2012-03-15 19:39 Ezequiel Garcia
2012-03-15 19:39 ` Mauro Carvalho Chehab
2012-03-15 19:46 ` Jarod Wilson
0 siblings, 2 replies; 4+ messages in thread
From: Ezequiel Garcia @ 2012-03-15 19:39 UTC (permalink / raw)
To: mchehab; +Cc: jarod, linux-media, Ezequiel Garcia
This changes rc_core to not load the IR decoders at load time,
postponing it to load only if a RC_DRIVER_IR_RAW device is registered
via rc_register_device.
Signed-off-by: Ezequiel Garcia <elezegarcia@gmail.com>
---
drivers/media/rc/rc-main.c | 8 ++++++--
include/media/rc-core.h | 2 ++
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/drivers/media/rc/rc-main.c b/drivers/media/rc/rc-main.c
index f6a930b..adf4a99 100644
--- a/drivers/media/rc/rc-main.c
+++ b/drivers/media/rc/rc-main.c
@@ -1103,6 +1103,12 @@ int rc_register_device(struct rc_dev *dev)
kfree(path);
if (dev->driver_type == RC_DRIVER_IR_RAW) {
+ /* Load raw decoders, if they aren't already */
+ if (dev->raw_init) {
+ IR_dprintk(1, "Loading raw decoders\n");
+ ir_raw_init();
+ dev->raw_init = true;
+ }
rc = ir_raw_event_register(dev);
if (rc < 0)
goto out_input;
@@ -1176,8 +1182,6 @@ static int __init rc_core_init(void)
return rc;
}
- /* Initialize/load the decoders/keymap code that will be used */
- ir_raw_init();
rc_map_register(&empty_map);
return 0;
diff --git a/include/media/rc-core.h b/include/media/rc-core.h
index b0c494a..71c99c1 100644
--- a/include/media/rc-core.h
+++ b/include/media/rc-core.h
@@ -47,6 +47,7 @@ enum rc_driver_type {
* anyone can call show_protocols or store_protocols
* @devno: unique remote control device number
* @raw: additional data for raw pulse/space devices
+ * @raw_init: used to load raw decoders modules if needed
* @input_dev: the input child device used to communicate events to userspace
* @driver_type: specifies if protocol decoding is done in hardware or software
* @idle: used to keep track of RX state
@@ -95,6 +96,7 @@ struct rc_dev {
struct mutex lock;
unsigned long devno;
struct ir_raw_event_ctrl *raw;
+ bool raw_init;
struct input_dev *input_dev;
enum rc_driver_type driver_type;
bool idle;
--
1.7.3.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] media: rc: Pospone ir raw decoders loading until really needed
2012-03-15 19:39 [PATCH] media: rc: Pospone ir raw decoders loading until really needed Ezequiel Garcia
@ 2012-03-15 19:39 ` Mauro Carvalho Chehab
2012-03-15 19:52 ` Ezequiel García
2012-03-15 19:46 ` Jarod Wilson
1 sibling, 1 reply; 4+ messages in thread
From: Mauro Carvalho Chehab @ 2012-03-15 19:39 UTC (permalink / raw)
To: Ezequiel Garcia; +Cc: mchehab, jarod, linux-media
Em 15-03-2012 16:39, Ezequiel Garcia escreveu:
> This changes rc_core to not load the IR decoders at load time,
> postponing it to load only if a RC_DRIVER_IR_RAW device is registered
> via rc_register_device.
>
> Signed-off-by: Ezequiel Garcia <elezegarcia@gmail.com>
> ---
> drivers/media/rc/rc-main.c | 8 ++++++--
> include/media/rc-core.h | 2 ++
> 2 files changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/media/rc/rc-main.c b/drivers/media/rc/rc-main.c
> index f6a930b..adf4a99 100644
> --- a/drivers/media/rc/rc-main.c
> +++ b/drivers/media/rc/rc-main.c
> @@ -1103,6 +1103,12 @@ int rc_register_device(struct rc_dev *dev)
> kfree(path);
>
> if (dev->driver_type == RC_DRIVER_IR_RAW) {
> + /* Load raw decoders, if they aren't already */
> + if (dev->raw_init) {
The logic here seems to be inverted. it should be, instead !dev->raw_init.
> + IR_dprintk(1, "Loading raw decoders\n");
> + ir_raw_init();
> + dev->raw_init = true;
> + }
> rc = ir_raw_event_register(dev);
> if (rc < 0)
> goto out_input;
> @@ -1176,8 +1182,6 @@ static int __init rc_core_init(void)
> return rc;
> }
>
> - /* Initialize/load the decoders/keymap code that will be used */
> - ir_raw_init();
> rc_map_register(&empty_map);
>
> return 0;
> diff --git a/include/media/rc-core.h b/include/media/rc-core.h
> index b0c494a..71c99c1 100644
> --- a/include/media/rc-core.h
> +++ b/include/media/rc-core.h
> @@ -47,6 +47,7 @@ enum rc_driver_type {
> * anyone can call show_protocols or store_protocols
> * @devno: unique remote control device number
> * @raw: additional data for raw pulse/space devices
> + * @raw_init: used to load raw decoders modules if needed
> * @input_dev: the input child device used to communicate events to userspace
> * @driver_type: specifies if protocol decoding is done in hardware or software
> * @idle: used to keep track of RX state
> @@ -95,6 +96,7 @@ struct rc_dev {
> struct mutex lock;
> unsigned long devno;
> struct ir_raw_event_ctrl *raw;
> + bool raw_init;
> struct input_dev *input_dev;
> enum rc_driver_type driver_type;
> bool idle;
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] media: rc: Pospone ir raw decoders loading until really needed
2012-03-15 19:39 [PATCH] media: rc: Pospone ir raw decoders loading until really needed Ezequiel Garcia
2012-03-15 19:39 ` Mauro Carvalho Chehab
@ 2012-03-15 19:46 ` Jarod Wilson
1 sibling, 0 replies; 4+ messages in thread
From: Jarod Wilson @ 2012-03-15 19:46 UTC (permalink / raw)
To: Ezequiel Garcia; +Cc: mchehab, linux-media
On Thu, Mar 15, 2012 at 04:39:02PM -0300, Ezequiel Garcia wrote:
> This changes rc_core to not load the IR decoders at load time,
> postponing it to load only if a RC_DRIVER_IR_RAW device is registered
> via rc_register_device.
>
> Signed-off-by: Ezequiel Garcia <elezegarcia@gmail.com>
> ---
> drivers/media/rc/rc-main.c | 8 ++++++--
> include/media/rc-core.h | 2 ++
> 2 files changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/media/rc/rc-main.c b/drivers/media/rc/rc-main.c
> index f6a930b..adf4a99 100644
> --- a/drivers/media/rc/rc-main.c
> +++ b/drivers/media/rc/rc-main.c
> @@ -1103,6 +1103,12 @@ int rc_register_device(struct rc_dev *dev)
> kfree(path);
>
> if (dev->driver_type == RC_DRIVER_IR_RAW) {
> + /* Load raw decoders, if they aren't already */
> + if (dev->raw_init) {
> + IR_dprintk(1, "Loading raw decoders\n");
> + ir_raw_init();
> + dev->raw_init = true;
> + }
> rc = ir_raw_event_register(dev);
> if (rc < 0)
> goto out_input;
> @@ -1176,8 +1182,6 @@ static int __init rc_core_init(void)
> return rc;
> }
>
> - /* Initialize/load the decoders/keymap code that will be used */
> - ir_raw_init();
> rc_map_register(&empty_map);
>
> return 0;
Uhm. How does this ever actually work? The only place I see raw_init set
to true is inside a conditional that requires it already be true. That's
not going to fly.
--
Jarod Wilson
jarod@redhat.com
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] media: rc: Pospone ir raw decoders loading until really needed
2012-03-15 19:39 ` Mauro Carvalho Chehab
@ 2012-03-15 19:52 ` Ezequiel García
0 siblings, 0 replies; 4+ messages in thread
From: Ezequiel García @ 2012-03-15 19:52 UTC (permalink / raw)
To: Mauro Carvalho Chehab; +Cc: jarod, linux-media, Rui Salvaterra
>> if (dev->driver_type == RC_DRIVER_IR_RAW) {
>> + /* Load raw decoders, if they aren't already */
>> + if (dev->raw_init) {
>
> The logic here seems to be inverted. it should be, instead !dev->raw_init.
Duh! Sorry about that. I'm *way* too accustomed to test things first.
Will pay more attention in the future.
Thanks for the review. I'm resending it now.
Ezequiel.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-03-15 19:52 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-15 19:39 [PATCH] media: rc: Pospone ir raw decoders loading until really needed Ezequiel Garcia
2012-03-15 19:39 ` Mauro Carvalho Chehab
2012-03-15 19:52 ` Ezequiel García
2012-03-15 19:46 ` Jarod Wilson
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.