提交 609e9d88 编写于 作者: H Hartmut Knaack 提交者: Jonathan Cameron

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: NHartmut Knaack <knaack.h@gmx.de>
Acked-by: NAntoine Tenart <antoine.tenart@free-electrons.com>
Signed-off-by: NJonathan Cameron <jic23@kernel.org>
上级 688febbd
...@@ -221,7 +221,7 @@ static int berlin2_adc_read_raw(struct iio_dev *indio_dev, ...@@ -221,7 +221,7 @@ static int berlin2_adc_read_raw(struct iio_dev *indio_dev,
return temp; return temp;
if (temp > 2047) if (temp > 2047)
temp = -(4096 - temp); temp -= 4096;
/* Convert to milli Celsius */ /* Convert to milli Celsius */
*val = ((temp * 100000) / 264 - 270000); *val = ((temp * 100000) / 264 - 270000);
...@@ -286,8 +286,7 @@ static int berlin2_adc_probe(struct platform_device *pdev) ...@@ -286,8 +286,7 @@ static int berlin2_adc_probe(struct platform_device *pdev)
int irq, tsen_irq; int irq, tsen_irq;
int ret; int ret;
indio_dev = devm_iio_device_alloc(&pdev->dev, indio_dev = devm_iio_device_alloc(&pdev->dev, sizeof(*priv));
sizeof(struct berlin2_adc_priv));
if (!indio_dev) if (!indio_dev)
return -ENOMEM; return -ENOMEM;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册