diff options
author | Raag Jadav <raag.jadav@intel.com> | 2023-11-17 20:10:53 +0530 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2023-11-18 12:36:34 +0000 |
commit | 18a813a1f94abbab14248071ca551e491bbc2abe (patch) | |
tree | b873ef3dc97400151486d5aebafbed213cfd70c1 | |
parent | 54a1dc08e1737552e6764f38837b19fae9548fb0 (diff) | |
download | lwn-18a813a1f94abbab14248071ca551e491bbc2abe.tar.gz lwn-18a813a1f94abbab14248071ca551e491bbc2abe.zip |
spi: intel: make mem_ops comparison unique to opcode match
Instead of comparing parameters for every supported mem_ops, only compare
on opcode match, which is relatively more efficient.
Signed-off-by: Raag Jadav <raag.jadav@intel.com>
Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Link: https://lore.kernel.org/r/20231117144053.24005-1-raag.jadav@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r-- | drivers/spi/spi-intel.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/spi/spi-intel.c b/drivers/spi/spi-intel.c index 98ec4dc22b81..3654ae35d2db 100644 --- a/drivers/spi/spi-intel.c +++ b/drivers/spi/spi-intel.c @@ -711,8 +711,7 @@ static bool intel_spi_cmp_mem_op(const struct intel_spi_mem_op *iop, { if (iop->mem_op.cmd.nbytes != op->cmd.nbytes || iop->mem_op.cmd.buswidth != op->cmd.buswidth || - iop->mem_op.cmd.dtr != op->cmd.dtr || - iop->mem_op.cmd.opcode != op->cmd.opcode) + iop->mem_op.cmd.dtr != op->cmd.dtr) return false; if (iop->mem_op.addr.nbytes != op->addr.nbytes || @@ -737,11 +736,12 @@ intel_spi_match_mem_op(struct intel_spi *ispi, const struct spi_mem_op *op) const struct intel_spi_mem_op *iop; for (iop = ispi->mem_ops; iop->mem_op.cmd.opcode; iop++) { - if (intel_spi_cmp_mem_op(iop, op)) - break; + if (iop->mem_op.cmd.opcode == op->cmd.opcode && + intel_spi_cmp_mem_op(iop, op)) + return iop; } - return iop->mem_op.cmd.opcode ? iop : NULL; + return NULL; } static bool intel_spi_supports_mem_op(struct spi_mem *mem, |