Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

V4L/DVB (13976): [STV090x] Added mutex protection around tuner I2C access.

With this change it is possible to have the same I2C address for both tuners.

Signed-off-by: Andreas Regel <andreas.regel@gmx.de>
Signed-off-by: Manu Abraham <manu@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>

authored by

Andreas Regel and committed by
Mauro Carvalho Chehab
96506a50 97f7a2ae

+10
+9
drivers/media/dvb/frontends/stv090x.c
··· 758 758 struct stv090x_state *state = fe->demodulator_priv; 759 759 u32 reg; 760 760 761 + if (enable) 762 + mutex_lock(&state->internal->tuner_lock); 763 + 761 764 reg = STV090x_READ_DEMOD(state, I2CRPT); 762 765 if (enable) { 763 766 dprintk(FE_DEBUG, 1, "Enable Gate"); ··· 774 771 if ((STV090x_WRITE_DEMOD(state, I2CRPT, reg)) < 0) 775 772 goto err; 776 773 } 774 + 775 + if (!enable) 776 + mutex_unlock(&state->internal->tuner_lock); 777 + 777 778 return 0; 778 779 err: 779 780 dprintk(FE_ERROR, 1, "I/O error"); 781 + mutex_unlock(&state->internal->tuner_lock); 780 782 return -1; 781 783 } 782 784 ··· 4447 4439 } 4448 4440 4449 4441 mutex_init(&state->internal->demod_lock); 4442 + mutex_init(&state->internal->tuner_lock); 4450 4443 4451 4444 if (stv090x_sleep(&state->frontend) < 0) { 4452 4445 dprintk(FE_ERROR, 1, "Error putting device to sleep");
+1
drivers/media/dvb/frontends/stv090x_priv.h
··· 235 235 u8 i2c_addr; 236 236 237 237 struct mutex demod_lock; /* Lock access to shared register */ 238 + struct mutex tuner_lock; /* Lock access to tuners */ 238 239 s32 mclk; /* Masterclock Divider factor */ 239 240 u32 dev_ver; 240 241