iio: adc: ad7944: Consolidate spi_sync() wrapper
authorDavid Lechner <dlechner@baylibre.com>
Fri, 12 Apr 2024 23:25:02 +0000 (18:25 -0500)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Sat, 13 Apr 2024 11:04:08 +0000 (12:04 +0100)
commit61c8031af674bb80a7e346368ea0a41632e1f5fc
treea41ba3985e0d3f93f412d16024199c30ea648468
parentd9dd38cb59fb828a428084128569e684dd51cbe9
iio: adc: ad7944: Consolidate spi_sync() wrapper

Since commit 6020ca4de8e5 ("iio: adc: ad7944: use spi_optimize_message()"),
The helper functions wrapping spi_sync() for 3-wire and 4-wire modes are
virtually identical. Since gpiod_set_value_cansleep() does a NULL check
internally, we can consolidate the two functions into one and avoid
switch statements at the call sites.

The default cases of the removed switch statement were just to make the
compiler happy and are not reachable since the mode is validated in the
probe function. So removing those should be safe.

Signed-off-by: David Lechner <dlechner@baylibre.com>
Link: https://lore.kernel.org/r/20240412-ad7944-consolidate-msg-v1-1-7fdeff89172f@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/adc/ad7944.c