diff options
author | Devin Heitmueller <dheitmueller@linuxtv.org> | 2009-03-11 02:00:45 -0400 |
---|---|---|
committer | Devin Heitmueller <dheitmueller@linuxtv.org> | 2009-03-11 02:00:45 -0400 |
commit | 7f62cf2d7360ac3b7f2fac64950706a588db8977 (patch) | |
tree | 9af593fd0e4188b7cb95ad7bfd53164bfea07eff /linux/drivers/media/dvb | |
parent | 923bf375eea7fd01b29ae6f94e88d9c39c5affb1 (diff) | |
download | mediapointer-dvb-s2-7f62cf2d7360ac3b7f2fac64950706a588db8977.tar.gz mediapointer-dvb-s2-7f62cf2d7360ac3b7f2fac64950706a588db8977.tar.bz2 |
au8522: add mutex protecting use of hybrid state
From: Devin Heitmueller <dheitmueller@linuxtv.org>
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.
Priority: normal
Signed-off-by: Devin Heitmueller <dheitmueller@linuxtv.org>
Signed-off-by: Michael Krufky <mkrufky@linuxtv.org>
Diffstat (limited to 'linux/drivers/media/dvb')
-rw-r--r-- | linux/drivers/media/dvb/frontends/au8522_dig.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/linux/drivers/media/dvb/frontends/au8522_dig.c b/linux/drivers/media/dvb/frontends/au8522_dig.c index 00d783ce2..27e2e0730 100644 --- a/linux/drivers/media/dvb/frontends/au8522_dig.c +++ b/linux/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); } |