tps = kmalloc(sizeof *tps, GFP_KERNEL); 
tps = kzalloc(sizeof *tps, GFP_KERNEL); 
tps65010_probe(struct i2c_adapter *bus, int address, int kind){	struct tps65010		*tps;	int			status;	if (the_tps) {		dev_dbg(&bus->dev, "only one %s for now\n", DRIVER_NAME);		return 0;	}	tps = kmalloc(sizeof *tps, GFP_KERNEL);	if (!tps)		return 0;	memset(tps, 0, sizeof *tps);	init_MUTEX(&tps->lock);	INIT_WORK(&tps->work, tps65010_work, tps);	tps->irq = -1;	tps->client.addr = address;	tps->client.adapter = bus;	tps->client.driver = &tps65010_driver;	strlcpy(tps->client.name, DRIVER_NAME, I2C_NAME_SIZE);	status = i2c_attach_client(&tps->client);	if (status < 0) {		dev_dbg(&bus->dev, "can't attach %s to device %d, err %d\n",				DRIVER_NAME, address, status);		goto fail1;	}#ifdef	CONFIG_ARM	if (machine_is_omap_h2()) {		tps->model = TPS65010;		omap_cfg_reg(W4_GPIO58);		tps->irq = OMAP_GPIO_IRQ(58);		omap_request_gpio(58);		omap_set_gpio_direction(58, 1);		set_irq_type(tps->irq, IRQT_FALLING);	}	if (machine_is_omap_osk()) {		tps->model = TPS65010;		// omap_cfg_reg(U19_1610_MPUIO1);		tps->irq = OMAP_GPIO_IRQ(OMAP_MPUIO(1));		omap_request_gpio(OMAP_MPUIO(1));		omap_set_gpio_direction(OMAP_MPUIO(1), 1);		set_irq_type(tps->irq, IRQT_FALLING);	}	if (machine_is_omap_h3()) {		tps->model = TPS65013;		// FIXME set up this board's IRQ ...	}#else#define set_irq_type(num,trigger)	do{}while(0)#endif	if (tps->irq > 0) {		set_irq_type(tps->irq, IRQT_LOW);		status = request_irq(tps->irq, tps65010_irq,			SA_SAMPLE_RANDOM, DRIVER_NAME, tps);		if (status < 0) {			dev_dbg(&tps->client.dev, "can't get IRQ %d, err %d\n",					tps->irq, status);			i2c_detach_client(&tps->client);			goto fail1;		}#ifdef	CONFIG_ARM		/* annoying race here, ideally we'd have an option		 * to claim the irq now and enable it later.		 */		disable_irq(tps->irq);		set_bit(FLAG_IRQ_ENABLE, &tps->flags);#endif	} else		printk(KERN_WARNING "%s: IRQ not configured!\n",				DRIVER_NAME);	switch (tps->model) {	case TPS65010:	case TPS65012:		tps->por = 1;		break;	case TPS_UNKNOWN:		printk(KERN_WARNING "%s: unknown TPS chip\n", DRIVER_NAME);		break;	/* else CHGCONFIG.POR is replaced by AUA, enabling a WAIT mode */	}	tps->chgconf = i2c_smbus_read_byte_data(&tps->client, TPS_CHGCONFIG);	show_chgconfig(tps->por, "conf/init", tps->chgconf);	show_chgstatus("chg/init",		i2c_smbus_read_byte_data(&tps->client, TPS_CHGSTATUS));	show_regstatus("reg/init",		i2c_smbus_read_byte_data(&tps->client, TPS_REGSTATUS));	pr_debug("%s: vdcdc1 0x%02x, vdcdc2 %02x, vregs1 %02x\n", DRIVER_NAME,		i2c_smbus_read_byte_data(&tps->client, TPS_VDCDC1),		i2c_smbus_read_byte_data(&tps->client, TPS_VDCDC2),		i2c_smbus_read_byte_data(&tps->client, TPS_VREGS1));	pr_debug("%s: defgpio 0x%02x, mask3 0x%02x\n", DRIVER_NAME,		i2c_smbus_read_byte_data(&tps->client, TPS_DEFGPIO),		i2c_smbus_read_byte_data(&tps->client, TPS_MASK3));	tps65010_driver.attach_adapter = tps65010_noscan;	the_tps = tps;#if	defined(CONFIG_USB_GADGET) && !defined(CONFIG_USB_OTG)	/* USB hosts can't draw VBUS.  OTG devices could, later	 * when OTG infrastructure enables it.  USB peripherals	 * could be relying on VBUS while booting, though.	 */	tps->vbus = 100;#endif	/* unmask the "interesting" irqs, then poll once to	 * kickstart monitoring, initialize shadowed status	 * registers, and maybe disable VBUS draw.	 */	tps->nmask1 = ~0;	(void) i2c_smbus_write_byte_data(&tps->client, TPS_MASK1, ~tps->nmask1);	tps->nmask2 = TPS_REG_ONOFF;	if (tps->model == TPS65013)		tps->nmask2 |= TPS_REG_NO_CHG;	(void) i2c_smbus_write_byte_data(&tps->client, TPS_MASK2, ~tps->nmask2);	(void) i2c_smbus_write_byte_data(&tps->client, TPS_MASK3, 0x0f		| i2c_smbus_read_byte_data(&tps->client, TPS_MASK3));	tps65010_work(tps);	tps->file = debugfs_create_file(DRIVER_NAME, S_IRUGO, NULL,				tps, DEBUG_FOPS);	return 0;fail1:	kfree(tps);	return 0;}
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/5263ebb51eb098b01caf229498c954999117e4a7/tps65010.c/clean/drivers/i2c/chips/tps65010.c