[PATCH] media: gpio-ir-recv: add allowed_protos and map_name for platform data

From: Du, Changbin
Date: Tue Jul 03 2012 - 06:27:21 EST


It's better to give platform code a chance to specify the allowed
protocols and which keymap to use.

Signed-off-by: Du, Changbin <changbin.du@xxxxxxxxx>
---
drivers/media/rc/gpio-ir-recv.c | 10 ++++++++--
include/media/gpio-ir-recv.h | 6 ++++--
2 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/drivers/media/rc/gpio-ir-recv.c
b/drivers/media/rc/gpio-ir-recv.c
index 0d87545..f0d09af 100644
--- a/drivers/media/rc/gpio-ir-recv.c
+++ b/drivers/media/rc/gpio-ir-recv.c
@@ -83,11 +83,17 @@ static int __devinit gpio_ir_recv_probe(struct
platform_device *pdev)
}

rcdev->driver_type = RC_DRIVER_IR_RAW;
- rcdev->allowed_protos = RC_TYPE_ALL;
rcdev->input_name = GPIO_IR_DEVICE_NAME;
rcdev->input_id.bustype = BUS_HOST;
rcdev->driver_name = GPIO_IR_DRIVER_NAME;
- rcdev->map_name = RC_MAP_EMPTY;
+ if (pdata->allowed_protos)
+ rcdev->allowed_protos = pdata->allowed_protos;
+ else
+ rcdev->allowed_protos = RC_TYPE_ALL;
+ if (pdata->map_name)
+ rcdev->map_name = pdata->map_name;
+ else
+ rcdev->map_name = RC_MAP_EMPTY;

gpio_dev->rcdev = rcdev;
gpio_dev->gpio_nr = pdata->gpio_nr;
diff --git a/include/media/gpio-ir-recv.h b/include/media/gpio-ir-recv.h
index 67797bf..0142736 100644
--- a/include/media/gpio-ir-recv.h
+++ b/include/media/gpio-ir-recv.h
@@ -14,8 +14,10 @@
#define __GPIO_IR_RECV_H__

struct gpio_ir_recv_platform_data {
- int gpio_nr;
- bool active_low;
+ int gpio_nr;
+ bool active_low;
+ u64 allowed_protos;
+ const char *map_name;
};

#endif /* __GPIO_IR_RECV_H__ */
--
1.7.9.5


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/