Commit 7d95fb74 authored by Mauro Carvalho Chehab's avatar Mauro Carvalho Chehab

media: dvbsky: use just one mutex for serializing device R/W ops

Right now, there are two mutexes serializing r/w ops: one "generic"
and another one specifically for stream on/off.

Clean it a little bit, getting rid of one of the mutexes.
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
parent 3b7158d6
...@@ -31,7 +31,6 @@ MODULE_PARM_DESC(disable_rc, "Disable inbuilt IR receiver."); ...@@ -31,7 +31,6 @@ MODULE_PARM_DESC(disable_rc, "Disable inbuilt IR receiver.");
DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
struct dvbsky_state { struct dvbsky_state {
struct mutex stream_mutex;
u8 ibuf[DVBSKY_BUF_LEN]; u8 ibuf[DVBSKY_BUF_LEN];
u8 obuf[DVBSKY_BUF_LEN]; u8 obuf[DVBSKY_BUF_LEN];
u8 last_lock; u8 last_lock;
...@@ -68,18 +67,17 @@ static int dvbsky_usb_generic_rw(struct dvb_usb_device *d, ...@@ -68,18 +67,17 @@ static int dvbsky_usb_generic_rw(struct dvb_usb_device *d,
static int dvbsky_stream_ctrl(struct dvb_usb_device *d, u8 onoff) static int dvbsky_stream_ctrl(struct dvb_usb_device *d, u8 onoff)
{ {
struct dvbsky_state *state = d_to_priv(d);
int ret; int ret;
u8 obuf_pre[3] = { 0x37, 0, 0 }; static u8 obuf_pre[3] = { 0x37, 0, 0 };
u8 obuf_post[3] = { 0x36, 3, 0 }; static u8 obuf_post[3] = { 0x36, 3, 0 };
mutex_lock(&state->stream_mutex); mutex_lock(&d->usb_mutex);
ret = dvbsky_usb_generic_rw(d, obuf_pre, 3, NULL, 0); ret = dvb_usbv2_generic_rw_locked(d, obuf_pre, 3, NULL, 0);
if (!ret && onoff) { if (!ret && onoff) {
msleep(20); msleep(20);
ret = dvbsky_usb_generic_rw(d, obuf_post, 3, NULL, 0); ret = dvb_usbv2_generic_rw_locked(d, obuf_post, 3, NULL, 0);
} }
mutex_unlock(&state->stream_mutex); mutex_unlock(&d->usb_mutex);
return ret; return ret;
} }
...@@ -608,8 +606,6 @@ static int dvbsky_init(struct dvb_usb_device *d) ...@@ -608,8 +606,6 @@ static int dvbsky_init(struct dvb_usb_device *d)
if (ret) if (ret)
return ret; return ret;
*/ */
mutex_init(&state->stream_mutex);
state->last_lock = 0; state->last_lock = 0;
return 0; return 0;
......
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