[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>
diff --git a/drivers/media/dvb/frontends/rtl2830.c b/drivers/media/dvb/frontends/rtl2830.c
index f036701..f971d94 100644
--- a/drivers/media/dvb/frontends/rtl2830.c
+++ b/drivers/media/dvb/frontends/rtl2830.c
@@ -273,12 +273,21 @@
 	if (ret)
 		goto err;
 
+	priv->sleeping = false;
+
 	return ret;
 err:
 	dbg("%s: failed=%d", __func__, ret);
 	return ret;
 }
 
+static int rtl2830_sleep(struct dvb_frontend *fe)
+{
+	struct rtl2830_priv *priv = fe->demodulator_priv;
+	priv->sleeping = true;
+	return 0;
+}
+
 int rtl2830_get_tune_settings(struct dvb_frontend *fe,
 	struct dvb_frontend_tune_settings *s)
 {
@@ -372,6 +381,9 @@
 	u8 tmp;
 	*status = 0;
 
+	if (priv->sleeping)
+		return 0;
+
 	ret = rtl2830_rd_reg_mask(priv, 0x351, &tmp, 0x78); /* [6:3] */
 	if (ret)
 		goto err;
@@ -498,6 +510,8 @@
 		goto err;
 	}
 
+	priv->sleeping = true;
+
 	return &priv->fe;
 err:
 	dbg("%s: failed=%d", __func__, ret);
@@ -530,6 +544,7 @@
 	.release = rtl2830_release,
 
 	.init = rtl2830_init,
+	.sleep = rtl2830_sleep,
 
 	.get_tune_settings = rtl2830_get_tune_settings,