status = i2c_get_status(dev); 
status = i2c_get_status(dev); 
static int saa7134_i2c_xfer(struct i2c_adapter *i2c_adap,			    struct i2c_msg *msgs, int num){	struct saa7134_dev *dev = i2c_adap->algo_data;	enum i2c_status status;	unsigned char data;	int addr,rc,i,byte;  	status = i2c_get_status(dev);	if (!i2c_is_idle(status))		if (!i2c_reset(dev))			return -EIO;	d2printk("start xfer\n");	d1printk(KERN_DEBUG "%s: i2c xfer:",dev->name);	for (i = 0; i < num; i++) {		if (!(msgs[i].flags & I2C_M_NOSTART) || 0 == i) {			/* send address */			d2printk("send address\n");			addr  = msgs[i].addr << 1;			if (msgs[i].flags & I2C_M_RD)				addr |= 1;			if (i > 0 && msgs[i].flags & I2C_M_RD) {				/* workaround for a saa7134 i2c bug				 * needed to talk to the mt352 demux				 * thanks to pinnacle for the hint */				int quirk = 0xfd;				d1printk(" [%02x quirk]",quirk);				i2c_send_byte(dev,START,quirk);				i2c_recv_byte(dev);			}			d1printk(" < %02x", addr);			rc = i2c_send_byte(dev,START,addr);			if (rc < 0)				 goto err;		}		if (msgs[i].flags & I2C_M_RD) {			/* read bytes */			d2printk("read bytes\n");			for (byte = 0; byte < msgs[i].len; byte++) {				d1printk(" =");				rc = i2c_recv_byte(dev);				if (rc < 0)					goto err;				d1printk("%02x", rc);				msgs[i].buf[byte] = rc;			}		} else {			/* write bytes */			d2printk("write bytes\n");			for (byte = 0; byte < msgs[i].len; byte++) {				data = msgs[i].buf[byte];				d1printk(" %02x", data);				rc = i2c_send_byte(dev,CONTINUE,data);				if (rc < 0)					goto err;			}		}	}	d2printk("xfer done\n");	d1printk(" >");	i2c_set_attr(dev,STOP);	rc = -EIO;	if (!i2c_is_busy_wait(dev))		goto err;  	status = i2c_get_status(dev);	if (i2c_is_error(status))		goto err;	/* ensure that the bus is idle for at least one bit slot */	msleep(1);	d1printk("\n");	return num; err:	if (1 == i2c_debug) {		status = i2c_get_status(dev);		printk(" ERROR: %s\n",str_i2c_status[status]);	}	return rc;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/4ac97914c6c35f6bf132071c718e034d0846b9f5/saa7134-i2c.c/buggy/drivers/media/video/saa7134/saa7134-i2c.c