diff options
author | Jean Delvare <khali@linux-fr.org> | 2009-05-13 15:49:32 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2009-06-16 17:21:11 -0400 |
commit | 4d7a2d6721a6380d4ffc26d81d2c8232fd0d2dfc (patch) | |
tree | 5ccac1dc6084363abdea5a63fe5d305421bd894c /drivers/media/video/ir-kbd-i2c.c | |
parent | c668f32dca105d876e51862a003a302fa61e4ae4 (diff) |
V4L/DVB (11845): ir-kbd-i2c: Use initialization data
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 'drivers/media/video/ir-kbd-i2c.c')
-rw-r--r-- | drivers/media/video/ir-kbd-i2c.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/drivers/media/video/ir-kbd-i2c.c b/drivers/media/video/ir-kbd-i2c.c index cb833a63041c..3a8880243b1f 100644 --- a/drivers/media/video/ir-kbd-i2c.c +++ b/drivers/media/video/ir-kbd-i2c.c | |||
@@ -298,7 +298,7 @@ static void ir_work(struct work_struct *work) | |||
298 | static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id) | 298 | static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id) |
299 | { | 299 | { |
300 | IR_KEYTAB_TYPE *ir_codes = NULL; | 300 | IR_KEYTAB_TYPE *ir_codes = NULL; |
301 | char *name; | 301 | const char *name; |
302 | int ir_type; | 302 | int ir_type; |
303 | struct IR_i2c *ir; | 303 | struct IR_i2c *ir; |
304 | struct input_dev *input_dev; | 304 | struct input_dev *input_dev; |
@@ -386,6 +386,16 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id) | |||
386 | goto err_out_free; | 386 | goto err_out_free; |
387 | } | 387 | } |
388 | 388 | ||
389 | /* Let the caller override settings */ | ||
390 | if (client->dev.platform_data) { | ||
391 | const struct IR_i2c_init_data *init_data = | ||
392 | client->dev.platform_data; | ||
393 | |||
394 | ir_codes = init_data->ir_codes; | ||
395 | name = init_data->name; | ||
396 | ir->get_key = init_data->get_key; | ||
397 | } | ||
398 | |||
389 | /* Sets name */ | 399 | /* Sets name */ |
390 | snprintf(ir->name, sizeof(ir->name), "i2c IR (%s)", name); | 400 | snprintf(ir->name, sizeof(ir->name), "i2c IR (%s)", name); |
391 | ir->ir_codes = ir_codes; | 401 | ir->ir_codes = ir_codes; |