Re: [PATCH 37/49] rc-core: allow empty keymaps

2014-07-25 Thread Mauro Carvalho Chehab
Em Fri, 04 Apr 2014 01:34:23 +0200
David Härdeman  escreveu:

> Remove the RC_MAP_EMPTY hack and instead allow for empty keymaps.

Doesn't apply anymore, but makes sense.

There's just one thing that we need to double check: if a given
device is with an empty keytable, it doesn't make sense to start
IR polling, as IR polling costs power.

So, we need to be sure that we'll only call the IR start method
if the table is filled.

I think the current behavior already takes this into account, but
we need to test it.

Regards,
Mauro

> 
> Signed-off-by: David Härdeman 
> ---
>  drivers/media/i2c/ir-kbd-i2c.c |4 +--
>  drivers/media/pci/cx88/cx88-input.c|6 -
>  drivers/media/pci/ivtv/ivtv-i2c.c  |2 +-
>  drivers/media/rc/gpio-ir-recv.c|2 +-
>  drivers/media/rc/img-ir/img-ir-hw.c|1 -
>  drivers/media/rc/img-ir/img-ir-raw.c   |1 -
>  drivers/media/rc/rc-keytable.c |3 +++
>  drivers/media/rc/rc-loopback.c |1 -
>  drivers/media/rc/rc-main.c |   33 
> ++--
>  drivers/media/usb/dvb-usb-v2/af9015.c  |4 ---
>  drivers/media/usb/dvb-usb-v2/af9035.c  |4 ---
>  drivers/media/usb/dvb-usb-v2/az6007.c  |4 ++-
>  drivers/media/usb/dvb-usb-v2/rtl28xxu.c|4 ---
>  drivers/media/usb/dvb-usb/dvb-usb-remote.c |4 +--
>  drivers/media/usb/em28xx/em28xx-cards.c|1 -
>  include/media/rc-map.h |1 -
>  16 files changed, 11 insertions(+), 64 deletions(-)
> 
> diff --git a/drivers/media/i2c/ir-kbd-i2c.c b/drivers/media/i2c/ir-kbd-i2c.c
> index 8311f1a..5393558 100644
> --- a/drivers/media/i2c/ir-kbd-i2c.c
> +++ b/drivers/media/i2c/ir-kbd-i2c.c
> @@ -309,7 +309,6 @@ static int ir_probe(struct i2c_client *client, const 
> struct i2c_device_id *id)
>   name= "Pixelview";
>   ir->get_key = get_key_pixelview;
>   rc_type = RC_BIT_OTHER;
> - ir_codes= RC_MAP_EMPTY;
>   break;
>   case 0x18:
>   case 0x1f:
> @@ -323,7 +322,6 @@ static int ir_probe(struct i2c_client *client, const 
> struct i2c_device_id *id)
>   name= "KNC One";
>   ir->get_key = get_key_knc1;
>   rc_type = RC_BIT_OTHER;
> - ir_codes= RC_MAP_EMPTY;
>   break;
>   case 0x6b:
>   name= "FusionHDTV";
> @@ -405,7 +403,7 @@ static int ir_probe(struct i2c_client *client, const 
> struct i2c_device_id *id)
>   ir->rc = rc;
>  
>   /* Make sure we are all setup before going on */
> - if (!name || !ir->get_key || !rc_type || !ir_codes) {
> + if (!name || !ir->get_key || !rc_type) {
>   dprintk(1, ": Unsupported device at address 0x%02x\n",
>   addr);
>   err = -ENODEV;
> diff --git a/drivers/media/pci/cx88/cx88-input.c 
> b/drivers/media/pci/cx88/cx88-input.c
> index 3f1342c..cb587ce 100644
> --- a/drivers/media/pci/cx88/cx88-input.c
> +++ b/drivers/media/pci/cx88/cx88-input.c
> @@ -437,11 +437,6 @@ int cx88_ir_init(struct cx88_core *core, struct pci_dev 
> *pci)
>   break;
>   }
>  
> - if (!ir_codes) {
> - err = -ENODEV;
> - goto err_out_free;
> - }
> -
>   /*
>* The usage of mask_keycode were very convenient, due to several
>* reasons. Among others, the scancode tables were using the scancode
> @@ -612,7 +607,6 @@ void cx88_i2c_init_ir(struct cx88_core *core)
>   core->init_data.name = "cx88 Leadtek PVR 2000 remote";
>   core->init_data.type = RC_BIT_UNKNOWN;
>   core->init_data.get_key = get_key_pvr2000;
> - core->init_data.ir_codes = RC_MAP_EMPTY;
>   break;
>   }
>  
> diff --git a/drivers/media/pci/ivtv/ivtv-i2c.c 
> b/drivers/media/pci/ivtv/ivtv-i2c.c
> index 1a41ba5..846bb51 100644
> --- a/drivers/media/pci/ivtv/ivtv-i2c.c
> +++ b/drivers/media/pci/ivtv/ivtv-i2c.c
> @@ -222,7 +222,7 @@ static int ivtv_i2c_new_ir(struct ivtv *itv, u32 hw, 
> const char *type, u8 addr)
>   init_data->get_key = get_key_adaptec;
>   init_data->name = itv->card_name;
>   /* FIXME: The protocol and RC_MAP needs to be corrected */
> - init_data->ir_codes = RC_MAP_EMPTY;
> + /* init_data->ir_codes = RC_MAP_? */
>   init_data->type = RC_BIT_UNKNOWN;
>   break;
>   }
> diff --git a/drivers/media/rc/gpio-ir-recv.c b/drivers/media/rc/gpio-ir-recv.c
> index 5985308..7d01560 100644
> --- a/drivers/media/rc/gpio-ir-recv.c
> +++ b/drivers/media/rc/gpio-ir-recv.c
> @@ -148,7 +148,7 @@ static int gpio_ir_recv_probe(struct platform_device 
> *pdev)
>   rcdev->allowed_protocols = pdata->allowed_protos;
>   else
>   rcdev->allowed_protocols = RC_BIT_ALL;
> - rcdev->map_name = pdata->map_name ?: RC_MAP_EMPTY;
> + rc

