Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 295103
b: refs/heads/master
c: 6d535bd
h: refs/heads/master
i:
  295101: fe1bdbc
  295099: 43d03d1
  295095: eba6f74
  295087: 6407d3c
  295071: ac8293a
  295039: 8845fad
v: v3
  • Loading branch information
Antti Palosaari authored and Mauro Carvalho Chehab committed Mar 19, 2012
1 parent cc3bea0 commit 2372812
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 31 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: be4a5e7f0e279b751a23570da583ec41ca32a34f
refs/heads/master: 6d535bd8829b18c6b5276d65f8f25e57dd0bcbed
74 changes: 46 additions & 28 deletions trunk/drivers/media/dvb/dvb-usb/af9015.c
Original file line number Diff line number Diff line change
Expand Up @@ -1141,18 +1141,7 @@ static int af9015_af9013_init(struct dvb_frontend *fe)
return -EAGAIN;

ret = priv->init[adap->id](fe);
if (ret)
goto err_unlock;

if (priv->tuner_ops_init[adap->id]) {
if (fe->ops.i2c_gate_ctrl)
fe->ops.i2c_gate_ctrl(fe, 1);
ret = priv->tuner_ops_init[adap->id](fe);
if (fe->ops.i2c_gate_ctrl)
fe->ops.i2c_gate_ctrl(fe, 0);
}

err_unlock:
mutex_unlock(&adap->dev->usb_mutex);

return ret;
Expand All @@ -1168,24 +1157,48 @@ static int af9015_af9013_sleep(struct dvb_frontend *fe)
if (mutex_lock_interruptible(&adap->dev->usb_mutex))
return -EAGAIN;

if (priv->tuner_ops_sleep[adap->id]) {
if (fe->ops.i2c_gate_ctrl)
fe->ops.i2c_gate_ctrl(fe, 1);
ret = priv->tuner_ops_sleep[adap->id](fe);
if (fe->ops.i2c_gate_ctrl)
fe->ops.i2c_gate_ctrl(fe, 0);
if (ret)
goto err_unlock;
}

ret = priv->sleep[adap->id](fe);

err_unlock:
mutex_unlock(&adap->dev->usb_mutex);

return ret;
}

/* override tuner callbacks for resource locking */
static int af9015_tuner_init(struct dvb_frontend *fe)
{
int ret;
struct dvb_usb_adapter *adap = fe->dvb->priv;
struct af9015_state *priv = adap->dev->priv;

if (mutex_lock_interruptible(&adap->dev->usb_mutex))
return -EAGAIN;

ret = priv->tuner_init[adap->id](fe);

mutex_unlock(&adap->dev->usb_mutex);

return ret;
}

/* override tuner callbacks for resource locking */
static int af9015_tuner_sleep(struct dvb_frontend *fe)
{
int ret;
struct dvb_usb_adapter *adap = fe->dvb->priv;
struct af9015_state *priv = adap->dev->priv;

if (mutex_lock_interruptible(&adap->dev->usb_mutex))
return -EAGAIN;

ret = priv->tuner_sleep[adap->id](fe);

mutex_unlock(&adap->dev->usb_mutex);

return ret;
}


static int af9015_af9013_frontend_attach(struct dvb_usb_adapter *adap)
{
int ret;
Expand Down Expand Up @@ -1364,13 +1377,18 @@ static int af9015_tuner_attach(struct dvb_usb_adapter *adap)
af9015_af9013_config[adap->id].tuner);
}

state->tuner_ops_sleep[adap->id] =
adap->fe_adap[0].fe->ops.tuner_ops.sleep;
adap->fe_adap[0].fe->ops.tuner_ops.sleep = 0;
if (adap->fe_adap[0].fe->ops.tuner_ops.init) {
state->tuner_init[adap->id] =
adap->fe_adap[0].fe->ops.tuner_ops.init;
adap->fe_adap[0].fe->ops.tuner_ops.init = af9015_tuner_init;
}

if (adap->fe_adap[0].fe->ops.tuner_ops.sleep) {
state->tuner_sleep[adap->id] =
adap->fe_adap[0].fe->ops.tuner_ops.sleep;
adap->fe_adap[0].fe->ops.tuner_ops.sleep = af9015_tuner_sleep;
}

state->tuner_ops_init[adap->id] =
adap->fe_adap[0].fe->ops.tuner_ops.init;
adap->fe_adap[0].fe->ops.tuner_ops.init = 0;
return ret;
}

Expand Down
4 changes: 2 additions & 2 deletions trunk/drivers/media/dvb/dvb-usb/af9015.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,8 @@ struct af9015_state {
int (*read_status[2]) (struct dvb_frontend *fe, fe_status_t *status);
int (*init[2]) (struct dvb_frontend *fe);
int (*sleep[2]) (struct dvb_frontend *fe);
int (*tuner_ops_init[2]) (struct dvb_frontend *fe);
int (*tuner_ops_sleep[2]) (struct dvb_frontend *fe);
int (*tuner_init[2]) (struct dvb_frontend *fe);
int (*tuner_sleep[2]) (struct dvb_frontend *fe);
};

struct af9015_config {
Expand Down

0 comments on commit 2372812

Please sign in to comment.