Commit 18a813a1 authored by Raag Jadav's avatar Raag Jadav Committed by Mark Brown

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: default avatarRaag Jadav <raag.jadav@intel.com>
Reviewed-by: default avatarMika Westerberg <mika.westerberg@linux.intel.com>
Link: https://lore.kernel.org/r/20231117144053.24005-1-raag.jadav@intel.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 54a1dc08
...@@ -711,8 +711,7 @@ static bool intel_spi_cmp_mem_op(const struct intel_spi_mem_op *iop, ...@@ -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 || if (iop->mem_op.cmd.nbytes != op->cmd.nbytes ||
iop->mem_op.cmd.buswidth != op->cmd.buswidth || iop->mem_op.cmd.buswidth != op->cmd.buswidth ||
iop->mem_op.cmd.dtr != op->cmd.dtr || iop->mem_op.cmd.dtr != op->cmd.dtr)
iop->mem_op.cmd.opcode != op->cmd.opcode)
return false; return false;
if (iop->mem_op.addr.nbytes != op->addr.nbytes || 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) ...@@ -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; const struct intel_spi_mem_op *iop;
for (iop = ispi->mem_ops; iop->mem_op.cmd.opcode; iop++) { for (iop = ispi->mem_ops; iop->mem_op.cmd.opcode; iop++) {
if (intel_spi_cmp_mem_op(iop, op)) if (iop->mem_op.cmd.opcode == op->cmd.opcode &&
break; 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, static bool intel_spi_supports_mem_op(struct spi_mem *mem,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment