]> git.baikalelectronics.ru Git - kernel.git/commit
iio: magnetometer: ak8974: Break out measurement
authorLinus Walleij <linus.walleij@linaro.org>
Mon, 20 Apr 2020 20:40:21 +0000 (22:40 +0200)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Sun, 3 May 2020 08:47:22 +0000 (09:47 +0100)
commite7e54c3ab1e3de6ae232898cd1377d83ebbaa910
tree324b95995baa42e15eefc5b78cba9634d6124aa1
parent72e060aa46b5f4018503c1123dd7381e077ca0a3
iio: magnetometer: ak8974: Break out measurement

This breaks out the measurement code to its own function
so we can handle this without swirling it up with the
big switch() statement inside ak8974_read_raw().

Keep a local s16 helper variable for the signed value
coming out of the measurement before assigning it to the
integer *val. The local variable makes the code easier
to read and the compiler will optimize it if possible.

Cc: Nick Reitemeyer <nick.reitemeyer@web.de>
Cc: Stephan Gerhold <stephan@gerhold.net>
Reviewed-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/magnetometer/ak8974.c