Commit f0459616 authored by Roland Stigge's avatar Roland Stigge Committed by Greg Kroah-Hartman

iio: Fixpoint formatted output bugfix

commit e71a7fd2 upstream.

Fix some ADC drivers' _scale interface to correct fixpoint formatted output
Signed-off-by: default avatarRoland Stigge <stigge@antcom.de>
Acked-by: default avatarJonathan Cameron <jic23@cam.ac.uk>
Acked-by: default avatarMichael Hennerich <Michael.Hennerich@analog.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 42633db9
......@@ -68,7 +68,7 @@ static ssize_t ad7476_show_scale(struct device *dev,
/* Corresponds to Vref / 2^(bits) */
unsigned int scale_uv = (st->int_vref_mv * 1000) >> st->chip_info->bits;
return sprintf(buf, "%d.%d\n", scale_uv / 1000, scale_uv % 1000);
return sprintf(buf, "%d.%03d\n", scale_uv / 1000, scale_uv % 1000);
}
static IIO_DEVICE_ATTR(in_scale, S_IRUGO, ad7476_show_scale, NULL, 0);
......
......@@ -432,7 +432,7 @@ static ssize_t ad799x_show_scale(struct device *dev,
/* Corresponds to Vref / 2^(bits) */
unsigned int scale_uv = (st->int_vref_mv * 1000) >> st->chip_info->bits;
return sprintf(buf, "%d.%d\n", scale_uv / 1000, scale_uv % 1000);
return sprintf(buf, "%d.%03d\n", scale_uv / 1000, scale_uv % 1000);
}
static IIO_DEVICE_ATTR(in_scale, S_IRUGO, ad799x_show_scale, NULL, 0);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment