diff options
| author | Mark Brown <broonie@kernel.org> | 2025-05-07 09:47:05 +0900 |
|---|---|---|
| committer | Mark Brown <broonie@kernel.org> | 2025-05-07 09:47:05 +0900 |
| commit | 9fbae052f6f68056fd84e8ba096a7e9ab3464f3d (patch) | |
| tree | 9761fe612792d8c4e67c5da66fa5258e7c0c13fe /drivers/spi/spi-mem.c | |
| parent | 222a87f6b94f6f177e896d6fcdc7881480344e34 (diff) | |
| parent | 9f7cd1bcb6363368abc954ff4e727b579813c697 (diff) | |
This patch set did some clean up and add runtime pm
Merge series from Haibo Chen <haibo.chen@nxp.com>:
PATCH1/3/4 to clean up the code, make the code more readable
PATCH2 add the runtime pm support
PATCH5 use devm_add_action_or_reset() to replace remove() callback, this can avoid
oops when do bind/unbind test
Diffstat (limited to 'drivers/spi/spi-mem.c')
| -rw-r--r-- | drivers/spi/spi-mem.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/spi/spi-mem.c b/drivers/spi/spi-mem.c index a31a1db07aa4..5db0639d3b01 100644 --- a/drivers/spi/spi-mem.c +++ b/drivers/spi/spi-mem.c @@ -596,7 +596,11 @@ u64 spi_mem_calc_op_duration(struct spi_mem_op *op) ns_per_cycles = 1000000000 / op->max_freq; ncycles += ((op->cmd.nbytes * 8) / op->cmd.buswidth) / (op->cmd.dtr ? 2 : 1); ncycles += ((op->addr.nbytes * 8) / op->addr.buswidth) / (op->addr.dtr ? 2 : 1); - ncycles += ((op->dummy.nbytes * 8) / op->dummy.buswidth) / (op->dummy.dtr ? 2 : 1); + + /* Dummy bytes are optional for some SPI flash memory operations */ + if (op->dummy.nbytes) + ncycles += ((op->dummy.nbytes * 8) / op->dummy.buswidth) / (op->dummy.dtr ? 2 : 1); + ncycles += ((op->data.nbytes * 8) / op->data.buswidth) / (op->data.dtr ? 2 : 1); return ncycles * ns_per_cycles; |