iio: adc: max9611: Make enum relations more future proof
authorGeert Uytterhoeven <geert+renesas@glider.be>
Wed, 13 Nov 2019 10:09:38 +0000 (11:09 +0100)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Sat, 16 Nov 2019 17:31:01 +0000 (17:31 +0000)
commita33db9475a3c7b6855c67d144dfa93a623b66cec
tree0762c87c5509aff4f6d16485304f22471f19cf16
parenta2587eb032f1679dd695b9e5113bcb6b52e46e0a
iio: adc: max9611: Make enum relations more future proof

The relations between enum values and array indices values are currently
not enforced by the code, which makes them fragile w.r.t. future
changes.

Fix this by:
  1. Using designated array initializers, to make sure array indices and
     enums values match,
  2. Linking max9611_csa_gain enum values to the corresponding
     max9611_conf_ids enum values, as the latter is cast to the former
     in max9611_read_csa_voltage().

No change in generated code.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Acked-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/adc/max9611.c