[PATCH 37/49] rc-core: allow empty keymaps

2014-04-03 Thread David Härdeman
Remove the RC_MAP_EMPTY hack and instead allow for empty keymaps.

Signed-off-by: David Härdeman 
---
 drivers/media/i2c/ir-kbd-i2c.c |4 +--
 drivers/media/pci/cx88/cx88-input.c|6 -
 drivers/media/pci/ivtv/ivtv-i2c.c  |2 +-
 drivers/media/rc/gpio-ir-recv.c|2 +-
 drivers/media/rc/img-ir/img-ir-hw.c|1 -
 drivers/media/rc/img-ir/img-ir-raw.c   |1 -
 drivers/media/rc/rc-keytable.c |3 +++
 drivers/media/rc/rc-loopback.c |1 -
 drivers/media/rc/rc-main.c |   33 ++--
 drivers/media/usb/dvb-usb-v2/af9015.c  |4 ---
 drivers/media/usb/dvb-usb-v2/af9035.c  |4 ---
 drivers/media/usb/dvb-usb-v2/az6007.c  |4 ++-
 drivers/media/usb/dvb-usb-v2/rtl28xxu.c|4 ---
 drivers/media/usb/dvb-usb/dvb-usb-remote.c |4 +--
 drivers/media/usb/em28xx/em28xx-cards.c|1 -
 include/media/rc-map.h |1 -
 16 files changed, 11 insertions(+), 64 deletions(-)

diff --git a/drivers/media/i2c/ir-kbd-i2c.c b/drivers/media/i2c/ir-kbd-i2c.c
index 8311f1a..5393558 100644
--- a/drivers/media/i2c/ir-kbd-i2c.c
+++ b/drivers/media/i2c/ir-kbd-i2c.c
@@ -309,7 +309,6 @@ static int ir_probe(struct i2c_client *client, const struct 
i2c_device_id *id)
name= "Pixelview";
ir->get_key = get_key_pixelview;
rc_type = RC_BIT_OTHER;
-   ir_codes= RC_MAP_EMPTY;
break;
case 0x18:
case 0x1f:
@@ -323,7 +322,6 @@ static int ir_probe(struct i2c_client *client, const struct 
i2c_device_id *id)
name= "KNC One";
ir->get_key = get_key_knc1;
rc_type = RC_BIT_OTHER;
-   ir_codes= RC_MAP_EMPTY;
break;
case 0x6b:
name= "FusionHDTV";
@@ -405,7 +403,7 @@ static int ir_probe(struct i2c_client *client, const struct 
i2c_device_id *id)
ir->rc = rc;
 
