Hi! > From: 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 > code. > > +++ 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) > } > EXPORT_SYMBOL_GPL(spi_mem_supports_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. > + mutex_lock(&ctlr->bus_lock_mutex); > + mutex_lock(&ctlr->io_mutex); Plus hiding locking into function like this ... is quite "interesting". Best regards, Pavel -- DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany