Skip to content

Commit

Permalink
[media] dvb_usb_v2: do not check active fe when stop streaming
Browse files Browse the repository at this point in the history
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: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
  • Loading branch information
Antti Palosaari authored and Mauro Carvalho Chehab committed Aug 4, 2012
1 parent ce6ea9a commit d32be21
Showing 1 changed file with 18 additions and 10 deletions.
28 changes: 18 additions & 10 deletions drivers/media/dvb/dvb-usb/dvb_usb_dvb.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand All @@ -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)
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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]) {
Expand Down

0 comments on commit d32be21

Please sign in to comment.