V4L/DVB (4384): Remove remaining static function calls

Rewrote _write() calls to use write() op.

Signed-off-by: Andrew de Quincey <adq_dvb@lidskialf.net>
Acked-by: Michael Krufky <mkrufky@linuxtv.org>
Acked-by: Trent Piepho <xyzzy@speakeasy.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
This commit is contained in:
Andrew de Quincey 2006-08-08 09:10:08 -03:00 committed by Mauro Carvalho Chehab
parent 13fef9335f
commit c10d14d62d
14 changed files with 114 additions and 71 deletions

View File

@ -1,4 +1,4 @@
/*
/*
cx24110 - Single Chip Satellite Channel Receiver driver module
Copyright (C) 2002 Peter Hettkamp <peter.hettkamp@htp-tel.de> based on
@ -311,16 +311,17 @@ static int cx24110_set_symbolrate (struct cx24110_state* state, u32 srate)
}
int cx24110_pll_write (struct dvb_frontend* fe, u32 data)
static int _cx24110_pll_write (struct dvb_frontend* fe, u8 *buf, int len)
{
struct cx24110_state *state = fe->demodulator_priv;
if (len != 3)
return -EINVAL;
/* tuner data is 21 bits long, must be left-aligned in data */
/* tuner cx24108 is written through a dedicated 3wire interface on the demod chip */
/* FIXME (low): add error handling, avoid infinite loops if HW fails... */
dprintk("cx24110 debug: cx24108_write(%8.8x)\n",data);
cx24110_writereg(state,0x6d,0x30); /* auto mode at 62kHz */
cx24110_writereg(state,0x70,0x15); /* auto mode 21 bits */
@ -329,19 +330,19 @@ int cx24110_pll_write (struct dvb_frontend* fe, u32 data)
cx24110_writereg(state,0x72,0);
/* write the topmost 8 bits */
cx24110_writereg(state,0x72,(data>>24)&0xff);
cx24110_writereg(state,0x72,buf[0]);
/* wait for the send to be completed */
while ((cx24110_readreg(state,0x6d)&0xc0)==0x80)
;
/* send another 8 bytes */
cx24110_writereg(state,0x72,(data>>16)&0xff);
cx24110_writereg(state,0x72,buf[1]);
while ((cx24110_readreg(state,0x6d)&0xc0)==0x80)
;
/* and the topmost 5 bits of this byte */
cx24110_writereg(state,0x72,(data>>8)&0xff);
cx24110_writereg(state,0x72,buf[2]);
while ((cx24110_readreg(state,0x6d)&0xc0)==0x80)
;
@ -642,6 +643,7 @@ static struct dvb_frontend_ops cx24110_ops = {
.release = cx24110_release,
.init = cx24110_initfe,
.write = _cx24110_pll_write,
.set_frontend = cx24110_set_frontend,
.get_frontend = cx24110_get_frontend,
.read_status = cx24110_read_status,
@ -664,4 +666,3 @@ MODULE_AUTHOR("Peter Hettkamp");
MODULE_LICENSE("GPL");
EXPORT_SYMBOL(cx24110_attach);
EXPORT_SYMBOL(cx24110_pll_write);

View File

@ -36,6 +36,12 @@ struct cx24110_config
extern struct dvb_frontend* cx24110_attach(const struct cx24110_config* config,
struct i2c_adapter* i2c);
extern int cx24110_pll_write(struct dvb_frontend* fe, u32 data);
static inline int cx24110_pll_write(struct dvb_frontend *fe, u32 val) {
int r = 0;
u8 buf[] = {(u8) (val>>24), (u8) (val>>16), (u8) (val>>8)};
if (fe->ops.write)
r = fe->ops.write(fe, buf, 3);
return r;
}
#endif // CX24110_H

View File

@ -70,7 +70,7 @@ static int mt352_single_write(struct dvb_frontend *fe, u8 reg, u8 val)
return 0;
}
int mt352_write(struct dvb_frontend* fe, u8* ibuf, int ilen)
static int _mt352_write(struct dvb_frontend* fe, u8* ibuf, int ilen)
{
int err,i;
for (i=0; i < ilen-1; i++)
@ -107,7 +107,7 @@ static int mt352_sleep(struct dvb_frontend* fe)
{
static u8 mt352_softdown[] = { CLOCK_CTL, 0x20, 0x08 };
mt352_write(fe, mt352_softdown, sizeof(mt352_softdown));
_mt352_write(fe, mt352_softdown, sizeof(mt352_softdown));
return 0;
}
@ -293,14 +293,14 @@ static int mt352_set_parameters(struct dvb_frontend* fe,
fe->ops.i2c_gate_ctrl(fe, 0);
}
mt352_write(fe, buf, 8);
mt352_write(fe, fsm_go, 2);
_mt352_write(fe, buf, 8);
_mt352_write(fe, fsm_go, 2);
} else {
if (fe->ops.tuner_ops.calc_regs) {
fe->ops.tuner_ops.calc_regs(fe, param, buf+8, 5);
buf[8] <<= 1;
mt352_write(fe, buf, sizeof(buf));
mt352_write(fe, tuner_go, 2);
_mt352_write(fe, buf, sizeof(buf));
_mt352_write(fe, tuner_go, 2);
}
}
@ -522,7 +522,7 @@ static int mt352_init(struct dvb_frontend* fe)
(mt352_read_register(state, CONFIG) & 0x20) == 0) {
/* Do a "hard" reset */
mt352_write(fe, mt352_reset_attach, sizeof(mt352_reset_attach));
_mt352_write(fe, mt352_reset_attach, sizeof(mt352_reset_attach));
return state->config.demod_init(fe);
}
@ -585,6 +585,7 @@ static struct dvb_frontend_ops mt352_ops = {
.init = mt352_init,
.sleep = mt352_sleep,
.write = _mt352_write,
.set_frontend = mt352_set_parameters,
.get_frontend = mt352_get_parameters,
@ -605,4 +606,3 @@ MODULE_AUTHOR("Holger Waechtler, Daniel Mack, Antonio Mancuso");
MODULE_LICENSE("GPL");
EXPORT_SYMBOL(mt352_attach);
EXPORT_SYMBOL(mt352_write);

View File

@ -54,6 +54,11 @@ struct mt352_config
extern struct dvb_frontend* mt352_attach(const struct mt352_config* config,
struct i2c_adapter* i2c);
extern int mt352_write(struct dvb_frontend* fe, u8* ibuf, int ilen);
static inline int mt352_write(struct dvb_frontend *fe, u8 *buf, int len) {
int r = 0;
if (fe->ops.write)
r = fe->ops.write(fe, buf, len);
return r;
}
#endif // MT352_H

View File

@ -92,11 +92,14 @@ static int stv0299_writeregI (struct stv0299_state* state, u8 reg, u8 data)
return (ret != 1) ? -EREMOTEIO : 0;
}
int stv0299_writereg (struct dvb_frontend* fe, u8 reg, u8 data)
int stv0299_write(struct dvb_frontend* fe, u8 *buf, int len)
{
struct stv0299_state* state = fe->demodulator_priv;
return stv0299_writeregI(state, reg, data);
if (len != 2)
return -EINVAL;
return stv0299_writeregI(state, buf[0], buf[1]);
}
static u8 stv0299_readreg (struct stv0299_state* state, u8 reg)
@ -694,6 +697,7 @@ static struct dvb_frontend_ops stv0299_ops = {
.init = stv0299_init,
.sleep = stv0299_sleep,
.write = stv0299_write,
.i2c_gate_ctrl = stv0299_i2c_gate_ctrl,
.set_frontend = stv0299_set_frontend,
@ -724,5 +728,4 @@ MODULE_AUTHOR("Ralph Metzler, Holger Waechtler, Peter Schildmann, Felix Domke, "
"Andreas Oberritter, Andrew de Quincey, Kenneth Aafly");
MODULE_LICENSE("GPL");
EXPORT_SYMBOL(stv0299_writereg);
EXPORT_SYMBOL(stv0299_attach);

View File

@ -89,9 +89,15 @@ struct stv0299_config
int (*set_symbol_rate)(struct dvb_frontend* fe, u32 srate, u32 ratio);
};
extern int stv0299_writereg (struct dvb_frontend* fe, u8 reg, u8 data);
extern struct dvb_frontend* stv0299_attach(const struct stv0299_config* config,
struct i2c_adapter* i2c);
static inline int stv0299_writereg(struct dvb_frontend *fe, u8 reg, u8 val) {
int r = 0;
u8 buf[] = {reg, val};
if (fe->ops.write)
r = fe->ops.write(fe, buf, 2);
return r;
}
#endif // STV0299_H

