Commit c10d14d6 authored by Andrew de Quincey's avatar Andrew de Quincey Committed by Mauro Carvalho Chehab
Browse files

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



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

Signed-off-by: default avatarAndrew de Quincey <adq_dvb@lidskialf.net>
Acked-by: default avatarMichael Krufky <mkrufky@linuxtv.org>
Acked-by: default avatarTrent Piepho <xyzzy@speakeasy.org>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@infradead.org>
parent 13fef933
Loading
Loading
Loading
Loading
+9 −8
Original line number Diff line number Diff line
@@ -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);
+7 −1
Original line number Diff line number Diff line
@@ -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
+8 −8
Original line number Diff line number Diff line
@@ -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);
+6 −1
Original line number Diff line number Diff line
@@ -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
+6 −3
Original line number Diff line number Diff line
@@ -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);
Loading