media: dtv5100: fix control-request directions
commit 8c8b9a9be2afa8bd6a72ad1130532baab9fab89d upstream.
The direction of the pipe argument must match the request-type direction
bit or control requests may fail depending on the host-controller-driver
implementation.
Fix the control requests which erroneously used usb_rcvctrlpipe().
Fixes: 8466028be7
("V4L/DVB (8734): Initial support for AME DTV-5100 USB2.0 DVB-T")
Cc: stable@vger.kernel.org # 2.6.28
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:

committed by
Greg Kroah-Hartman

parent
db317a3722
commit
dbd58d3978
@@ -26,6 +26,7 @@ static int dtv5100_i2c_msg(struct dvb_usb_device *d, u8 addr,
|
|||||||
u8 *wbuf, u16 wlen, u8 *rbuf, u16 rlen)
|
u8 *wbuf, u16 wlen, u8 *rbuf, u16 rlen)
|
||||||
{
|
{
|
||||||
struct dtv5100_state *st = d->priv;
|
struct dtv5100_state *st = d->priv;
|
||||||
|
unsigned int pipe;
|
||||||
u8 request;
|
u8 request;
|
||||||
u8 type;
|
u8 type;
|
||||||
u16 value;
|
u16 value;
|
||||||
@@ -34,6 +35,7 @@ static int dtv5100_i2c_msg(struct dvb_usb_device *d, u8 addr,
|
|||||||
switch (wlen) {
|
switch (wlen) {
|
||||||
case 1:
|
case 1:
|
||||||
/* write { reg }, read { value } */
|
/* write { reg }, read { value } */
|
||||||
|
pipe = usb_rcvctrlpipe(d->udev, 0);
|
||||||
request = (addr == DTV5100_DEMOD_ADDR ? DTV5100_DEMOD_READ :
|
request = (addr == DTV5100_DEMOD_ADDR ? DTV5100_DEMOD_READ :
|
||||||
DTV5100_TUNER_READ);
|
DTV5100_TUNER_READ);
|
||||||
type = USB_TYPE_VENDOR | USB_DIR_IN;
|
type = USB_TYPE_VENDOR | USB_DIR_IN;
|
||||||
@@ -41,6 +43,7 @@ static int dtv5100_i2c_msg(struct dvb_usb_device *d, u8 addr,
|
|||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
/* write { reg, value } */
|
/* write { reg, value } */
|
||||||
|
pipe = usb_sndctrlpipe(d->udev, 0);
|
||||||
request = (addr == DTV5100_DEMOD_ADDR ? DTV5100_DEMOD_WRITE :
|
request = (addr == DTV5100_DEMOD_ADDR ? DTV5100_DEMOD_WRITE :
|
||||||
DTV5100_TUNER_WRITE);
|
DTV5100_TUNER_WRITE);
|
||||||
type = USB_TYPE_VENDOR | USB_DIR_OUT;
|
type = USB_TYPE_VENDOR | USB_DIR_OUT;
|
||||||
@@ -54,7 +57,7 @@ static int dtv5100_i2c_msg(struct dvb_usb_device *d, u8 addr,
|
|||||||
|
|
||||||
memcpy(st->data, rbuf, rlen);
|
memcpy(st->data, rbuf, rlen);
|
||||||
msleep(1); /* avoid I2C errors */
|
msleep(1); /* avoid I2C errors */
|
||||||
return usb_control_msg(d->udev, usb_rcvctrlpipe(d->udev, 0), request,
|
return usb_control_msg(d->udev, pipe, request,
|
||||||
type, value, index, st->data, rlen,
|
type, value, index, st->data, rlen,
|
||||||
DTV5100_USB_TIMEOUT);
|
DTV5100_USB_TIMEOUT);
|
||||||
}
|
}
|
||||||
@@ -141,7 +144,7 @@ static int dtv5100_probe(struct usb_interface *intf,
|
|||||||
|
|
||||||
/* initialize non qt1010/zl10353 part? */
|
/* initialize non qt1010/zl10353 part? */
|
||||||
for (i = 0; dtv5100_init[i].request; i++) {
|
for (i = 0; dtv5100_init[i].request; i++) {
|
||||||
ret = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
|
ret = usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
|
||||||
dtv5100_init[i].request,
|
dtv5100_init[i].request,
|
||||||
USB_TYPE_VENDOR | USB_DIR_OUT,
|
USB_TYPE_VENDOR | USB_DIR_OUT,
|
||||||
dtv5100_init[i].value,
|
dtv5100_init[i].value,
|
||||||
|
Reference in New Issue
Block a user