From patchwork Thu Dec 9 17:40:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miquel Raynal X-Patchwork-Id: 522685 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8D861C433F5 for ; Thu, 9 Dec 2021 17:41:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237486AbhLIRom (ORCPT ); Thu, 9 Dec 2021 12:44:42 -0500 Received: from relay10.mail.gandi.net ([217.70.178.230]:34707 "EHLO relay10.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241534AbhLIRol (ORCPT ); Thu, 9 Dec 2021 12:44:41 -0500 Received: (Authenticated sender: miquel.raynal@bootlin.com) by relay10.mail.gandi.net (Postfix) with ESMTPSA id 14A87240006; Thu, 9 Dec 2021 17:41:05 +0000 (UTC) From: Miquel Raynal To: Richard Weinberger , Vignesh Raghavendra , Tudor Ambarus , Pratyush Yadav , Michael Walle , Cc: Mark Brown , , Julien Su , Jaime Liao , Miquel Raynal Subject: [PATCH v4 11/12] spi: mxic: Use spi_mem_generic_supports_op() Date: Thu, 9 Dec 2021 18:40:45 +0100 Message-Id: <20211209174046.535229-12-miquel.raynal@bootlin.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20211209174046.535229-1-miquel.raynal@bootlin.com> References: <20211209174046.535229-1-miquel.raynal@bootlin.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org This driver can be simplified a little bit by using spi_mem_generic_supports_op() instead of the spi_mem_default/dtr_supports_op() couple. The all_false boolean is inverted to become a dtr boolean, which tacks if at least one of the operation member uses dtr mode. The idea behind this change is to simplify the introduction of the pipelined ECC engine. Signed-off-by: Miquel Raynal --- drivers/spi/spi-mxic.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/drivers/spi/spi-mxic.c b/drivers/spi/spi-mxic.c index 485a7f2afb44..84534733eb36 100644 --- a/drivers/spi/spi-mxic.c +++ b/drivers/spi/spi-mxic.c @@ -452,7 +452,7 @@ static ssize_t mxic_spi_mem_dirmap_write(struct spi_mem_dirmap_desc *desc, static bool mxic_spi_mem_supports_op(struct spi_mem *mem, const struct spi_mem_op *op) { - bool all_false; + bool dtr; if (op->data.buswidth > 8 || op->addr.buswidth > 8 || op->dummy.buswidth > 8 || op->cmd.buswidth > 8) @@ -465,13 +465,9 @@ static bool mxic_spi_mem_supports_op(struct spi_mem *mem, if (op->addr.nbytes > 7) return false; - all_false = !op->cmd.dtr && !op->addr.dtr && !op->dummy.dtr && - !op->data.dtr; + dtr = op->cmd.dtr || op->addr.dtr || op->dummy.dtr || op->data.dtr; - if (all_false) - return spi_mem_default_supports_op(mem, op); - else - return spi_mem_dtr_supports_op(mem, op); + return spi_mem_generic_supports_op(mem, op, dtr, false); } static int mxic_spi_mem_dirmap_create(struct spi_mem_dirmap_desc *desc)