Commit 2930977a authored by Mauro Carvalho Chehab's avatar Mauro Carvalho Chehab

[media] au0828: Fix DVB resume when streaming

When DVB is streaming and suspend is called, it will call
au0828_stop_transport(), with will clean the streaming flag.

Due to that, stop_urb_transfer() will be called twice,
causing an oops.

So, we need another flag to be used at resume, telling it
to restart DVB.

While here, add a logic at stop_urb_transfer() to prevent
it of being called twice, and convert the usb_streaming
flag into boolean.
Signed-off-by: default avatarMauro Carvalho Chehab <m.chehab@samsung.com>
parent bbc62a18
...@@ -121,7 +121,7 @@ static void urb_completion(struct urb *purb) ...@@ -121,7 +121,7 @@ static void urb_completion(struct urb *purb)
return; return;
} }
if (dev->urb_streaming == 0) { if (!dev->urb_streaming) {
dprintk(2, "%s: not streaming!\n", __func__); dprintk(2, "%s: not streaming!\n", __func__);
return; return;
} }
...@@ -159,7 +159,10 @@ static int stop_urb_transfer(struct au0828_dev *dev) ...@@ -159,7 +159,10 @@ static int stop_urb_transfer(struct au0828_dev *dev)
dprintk(2, "%s()\n", __func__); dprintk(2, "%s()\n", __func__);
dev->urb_streaming = 0; if (!dev->urb_streaming)
return 0;
dev->urb_streaming = false;
for (i = 0; i < URB_COUNT; i++) { for (i = 0; i < URB_COUNT; i++) {
if (dev->urbs[i]) { if (dev->urbs[i]) {
usb_kill_urb(dev->urbs[i]); usb_kill_urb(dev->urbs[i]);
...@@ -229,7 +232,7 @@ static int start_urb_transfer(struct au0828_dev *dev) ...@@ -229,7 +232,7 @@ static int start_urb_transfer(struct au0828_dev *dev)
} }
} }
dev->urb_streaming = 1; dev->urb_streaming = true;
ret = 0; ret = 0;
err: err:
...@@ -323,7 +326,7 @@ static void au0828_restart_dvb_streaming(struct work_struct *work) ...@@ -323,7 +326,7 @@ static void au0828_restart_dvb_streaming(struct work_struct *work)
restart_streaming); restart_streaming);
struct au0828_dvb *dvb = &dev->dvb; struct au0828_dvb *dvb = &dev->dvb;
if (dev->urb_streaming == 0) if (!dev->urb_streaming)
return; return;
dprintk(1, "Restarting streaming...!\n"); dprintk(1, "Restarting streaming...!\n");
...@@ -628,6 +631,7 @@ void au0828_dvb_suspend(struct au0828_dev *dev) ...@@ -628,6 +631,7 @@ void au0828_dvb_suspend(struct au0828_dev *dev)
stop_urb_transfer(dev); stop_urb_transfer(dev);
au0828_stop_transport(dev, 1); au0828_stop_transport(dev, 1);
mutex_unlock(&dvb->lock); mutex_unlock(&dvb->lock);
dev->need_urb_start = 1;
} }
} }
...@@ -635,7 +639,7 @@ void au0828_dvb_resume(struct au0828_dev *dev) ...@@ -635,7 +639,7 @@ void au0828_dvb_resume(struct au0828_dev *dev)
{ {
struct au0828_dvb *dvb = &dev->dvb; struct au0828_dvb *dvb = &dev->dvb;
if (dvb->frontend && dev->urb_streaming) { if (dvb->frontend && dev->need_urb_start) {
pr_info("resuming DVB\n"); pr_info("resuming DVB\n");
au0828_set_frontend(dvb->frontend); au0828_set_frontend(dvb->frontend);
......
...@@ -267,8 +267,8 @@ struct au0828_dev { ...@@ -267,8 +267,8 @@ struct au0828_dev {
char *transfer_buffer[AU0828_MAX_ISO_BUFS];/* transfer buffers for isoc char *transfer_buffer[AU0828_MAX_ISO_BUFS];/* transfer buffers for isoc
transfer */ transfer */
/* USB / URB Related */ /* DVB USB / URB Related */
int urb_streaming; bool urb_streaming, need_urb_start;
struct urb *urbs[URB_COUNT]; struct urb *urbs[URB_COUNT];
/* Preallocated transfer digital transfer buffers */ /* Preallocated transfer digital transfer buffers */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment