diff options
author | Andy Walls <awalls@radix.net> | 2009-11-21 11:39:28 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2009-12-05 15:41:57 -0500 |
commit | 8352619043a04785b8d20e438629b14e556fffce (patch) | |
tree | cffbda41f6f806096d7e6ff73468e0548a2bab97 /drivers/media/video/cx18/cx18-i2c.c | |
parent | ad2fe2d48812029b0b674594f297d0723f7c6e8f (diff) |
V4L/DVB (13445): cx18: Use per cx18 instance init data for ir-kbd-i2c instead of const data
This change creates per cx18 instances of IR_i2c_init_data for handing over
initialization data to ir-kbd-i2c, since that module wants non-const data
even though it never modifies the data.
Signed-off-by: Andy Walls <awalls@radix.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/cx18/cx18-i2c.c')
-rw-r--r-- | drivers/media/video/cx18/cx18-i2c.c | 25 |
1 files changed, 10 insertions, 15 deletions
diff --git a/drivers/media/video/cx18/cx18-i2c.c b/drivers/media/video/cx18/cx18-i2c.c index 2477461e84d7..eecf29af916c 100644 --- a/drivers/media/video/cx18/cx18-i2c.c +++ b/drivers/media/video/cx18/cx18-i2c.c | |||
@@ -28,7 +28,6 @@ | |||
28 | #include "cx18-gpio.h" | 28 | #include "cx18-gpio.h" |
29 | #include "cx18-i2c.h" | 29 | #include "cx18-i2c.h" |
30 | #include "cx18-irq.h" | 30 | #include "cx18-irq.h" |
31 | #include <media/ir-kbd-i2c.h> | ||
32 | 31 | ||
33 | #define CX18_REG_I2C_1_WR 0xf15000 | 32 | #define CX18_REG_I2C_1_WR 0xf15000 |
34 | #define CX18_REG_I2C_1_RD 0xf15008 | 33 | #define CX18_REG_I2C_1_RD 0xf15008 |
@@ -97,17 +96,11 @@ static const char * const hw_devicenames[] = { | |||
97 | "ir_rx_z8f0811_haup", | 96 | "ir_rx_z8f0811_haup", |
98 | }; | 97 | }; |
99 | 98 | ||
100 | static const struct IR_i2c_init_data z8f0811_ir_init_data = { | 99 | static int cx18_i2c_new_ir(struct cx18 *cx, struct i2c_adapter *adap, u32 hw, |
101 | .ir_codes = &ir_codes_hauppauge_new_table, | 100 | const char *type, u8 addr) |
102 | .internal_get_key_func = IR_KBD_GET_KEY_HAUP_XVR, | ||
103 | .type = IR_TYPE_RC5, | ||
104 | .name = "CX23418 Z8F0811 Hauppauge", | ||
105 | }; | ||
106 | |||
107 | static int cx18_i2c_new_ir(struct i2c_adapter *adap, u32 hw, const char *type, | ||
108 | u8 addr) | ||
109 | { | 101 | { |
110 | struct i2c_board_info info; | 102 | struct i2c_board_info info; |
103 | struct IR_i2c_init_data *init_data = &cx->ir_i2c_init_data; | ||
111 | unsigned short addr_list[2] = { addr, I2C_CLIENT_END }; | 104 | unsigned short addr_list[2] = { addr, I2C_CLIENT_END }; |
112 | 105 | ||
113 | memset(&info, 0, sizeof(struct i2c_board_info)); | 106 | memset(&info, 0, sizeof(struct i2c_board_info)); |
@@ -116,9 +109,11 @@ static int cx18_i2c_new_ir(struct i2c_adapter *adap, u32 hw, const char *type, | |||
116 | /* Our default information for ir-kbd-i2c.c to use */ | 109 | /* Our default information for ir-kbd-i2c.c to use */ |
117 | switch (hw) { | 110 | switch (hw) { |
118 | case CX18_HW_Z8F0811_IR_RX_HAUP: | 111 | case CX18_HW_Z8F0811_IR_RX_HAUP: |
119 | info.platform_data = (void *) &z8f0811_ir_init_data; | 112 | init_data->ir_codes = &ir_codes_hauppauge_new_table; |
120 | break; | 113 | init_data->internal_get_key_func = IR_KBD_GET_KEY_HAUP_XVR; |
121 | default: | 114 | init_data->type = IR_TYPE_RC5; |
115 | init_data->name = cx->card_name; | ||
116 | info.platform_data = init_data; | ||
122 | break; | 117 | break; |
123 | } | 118 | } |
124 | 119 | ||
@@ -154,8 +149,8 @@ int cx18_i2c_register(struct cx18 *cx, unsigned idx) | |||
154 | return sd != NULL ? 0 : -1; | 149 | return sd != NULL ? 0 : -1; |
155 | } | 150 | } |
156 | 151 | ||
157 | if (hw & CX18_HW_Z8F0811_IR_HAUP) | 152 | if (hw & CX18_HW_IR_ANY) |
158 | return cx18_i2c_new_ir(adap, hw, type, hw_addrs[idx]); | 153 | return cx18_i2c_new_ir(cx, adap, hw, type, hw_addrs[idx]); |
159 | 154 | ||
160 | /* Is it not an I2C device or one we do not wish to register? */ | 155 | /* Is it not an I2C device or one we do not wish to register? */ |
161 | if (!hw_addrs[idx]) | 156 | if (!hw_addrs[idx]) |