mirror of https://gitee.com/openkylin/linux.git
iio: Fixpoint formatted output bugfix
Fix some ADC drivers' _scale interface to correct fixpoint formatted output Signed-off-by: Roland Stigge <stigge@antcom.de> Acked-by: Jonathan Cameron <jic23@cam.ac.uk> Acked-by: Michael Hennerich <Michael.Hennerich@analog.com> Cc: stable <stable@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
parent
9c33008412
commit
e71a7fd259
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue