Re: [PATCH 4.19.y-cip 5/7] spi: spi-mem: Split spi_mem_exec_op() code

Lad Prabhakar

Hi Pavel,

Thank you for the review.

-----Original Message-----
From: Pavel Machek <pavel@...>
Sent: 23 November 2020 19:44
To: Prabhakar Mahadev Lad <prabhakar.mahadev-lad.rj@...>
Cc: cip-dev@...; Nobuhiro Iwamatsu <nobuhiro1.iwamatsu@...>; Pavel Machek
<pavel@...>; Biju Das <biju.das.jz@...>
Subject: Re: [PATCH 4.19.y-cip 5/7] spi: spi-mem: Split spi_mem_exec_op() code


From: Boris Brezillon <boris.brezillon@...>

commit f86c24f4795303e4024bc113196de32782f6ccb5 upstream.

The logic surrounding the ->exec_op() call applies to direct mapping
accessors. Move this code to separate functions to avoid duplicating
+++ b/drivers/spi/spi-mem.c
@@ -213,6 +213,44 @@ bool spi_mem_supports_op(struct spi_mem *mem, const struct spi_mem_op *op)

+static int spi_mem_access_start(struct spi_mem *mem)
+ struct spi_controller *ctlr = mem->spi->controller;
+ if (ctlr->auto_runtime_pm) {
+ int ret;
+ ret = pm_runtime_get_sync(ctlr->dev.parent);
+ if (ret < 0) {
+ dev_err(&ctlr->dev, "Failed to power device: %d\n",
+ ret);
+ return ret;
+ }
This misses pm_runtime_put() in the error case.
Agreed (pm_runtime_put_noidle()).

+ mutex_lock(&ctlr->bus_lock_mutex);
+ mutex_lock(&ctlr->io_mutex);
Plus hiding locking into function like this ... is quite


Best regards,

DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany

Join { to automatically receive all group messages.