/* Make sure we are all setup before going on */
-   if (!name || !ir->get_key || !rc_type || !ir_codes) {
+   if (!name || !ir->get_key || !rc_type) {
dprintk(1, ": Unsupported device at address 0x%02x\n",
addr);
err = -ENODEV;
diff --git a/drivers/media/pci/cx88/cx88-input.c 
b/drivers/media/pci/cx88/cx88-input.c
index 3f1342c..cb587ce 100644
--- a/drivers/media/pci/cx88/cx88-input.c
+++ b/drivers/media/pci/cx88/cx88-input.c
@@ -437,11 +437,6 @@ int cx88_ir_init(struct cx88_core *core, struct pci_dev 
*pci)
break;
}
 
-   if (!ir_codes) {
-   err = -ENODEV;
-   goto err_out_free;
-   }
-
/*
 * The usage of mask_keycode were very convenient, due to several
 * reasons. Among others, the scancode tables were using the scancode
@@ -612,7 +607,6 @@ void cx88_i2c_init_ir(struct cx88_core *core)
core->init_data.name = "cx88 Leadtek PVR 2000 remote";
core->init_data.type = RC_BIT_UNKNOWN;
core->init_data.get_key = get_key_pvr2000;
-   core->init_data.ir_codes = RC_MAP_EMPTY;
break;
}
 
diff --git a/drivers/media/pci/ivtv/ivtv-i2c.c 
b/drivers/media/pci/ivtv/ivtv-i2c.c
index 1a41ba5..846bb51 100644
--- a/drivers/media/pci/ivtv/ivtv-i2c.c
+++ b/drivers/media/pci/ivtv/ivtv-i2c.c
@@ -222,7 +222,7 @@ static int ivtv_i2c_new_ir(struct ivtv *itv, u32 hw, const 
char *type, u8 addr)
init_data->get_key = get_key_adaptec;
init_data->name = itv->card_name;
/* FIXME: The protocol and RC_MAP needs to be corrected */
-   init_data->ir_codes = RC_MAP_EMPTY;
+   /* init_data->ir_codes = RC_MAP_? */
init_data->type = RC_BIT_UNKNOWN;
break;
}
diff --git a/drivers/media/rc/gpio-ir-recv.c b/drivers/media/rc/gpio-ir-recv.c
index 5985308..7d01560 100644
--- a/drivers/media/rc/gpio-ir-recv.c
+++ b/drivers/media/rc/gpio-ir-recv.c
@@ -148,7 +148,7 @@ static int gpio_ir_recv_probe(struct platform_device *pdev)
rcdev->allowed_protocols = pdata->allowed_protos;
else
rcdev->allowed_protocols = RC_BIT_ALL;
-   rcdev->map_name = pdata->map_name ?: RC_MAP_EMPTY;
+   rcdev->map_name = pdata->map_name;
 
gpio_dev->rcdev = rcdev;
gpio_dev->gpio_nr = pdata->gpio_nr;
diff --git a/drivers/media/rc/img-ir/img-ir-hw.c 
b/drivers/media/rc/img-ir/img-ir-hw.c
index 3bb6a32..5bc7903 100644
--- a/drivers/media/rc/img-ir/img-ir-hw.c
+++ b/drivers/media/rc/img-ir/img-ir-hw.c
@@ -993,7 +993,6 @@ int img_ir_probe_hw(struct img_ir_priv *priv)
goto err_alloc_rc;
}
rdev->priv = priv;
-   rdev->map_name = RC_MAP_EMPTY;
rdev->allowed_protocols = img_ir_allowed_protos(priv);
rdev->input_name = "I