Merge 4.3-rc7 into staging-next
[firefly-linux-kernel-4.4.55.git] / drivers / staging / iio / adc / mxs-lradc.c
index f250aaf3bf261d41b2294bd097087843b89e093b..d997d9c74ca824740a825cc5399c12be5d491875 100644 (file)
@@ -930,11 +930,12 @@ static int mxs_lradc_read_raw(struct iio_dev *iio_dev,
        case IIO_CHAN_INFO_OFFSET:
                if (chan->type == IIO_TEMP) {
                        /* The calculated value from the ADC is in Kelvin, we
-                        * want Celsius for hwmon so the offset is
-                        * -272.15 * scale
+                        * want Celsius for hwmon so the offset is -273.15
+                        * The offset is applied before scaling so it is
+                        * actually -213.15 * 4 / 1.012 = -1079.644268
                         */
-                       *val = -1075;
-                       *val2 = 691699;
+                       *val = -1079;
+                       *val2 = 644268;
 
                        return IIO_VAL_INT_PLUS_MICRO;
                }
@@ -1232,7 +1233,7 @@ static int mxs_lradc_trigger_init(struct iio_dev *iio)
        struct mxs_lradc *lradc = iio_priv(iio);
 
        trig = iio_trigger_alloc("%s-dev%i", iio->name, iio->id);
-       if (trig == NULL)
+       if (!trig)
                return -ENOMEM;
 
        trig->dev.parent = lradc->dev;