]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
iio: gyro: st_gyro: inline per-sensor data
authorLinus Walleij <linus.walleij@linaro.org>
Wed, 9 Nov 2016 15:09:58 +0000 (16:09 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 5 Feb 2020 13:05:44 +0000 (13:05 +0000)
commit6285915a9de1650b715c2365bf2c2ccf2fbb2ac7
tree7b66c3405ef17c70b7ff6cda3bca5b7488c1fae9
parentb814f7f4f8580372100d999473873b8e6884d1f7
iio: gyro: st_gyro: inline per-sensor data

[ Upstream commit d8594fa22a3f7c294639d9aa2959d63e66d9437c ]

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.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/iio/gyro/st_gyro_core.c