diff options
author | Andy Walls <awalls@radix.net> | 2009-09-05 10:58:37 -0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2009-09-12 12:20:15 -0300 |
commit | 78f2e672b37ae8935ec0b97cedbc2d877ffa0c5f (patch) | |
tree | 1adcd5ce3515fd003d7336db668c27db3b0c53b5 /drivers | |
parent | d2ebd0f806fdb6104903365e355675934eec22b2 (diff) | |
download | op-kernel-dev-78f2e672b37ae8935ec0b97cedbc2d877ffa0c5f.zip op-kernel-dev-78f2e672b37ae8935ec0b97cedbc2d877ffa0c5f.tar.gz |
V4L/DVB (12699): cx18: ir-kbd-i2c initialization data should point to a persistent object
ir-kbd-i2c's ir_probe() function can be called much later (i.e. at ir-kbd-i2c
module load), than the lifetime of a struct IR_i2c_init_data allocated off of
the stack in cx18_i2c_new_ir() at registration time. Make sure we pass
a pointer to a persistent IR_i2c_init_data object at i2c registration time.
Thanks to Brian Rogers for pointing out a solution, and Dustin Mitchell for
testing against a 2.6.30 kernel.
Reported-by: Dustin Mitchell <soxslayer@gmail.com>
Reported-by: Brian Rogers <brian@xyzw.org>
Tested-by: Dustin Mitchell <soxslayer@gmail.com>
Signed-off-by: Andy Walls <awalls@radix.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/media/video/cx18/cx18-i2c.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/drivers/media/video/cx18/cx18-i2c.c b/drivers/media/video/cx18/cx18-i2c.c index 766ddce..da395fe 100644 --- a/drivers/media/video/cx18/cx18-i2c.c +++ b/drivers/media/video/cx18/cx18-i2c.c @@ -97,11 +97,17 @@ static const char * const hw_devicenames[] = { "ir_rx_z8f0811_haup", }; +static const struct IR_i2c_init_data z8f0811_ir_init_data = { + .ir_codes = &ir_codes_hauppauge_new_table, + .internal_get_key_func = IR_KBD_GET_KEY_HAUP_XVR, + .type = IR_TYPE_RC5, + .name = "CX23418 Z8F0811 Hauppauge", +}; + static int cx18_i2c_new_ir(struct i2c_adapter *adap, u32 hw, const char *type, u8 addr) { struct i2c_board_info info; - struct IR_i2c_init_data ir_init_data; unsigned short addr_list[2] = { addr, I2C_CLIENT_END }; memset(&info, 0, sizeof(struct i2c_board_info)); @@ -110,12 +116,7 @@ static int cx18_i2c_new_ir(struct i2c_adapter *adap, u32 hw, const char *type, /* Our default information for ir-kbd-i2c.c to use */ switch (hw) { case CX18_HW_Z8F0811_IR_RX_HAUP: - memset(&ir_init_data, 0, sizeof(struct IR_i2c_init_data)); - ir_init_data.ir_codes = &ir_codes_hauppauge_new_table; - ir_init_data.internal_get_key_func = IR_KBD_GET_KEY_HAUP_XVR; - ir_init_data.type = IR_TYPE_RC5; - ir_init_data.name = "CX23418 Z8F0811 Hauppauge"; - info.platform_data = &ir_init_data; + info.platform_data = &z8f0811_ir_init_data; break; default: break; |