提交 4ff5ed44 编写于 作者: D Devin Heitmueller 提交者: Mauro Carvalho Chehab

V4L/DVB (11069): au8522: add mutex protecting use of hybrid state

Access using the hybrid state framework requires the list to be protected by
a mutex.

Thanks to Michael Krufky <mkrufky@linuxtv.org> for reporting this during a
code review.
Signed-off-by: NDevin Heitmueller <dheitmueller@linuxtv.org>
Signed-off-by: NMichael Krufky <mkrufky@linuxtv.org>
Signed-off-by: NMauro Carvalho Chehab <mchehab@redhat.com>
上级 7fdd7c72
...@@ -34,6 +34,7 @@ static int debug; ...@@ -34,6 +34,7 @@ static int debug;
/* Despite the name "hybrid_tuner", the framework works just as well for /* Despite the name "hybrid_tuner", the framework works just as well for
hybrid demodulators as well... */ hybrid demodulators as well... */
static LIST_HEAD(hybrid_tuner_instance_list); static LIST_HEAD(hybrid_tuner_instance_list);
static DEFINE_MUTEX(au8522_list_mutex);
#define dprintk(arg...) do { \ #define dprintk(arg...) do { \
if (debug) \ if (debug) \
...@@ -795,15 +796,23 @@ static struct dvb_frontend_ops au8522_ops; ...@@ -795,15 +796,23 @@ static struct dvb_frontend_ops au8522_ops;
int au8522_get_state(struct au8522_state **state, struct i2c_adapter *i2c, int au8522_get_state(struct au8522_state **state, struct i2c_adapter *i2c,
u8 client_address) u8 client_address)
{ {
return hybrid_tuner_request_state(struct au8522_state, (*state), int ret;
hybrid_tuner_instance_list,
i2c, client_address, "au8522"); mutex_lock(&au8522_list_mutex);
ret = hybrid_tuner_request_state(struct au8522_state, (*state),
hybrid_tuner_instance_list,
i2c, client_address, "au8522");
mutex_unlock(&au8522_list_mutex);
return ret;
} }
void au8522_release_state(struct au8522_state *state) void au8522_release_state(struct au8522_state *state)
{ {
mutex_lock(&au8522_list_mutex);
if (state != NULL) if (state != NULL)
hybrid_tuner_release_state(state); hybrid_tuner_release_state(state);
mutex_unlock(&au8522_list_mutex);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册