int it87_detect(struct i2c_adapter *adapter, int address, int kind) 
static int it87_detect(struct i2c_adapter *adapter, int address, int kind) 
int it87_detect(struct i2c_adapter *adapter, int address, int kind){	int i;	struct i2c_client *new_client;	struct it87_data *data;	int err = 0;	const char *name = "";	int is_isa = i2c_is_isa_adapter(adapter);	int enable_pwm_interface;	if (!is_isa && 	    !i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA))		goto ERROR0;	/* Reserve the ISA region */	if (is_isa)		if (!request_region(address, IT87_EXTENT, it87_isa_driver.name))			goto ERROR0;	/* For now, we presume we have a valid client. We create the	   client structure, even though we cannot fill it completely yet.	   But it allows us to access it87_{read,write}_value. */	if (!(data = kzalloc(sizeof(struct it87_data), GFP_KERNEL))) {		err = -ENOMEM;		goto ERROR1;	}	new_client = &data->client;	if (is_isa)		init_MUTEX(&data->lock);	i2c_set_clientdata(new_client, data);	new_client->addr = address;	new_client->adapter = adapter;	new_client->driver = is_isa ? &it87_isa_driver : &it87_driver;	new_client->flags = 0;	/* Now, we do the remaining detection. */	if (kind < 0) {		if ((it87_read_value(new_client, IT87_REG_CONFIG) & 0x80)		  || (!is_isa		   && it87_read_value(new_client, IT87_REG_I2C_ADDR) != address)) {		   	err = -ENODEV;			goto ERROR2;		}	}	/* Determine the chip type. */	if (kind <= 0) {		i = it87_read_value(new_client, IT87_REG_CHIPID);		if (i == 0x90) {			kind = it87;			if ((is_isa) && (chip_type == IT8712F_DEVID))				kind = it8712;		}		else {			if (kind == 0)				dev_info(&adapter->dev, 					"Ignoring 'force' parameter for unknown chip at "					"adapter %d, address 0x%02x\n",					i2c_adapter_id(adapter), address);			err = -ENODEV;			goto ERROR2;		}	}	if (kind == it87) {		name = "it87";	} else if (kind == it8712) {		name = "it8712";	}	/* Fill in the remaining client fields and put it into the global list */	strlcpy(new_client->name, name, I2C_NAME_SIZE);	data->type = kind;	data->valid = 0;	init_MUTEX(&data->update_lock);	/* Tell the I2C layer a new client has arrived */	if ((err = i2c_attach_client(new_client)))		goto ERROR2;	/* Check PWM configuration */	enable_pwm_interface = it87_check_pwm(new_client);	/* Initialize the IT87 chip */	it87_init_client(new_client, data);	/* Register sysfs hooks */	data->class_dev = hwmon_device_register(&new_client->dev);	if (IS_ERR(data->class_dev)) {		err = PTR_ERR(data->class_dev);		goto ERROR3;	}	device_create_file(&new_client->dev, &sensor_dev_attr_in0_input.dev_attr);	device_create_file(&new_client->dev, &sensor_dev_attr_in1_input.dev_attr);	device_create_file(&new_client->dev, &sensor_dev_attr_in2_input.dev_attr);	device_create_file(&new_client->dev, &sensor_dev_attr_in3_input.dev_attr);	device_create_file(&new_client->dev, &sensor_dev_attr_in4_input.dev_attr);	device_create_file(&new_client->dev, &sensor_dev_attr_in5_input.dev_attr);	device_create_file(&new_client->dev, &sensor_dev_attr_in6_input.dev_attr);	device_create_file(&new_client->dev, &sensor_dev_attr_in7_input.dev_attr);	device_create_file(&new_client->dev, &sensor_dev_attr_in8_input.dev_attr);	device_create_file(&new_client->dev, &sensor_dev_attr_in0_min.dev_attr);	device_create_file(&new_client->dev, &sensor_dev_attr_in1_min.dev_attr);	device_create_file(&new_client->dev, &sensor_dev_attr_in2_min.dev_attr);	device_create_file(&new_client->dev, &sensor_dev_attr_in3_min.dev_attr);	device_create_file(&new_client->dev, &sensor_dev_attr_in4_min.dev_attr);	device_create_file(&new_client->dev, &sensor_dev_attr_in5_min.dev_attr);	device_create_file(&new_client->dev, &sensor_dev_attr_in6_min.dev_attr);	device_create_file(&new_client->dev, &sensor_dev_attr_in7_min.dev_attr);	device_create_file(&new_client->dev, &sensor_dev_attr_in0_max.dev_attr);	device_create_file(&new_client->dev, &sensor_dev_attr_in1_max.dev_attr);	device_create_file(&new_client->dev, &sensor_dev_attr_in2_max.dev_attr);	device_create_file(&new_client->dev, &sensor_dev_attr_in3_max.dev_attr);	device_create_file(&new_client->dev, &sensor_dev_attr_in4_max.dev_attr);	device_create_file(&new_client->dev, &sensor_dev_attr_in5_max.dev_attr);	device_create_file(&new_client->dev, &sensor_dev_attr_in6_max.dev_attr);	device_create_file(&new_client->dev, &sensor_dev_attr_in7_max.dev_attr);	device_create_file(&new_client->dev, &sensor_dev_attr_temp1_input.dev_attr);	device_create_file(&new_client->dev, &sensor_dev_attr_temp2_input.dev_attr);	device_create_file(&new_client->dev, &sensor_dev_attr_temp3_input.dev_attr);	device_create_file(&new_client->dev, &sensor_dev_attr_temp1_max.dev_attr);	device_create_file(&new_client->dev, &sensor_dev_attr_temp2_max.dev_attr);	device_create_file(&new_client->dev, &sensor_dev_attr_temp3_max.dev_attr);	device_create_file(&new_client->dev, &sensor_dev_attr_temp1_min.dev_attr);	device_create_file(&new_client->dev, &sensor_dev_attr_temp2_min.dev_attr);	device_create_file(&new_client->dev, &sensor_dev_attr_temp3_min.dev_attr);	device_create_file(&new_client->dev, &sensor_dev_attr_temp1_type.dev_attr);	device_create_file(&new_client->dev, &sensor_dev_attr_temp2_type.dev_attr);	device_create_file(&new_client->dev, &sensor_dev_attr_temp3_type.dev_attr);	device_create_file(&new_client->dev, &sensor_dev_attr_fan1_input.dev_attr);	device_create_file(&new_client->dev, &sensor_dev_attr_fan2_input.dev_attr);	device_create_file(&new_client->dev, &sensor_dev_attr_fan3_input.dev_attr);	device_create_file(&new_client->dev, &sensor_dev_attr_fan1_min.dev_attr);	device_create_file(&new_client->dev, &sensor_dev_attr_fan2_min.dev_attr);	device_create_file(&new_client->dev, &sensor_dev_attr_fan3_min.dev_attr);	device_create_file(&new_client->dev, &sensor_dev_attr_fan1_div.dev_attr);	device_create_file(&new_client->dev, &sensor_dev_attr_fan2_div.dev_attr);	device_create_file(&new_client->dev, &sensor_dev_attr_fan3_div.dev_attr);	device_create_file(&new_client->dev, &dev_attr_alarms);	if (enable_pwm_interface) {		device_create_file(&new_client->dev, &sensor_dev_attr_pwm1_enable.dev_attr);		device_create_file(&new_client->dev, &sensor_dev_attr_pwm2_enable.dev_attr);		device_create_file(&new_client->dev, &sensor_dev_attr_pwm3_enable.dev_attr);		device_create_file(&new_client->dev, &sensor_dev_attr_pwm1.dev_attr);		device_create_file(&new_client->dev, &sensor_dev_attr_pwm2.dev_attr);		device_create_file(&new_client->dev, &sensor_dev_attr_pwm3.dev_attr);	}	if (data->type == it8712) {		data->vrm = vid_which_vrm();		device_create_file_vrm(new_client);		device_create_file_vid(new_client);	}	return 0;ERROR3:	i2c_detach_client(new_client);ERROR2:	kfree(data);ERROR1:	if (is_isa)		release_region(address, IT87_EXTENT);ERROR0:	return err;}
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/c49efceffa599299ab3f38b1cdf8c2f1bf9811c4/it87.c/buggy/drivers/hwmon/it87.c