aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb/frontends/au8522_dig.c
diff options
context:
space:
mode:
authorDevin Heitmueller <dheitmueller@linuxtv.org>2009-03-11 03:00:45 -0300
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-03-30 12:43:25 -0300
commit4ff5ed44f84aed6727ec226853a1c6b03c36db5e (patch)
treedd4a2fa3338710215a114aa147177209efc26cac /drivers/media/dvb/frontends/au8522_dig.c
parentV4L/DVB (11068): au0828: add analog profile for the HVR-850 (diff)
downloadlinux-dev-4ff5ed44f84aed6727ec226853a1c6b03c36db5e.tar.xz
linux-dev-4ff5ed44f84aed6727ec226853a1c6b03c36db5e.zip
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: Devin Heitmueller <dheitmueller@linuxtv.org> Signed-off-by: Michael Krufky <mkrufky@linuxtv.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/dvb/frontends/au8522_dig.c')
-rw-r--r--drivers/media/dvb/frontends/au8522_dig.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/drivers/media/dvb/frontends/au8522_dig.c b/drivers/media/dvb/frontends/au8522_dig.c
index b04346687c68..7e24b914dbe5 100644
--- a/drivers/media/dvb/frontends/au8522_dig.c
+++ b/drivers/media/dvb/frontends/au8522_dig.c
@@ -34,6 +34,7 @@ static int debug;
/* Despite the name "hybrid_tuner", the framework works just as well for
hybrid demodulators as well... */
static LIST_HEAD(hybrid_tuner_instance_list);
+static DEFINE_MUTEX(au8522_list_mutex);
#define dprintk(arg...) do { \
if (debug) \
@@ -795,15 +796,23 @@ static struct dvb_frontend_ops au8522_ops;
int au8522_get_state(struct au8522_state **state, struct i2c_adapter *i2c,
u8 client_address)
{
- return hybrid_tuner_request_state(struct au8522_state, (*state),
- hybrid_tuner_instance_list,
- i2c, client_address, "au8522");
+ int ret;
+
+ 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)
{
+ mutex_lock(&au8522_list_mutex);
if (state != NULL)
hybrid_tuner_release_state(state);
+ mutex_unlock(&au8522_list_mutex);
}