aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb
diff options
context:
space:
mode:
authorDevin Heitmueller <dheitmueller@linuxtv.org>2009-03-11 02:00:45 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-03-30 11:43:25 -0400
commit4ff5ed44f84aed6727ec226853a1c6b03c36db5e (patch)
treedd4a2fa3338710215a114aa147177209efc26cac /drivers/media/dvb
parent7fdd7c72ad65ef98d1071cf4cd8a39490f423bae (diff)
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')
-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;
34/* Despite the name "hybrid_tuner", the framework works just as well for 34/* Despite the name "hybrid_tuner", the framework works just as well for
35 hybrid demodulators as well... */ 35 hybrid demodulators as well... */
36static LIST_HEAD(hybrid_tuner_instance_list); 36static LIST_HEAD(hybrid_tuner_instance_list);
37static DEFINE_MUTEX(au8522_list_mutex);
37 38
38#define dprintk(arg...) do { \ 39#define dprintk(arg...) do { \
39 if (debug) \ 40 if (debug) \
@@ -795,15 +796,23 @@ static struct dvb_frontend_ops au8522_ops;
795int au8522_get_state(struct au8522_state **state, struct i2c_adapter *i2c, 796int au8522_get_state(struct au8522_state **state, struct i2c_adapter *i2c,
796 u8 client_address) 797 u8 client_address)
797{ 798{
798 return hybrid_tuner_request_state(struct au8522_state, (*state), 799 int ret;
799 hybrid_tuner_instance_list, 800
800 i2c, client_address, "au8522"); 801 mutex_lock(&au8522_list_mutex);
802 ret = hybrid_tuner_request_state(struct au8522_state, (*state),
803 hybrid_tuner_instance_list,
804 i2c, client_address, "au8522");
805 mutex_unlock(&au8522_list_mutex);
806
807 return ret;
801} 808}
802 809
803void au8522_release_state(struct au8522_state *state) 810void au8522_release_state(struct au8522_state *state)
804{ 811{
812 mutex_lock(&au8522_list_mutex);
805 if (state != NULL) 813 if (state != NULL)
806 hybrid_tuner_release_state(state); 814 hybrid_tuner_release_state(state);
815 mutex_unlock(&au8522_list_mutex);
807} 816}
808 817
809 818