struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); int nr = sensor_attr->index;
static ssize_t show_sensor(struct device *dev, char *buf, int nr){	struct it87_data *data = it87_update_device(dev);	u8 reg = data->sensor; /* In case the value is updated while we use it */		if (reg & (1 << nr))		return sprintf(buf, "3\n");  /* thermal diode */	if (reg & (8 << nr))		return sprintf(buf, "2\n");  /* thermistor */	return sprintf(buf, "0\n");      /* disabled */}