]> asedeno.scripts.mit.edu Git - linux.git/commit
iio: accel: st_accel: inline per-sensor data
authorLinus Walleij <linus.walleij@linaro.org>
Mon, 14 Nov 2016 10:35:21 +0000 (11:35 +0100)
committerJonathan Cameron <jic23@kernel.org>
Sat, 19 Nov 2016 12:25:36 +0000 (12:25 +0000)
commit9049531c91b4ed7948d7c8bf6e945f5da56fc501
tree38541e2dcd6d34b012d3bec7a00c5ac4d2939a3f
parent0f883b223aa407a9c9fab714655fbc1549cf3c01
iio: accel: st_accel: inline per-sensor data

We have #defines for all the individual sensor registers and
value/mask pairs #defined at the top of the file and used at
exactly one spot.

This is usually good if the #defines give a meaning to the
opaque magic numbers.

However in this case, the semantic meaning is inherent in the
name of the C99-addressable fields, and that means duplication
of information, and only makes the code hard to maintain since
you every time have to add a new #define AND update the site
where it is to be used.

Get rid of the #defines and just open code the values into the
appropriate struct elements. Make sure to explicitly address
the .hz and .value fields in the st_sensor_odr_avl struct
so that the meaning of all values is clear.

This patch is purely syntactic should have no semantic effect.

Cc: Lorenzo Bianconi <lorenzo.bianconi83@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
drivers/iio/accel/st_accel_core.c