aboutsummaryrefslogtreecommitdiff
path: root/drivers/spi
diff options
context:
space:
mode:
authorVladimir Zapolskiy2019-06-18 19:28:18 +0300
committerMark Brown2019-06-18 19:19:14 +0100
commitf56943699463478617b235930252261d5277bd46 (patch)
tree009377f928ec637e3af482b58236d46e8b16668a /drivers/spi
parentebc37af5e0a134355ea2b62ed4141458bdbd5389 (diff)
spi: don't open code list_for_each_entry_safe_reverse()
The loop declaration in function spi_res_release() can be simplified by reusing the common list_for_each_entry_safe_reverse() helper macro. Signed-off-by: Vladimir Zapolskiy <vz@mleia.com> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers/spi')
-rw-r--r--drivers/spi/spi.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index e71881afe475..01a40bcfc352 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -2721,12 +2721,9 @@ EXPORT_SYMBOL_GPL(spi_res_add);
*/
void spi_res_release(struct spi_controller *ctlr, struct spi_message *message)
{
- struct spi_res *res;
-
- while (!list_empty(&message->resources)) {
- res = list_last_entry(&message->resources,
- struct spi_res, entry);
+ struct spi_res *res, *tmp;
+ list_for_each_entry_safe_reverse(res, tmp, &message->resources, entry) {
if (res->release)
res->release(ctlr, message, res->data);