dprintk(KERN_DEBUG "msp3410: detection still in progress\n"); 
dprintk("msp3410: detection still in progress\n"); 
static int msp3410d_thread(void *data){	struct i2c_client *client = data;	struct msp3400c *msp = i2c_get_clientdata(client);	int mode,val,i,std;	printk("msp3410: daemon started\n");	for (;;) {		d2printk(KERN_DEBUG "msp3410: thread: sleep\n");		msp34xx_sleep(msp,-1);		d2printk(KERN_DEBUG "msp3410: thread: wakeup\n");	restart:		dprintk("msp3410: thread: restart scan\n");		msp->restart = 0;		if (kthread_should_stop())			break;		if (msp->mode == MSP_MODE_EXTERN) {			/* no carrier scan needed, just unmute */			dprintk(KERN_DEBUG "msp3410: thread: no carrier scan\n");			msp3400c_setvolume(client, msp->muted,					   msp->volume, msp->balance);			continue;		}		/* put into sane state (and mute) */		msp3400c_reset(client);		/* some time for the tuner to sync */		if (msp34xx_sleep(msp,200))			goto restart;		/* start autodetect */		mode = msp34xx_modus(msp->norm);		std  = msp34xx_standard(msp->norm);		msp3400c_write(client, I2C_MSP3400C_DEM, 0x30, mode);		msp3400c_write(client, I2C_MSP3400C_DEM, 0x20, std);		msp->watch_stereo = 0;		if (debug)			printk(KERN_DEBUG "msp3410: setting mode: %s (0x%04x)\n",			       msp34xx_standard_mode_name(std) ,std);		if (std != 1) {			/* programmed some specific mode */			val = std;		} else {			/* triggered autodetect */			for (;;) {				if (msp34xx_sleep(msp,100))					goto restart;				/* check results */				val = msp3400c_read(client, I2C_MSP3400C_DEM, 0x7e);				if (val < 0x07ff)					break;				dprintk(KERN_DEBUG "msp3410: detection still in progress\n");			}		}		for (i = 0; modelist[i].name != NULL; i++)			if (modelist[i].retval == val)				break;		dprintk(KERN_DEBUG "msp3410: current mode: %s (0x%04x)\n",			modelist[i].name ? modelist[i].name : "unknown",			val);		msp->main   = modelist[i].main;		msp->second = modelist[i].second;		if (amsound && (msp->norm == VIDEO_MODE_SECAM) && (val != 0x0009)) {			/* autodetection has failed, let backup */			dprintk(KERN_DEBUG "msp3410: autodetection failed,"				" switching to backup mode: %s (0x%04x)\n",				modelist[8].name ? modelist[8].name : "unknown",val);			val = 0x0009;			msp3400c_write(client, I2C_MSP3400C_DEM, 0x20, val);		}		/* set various prescales */		msp3400c_write(client, I2C_MSP3400C_DFP, 0x0d, 0x1900); /* scart */		msp3400c_write(client, I2C_MSP3400C_DFP, 0x0e, 0x2403); /* FM */		msp3400c_write(client, I2C_MSP3400C_DFP, 0x10, 0x5a00); /* nicam */		/* set stereo */		switch (val) {		case 0x0008: /* B/G NICAM */		case 0x000a: /* I NICAM */			if (val == 0x0008)				msp->mode = MSP_MODE_FM_NICAM1;			else				msp->mode = MSP_MODE_FM_NICAM2;			/* just turn on stereo */			msp->rxsubchans = V4L2_TUNER_SUB_STEREO;			msp->nicam_on = 1;			msp->watch_stereo = 1;			msp3400c_set_audmode(client,V4L2_TUNER_MODE_STEREO);			break;		case 0x0009:			msp->mode = MSP_MODE_AM_NICAM;			msp->rxsubchans = V4L2_TUNER_SUB_MONO;			msp->nicam_on = 1;			msp3400c_set_audmode(client,V4L2_TUNER_MODE_MONO);			msp->watch_stereo = 1;			break;		case 0x0020: /* BTSC */			/* just turn on stereo */			msp->mode = MSP_MODE_BTSC;			msp->rxsubchans = V4L2_TUNER_SUB_STEREO;			msp->nicam_on = 0;			msp->watch_stereo = 1;			msp3400c_set_audmode(client,V4L2_TUNER_MODE_STEREO);			break;		case 0x0040: /* FM radio */			msp->mode   = MSP_MODE_FM_RADIO;			msp->rxsubchans = V4L2_TUNER_SUB_STEREO;			msp->audmode = V4L2_TUNER_MODE_STEREO;			msp->nicam_on = 0;			msp->watch_stereo = 0;			/* not needed in theory if HAVE_RADIO(), but			   short programming enables carrier mute */			msp3400c_setmode(client,MSP_MODE_FM_RADIO);			msp3400c_setcarrier(client, MSP_CARRIER(10.7),					    MSP_CARRIER(10.7));			/* scart routing */			msp3400c_set_scart(client,SCART_IN2,0);			/* msp34xx does radio decoding */			msp3400c_write(client,I2C_MSP3400C_DFP, 0x08, 0x0020);			msp3400c_write(client,I2C_MSP3400C_DFP, 0x09, 0x0020);			msp3400c_write(client,I2C_MSP3400C_DFP, 0x0b, 0x0020);			break;		case 0x0003:		case 0x0004:		case 0x0005:			msp->mode   = MSP_MODE_FM_TERRA;			msp->rxsubchans = V4L2_TUNER_SUB_MONO;			msp->audmode = V4L2_TUNER_MODE_MONO;			msp->nicam_on = 0;			msp->watch_stereo = 1;			break;		}		/* unmute, restore misc registers */		msp3400c_setbass(client, msp->bass);		msp3400c_settreble(client, msp->treble);		msp3400c_setvolume(client, msp->muted,				    msp->volume, msp->balance);		msp3400c_write(client, I2C_MSP3400C_DFP, 0x0013, msp->acb);		/* monitor tv audio mode */		while (msp->watch_stereo) {			if (msp34xx_sleep(msp,5000))				goto restart;			watch_stereo(client);		}	}	dprintk(KERN_DEBUG "msp3410: thread: exit\n");	return 0;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/6df840f20d1ff63fd13ed1bb3e186395ee800794/msp3400.c/buggy/drivers/media/video/msp3400.c