aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb/dvb-usb/m920x.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/dvb/dvb-usb/m920x.c')
-rw-r--r--drivers/media/dvb/dvb-usb/m920x.c49
1 files changed, 30 insertions, 19 deletions
diff --git a/drivers/media/dvb/dvb-usb/m920x.c b/drivers/media/dvb/dvb-usb/m920x.c
index da9dc91ce910..9456792f219b 100644
--- a/drivers/media/dvb/dvb-usb/m920x.c
+++ b/drivers/media/dvb/dvb-usb/m920x.c
@@ -134,13 +134,17 @@ static int m920x_rc_query(struct dvb_usb_device *d, u32 *event, int *state)
134{ 134{
135 struct m920x_state *m = d->priv; 135 struct m920x_state *m = d->priv;
136 int i, ret = 0; 136 int i, ret = 0;
137 u8 rc_state[2]; 137 u8 *rc_state;
138
139 rc_state = kmalloc(2, GFP_KERNEL);
140 if (!rc_state)
141 return -ENOMEM;
138 142
139 if ((ret = m920x_read(d->udev, M9206_CORE, 0x0, M9206_RC_STATE, rc_state, 1)) != 0) 143 if ((ret = m920x_read(d->udev, M9206_CORE, 0x0, M9206_RC_STATE, rc_state, 1)) != 0)
140 goto unlock; 144 goto out;
141 145
142 if ((ret = m920x_read(d->udev, M9206_CORE, 0x0, M9206_RC_KEY, rc_state + 1, 1)) != 0) 146 if ((ret = m920x_read(d->udev, M9206_CORE, 0x0, M9206_RC_KEY, rc_state + 1, 1)) != 0)
143 goto unlock; 147 goto out;
144 148
145 for (i = 0; i < d->props.rc.legacy.rc_map_size; i++) 149 for (i = 0; i < d->props.rc.legacy.rc_map_size; i++)
146 if (rc5_data(&d->props.rc.legacy.rc_map_table[i]) == rc_state[1]) { 150 if (rc5_data(&d->props.rc.legacy.rc_map_table[i]) == rc_state[1]) {
@@ -149,7 +153,7 @@ static int m920x_rc_query(struct dvb_usb_device *d, u32 *event, int *state)
149 switch(rc_state[0]) { 153 switch(rc_state[0]) {
150 case 0x80: 154 case 0x80:
151 *state = REMOTE_NO_KEY_PRESSED; 155 *state = REMOTE_NO_KEY_PRESSED;
152 goto unlock; 156 goto out;
153 157
154 case 0x88: /* framing error or "invalid code" */ 158 case 0x88: /* framing error or "invalid code" */
155 case 0x99: 159 case 0x99:
@@ -157,7 +161,7 @@ static int m920x_rc_query(struct dvb_usb_device *d, u32 *event, int *state)
157 case 0xd8: 161 case 0xd8:
158 *state = REMOTE_NO_KEY_PRESSED; 162 *state = REMOTE_NO_KEY_PRESSED;
159 m->rep_count = 0; 163 m->rep_count = 0;
160 goto unlock; 164 goto out;
161 165
162 case 0x93: 166 case 0x93:
163 case 0x92: 167 case 0x92:
@@ -165,7 +169,7 @@ static int m920x_rc_query(struct dvb_usb_device *d, u32 *event, int *state)
165 case 0x82: 169 case 0x82:
166 m->rep_count = 0; 170 m->rep_count = 0;
167 *state = REMOTE_KEY_PRESSED; 171 *state = REMOTE_KEY_PRESSED;
168 goto unlock; 172 goto out;
169 173
170 case 0x91: 174 case 0x91:
171 case 0x81: /* pinnacle PCTV310e */ 175 case 0x81: /* pinnacle PCTV310e */
@@ -174,12 +178,12 @@ static int m920x_rc_query(struct dvb_usb_device *d, u32 *event, int *state)
174 *state = REMOTE_KEY_REPEAT; 178 *state = REMOTE_KEY_REPEAT;
175 else 179 else
176 *state = REMOTE_NO_KEY_PRESSED; 180 *state = REMOTE_NO_KEY_PRESSED;
177 goto unlock; 181 goto out;
178 182
179 default: 183 default:
180 deb("Unexpected rc state %02x\n", rc_state[0]); 184 deb("Unexpected rc state %02x\n", rc_state[0]);
181 *state = REMOTE_NO_KEY_PRESSED; 185 *state = REMOTE_NO_KEY_PRESSED;
182 goto unlock; 186 goto out;
183 } 187 }
184 } 188 }
185 189
@@ -188,8 +192,8 @@ static int m920x_rc_query(struct dvb_usb_device *d, u32 *event, int *state)
188 192
189 *state = REMOTE_NO_KEY_PRESSED; 193 *state = REMOTE_NO_KEY_PRESSED;
190 194
191 unlock: 195 out:
192 196 kfree(rc_state);
193 return ret; 197 return ret;
194} 198}
195 199
@@ -339,13 +343,19 @@ static int m920x_pid_filter(struct dvb_usb_adapter *adap, int index, u16 pid, in
339static int m920x_firmware_download(struct usb_device *udev, const struct firmware *fw) 343static int m920x_firmware_download(struct usb_device *udev, const struct firmware *fw)
340{ 344{
341 u16 value, index, size; 345 u16 value, index, size;
342 u8 read[4], *buff; 346 u8 *read, *buff;
343 int i, pass, ret = 0; 347 int i, pass, ret = 0;
344 348
345 buff = kmalloc(65536, GFP_KERNEL); 349 buff = kmalloc(65536, GFP_KERNEL);
346 if (buff == NULL) 350 if (buff == NULL)
347 return -ENOMEM; 351 return -ENOMEM;
348 352
353 read = kmalloc(4, GFP_KERNEL);
354 if (!read) {
355 kfree(buff);
356 return -ENOMEM;
357 }
358
349 if ((ret = m920x_read(udev, M9206_FILTER, 0x0, 0x8000, read, 4)) != 0) 359 if ((ret = m920x_read(udev, M9206_FILTER, 0x0, 0x8000, read, 4)) != 0)
350 goto done; 360 goto done;
351 deb("%x %x %x %x\n", read[0], read[1], read[2], read[3]); 361 deb("%x %x %x %x\n", read[0], read[1], read[2], read[3]);
@@ -396,6 +406,7 @@ static int m920x_firmware_download(struct usb_device *udev, const struct firmwar
396 deb("firmware uploaded!\n"); 406 deb("firmware uploaded!\n");
397 407
398 done: 408 done:
409 kfree(read);
399 kfree(buff); 410 kfree(buff);
400 411
401 return ret; 412 return ret;
@@ -632,9 +643,9 @@ static struct rc_map_table rc_map_pinnacle310e_table[] = {
632 { 0x16, KEY_POWER }, 643 { 0x16, KEY_POWER },
633 { 0x17, KEY_FAVORITES }, 644 { 0x17, KEY_FAVORITES },
634 { 0x0f, KEY_TEXT }, 645 { 0x0f, KEY_TEXT },
635 { 0x48, KEY_MEDIA }, /* preview */ 646 { 0x48, KEY_PROGRAM }, /* preview */
636 { 0x1c, KEY_EPG }, 647 { 0x1c, KEY_EPG },
637 { 0x04, KEY_LIST }, /* record list */ 648 { 0x04, KEY_LIST }, /* record list */
638 { 0x03, KEY_1 }, 649 { 0x03, KEY_1 },
639 { 0x01, KEY_2 }, 650 { 0x01, KEY_2 },
640 { 0x06, KEY_3 }, 651 { 0x06, KEY_3 },
@@ -674,14 +685,14 @@ static struct rc_map_table rc_map_pinnacle310e_table[] = {
674 { 0x0e, KEY_MUTE }, 685 { 0x0e, KEY_MUTE },
675/* { 0x49, KEY_LR }, */ /* L/R */ 686/* { 0x49, KEY_LR }, */ /* L/R */
676 { 0x07, KEY_SLEEP }, /* Hibernate */ 687 { 0x07, KEY_SLEEP }, /* Hibernate */
677 { 0x08, KEY_MEDIA }, /* A/V */ 688 { 0x08, KEY_VIDEO }, /* A/V */
678 { 0x0e, KEY_MENU }, /* Recall */ 689 { 0x0e, KEY_MENU }, /* Recall */
679 { 0x45, KEY_ZOOMIN }, 690 { 0x45, KEY_ZOOMIN },
680 { 0x46, KEY_ZOOMOUT }, 691 { 0x46, KEY_ZOOMOUT },
681 { 0x18, KEY_TV }, /* Red */ 692 { 0x18, KEY_RED }, /* Red */
682 { 0x53, KEY_VCR }, /* Green */ 693 { 0x53, KEY_GREEN }, /* Green */
683 { 0x5e, KEY_SAT }, /* Yellow */ 694 { 0x5e, KEY_YELLOW }, /* Yellow */
684 { 0x5f, KEY_PLAYER }, /* Blue */ 695 { 0x5f, KEY_BLUE }, /* Blue */
685}; 696};
686 697
687/* DVB USB Driver stuff */ 698/* DVB USB Driver stuff */