[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20240413120507.05bbd229@jic23-huawei>
Date: Sat, 13 Apr 2024 12:05:07 +0100
From: Jonathan Cameron <jic23@...nel.org>
To: David Lechner <dlechner@...libre.com>
Cc: Michael Hennerich <Michael.Hennerich@...log.com>, Nuno Sá
<nuno.sa@...log.com>, linux-iio@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] iio: adc: ad7944: Consolidate spi_sync() wrapper
On Fri, 12 Apr 2024 18:25:02 -0500
David Lechner <dlechner@...libre.com> wrote:
> 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@...libre.com>
I was initially dubious about implying the need to change a GPIO when we don't,
but given that the resulting function is really simple and the comment on that
is immediately above the code (not obvious from this diff) this seems fine to
me.
Applied.
Powered by blists - more mailing lists