[media] dtt200u: handle USB control message errors
If something bad happens while an USB control message is transfered, return an error code. Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
This commit is contained in:
Родитель
ab883e2de3
Коммит
a3f9f07e06
|
@ -28,37 +28,42 @@ struct dtt200u_state {
|
||||||
static int dtt200u_power_ctrl(struct dvb_usb_device *d, int onoff)
|
static int dtt200u_power_ctrl(struct dvb_usb_device *d, int onoff)
|
||||||
{
|
{
|
||||||
struct dtt200u_state *st = d->priv;
|
struct dtt200u_state *st = d->priv;
|
||||||
|
int ret = 0;
|
||||||
|
|
||||||
mutex_lock(&st->data_mutex);
|
mutex_lock(&st->data_mutex);
|
||||||
|
|
||||||
st->data[0] = SET_INIT;
|
st->data[0] = SET_INIT;
|
||||||
|
|
||||||
if (onoff)
|
if (onoff)
|
||||||
dvb_usb_generic_write(d, st->data, 2);
|
ret = dvb_usb_generic_write(d, st->data, 2);
|
||||||
|
|
||||||
mutex_unlock(&st->data_mutex);
|
mutex_unlock(&st->data_mutex);
|
||||||
return 0;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int dtt200u_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff)
|
static int dtt200u_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff)
|
||||||
{
|
{
|
||||||
struct dtt200u_state *st = adap->dev->priv;
|
struct dtt200u_state *st = adap->dev->priv;
|
||||||
|
int ret;
|
||||||
|
|
||||||
mutex_lock(&st->data_mutex);
|
mutex_lock(&st->data_mutex);
|
||||||
st->data[0] = SET_STREAMING;
|
st->data[0] = SET_STREAMING;
|
||||||
st->data[1] = onoff;
|
st->data[1] = onoff;
|
||||||
|
|
||||||
dvb_usb_generic_write(adap->dev, st->data, 2);
|
ret = dvb_usb_generic_write(adap->dev, st->data, 2);
|
||||||
|
if (ret < 0)
|
||||||
|
goto ret;
|
||||||
|
|
||||||
if (onoff)
|
if (onoff)
|
||||||
return 0;
|
goto ret;
|
||||||
|
|
||||||
st->data[0] = RESET_PID_FILTER;
|
st->data[0] = RESET_PID_FILTER;
|
||||||
dvb_usb_generic_write(adap->dev, st->data, 1);
|
ret = dvb_usb_generic_write(adap->dev, st->data, 1);
|
||||||
|
|
||||||
|
ret:
|
||||||
mutex_unlock(&st->data_mutex);
|
mutex_unlock(&st->data_mutex);
|
||||||
|
|
||||||
return 0;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int dtt200u_pid_filter(struct dvb_usb_adapter *adap, int index, u16 pid, int onoff)
|
static int dtt200u_pid_filter(struct dvb_usb_adapter *adap, int index, u16 pid, int onoff)
|
||||||
|
@ -84,11 +89,15 @@ static int dtt200u_rc_query(struct dvb_usb_device *d)
|
||||||
{
|
{
|
||||||
struct dtt200u_state *st = d->priv;
|
struct dtt200u_state *st = d->priv;
|
||||||
u32 scancode;
|
u32 scancode;
|
||||||
|
int ret;
|
||||||
|
|
||||||
mutex_lock(&st->data_mutex);
|
mutex_lock(&st->data_mutex);
|
||||||
st->data[0] = GET_RC_CODE;
|
st->data[0] = GET_RC_CODE;
|
||||||
|
|
||||||
dvb_usb_generic_rw(d, st->data, 1, st->data, 5, 0);
|
ret = dvb_usb_generic_rw(d, st->data, 1, st->data, 5, 0);
|
||||||
|
if (ret < 0)
|
||||||
|
goto ret;
|
||||||
|
|
||||||
if (st->data[0] == 1) {
|
if (st->data[0] == 1) {
|
||||||
enum rc_type proto = RC_TYPE_NEC;
|
enum rc_type proto = RC_TYPE_NEC;
|
||||||
|
|
||||||
|
@ -116,8 +125,9 @@ static int dtt200u_rc_query(struct dvb_usb_device *d)
|
||||||
if (st->data[0] != 0)
|
if (st->data[0] != 0)
|
||||||
deb_info("st->data: %*ph\n", 5, st->data);
|
deb_info("st->data: %*ph\n", 5, st->data);
|
||||||
|
|
||||||
|
ret:
|
||||||
mutex_unlock(&st->data_mutex);
|
mutex_unlock(&st->data_mutex);
|
||||||
return 0;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int dtt200u_frontend_attach(struct dvb_usb_adapter *adap)
|
static int dtt200u_frontend_attach(struct dvb_usb_adapter *adap)
|
||||||
|
|
Загрузка…
Ссылка в новой задаче