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

[media] stv090x: Optional external lock routine

Card driver may supply its own lock routine now.

Signed-off-by: Oliver Endriss <o.endriss@gmx.de>
Signed-off-by: Manu Abraham <manu@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>

authored by

Oliver Endriss and committed by
Mauro Carvalho Chehab
f790bdd0 5bd0dc2d

+17 -5
+16 -5
drivers/media/dvb/frontends/stv090x.c
··· 767 767 * In case of any error, the lock is unlocked and exit within the 768 768 * relevant operations themselves. 769 769 */ 770 - if (enable) 771 - mutex_lock(&state->internal->tuner_lock); 770 + if (enable) { 771 + if (state->config->tuner_i2c_lock) 772 + state->config->tuner_i2c_lock(&state->frontend, 1); 773 + else 774 + mutex_lock(&state->internal->tuner_lock); 775 + } 772 776 773 777 reg = STV090x_READ_DEMOD(state, I2CRPT); 774 778 if (enable) { ··· 788 784 goto err; 789 785 } 790 786 791 - if (!enable) 792 - mutex_unlock(&state->internal->tuner_lock); 787 + if (!enable) { 788 + if (state->config->tuner_i2c_lock) 789 + state->config->tuner_i2c_lock(&state->frontend, 0); 790 + else 791 + mutex_unlock(&state->internal->tuner_lock); 792 + } 793 793 794 794 return 0; 795 795 err: 796 796 dprintk(FE_ERROR, 1, "I/O error"); 797 - mutex_unlock(&state->internal->tuner_lock); 797 + if (state->config->tuner_i2c_lock) 798 + state->config->tuner_i2c_lock(&state->frontend, 0); 799 + else 800 + mutex_unlock(&state->internal->tuner_lock); 798 801 return -1; 799 802 } 800 803
+1
drivers/media/dvb/frontends/stv090x.h
··· 100 100 int (*tuner_get_bbgain) (struct dvb_frontend *fe, u32 *gain); 101 101 int (*tuner_set_refclk) (struct dvb_frontend *fe, u32 refclk); 102 102 int (*tuner_get_status) (struct dvb_frontend *fe, u32 *status); 103 + void (*tuner_i2c_lock) (struct dvb_frontend *fe, int lock); 103 104 }; 104 105 105 106 #if defined(CONFIG_DVB_STV090x) || (defined(CONFIG_DVB_STV090x_MODULE) && defined(MODULE))