diff options
author | Mauro Carvalho Chehab <mchehab@redhat.com> | 2009-05-13 19:49:32 +0000 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2009-05-13 19:49:32 +0000 |
commit | ff5842e7e95c426abf87bbdb32361c523b1b98f0 (patch) | |
tree | fd9bf420f0f88f681cee2a6abc859492e07c79b8 /linux/drivers/media/video/ir-kbd-i2c.c | |
parent | b60f8e0b02ee9d9ef582e9df01eb81e5218baf9e (diff) | |
download | mediapointer-dvb-s2-ff5842e7e95c426abf87bbdb32361c523b1b98f0.tar.gz mediapointer-dvb-s2-ff5842e7e95c426abf87bbdb32361c523b1b98f0.tar.bz2 |
ir-kbd-i2c: Use initialization data
From: Jean Delvare <khali@linux-fr.org>
For specific boards, pass initialization data to ir-kbd-i2c instead
of modifying the settings after the device is initialized. This is
more efficient and easier to read.
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'linux/drivers/media/video/ir-kbd-i2c.c')
-rw-r--r-- | linux/drivers/media/video/ir-kbd-i2c.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/linux/drivers/media/video/ir-kbd-i2c.c b/linux/drivers/media/video/ir-kbd-i2c.c index 2408b8327..6a81e74bb 100644 --- a/linux/drivers/media/video/ir-kbd-i2c.c +++ b/linux/drivers/media/video/ir-kbd-i2c.c @@ -307,7 +307,7 @@ static void ir_work(struct work_struct *work) static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id) { IR_KEYTAB_TYPE *ir_codes = NULL; - char *name; + const char *name; int ir_type; struct IR_i2c *ir; struct input_dev *input_dev; @@ -395,6 +395,16 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id) goto err_out_free; } + /* Let the caller override settings */ + if (client->dev.platform_data) { + const struct IR_i2c_init_data *init_data = + client->dev.platform_data; + + ir_codes = init_data->ir_codes; + name = init_data->name; + ir->get_key = init_data->get_key; + } + /* Sets name */ snprintf(ir->name, sizeof(ir->name), "i2c IR (%s)", name); ir->ir_codes = ir_codes; |