aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb/frontends
diff options
context:
space:
mode:
authorAntti Palosaari <crope@iki.fi>2012-01-21 20:40:58 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2012-02-28 16:44:25 -0500
commita8567cf22e0efb9faafa6cf33b607ca5aee3c2fa (patch)
tree158208995684ed035053db50970530b3f8c47299 /drivers/media/dvb/frontends
parent9935eea5ac300b84036192af1bd98940a64650de (diff)
[media] rtl2830: prevent .read_status() when sleeping
Hardware is not accessible when device is sleeping. Preventing such IOCTLs when sleep should be job of DVB CORE... Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/dvb/frontends')
-rw-r--r--drivers/media/dvb/frontends/rtl2830.c15
-rw-r--r--drivers/media/dvb/frontends/rtl2830_priv.h2
2 files changed, 17 insertions, 0 deletions
diff --git a/drivers/media/dvb/frontends/rtl2830.c b/drivers/media/dvb/frontends/rtl2830.c
index f036701c12ee..f971d949b2af 100644
--- a/drivers/media/dvb/frontends/rtl2830.c
+++ b/drivers/media/dvb/frontends/rtl2830.c
@@ -273,12 +273,21 @@ static int rtl2830_init(struct dvb_frontend *fe)
273 if (ret) 273 if (ret)
274 goto err; 274 goto err;
275 275
276 priv->sleeping = false;
277
276 return ret; 278 return ret;
277err: 279err:
278 dbg("%s: failed=%d", __func__, ret); 280 dbg("%s: failed=%d", __func__, ret);
279 return ret; 281 return ret;
280} 282}
281 283
284static int rtl2830_sleep(struct dvb_frontend *fe)
285{
286 struct rtl2830_priv *priv = fe->demodulator_priv;
287 priv->sleeping = true;
288 return 0;
289}
290
282int rtl2830_get_tune_settings(struct dvb_frontend *fe, 291int rtl2830_get_tune_settings(struct dvb_frontend *fe,
283 struct dvb_frontend_tune_settings *s) 292 struct dvb_frontend_tune_settings *s)
284{ 293{
@@ -372,6 +381,9 @@ static int rtl2830_read_status(struct dvb_frontend *fe, fe_status_t *status)
372 u8 tmp; 381 u8 tmp;
373 *status = 0; 382 *status = 0;
374 383
384 if (priv->sleeping)
385 return 0;
386
375 ret = rtl2830_rd_reg_mask(priv, 0x351, &tmp, 0x78); /* [6:3] */ 387 ret = rtl2830_rd_reg_mask(priv, 0x351, &tmp, 0x78); /* [6:3] */
376 if (ret) 388 if (ret)
377 goto err; 389 goto err;
@@ -498,6 +510,8 @@ struct dvb_frontend *rtl2830_attach(const struct rtl2830_config *cfg,
498 goto err; 510 goto err;
499 } 511 }
500 512
513 priv->sleeping = true;
514
501 return &priv->fe; 515 return &priv->fe;
502err: 516err:
503 dbg("%s: failed=%d", __func__, ret); 517 dbg("%s: failed=%d", __func__, ret);
@@ -530,6 +544,7 @@ static struct dvb_frontend_ops rtl2830_ops = {
530 .release = rtl2830_release, 544 .release = rtl2830_release,
531 545
532 .init = rtl2830_init, 546 .init = rtl2830_init,
547 .sleep = rtl2830_sleep,
533 548
534 .get_tune_settings = rtl2830_get_tune_settings, 549 .get_tune_settings = rtl2830_get_tune_settings,
535 550
diff --git a/drivers/media/dvb/frontends/rtl2830_priv.h b/drivers/media/dvb/frontends/rtl2830_priv.h
index 49de01dd5e83..4a464761b5b8 100644
--- a/drivers/media/dvb/frontends/rtl2830_priv.h
+++ b/drivers/media/dvb/frontends/rtl2830_priv.h
@@ -43,6 +43,8 @@ struct rtl2830_priv {
43 struct rtl2830_config cfg; 43 struct rtl2830_config cfg;
44 struct i2c_adapter tuner_i2c_adapter; 44 struct i2c_adapter tuner_i2c_adapter;
45 45
46 bool sleeping;
47
46 u8 page; /* active register page */ 48 u8 page; /* active register page */
47}; 49};
48 50