summary refs log tree commit diff
path: root/drivers/iio
diff options
context:
space:
mode:
authorHartmut Knaack <knaack.h@gmx.de>2015-07-28 00:39:01 +0200
committerJonathan Cameron <jic23@kernel.org>2015-08-02 19:08:13 +0100
commit609e9d88f277bfe83392595745cc3976d42125b2 (patch)
tree85f4d17a3b7482b0848405b5c804d59a55658497 /drivers/iio
parent688febbd168c52ab54ad29c210aceecb72386398 (diff)
downloadlinux-609e9d88f277bfe83392595745cc3976d42125b2.tar.gz
iio:adc:berlin2-adc: use short operator format
Use augmented assignment to subtract the offset for negative temperature
values.
Specify the amount of private data to be allocated through
devm_iio_device_alloc() with sizeof(*priv), as it is shorter and common
practice in IIO.

Signed-off-by: Hartmut Knaack <knaack.h@gmx.de>
Acked-by: Antoine Tenart <antoine.tenart@free-electrons.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Diffstat (limited to 'drivers/iio')
-rw-r--r--drivers/iio/adc/berlin2-adc.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/iio/adc/berlin2-adc.c b/drivers/iio/adc/berlin2-adc.c
index 2084b0b66ea0..e04b7734df1d 100644
--- a/drivers/iio/adc/berlin2-adc.c
+++ b/drivers/iio/adc/berlin2-adc.c
@@ -221,7 +221,7 @@ static int berlin2_adc_read_raw(struct iio_dev *indio_dev,
 			return temp;
 
 		if (temp > 2047)
-			temp = -(4096 - temp);
+			temp -= 4096;
 
 		/* Convert to milli Celsius */
 		*val = ((temp * 100000) / 264 - 270000);
@@ -286,8 +286,7 @@ static int berlin2_adc_probe(struct platform_device *pdev)
 	int irq, tsen_irq;
 	int ret;
 
-	indio_dev = devm_iio_device_alloc(&pdev->dev,
-					  sizeof(struct berlin2_adc_priv));
+	indio_dev = devm_iio_device_alloc(&pdev->dev, sizeof(*priv));
 	if (!indio_dev)
 		return -ENOMEM;