Title: [8454] trunk/drivers/staging/iio/adc/ad7414.c: Task[#5912] correct the format of the temperature value
- Revision
- 8454
- Author
- sonicz
- Date
- 2010-03-12 01:18:55 -0500 (Fri, 12 Mar 2010)
Log Message
Task[#5912] correct the format of the temperature value
Modified Paths
Diff
Modified: trunk/drivers/staging/iio/adc/ad7414.c (8453 => 8454)
--- trunk/drivers/staging/iio/adc/ad7414.c 2010-03-12 06:05:39 UTC (rev 8453)
+++ trunk/drivers/staging/iio/adc/ad7414.c 2010-03-12 06:18:55 UTC (rev 8454)
@@ -187,7 +187,7 @@
value = (s16)be16_to_cpu(data);
value >>= AD7414_TEMP_OFFSET;
- return sprintf(buf, "%d.%d\n", (value >> 2), (value & 3) * 25);
+ return sprintf(buf, "%d.%.2d\n", (value >> 2), (value & 3) * 25);
}
IIO_DEVICE_ATTR(temperature, S_IRUGO, ad7414_show_temperature, NULL, 0);
@@ -352,10 +352,10 @@
ret = strict_strtoul(buf, 10, &data);
- if (ret)
+ if (ret || data > 127 || data < -128)
return -EINVAL;
- ret = ad7414_i2c_write(chip, bound_reg, (s8)data);
+ ret = ad7414_i2c_write(chip, bound_reg, (u8)data);
if (ret)
return -EIO;
_______________________________________________
Linux-kernel-commits mailing list
[email protected]
https://blackfin.uclinux.org/mailman/listinfo/linux-kernel-commits