diff --git a/drivers/media/usb/dvb-usb-v2/dvb_usb_core.c b/drivers/media/usb/dvb-usb-v2/dvb_usb_core.c index bd86d250433d..e54a002676b9 100644 --- a/drivers/media/usb/dvb-usb-v2/dvb_usb_core.c +++ b/drivers/media/usb/dvb-usb-v2/dvb_usb_core.c @@ -376,9 +376,7 @@ static int dvb_usb_stop_feed(struct dvb_demux_feed *dvbdmxfeed) usb_urb_killv2(&adap->stream); /* clear 'streaming' status bit */ - clear_bit(ADAP_STREAMING, &adap->state_bits); - smp_mb__after_atomic(); - wake_up_bit(&adap->state_bits, ADAP_STREAMING); + clear_and_wake_up_bit(ADAP_STREAMING, &adap->state_bits); skip_feed_stop: if (ret) @@ -580,11 +578,8 @@ static int dvb_usb_fe_init(struct dvb_frontend *fe) goto err; } err: - if (!adap->suspend_resume_active) { - clear_bit(ADAP_INIT, &adap->state_bits); - smp_mb__after_atomic(); - wake_up_bit(&adap->state_bits, ADAP_INIT); - } + if (!adap->suspend_resume_active) + clear_and_wake_up_bit(ADAP_INIT, &adap->state_bits); dev_dbg(&d->udev->dev, "%s: ret=%d\n", __func__, ret); return ret; @@ -621,9 +616,7 @@ static int dvb_usb_fe_sleep(struct dvb_frontend *fe) err: if (!adap->suspend_resume_active) { adap->active_fe = -1; - clear_bit(ADAP_SLEEP, &adap->state_bits); - smp_mb__after_atomic(); - wake_up_bit(&adap->state_bits, ADAP_SLEEP); + clear_and_wake_up_bit(ADAP_SLEEP, &adap->state_bits); } dev_dbg(&d->udev->dev, "%s: ret=%d\n", __func__, ret); @@ -637,7 +630,6 @@ static int dvb_usbv2_adapter_frontend_init(struct dvb_usb_adapter *adap) dev_dbg(&d->udev->dev, "%s: adap=%d\n", __func__, adap->id); memset(adap->fe, 0, sizeof(adap->fe)); - adap->active_fe = -1; if (d->props->frontend_attach) { ret = d->props->frontend_attach(adap); @@ -759,6 +751,7 @@ static int dvb_usbv2_adapter_init(struct dvb_usb_device *d) for (i = 0; i < adapter_count; i++) { adap = &d->adapter[i]; adap->id = i; + adap->active_fe = -1; adap->props = &d->props->adapter[i]; /* speed - when running at FULL speed we need a HW PID filter */