Skip to content

Commit 18a813a

Browse files
raagjadavbroonie
authored andcommitted
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>
1 parent 54a1dc0 commit 18a813a

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

drivers/spi/spi-intel.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -711,8 +711,7 @@ static bool intel_spi_cmp_mem_op(const struct intel_spi_mem_op *iop,
711711
{
712712
if (iop->mem_op.cmd.nbytes != op->cmd.nbytes ||
713713
iop->mem_op.cmd.buswidth != op->cmd.buswidth ||
714-
iop->mem_op.cmd.dtr != op->cmd.dtr ||
715-
iop->mem_op.cmd.opcode != op->cmd.opcode)
714+
iop->mem_op.cmd.dtr != op->cmd.dtr)
716715
return false;
717716

718717
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)
737736
const struct intel_spi_mem_op *iop;
738737

739738
for (iop = ispi->mem_ops; iop->mem_op.cmd.opcode; iop++) {
740-
if (intel_spi_cmp_mem_op(iop, op))
741-
break;
739+
if (iop->mem_op.cmd.opcode == op->cmd.opcode &&
740+
intel_spi_cmp_mem_op(iop, op))
741+
return iop;
742742
}
743743

744-
return iop->mem_op.cmd.opcode ? iop : NULL;
744+
return NULL;
745745
}
746746

747747
static bool intel_spi_supports_mem_op(struct spi_mem *mem,

0 commit comments

Comments
 (0)