View File

@ -72,7 +72,7 @@ static u8 tda10021_inittab[0x40]=
0x04, 0x2d, 0x2f, 0xff, 0x00, 0x00, 0x00, 0x00,
};
static int tda10021_writereg (struct tda10021_state* state, u8 reg, u8 data)
static int _tda10021_writereg (struct tda10021_state* state, u8 reg, u8 data)
{
u8 buf[] = { reg, data };
struct i2c_msg msg = { .addr = state->config->demod_address, .flags = 0, .buf = buf, .len = 2 };
@ -88,14 +88,6 @@ static int tda10021_writereg (struct tda10021_state* state, u8 reg, u8 data)
return (ret != 1) ? -EREMOTEIO : 0;
}
int tda10021_write_byte(struct dvb_frontend* fe, int reg, int data)
{
struct tda10021_state* state = fe->demodulator_priv;
return tda10021_writereg(state, reg, data);
}
EXPORT_SYMBOL(tda10021_write_byte);
static u8 tda10021_readreg (struct tda10021_state* state, u8 reg)
{
u8 b0 [] = { reg };
@ -149,8 +141,8 @@ static int tda10021_setup_reg0 (struct tda10021_state* state, u8 reg0,
else if (INVERSION_OFF == inversion)
DISABLE_INVERSION(reg0);
tda10021_writereg (state, 0x00, reg0 & 0xfe);
tda10021_writereg (state, 0x00, reg0 | 0x01);
_tda10021_writereg (state, 0x00, reg0 & 0xfe);
_tda10021_writereg (state, 0x00, reg0 | 0x01);
state->reg0 = reg0;
return 0;
@ -198,17 +190,27 @@ static int tda10021_set_symbolrate (struct tda10021_state* state, u32 symbolrate
NDEC = (NDEC << 6) | tda10021_inittab[0x03];
tda10021_writereg (state, 0x03, NDEC);
tda10021_writereg (state, 0x0a, BDR&0xff);
tda10021_writereg (state, 0x0b, (BDR>> 8)&0xff);
tda10021_writereg (state, 0x0c, (BDR>>16)&0x3f);
_tda10021_writereg (state, 0x03, NDEC);
_tda10021_writereg (state, 0x0a, BDR&0xff);
_tda10021_writereg (state, 0x0b, (BDR>> 8)&0xff);
_tda10021_writereg (state, 0x0c, (BDR>>16)&0x3f);
tda10021_writereg (state, 0x0d, BDRI);
tda10021_writereg (state, 0x0e, SFIL);
_tda10021_writereg (state, 0x0d, BDRI);
_tda10021_writereg (state, 0x0e, SFIL);
return 0;
}
int tda10021_write(struct dvb_frontend* fe, u8 *buf, int len)
{
struct tda10021_state* state = fe->demodulator_priv;
if (len != 2)
return -EINVAL;
return _tda10021_writereg(state, buf[0], buf[1]);
}
static int tda10021_init (struct dvb_frontend *fe)
{
struct tda10021_state* state = fe->demodulator_priv;
@ -216,12 +218,12 @@ static int tda10021_init (struct dvb_frontend *fe)
dprintk("DVB: TDA10021(%d): init chip\n", fe->adapter->num);
//tda10021_writereg (fe, 0, 0);
//_tda10021_writereg (fe, 0, 0);
for (i=0; i<tda10021_inittab_size; i++)
tda10021_writereg (state, i, tda10021_inittab[i]);
_tda10021_writereg (state, i, tda10021_inittab[i]);
tda10021_writereg (state, 0x34, state->pwm);
_tda10021_writereg (state, 0x34, state->pwm);
//Comment by markus
//0x2A[3-0] == PDIV -> P multiplaying factor (P=PDIV+1)(default 0)
@ -230,7 +232,7 @@ static int tda10021_init (struct dvb_frontend *fe)
//0x2A[6] == POLAXIN -> Polarity of the input reference clock (default 0)
//Activate PLL
tda10021_writereg(state, 0x2a, tda10021_inittab[0x2a] & 0xef);
_tda10021_writereg(state, 0x2a, tda10021_inittab[0x2a] & 0xef);
return 0;
}
@ -264,12 +266,12 @@ static int tda10021_set_parameters (struct dvb_frontend *fe,
}
tda10021_set_symbolrate (state, p->u.qam.symbol_rate);
tda10021_writereg (state, 0x34, state->pwm);
_tda10021_writereg (state, 0x34, state->pwm);
tda10021_writereg (state, 0x01, reg0x01[qam]);
tda10021_writereg (state, 0x05, reg0x05[qam]);
tda10021_writereg (state, 0x08, reg0x08[qam]);
tda10021_writereg (state, 0x09, reg0x09[qam]);
_tda10021_writereg (state, 0x01, reg0x01[qam]);
_tda10021_writereg (state, 0x05, reg0x05[qam]);
_tda10021_writereg (state, 0x08, reg0x08[qam]);
_tda10021_writereg (state, 0x09, reg0x09[qam]);
tda10021_setup_reg0 (state, reg0x00[qam], p->inversion);
@ -342,8 +344,8 @@ static int tda10021_read_ucblocks(struct dvb_frontend* fe, u32* ucblocks)
*ucblocks = 0xffffffff;
/* reset uncorrected block counter */
tda10021_writereg (state, 0x10, tda10021_inittab[0x10] & 0xdf);
tda10021_writereg (state, 0x10, tda10021_inittab[0x10]);
_tda10021_writereg (state, 0x10, tda10021_inittab[0x10] & 0xdf);
_tda10021_writereg (state, 0x10, tda10021_inittab[0x10]);
return 0;
}
@ -392,8 +394,8 @@ static int tda10021_sleep(struct dvb_frontend* fe)
{
struct tda10021_state* state = fe->demodulator_priv;
tda10021_writereg (state, 0x1b, 0x02); /* pdown ADC */
tda10021_writereg (state, 0x00, 0x80); /* standby */
_tda10021_writereg (state, 0x1b, 0x02); /* pdown ADC */
_tda10021_writereg (state, 0x00, 0x80); /* standby */
return 0;
}
@ -459,6 +461,7 @@ static struct dvb_frontend_ops tda10021_ops = {
.init = tda10021_init,
.sleep = tda10021_sleep,
.write = tda10021_write,
.i2c_gate_ctrl = tda10021_i2c_gate_ctrl,
.set_frontend = tda10021_set_parameters,

View File

@ -35,6 +35,12 @@ struct tda10021_config
extern struct dvb_frontend* tda10021_attach(const struct tda10021_config* config,
struct i2c_adapter* i2c, u8 pwm);
extern int tda10021_write_byte(struct dvb_frontend* fe, int reg, int data);
static inline int tda10021_writereg(struct dvb_frontend *fe, u8 reg, u8 val) {
int r = 0;
u8 buf[] = {reg, val};
if (fe->ops.write)
r = fe->ops.write(fe, buf, 2);
return r;
}
#endif // TDA10021_H

View File

@ -579,11 +579,14 @@ static int tda1004x_decode_fec(int tdafec)
return -1;
}
int tda1004x_write_byte(struct dvb_frontend* fe, int reg, int data)
int tda1004x_write(struct dvb_frontend* fe, u8 *buf, int len)
{
struct tda1004x_state* state = fe->demodulator_priv;
return tda1004x_write_byteI(state, reg, data);
if (len != 2)
return -EINVAL;
return tda1004x_write_byteI(state, buf[0], buf[1]);
}
static int tda10045_init(struct dvb_frontend* fe)
@ -1192,7 +1195,13 @@ static int tda1004x_get_tune_settings(struct dvb_frontend* fe, struct dvb_fronte
return 0;
}
static void tda1004x_release(struct dvb_frontend* fe)
static void tda10045_release(struct dvb_frontend* fe)
{
struct tda1004x_state *state = fe->demodulator_priv;
kfree(state);
}
static void tda10046_release(struct dvb_frontend* fe)
{
struct tda1004x_state *state = fe->demodulator_priv;
kfree(state);
@ -1212,10 +1221,11 @@ static struct dvb_frontend_ops tda10045_ops = {
FE_CAN_TRANSMISSION_MODE_AUTO | FE_CAN_GUARD_INTERVAL_AUTO
},
.release = tda1004x_release,
.release = tda10045_release,
.init = tda10045_init,
.sleep = tda1004x_sleep,
.write = tda1004x_write,
.i2c_gate_ctrl = tda1004x_i2c_gate_ctrl,
.set_frontend = tda1004x_set_fe,
@ -1270,10 +1280,11 @@ static struct dvb_frontend_ops tda10046_ops = {
FE_CAN_TRANSMISSION_MODE_AUTO | FE_CAN_GUARD_INTERVAL_AUTO
},
.release = tda1004x_release,
.release = tda10046_release,
.init = tda10046_init,
.sleep = tda1004x_sleep,
.write = tda1004x_write,
.i2c_gate_ctrl = tda1004x_i2c_gate_ctrl,
.set_frontend = tda1004x_set_fe,
@ -1323,4 +1334,3 @@ MODULE_LICENSE("GPL");
EXPORT_SYMBOL(tda10045_attach);
EXPORT_SYMBOL(tda10046_attach);
EXPORT_SYMBOL(tda1004x_write_byte);

View File

@ -77,6 +77,12 @@ extern struct dvb_frontend* tda10045_attach(const struct tda1004x_config* config
extern struct dvb_frontend* tda10046_attach(const struct tda1004x_config* config,
struct i2c_adapter* i2c);
extern int tda1004x_write_byte(struct dvb_frontend* fe, int reg, int data);
static inline int tda1004x_writereg(struct dvb_frontend *fe, u8 reg, u8 val) {
int r = 0;
u8 buf[] = {reg, val};
if (fe->ops.write)
r = fe->ops.write(fe, buf, 2);
return r;
}
#endif // TDA1004X_H

View File

@ -258,7 +258,6 @@ static int zl10353_init(struct dvb_frontend *fe)
static void zl10353_release(struct dvb_frontend *fe)
{
struct zl10353_state *state = fe->demodulator_priv;
kfree(state);
}
@ -314,6 +313,7 @@ static struct dvb_frontend_ops zl10353_ops = {
.init = zl10353_init,
.sleep = zl10353_sleep,
.write = zl10353_write,
.set_frontend = zl10353_set_parameters,
.get_tune_settings = zl10353_get_tune_settings,
@ -330,4 +330,3 @@ MODULE_AUTHOR("Chris Pascoe");
MODULE_LICENSE("GPL");
EXPORT_SYMBOL(zl10353_attach);
EXPORT_SYMBOL(zl10353_write);

View File

@ -36,6 +36,4 @@ struct zl10353_config
extern struct dvb_frontend* zl10353_attach(const struct zl10353_config *config,
struct i2c_adapter *i2c);
extern int zl10353_write(struct dvb_frontend *fe, u8 *ibuf, int ilen);
#endif /* ZL10353_H */

View File

@ -749,17 +749,17 @@ static int philips_tdm1316l_tuner_set_params(struct dvb_frontend *fe, struct dvb
// setup PLL filter and TDA9889
switch (params->u.ofdm.bandwidth) {
case BANDWIDTH_6_MHZ:
tda1004x_write_byte(fe, 0x0C, 0x14);
tda1004x_writereg(fe, 0x0C, 0x14);
filter = 0;
break;
case BANDWIDTH_7_MHZ:
tda1004x_write_byte(fe, 0x0C, 0x80);
tda1004x_writereg(fe, 0x0C, 0x80);
filter = 0;
break;
case BANDWIDTH_8_MHZ:
tda1004x_write_byte(fe, 0x0C, 0x14);
tda1004x_writereg(fe, 0x0C, 0x14);
filter = 1;
break;

View File

@ -1107,17 +1107,17 @@ static int philips_tdm1316l_tuner_set_params(struct dvb_frontend* fe, struct dvb
// setup PLL filter
switch (params->u.ofdm.bandwidth) {
case BANDWIDTH_6_MHZ:
tda1004x_write_byte(fe, 0x0C, 0);
tda1004x_writereg(fe, 0x0C, 0);
filter = 0;
break;
case BANDWIDTH_7_MHZ:
tda1004x_write_byte(fe, 0x0C, 0);
tda1004x_writereg(fe, 0x0C, 0);
filter = 0;
break;
case BANDWIDTH_8_MHZ:
tda1004x_write_byte(fe, 0x0C, 0xFF);
tda1004x_writereg(fe, 0x0C, 0xFF);
filter = 1;
break;