Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp525146imm; Wed, 20 Jun 2018 02:14:45 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKWEIcrU7mGw3HR1zBfQe4LgahgKyOzqaULdUag1p/bqHds2rMrc7GCEcnxQG2Kq6nKZJgT X-Received: by 2002:a62:df12:: with SMTP id u18-v6mr21874185pfg.230.1529486085683; Wed, 20 Jun 2018 02:14:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529486085; cv=none; d=google.com; s=arc-20160816; b=zEEPfdzoGzpIDiSGN6lVzqcnGU9Vsvk4xn/BuKxyq9FBIMupu9yC71BW4cA3E5tWz1 Nn0oJp6cpqDXF+3lERvLZIynD+AVEA/5qR5RvcC5lZV+GyvM2vJQuxSem5jdAGEzKtB8 VLE9amIw7RTuBsLx3VN30gpm8LuPecrWDf1t+x1vamfc8Wt0fz2VVU2gBWm+p9lX3sx0 meQ5XyO7lXJ94okQ1I+cjB38vlhbdi09TdG3bu9BdIGmSvqM4s/cDVR8kNFbQmeWgann G1Ocpmx5Z9dykwk24N2O9tb4QfRvmfO2PdID26Q47Lkl/5rOS5eT5IkMndFgWDBYhpBT uVaA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=t7wTLhP/fkMnuY6/EfqISEodQam5oq1wjS1vYGEVP1s=; b=azYVHATIs1q4FAEJfhGXWIWxeBfnlTtKt9saC8T/7DzGZtYz+7dtbqG39C8wvgJILd bI0+XxgKjx7ZWWAPR11ZOFa28p3wC8KypUvcietDqJUJcvwCYy7mCkF0O+IrScR22L+V RF74UkTaxiIxksjej7loiJGriQnUqELgmgu7de58k1xB47qOk2KWgNd0FlCnsInLZvH+ xXOG0y3QUbys85pCVwQBGPJB2bNulNXYetoABysExUzEz4SM8T6YsToUWXOxPTPlKdnQ Qsh8/j5T0U9D0s4Ojbye5PP/BwiuIOlIwA0j3UQSFz6tTLKFIbSvo3XKOVvvwXepkjFY seFg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=q2MhU+hL; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b2-v6si1898363pfn.361.2018.06.20.02.14.31; Wed, 20 Jun 2018 02:14:45 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=q2MhU+hL; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754669AbeFTJNr (ORCPT + 99 others); Wed, 20 Jun 2018 05:13:47 -0400 Received: from mail-lf0-f66.google.com ([209.85.215.66]:33464 "EHLO mail-lf0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754113AbeFTIdt (ORCPT ); Wed, 20 Jun 2018 04:33:49 -0400 Received: by mail-lf0-f66.google.com with SMTP id y20-v6so3680435lfy.0; Wed, 20 Jun 2018 01:33:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=t7wTLhP/fkMnuY6/EfqISEodQam5oq1wjS1vYGEVP1s=; b=q2MhU+hLC3yJish60vjdXIzLWvDw9IdKpbrgTTTwq1LaQmi2iuVQ1i6hYml6QvMbVA DNMf7y7v4MohWTZcj3sE+wR4Nmfjke5LjSLJ3mZsPHg6xwhyfSsLh6551RKYV3+jUM3g RruYERdvNLxxi+6d2Jr+bKk2mnbIiey/ea9lEWb+YsCQUJb6QrPZWxM+mOpFtTnvthIE uB3X25gIR54yEvGi8OOOtTt1ErCmZrmfG6o/XDwpflR0ubsE62qPLTzsBU1h+MZhH+tq wPOlne4qsxyWUmg+rwsvZ2L+tSHt2gvdccF+7nckyNKR7LcAS7GrvqqA5ZjiHMzczrYE EpOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=t7wTLhP/fkMnuY6/EfqISEodQam5oq1wjS1vYGEVP1s=; b=YRRpdBK/h1Zbgzn53pneUgGsAI0XrzFvbFyFEbhZyzFyoMeEgHrlim3ZwGQv546bCw GLxLfS2ojIK6lht87Y4Jcjw8fNFmwzAAGwQjbRcw56Kp+FUhIyL/0NLyxy0yQ3qdhE2R HlwP/6EWZqXXUrQLLLbxgi8Plaz925XdC8bm2zXGdhO7fggZeJRVCpbjfZJT9ua+xFZp T5VvM9nd+hPd/G7lSjdBT4tfn93AV3fkXHR5EizLkeyWR+9xvmPEtj0W/BsMm60hnFBJ WCjWgPEM3tLxdE7W3EOgILWV4z82CgMPpFwjlKVREGSCeK6/9h7zZLOAOTnNB8CWWKUI B6jw== X-Gm-Message-State: APt69E1/s9aYe7taK+TUvqbLHaNbDiGsab3O1GKfvKUU6XIjfXj1aMFI yIalzMRWEb2qG2+EdjzRn55CdjAD X-Received: by 2002:a2e:9187:: with SMTP id f7-v6mr14268095ljg.98.1529480089680; Wed, 20 Jun 2018 00:34:49 -0700 (PDT) Received: from localhost (87-57-30-174-static.dk.customer.tdc.net. [87.57.30.174]) by smtp.gmail.com with ESMTPSA id n19-v6sm272102lja.32.2018.06.20.00.34.48 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 20 Jun 2018 00:34:49 -0700 (PDT) From: Esben Haabendal To: Mark Brown , linux-spi@vger.kernel.org Cc: Kurt Kanzenbach , Angelo Dureghello , Nikita Yushchenko , Sanchayan Maity , Yuan Yao , linux-kernel@vger.kernel.org, Esben Haabendal , =?UTF-8?q?Martin=20Hundeb=C3=B8ll?= Subject: [PATCH 02/12] spi: spi-fsl-dspi: Drop unneeded use of dataflags bits Date: Wed, 20 Jun 2018 09:34:32 +0200 Message-Id: <20180620073442.20913-3-esben.haabendal@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180620073442.20913-1-esben.haabendal@gmail.com> References: <20180620073442.20913-1-esben.haabendal@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Esben Haabendal Checking directly against pointer value should be at least as fast as doing bitmasking and compare, so let's keep it simple. Signed-off-by: Esben Haabendal Cc: Martin Hundebøll --- drivers/spi/spi-fsl-dspi.c | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/drivers/spi/spi-fsl-dspi.c b/drivers/spi/spi-fsl-dspi.c index 3ca9b9608801..3bf135bf8b93 100644 --- a/drivers/spi/spi-fsl-dspi.c +++ b/drivers/spi/spi-fsl-dspi.c @@ -38,8 +38,6 @@ #define DRIVER_NAME "fsl-dspi" -#define TRAN_STATE_RX_VOID 0x01 -#define TRAN_STATE_TX_VOID 0x02 #define TRAN_STATE_WORD_ODD_NUM 0x04 #define DSPI_FIFO_SIZE 4 @@ -232,7 +230,7 @@ static void dspi_rx_dma_callback(void *arg) rx_word = is_double_byte_mode(dspi); - if (!(dspi->dataflags & TRAN_STATE_RX_VOID)) { + if (dspi->rx) { for (i = 0; i < dma->curr_xfer_len; i++) { d = dspi->dma->rx_dma_buf[i]; rx_word ? (*(u16 *)dspi->rx = d) : @@ -538,12 +536,13 @@ static u32 dspi_data_to_pushr(struct fsl_dspi *dspi, int tx_word) { u16 d16; - if (!(dspi->dataflags & TRAN_STATE_TX_VOID)) + if (dspi->tx) { d16 = tx_word ? *(u16 *)dspi->tx : *(u8 *)dspi->tx; - else + dspi->tx += tx_word + 1; + } else { d16 = dspi->void_write_data; + } - dspi->tx += tx_word + 1; dspi->len -= tx_word + 1; return SPI_PUSHR_TXDATA(d16) | @@ -560,10 +559,10 @@ static void dspi_data_from_popr(struct fsl_dspi *dspi, int rx_word) regmap_read(dspi->regmap, SPI_POPR, &val); d = SPI_POPR_RXDATA(val); - if (!(dspi->dataflags & TRAN_STATE_RX_VOID)) + if (dspi->rx) { rx_word ? (*(u16 *)dspi->rx = d) : (*(u8 *)dspi->rx = d); - - dspi->rx += rx_word + 1; + dspi->rx += rx_word + 1; + } } static int dspi_eoq_write(struct fsl_dspi *dspi) @@ -687,12 +686,6 @@ static int dspi_transfer_one_message(struct spi_master *master, dspi->rx_end = dspi->rx + transfer->len; dspi->len = transfer->len; - if (!dspi->rx) - dspi->dataflags |= TRAN_STATE_RX_VOID; - - if (!dspi->tx) - dspi->dataflags |= TRAN_STATE_TX_VOID; - regmap_write(dspi->regmap, SPI_MCR, dspi->cur_chip->mcr_val); regmap_update_bits(dspi->regmap, SPI_MCR, SPI_MCR_CLR_TXF | SPI_MCR_CLR_RXF, -- 2.17.1