提交 d32be218 编写于 作者: A Antti Palosaari 提交者: Mauro Carvalho Chehab

[media] dvb_usb_v2: do not check active fe when stop streaming

Do not check active frontend as it could be already shutdown.
Add some more debugs.

It turns out that device is put sleep earlier than streaming
is stopped in some cases. That is because streaming is running
different task and there is no locking.

Maybe some locking could be good idea to force stop streaming
before device is shut down. I can guess there could be problems
in someday cases like chip is sleep but streaming control is
requested after that...
Signed-off-by: NAntti Palosaari <crope@iki.fi>
Signed-off-by: NMauro Carvalho Chehab <mchehab@redhat.com>
上级 ce6ea9a9
......@@ -68,11 +68,14 @@ static int dvb_usb_ctrl_feed(struct dvb_demux_feed *dvbdmxfeed, int onoff)
struct dvb_usb_adapter *adap = dvbdmxfeed->demux->priv;
int newfeedcount, ret;
if (adap == NULL || adap->active_fe < 0) {
if (adap == NULL) {
ret = -ENODEV;
goto err;
}
pr_debug("%s: adap=%d active_fe=%d\n", __func__, adap->id,
adap->active_fe);
newfeedcount = adap->feedcount + (onoff ? 1 : -1);
/* stop feed before setting a new pid if there will be no pid anymore */
......@@ -189,12 +192,15 @@ static int dvb_usb_stop_feed(struct dvb_demux_feed *dvbdmxfeed)
int dvb_usbv2_adapter_dvb_init(struct dvb_usb_adapter *adap)
{
int ret = dvb_register_adapter(&adap->dvb_adap, adap->dev->name,
adap->dev->props->owner,
&adap->dev->udev->dev,
adap->dev->props->adapter_nr);
int ret;
pr_debug("%s: adap=%d\n", __func__, adap->id);
ret = dvb_register_adapter(&adap->dvb_adap, adap->dev->name,
adap->dev->props->owner, &adap->dev->udev->dev,
adap->dev->props->adapter_nr);
if (ret < 0) {
pr_debug("%s: dvb_register_adapter failed=%d\n", __func__, ret);
pr_debug("%s: dvb_register_adapter() failed=%d\n", __func__,
ret);
goto err;
}
adap->dvb_adap.priv = adap;
......@@ -258,6 +264,8 @@ int dvb_usbv2_adapter_dvb_init(struct dvb_usb_adapter *adap)
int dvb_usbv2_adapter_dvb_exit(struct dvb_usb_adapter *adap)
{
pr_debug("%s: adap=%d\n", __func__, adap->id);
if (adap->state & DVB_USB_ADAP_STATE_DVB) {
pr_debug("%s: unregistering DVB part\n", __func__);
dvb_net_release(&adap->dvb_net);
......@@ -274,6 +282,7 @@ static int dvb_usb_fe_wakeup(struct dvb_frontend *fe)
{
int ret;
struct dvb_usb_adapter *adap = fe->dvb->priv;
pr_debug("%s: adap=%d fe=%d\n", __func__, adap->id, fe->id);
ret = dvb_usbv2_device_power_ctrl(adap->dev, 1);
if (ret < 0)
......@@ -303,6 +312,7 @@ static int dvb_usb_fe_sleep(struct dvb_frontend *fe)
{
int ret;
struct dvb_usb_adapter *adap = fe->dvb->priv;
pr_debug("%s: adap=%d fe=%d\n", __func__, adap->id, fe->id);
if (adap->fe_sleep[fe->id]) {
ret = adap->fe_sleep[fe->id](fe);
......@@ -331,8 +341,7 @@ static int dvb_usb_fe_sleep(struct dvb_frontend *fe)
int dvb_usbv2_adapter_frontend_init(struct dvb_usb_adapter *adap)
{
int ret, i, count_registered = 0;
pr_debug("%s:\n", __func__);
pr_debug("%s: adap=%d\n", __func__, adap->id);
memset(adap->fe, 0, sizeof(adap->fe));
adap->active_fe = -1;
......@@ -400,8 +409,7 @@ int dvb_usbv2_adapter_frontend_init(struct dvb_usb_adapter *adap)
int dvb_usbv2_adapter_frontend_exit(struct dvb_usb_adapter *adap)
{
int i;
pr_debug("%s:\n", __func__);
pr_debug("%s: adap=%d\n", __func__, adap->id);
for (i = adap->num_frontends_initialized - 1; i >= 0; i--) {
if (adap->fe[i]) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册