/* Read a value from the ADC and scale it before returning it to the caller. The scale factor is gained from the channel configuration passed via the platform data when the device was registered.  */
static ssize_t s3c_hwmon_ch_show(struct device *dev, struct device_attribute *attr, char *buf)
/* Read a value from the ADC and scale it before returning it to the caller. The scale factor is gained from the channel configuration passed via the platform data when the device was registered.  */
static ssize_t s3c_hwmon_ch_show(struct device *dev, struct device_attribute *attr, char *buf)
{
	struct sensor_device_attribute *sen_attr = to_sensor_dev_attr(attr);
	struct s3c_hwmon *hwmon = platform_get_drvdata(to_platform_device(dev));
	struct s3c_hwmon_pdata *pdata = dev->platform_data;
	struct s3c_hwmon_chcfg *cfg;
	int ret;
	cfg = pdata->in[sen_attr->index];
	ret = s3c_hwmon_read_ch(dev, hwmon, sen_attr->index);
	if (ret < 0)
		return ret;
	ret *= cfg->mult;
	ret = DIV_ROUND_CLOSEST(ret, cfg->div);
	return snprintf(buf, PAGE_SIZE, "%d\n", ret);
}