Skip to content

Commit

Permalink
Staging: iio: Aditional fixpoint formatted output bugfix
Browse files Browse the repository at this point in the history
iio: Additional fixpoint formatted output bugfixes

Fix some ADC/DAC drivers' _scale interface to correct fixpoint formatted output

This patch adds the fixes to ad7887_core.c and ad5446.c

Signed-off-by: Roland Stigge <stigge@antcom.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Roland Stigge authored and Greg Kroah-Hartman committed Jan 22, 2011
1 parent 01446ef commit 41135b1
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion drivers/staging/iio/adc/ad7887_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ static ssize_t ad7887_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, ad7887_show_scale, NULL, 0);

Expand Down
2 changes: 1 addition & 1 deletion drivers/staging/iio/dac/ad5446.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ static ssize_t ad5446_show_scale(struct device *dev,
/* Corresponds to Vref / 2^(bits) */
unsigned int scale_uv = (st->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(out_scale, S_IRUGO, ad5446_show_scale, NULL, 0);

Expand Down

0 comments on commit 41135b1

Please sign in to comment.