Skip to content

Commit

Permalink
[PATCH] dvb: remove unnecessary casts in frontends
Browse files Browse the repository at this point in the history
remove unnecessary casts in frontends (Kenneth Aafloy)

Signed-off-by: Johannes Stezenbach <js@linuxtv.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
  • Loading branch information
Johannes Stezenbach authored and Linus Torvalds committed May 17, 2005
1 parent 591ad98 commit b874270
Show file tree
Hide file tree
Showing 21 changed files with 241 additions and 242 deletions.
18 changes: 9 additions & 9 deletions drivers/media/dvb/frontends/at76c651.c
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ static int at76c651_set_parameters(struct dvb_frontend* fe,
struct dvb_frontend_parameters *p)
{
int ret;
struct at76c651_state* state = (struct at76c651_state*) fe->demodulator_priv;
struct at76c651_state* state = fe->demodulator_priv;

at76c651_writereg(state, 0x0c, 0xc3);
state->config->pll_set(fe, p);
Expand All @@ -276,7 +276,7 @@ static int at76c651_set_parameters(struct dvb_frontend* fe,

static int at76c651_set_defaults(struct dvb_frontend* fe)
{
struct at76c651_state* state = (struct at76c651_state*) fe->demodulator_priv;
struct at76c651_state* state = fe->demodulator_priv;

at76c651_set_symbol_rate(state, 6900000);
at76c651_set_qam(state, QAM_64);
Expand All @@ -294,7 +294,7 @@ static int at76c651_set_defaults(struct dvb_frontend* fe)

static int at76c651_read_status(struct dvb_frontend* fe, fe_status_t* status)
{
struct at76c651_state* state = (struct at76c651_state*) fe->demodulator_priv;
struct at76c651_state* state = fe->demodulator_priv;
u8 sync;

/*
Expand All @@ -319,7 +319,7 @@ static int at76c651_read_status(struct dvb_frontend* fe, fe_status_t* status)

static int at76c651_read_ber(struct dvb_frontend* fe, u32* ber)
{
struct at76c651_state* state = (struct at76c651_state*) fe->demodulator_priv;
struct at76c651_state* state = fe->demodulator_priv;

*ber = (at76c651_readreg(state, 0x81) & 0x0F) << 16;
*ber |= at76c651_readreg(state, 0x82) << 8;
Expand All @@ -331,7 +331,7 @@ static int at76c651_read_ber(struct dvb_frontend* fe, u32* ber)

static int at76c651_read_signal_strength(struct dvb_frontend* fe, u16* strength)
{
struct at76c651_state* state = (struct at76c651_state*) fe->demodulator_priv;
struct at76c651_state* state = fe->demodulator_priv;

u8 gain = ~at76c651_readreg(state, 0x91);
*strength = (gain << 8) | gain;
Expand All @@ -341,7 +341,7 @@ static int at76c651_read_signal_strength(struct dvb_frontend* fe, u16* strength)

static int at76c651_read_snr(struct dvb_frontend* fe, u16* snr)
{
struct at76c651_state* state = (struct at76c651_state*) fe->demodulator_priv;
struct at76c651_state* state = fe->demodulator_priv;

*snr = 0xFFFF -
((at76c651_readreg(state, 0x8F) << 8) |
Expand All @@ -352,7 +352,7 @@ static int at76c651_read_snr(struct dvb_frontend* fe, u16* snr)

static int at76c651_read_ucblocks(struct dvb_frontend* fe, u32* ucblocks)
{
struct at76c651_state* state = (struct at76c651_state*) fe->demodulator_priv;
struct at76c651_state* state = fe->demodulator_priv;

*ucblocks = at76c651_readreg(state, 0x82);

Expand All @@ -369,7 +369,7 @@ static int at76c651_get_tune_settings(struct dvb_frontend* fe, struct dvb_fronte

static void at76c651_release(struct dvb_frontend* fe)
{
struct at76c651_state* state = (struct at76c651_state*) fe->demodulator_priv;
struct at76c651_state* state = fe->demodulator_priv;
kfree(state);
}

Expand All @@ -381,7 +381,7 @@ struct dvb_frontend* at76c651_attach(const struct at76c651_config* config,
struct at76c651_state* state = NULL;

/* allocate memory for the internal state */
state = (struct at76c651_state*) kmalloc(sizeof(struct at76c651_state), GFP_KERNEL);
state = kmalloc(sizeof(struct at76c651_state), GFP_KERNEL);
if (state == NULL) goto error;

/* setup the state */
Expand Down
20 changes: 10 additions & 10 deletions drivers/media/dvb/frontends/cx22700.c
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ static int cx22700_get_tps (struct cx22700_state* state, struct dvb_ofdm_paramet

static int cx22700_init (struct dvb_frontend* fe)

{ struct cx22700_state* state = (struct cx22700_state*) fe->demodulator_priv;
{ struct cx22700_state* state = fe->demodulator_priv;
int i;

dprintk("cx22700_init: init chip\n");
Expand All @@ -258,7 +258,7 @@ static int cx22700_init (struct dvb_frontend* fe)

static int cx22700_read_status(struct dvb_frontend* fe, fe_status_t* status)
{
struct cx22700_state* state = (struct cx22700_state*) fe->demodulator_priv;
struct cx22700_state* state = fe->demodulator_priv;

u16 rs_ber = (cx22700_readreg (state, 0x0d) << 9)
| (cx22700_readreg (state, 0x0e) << 1);
Expand Down Expand Up @@ -286,7 +286,7 @@ static int cx22700_read_status(struct dvb_frontend* fe, fe_status_t* status)

static int cx22700_read_ber(struct dvb_frontend* fe, u32* ber)
{
struct cx22700_state* state = (struct cx22700_state*) fe->demodulator_priv;
struct cx22700_state* state = fe->demodulator_priv;

*ber = cx22700_readreg (state, 0x0c) & 0x7f;
cx22700_writereg (state, 0x0c, 0x00);
Expand All @@ -296,7 +296,7 @@ static int cx22700_read_ber(struct dvb_frontend* fe, u32* ber)

static int cx22700_read_signal_strength(struct dvb_frontend* fe, u16* signal_strength)
{
struct cx22700_state* state = (struct cx22700_state*) fe->demodulator_priv;
struct cx22700_state* state = fe->demodulator_priv;

u16 rs_ber = (cx22700_readreg (state, 0x0d) << 9)
| (cx22700_readreg (state, 0x0e) << 1);
Expand All @@ -307,7 +307,7 @@ static int cx22700_read_signal_strength(struct dvb_frontend* fe, u16* signal_str

static int cx22700_read_snr(struct dvb_frontend* fe, u16* snr)
{
struct cx22700_state* state = (struct cx22700_state*) fe->demodulator_priv;
struct cx22700_state* state = fe->demodulator_priv;

u16 rs_ber = (cx22700_readreg (state, 0x0d) << 9)
| (cx22700_readreg (state, 0x0e) << 1);
Expand All @@ -318,7 +318,7 @@ static int cx22700_read_snr(struct dvb_frontend* fe, u16* snr)

static int cx22700_read_ucblocks(struct dvb_frontend* fe, u32* ucblocks)
{
struct cx22700_state* state = (struct cx22700_state*) fe->demodulator_priv;
struct cx22700_state* state = fe->demodulator_priv;

*ucblocks = cx22700_readreg (state, 0x0f);
cx22700_writereg (state, 0x0f, 0x00);
Expand All @@ -328,7 +328,7 @@ static int cx22700_read_ucblocks(struct dvb_frontend* fe, u32* ucblocks)

static int cx22700_set_frontend(struct dvb_frontend* fe, struct dvb_frontend_parameters *p)
{
struct cx22700_state* state = (struct cx22700_state*) fe->demodulator_priv;
struct cx22700_state* state = fe->demodulator_priv;

cx22700_writereg (state, 0x00, 0x02); /* XXX CHECKME: soft reset*/
cx22700_writereg (state, 0x00, 0x00);
Expand All @@ -346,7 +346,7 @@ static int cx22700_set_frontend(struct dvb_frontend* fe, struct dvb_frontend_par

static int cx22700_get_frontend(struct dvb_frontend* fe, struct dvb_frontend_parameters *p)
{
struct cx22700_state* state = (struct cx22700_state*) fe->demodulator_priv;
struct cx22700_state* state = fe->demodulator_priv;
u8 reg09 = cx22700_readreg (state, 0x09);

p->inversion = reg09 & 0x1 ? INVERSION_ON : INVERSION_OFF;
Expand All @@ -363,7 +363,7 @@ static int cx22700_get_tune_settings(struct dvb_frontend* fe, struct dvb_fronten

static void cx22700_release(struct dvb_frontend* fe)
{
struct cx22700_state* state = (struct cx22700_state*) fe->demodulator_priv;
struct cx22700_state* state = fe->demodulator_priv;
kfree(state);
}

Expand All @@ -375,7 +375,7 @@ struct dvb_frontend* cx22700_attach(const struct cx22700_config* config,
struct cx22700_state* state = NULL;

/* allocate memory for the internal state */
state = (struct cx22700_state*) kmalloc(sizeof(struct cx22700_state), GFP_KERNEL);
state = kmalloc(sizeof(struct cx22700_state), GFP_KERNEL);
if (state == NULL) goto error;

/* setup the state */
Expand Down
20 changes: 10 additions & 10 deletions drivers/media/dvb/frontends/cx22702.c
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ static int cx22702_get_tps (struct cx22702_state *state, struct dvb_ofdm_paramet
static int cx22702_set_tps (struct dvb_frontend* fe, struct dvb_frontend_parameters *p)
{
u8 val;
struct cx22702_state* state = (struct cx22702_state*) fe->demodulator_priv;
struct cx22702_state* state = fe->demodulator_priv;

/* set PLL */
cx22702_writereg (state, 0x0D, cx22702_readreg(state,0x0D) &0xfe);
Expand Down Expand Up @@ -338,7 +338,7 @@ static int cx22702_set_tps (struct dvb_frontend* fe, struct dvb_frontend_paramet
static int cx22702_init (struct dvb_frontend* fe)
{
int i;
struct cx22702_state* state = (struct cx22702_state*) fe->demodulator_priv;
struct cx22702_state* state = fe->demodulator_priv;

cx22702_writereg (state, 0x00, 0x02);

Expand All @@ -360,7 +360,7 @@ static int cx22702_init (struct dvb_frontend* fe)

static int cx22702_read_status(struct dvb_frontend* fe, fe_status_t* status)
{
struct cx22702_state* state = (struct cx22702_state*) fe->demodulator_priv;
struct cx22702_state* state = fe->demodulator_priv;
u8 reg0A;
u8 reg23;

Expand Down Expand Up @@ -389,7 +389,7 @@ static int cx22702_read_status(struct dvb_frontend* fe, fe_status_t* status)

static int cx22702_read_ber(struct dvb_frontend* fe, u32* ber)
{
struct cx22702_state* state = (struct cx22702_state*) fe->demodulator_priv;
struct cx22702_state* state = fe->demodulator_priv;

if(cx22702_readreg (state, 0xE4) & 0x02) {
/* Realtime statistics */
Expand All @@ -406,7 +406,7 @@ static int cx22702_read_ber(struct dvb_frontend* fe, u32* ber)

static int cx22702_read_signal_strength(struct dvb_frontend* fe, u16* signal_strength)
{
struct cx22702_state* state = (struct cx22702_state*) fe->demodulator_priv;
struct cx22702_state* state = fe->demodulator_priv;

*signal_strength = cx22702_readreg (state, 0x23);

Expand All @@ -415,7 +415,7 @@ static int cx22702_read_signal_strength(struct dvb_frontend* fe, u16* signal_str

static int cx22702_read_snr(struct dvb_frontend* fe, u16* snr)
{
struct cx22702_state* state = (struct cx22702_state*) fe->demodulator_priv;
struct cx22702_state* state = fe->demodulator_priv;

u16 rs_ber=0;
if(cx22702_readreg (state, 0xE4) & 0x02) {
Expand All @@ -434,7 +434,7 @@ static int cx22702_read_snr(struct dvb_frontend* fe, u16* snr)

static int cx22702_read_ucblocks(struct dvb_frontend* fe, u32* ucblocks)
{
struct cx22702_state* state = (struct cx22702_state*) fe->demodulator_priv;
struct cx22702_state* state = fe->demodulator_priv;

u8 _ucblocks;

Expand All @@ -449,7 +449,7 @@ static int cx22702_read_ucblocks(struct dvb_frontend* fe, u32* ucblocks)

static int cx22702_get_frontend(struct dvb_frontend* fe, struct dvb_frontend_parameters *p)
{
struct cx22702_state* state = (struct cx22702_state*) fe->demodulator_priv;
struct cx22702_state* state = fe->demodulator_priv;

u8 reg0C = cx22702_readreg (state, 0x0C);

Expand All @@ -459,7 +459,7 @@ static int cx22702_get_frontend(struct dvb_frontend* fe, struct dvb_frontend_par

static void cx22702_release(struct dvb_frontend* fe)
{
struct cx22702_state* state = (struct cx22702_state*) fe->demodulator_priv;
struct cx22702_state* state = fe->demodulator_priv;
kfree(state);
}

Expand All @@ -471,7 +471,7 @@ struct dvb_frontend* cx22702_attach(const struct cx22702_config* config,
struct cx22702_state* state = NULL;

/* allocate memory for the internal state */
state = (struct cx22702_state*) kmalloc(sizeof(struct cx22702_state), GFP_KERNEL);
state = kmalloc(sizeof(struct cx22702_state), GFP_KERNEL);
if (state == NULL) goto error;

/* setup the state */
Expand Down
31 changes: 15 additions & 16 deletions drivers/media/dvb/frontends/cx24110.c
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ dprintk("cx24110 debug: entering %s(%d)\n",__FUNCTION__,srate);

int cx24110_pll_write (struct dvb_frontend* fe, u32 data)
{
struct cx24110_state *state = (struct cx24110_state*) fe->demodulator_priv;
struct cx24110_state *state = fe->demodulator_priv;

/* 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 */
Expand Down Expand Up @@ -356,7 +356,7 @@ int cx24110_pll_write (struct dvb_frontend* fe, u32 data)

static int cx24110_initfe(struct dvb_frontend* fe)
{
struct cx24110_state *state = (struct cx24110_state*) fe->demodulator_priv;
struct cx24110_state *state = fe->demodulator_priv;
/* fixme (low): error handling */
int i;

Expand All @@ -373,7 +373,7 @@ static int cx24110_initfe(struct dvb_frontend* fe)

static int cx24110_set_voltage (struct dvb_frontend* fe, fe_sec_voltage_t voltage)
{
struct cx24110_state *state = (struct cx24110_state*) fe->demodulator_priv;
struct cx24110_state *state = fe->demodulator_priv;

switch (voltage) {
case SEC_VOLTAGE_13:
Expand All @@ -385,8 +385,7 @@ static int cx24110_set_voltage (struct dvb_frontend* fe, fe_sec_voltage_t voltag
};
}

static int cx24110_diseqc_send_burst(struct dvb_frontend* fe,
fe_sec_mini_cmd_t burst)
static int cx24110_diseqc_send_burst(struct dvb_frontend* fe, fe_sec_mini_cmd_t burst)
{
int rv, bit, i;
struct cx24110_state *state = fe->demodulator_priv;
Expand All @@ -413,7 +412,7 @@ static int cx24110_send_diseqc_msg(struct dvb_frontend* fe,
struct dvb_diseqc_master_cmd *cmd)
{
int i, rv;
struct cx24110_state *state = (struct cx24110_state*) fe->demodulator_priv;
struct cx24110_state *state = fe->demodulator_priv;

for (i = 0; i < cmd->msg_len; i++)
cx24110_writereg(state, 0x79 + i, cmd->msg[i]);
Expand All @@ -432,7 +431,7 @@ static int cx24110_send_diseqc_msg(struct dvb_frontend* fe,

static int cx24110_read_status(struct dvb_frontend* fe, fe_status_t* status)
{
struct cx24110_state *state = (struct cx24110_state*) fe->demodulator_priv;
struct cx24110_state *state = fe->demodulator_priv;

int sync = cx24110_readreg (state, 0x55);

Expand Down Expand Up @@ -460,7 +459,7 @@ static int cx24110_read_status(struct dvb_frontend* fe, fe_status_t* status)

static int cx24110_read_ber(struct dvb_frontend* fe, u32* ber)
{
struct cx24110_state *state = (struct cx24110_state*) fe->demodulator_priv;
struct cx24110_state *state = fe->demodulator_priv;

/* fixme (maybe): value range is 16 bit. Scale? */
if(cx24110_readreg(state,0x24)&0x10) {
Expand All @@ -478,7 +477,7 @@ static int cx24110_read_ber(struct dvb_frontend* fe, u32* ber)

static int cx24110_read_signal_strength(struct dvb_frontend* fe, u16* signal_strength)
{
struct cx24110_state *state = (struct cx24110_state*) fe->demodulator_priv;
struct cx24110_state *state = fe->demodulator_priv;

/* no provision in hardware. Read the frontend AGC accumulator. No idea how to scale this, but I know it is 2s complement */
u8 signal = cx24110_readreg (state, 0x27)+128;
Expand All @@ -489,7 +488,7 @@ static int cx24110_read_signal_strength(struct dvb_frontend* fe, u16* signal_str

static int cx24110_read_snr(struct dvb_frontend* fe, u16* snr)
{
struct cx24110_state *state = (struct cx24110_state*) fe->demodulator_priv;
struct cx24110_state *state = fe->demodulator_priv;

/* no provision in hardware. Can be computed from the Es/N0 estimator, but I don't know how. */
if(cx24110_readreg(state,0x6a)&0x80) {
Expand All @@ -505,7 +504,7 @@ static int cx24110_read_snr(struct dvb_frontend* fe, u16* snr)

static int cx24110_read_ucblocks(struct dvb_frontend* fe, u32* ucblocks)
{
struct cx24110_state *state = (struct cx24110_state*) fe->demodulator_priv;
struct cx24110_state *state = fe->demodulator_priv;
u32 lastbyer;

if(cx24110_readreg(state,0x10)&0x40) {
Expand All @@ -527,7 +526,7 @@ static int cx24110_read_ucblocks(struct dvb_frontend* fe, u32* ucblocks)

static int cx24110_set_frontend(struct dvb_frontend* fe, struct dvb_frontend_parameters *p)
{
struct cx24110_state *state = (struct cx24110_state*) fe->demodulator_priv;
struct cx24110_state *state = fe->demodulator_priv;

state->config->pll_set(fe, p);
cx24110_set_inversion (state, p->inversion);
Expand All @@ -540,7 +539,7 @@ static int cx24110_set_frontend(struct dvb_frontend* fe, struct dvb_frontend_par

static int cx24110_get_frontend(struct dvb_frontend* fe, struct dvb_frontend_parameters *p)
{
struct cx24110_state *state = (struct cx24110_state*) fe->demodulator_priv;
struct cx24110_state *state = fe->demodulator_priv;
s32 afc; unsigned sclk;

/* cannot read back tuner settings (freq). Need to have some private storage */
Expand All @@ -567,14 +566,14 @@ static int cx24110_get_frontend(struct dvb_frontend* fe, struct dvb_frontend_par

static int cx24110_set_tone(struct dvb_frontend* fe, fe_sec_tone_mode_t tone)
{
struct cx24110_state *state = (struct cx24110_state*) fe->demodulator_priv;
struct cx24110_state *state = fe->demodulator_priv;

return cx24110_writereg(state,0x76,(cx24110_readreg(state,0x76)&~0x10)|(((tone==SEC_TONE_ON))?0x10:0));
}

static void cx24110_release(struct dvb_frontend* fe)
{
struct cx24110_state* state = (struct cx24110_state*) fe->demodulator_priv;
struct cx24110_state* state = fe->demodulator_priv;
kfree(state);
}

Expand All @@ -587,7 +586,7 @@ struct dvb_frontend* cx24110_attach(const struct cx24110_config* config,
int ret;

/* allocate memory for the internal state */
state = (struct cx24110_state*) kmalloc(sizeof(struct cx24110_state), GFP_KERNEL);
state = kmalloc(sizeof(struct cx24110_state), GFP_KERNEL);
if (state == NULL) goto error;

/* setup the state */
Expand Down
Loading

0 comments on commit b874270

Please sign in to comment.