struct sp8870_state* state = (struct sp8870_state*) fe->demodulator_priv; 
struct sp8870_state* state = fe->demodulator_priv; 
static int sp8870_set_frontend (struct dvb_frontend* fe, struct dvb_frontend_parameters *p){	struct sp8870_state* state = (struct sp8870_state*) fe->demodulator_priv;	/*	    The firmware of the sp8870 sometimes locks up after setting frontend parameters.	    We try to detect this by checking the data valid signal.	    If it is not set after MAXCHECKS we try to recover the lockup by setting	    the frontend parameters again.	*/	int err = 0;	int valid = 0;	int trials = 0;	int check_count = 0;	dprintk("%s: frequency = %i\n", __FUNCTION__, p->frequency);	for (trials = 1; trials <= MAXTRIALS; trials++) {		if ((err = sp8870_set_frontend_parameters(fe, p)))			return err;		for (check_count = 0; check_count < MAXCHECKS; check_count++) {//			valid = ((sp8870_readreg(i2c, 0x0200) & 4) == 0);			valid = sp8870_read_data_valid_signal(state);			if (valid) {				dprintk("%s: delay = %i usec\n",					__FUNCTION__, check_count * 10);				break;			}			udelay(10);		}		if (valid)			break;	}	if (!valid) {		printk("%s: firmware crash!!!!!!\n", __FUNCTION__);		return -EIO;	}	if (debug) {		if (valid) {			if (trials > 1) {				printk("%s: firmware lockup!!!\n", __FUNCTION__);				printk("%s: recovered after %i trial(s))\n",  __FUNCTION__, trials - 1);				lockups++;			}		}		switches++;		printk("%s: switches = %i lockups = %i\n", __FUNCTION__, switches, lockups);	}	return 0;}
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/b8742700f13163ffa00cddce2a3c940b9ab2ab5a/sp8870.c/buggy/drivers/media/dvb/frontends/sp8870.c