Received: by 2002:ab2:b82:0:b0:1f3:401:3cfb with SMTP id 2csp706805lqh; Thu, 28 Mar 2024 13:53:11 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWQVleJKqEfOtz29P26JjIlebuONhDVVZazZ2noPFaR36++jTG6D9hHx8sOITSg1IKChafxJxsOe2+Ai2uY/VKmsq5LYncebR2FrAnyjQ== X-Google-Smtp-Source: AGHT+IGX12Cqxd6/Zkv8JdAp9QXCyAbuZD6sjFOmIeIEqjQabmy6EZ1tUlQDOw5iSSQtPdY8QpeL X-Received: by 2002:a05:620a:a4c:b0:78a:2900:418e with SMTP id j12-20020a05620a0a4c00b0078a2900418emr662522qka.60.1711659191374; Thu, 28 Mar 2024 13:53:11 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711659191; cv=pass; d=google.com; s=arc-20160816; b=gLQrb+AnF7zaFXM5yDIMbX10DbMfapcKklsVWyJgQAJeTaAOwQRvQEJvU9g/0MqiGd 6FibyP3Jqpr+FYRpbBVV0VApLlKkW+2Ts8nZ9qzCXy3ZM48AlxUySPnbjaX5/sCDwqMq QAJyQBoqQv+KN2P2l9gjX0j+1v76Qr55bEsV48hi5hQeI3RWAHLstoJnd7LK0u6JkHqX NXGtrDhsyypUO2S+8mA3hn7YMwQeVGABRXorP3WuLvP/19aYMeRgjVRw4hbp0Q1/5aqn 3pB9+t0qoXp3rI0m04g1CnR4cL0YAxQ2hUo7QSRkitoKwD6t0I1IyE78/8kqajcrprhD yHRw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=02QukKA7rGv689sMEnY5Waa2GxmfCRYMmefB+eiHwtw=; fh=kC892vDBQo6pWaPXebO1zSj3/HtjW3dJFuq4iFdVcL4=; b=YCgf2IxZbvsPG/AZzY7oro72DNjPQmKgoQD7qIWvBHzWRK9YMkAL5L3jk6nryKqogv 9R+fEz1d/1XPnu88s5RPC1tVo+cBh4KYlQzucfkmk+6SGOVS8YO1IAaeA+WRU4pOGqeV LI0MaX4hLdgcFESqv4eT3M8kTOeegAbIl7nu7uCg+o6rUicbYyPKPYqy2HnSUanouAxZ LRS+Qv3CgkEJkTCNVq/1CHZf1LuZ0SaWQ43smkbrnJeH5B8qOi/awgFNzxVfF0W2ZLLl WC6fTMdBDXzR/8rjRQ4E7zIF4oCbKhMiBikNrUkQ4sfL3hipgKKTSueoRjfiEgIBRTae PsGg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@baylibre-com.20230601.gappssmtp.com header.s=20230601 header.b=PaSNHWG5; arc=pass (i=1 spf=pass spfdomain=baylibre.com dkim=pass dkdomain=baylibre-com.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-123633-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-123633-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id v7-20020a05620a0a8700b0078a5d2360f3si2205326qkg.541.2024.03.28.13.53.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Mar 2024 13:53:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-123633-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@baylibre-com.20230601.gappssmtp.com header.s=20230601 header.b=PaSNHWG5; arc=pass (i=1 spf=pass spfdomain=baylibre.com dkim=pass dkdomain=baylibre-com.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-123633-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-123633-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 0F8CE1C30AFA for ; Thu, 28 Mar 2024 20:53:11 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CA8AB13AD06; Thu, 28 Mar 2024 20:52:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b="PaSNHWG5" Received: from mail-ot1-f41.google.com (mail-ot1-f41.google.com [209.85.210.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 65F9F81219 for ; Thu, 28 Mar 2024 20:52:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.41 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711659170; cv=none; b=hIfIME3TZNFf06mmvYbQLc8FaIaRCKzpbc82IVkLqZusmQtwb949O/hWjhaoL2MFi6cr17E5Em92sh6mqjlIG72P59gvhJ7ibAskTiwfmn7kzBcrf9ihKIjOKi8bXu3/f5qd7Nc+Lj69RS6f2PLFYfoc8slPF7avyo/FTXC+thQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711659170; c=relaxed/simple; bh=GeMYE1tfKAVoMVZLat41QykjcobP/pX5nbPP5nlFDmM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=oFWAvXcY98qtpsIvvTMSW7+cItOs+U3IEJvw6quwQbhhjZkBFW/iZ3nkqpPydx/Swbotl0qd+qYI65uSIKIY+EVX4zI3xYBSFLxF+q1HpbqhiXkzihoZQWV07cpiwEtYWPXH1O61QVGSzmiSXpXYmZX5BU2gnEH/5D/Nrmnvz1A= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com; spf=pass smtp.mailfrom=baylibre.com; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b=PaSNHWG5; arc=none smtp.client-ip=209.85.210.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=baylibre.com Received: by mail-ot1-f41.google.com with SMTP id 46e09a7af769-6e695b7391dso670213a34.1 for ; Thu, 28 Mar 2024 13:52:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1711659167; x=1712263967; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=02QukKA7rGv689sMEnY5Waa2GxmfCRYMmefB+eiHwtw=; b=PaSNHWG5HD6j+WPHD8wLgj5iRrFYweQ8S76xWWlZ9HpMEXUGlrGH1MGOv62UrKFVYW e+2gQOcAR7TxKun9CqicBWPPzFB8zSDYPdfl8N4ykmg1t31DUDLjfdhm6pXHXRDqR6nU SnDzxl9+t+dgyZHUCGlIIwbyVhPXxVkTKKEFDi3nxa28sBEsDHphnCsTTsQjEMtXHluF Q/BVX3Hlzl5Iuhml51uyFojHWZB5NTkmOxd06SsvSeMBGPPbTxcz9N0fgffpmXaFR5O7 IXec/hpknlPHjva+gmKYt5beOTKQ6x/LIuJll0KaM/jEpFYooxNB7tOFuLsaakZaHrNZ rJiA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711659167; x=1712263967; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=02QukKA7rGv689sMEnY5Waa2GxmfCRYMmefB+eiHwtw=; b=qynBmE9ai9/lSmvwk4gx6eFByoGRQcT36H4kevID8v+x8+I+c+XupB9/QwD+/XsX6f LZTMP7lNDUGXFq8YYcmIbKa3kxJ33RLbzg6c9l76XtzLcZfGbTuea+Y4zQglm5/saV6a loLiamHff9rc0gV2L8EIp2S4VqQX2udzVTAVOSfnzsL9GSyxfIM5BJuBaYTQBXKesYwN yT3RBxhE1zNCCuzdJl5HDBBRpX2dyRV0WjzeSkmUD8S3x6EyfIpFyQ9aR3C8VTd8oUtJ Tjq2A47E1xfGZx964GuDogpykmibR0+z01skU8Ukh9DCd6bN6ge/s0MGZCNV0X13O7gB 02XQ== X-Forwarded-Encrypted: i=1; AJvYcCVROVUzOD/JzValw0bUvoZBiyPh66je+L3XEHE639nFOgXLPO9u6a2QVwa1TefbjA5GwWVxwgqQnx+ZeUqFZ/znyL+3KPjq73n0lEAG X-Gm-Message-State: AOJu0YyglwWVbDiIrq/hO+K10Xf85y8GcpWOzv2G/P14Y2qagipmF6CB HI8tVMt5DXCRoM4c2B5wu2JeYCdOrDJsM9Eec/GPRJ/yHDOdW1zCK+eVwq+GrFlo6b3/fMUWmmw W X-Received: by 2002:a05:6870:96a4:b0:229:f2a0:5f4d with SMTP id o36-20020a05687096a400b00229f2a05f4dmr378247oaq.1.1711659167493; Thu, 28 Mar 2024 13:52:47 -0700 (PDT) Received: from freyr.lechnology.com (ip98-183-112-25.ok.ok.cox.net. [98.183.112.25]) by smtp.gmail.com with ESMTPSA id g16-20020a9d6c50000000b006e7011fea78sm293335otq.41.2024.03.28.13.52.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Mar 2024 13:52:46 -0700 (PDT) From: David Lechner To: Mark Brown Cc: David Lechner , linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/2] spi: au1550: t->{tx,rx}_dma checks Date: Thu, 28 Mar 2024 15:51:45 -0500 Message-ID: <20240328-spi-more-tx-rx-buf-cleanup-v1-1-9ec1ceedf08c@baylibre.com> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240328-spi-more-tx-rx-buf-cleanup-v1-0-9ec1ceedf08c@baylibre.com> References: <20240328-spi-more-tx-rx-buf-cleanup-v1-0-9ec1ceedf08c@baylibre.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" X-Mailer: b4 0.12.4 Content-Transfer-Encoding: 8bit There are no more peripheral drivers that set t->tx_dma or t->rx_dma so these will always == 0. Therefore, we can remove these checks since they are always true. Signed-off-by: David Lechner --- drivers/spi/spi-au1550.c | 29 ++++++++++------------------- 1 file changed, 10 insertions(+), 19 deletions(-) diff --git a/drivers/spi/spi-au1550.c b/drivers/spi/spi-au1550.c index 825d2f1cdff8..16f200bb3d17 100644 --- a/drivers/spi/spi-au1550.c +++ b/drivers/spi/spi-au1550.c @@ -314,11 +314,8 @@ static int au1550_spi_dma_txrxb(struct spi_device *spi, struct spi_transfer *t) hw->tx = t->tx_buf; hw->rx = t->rx_buf; - dma_tx_addr = t->tx_dma; - dma_rx_addr = t->rx_dma; /* - * check if buffers are already dma mapped, map them otherwise: * - first map the TX buffer, so cache data gets written to memory * - then map the RX buffer, so that cache entries (with * soon-to-be-stale data) get removed @@ -326,23 +323,17 @@ static int au1550_spi_dma_txrxb(struct spi_device *spi, struct spi_transfer *t) * use temp rx buffer (preallocated or realloc to fit) for rx dma */ if (t->tx_buf) { - if (t->tx_dma == 0) { /* if DMA_ADDR_INVALID, map it */ - dma_tx_addr = dma_map_single(hw->dev, - (void *)t->tx_buf, - t->len, DMA_TO_DEVICE); - if (dma_mapping_error(hw->dev, dma_tx_addr)) - dev_err(hw->dev, "tx dma map error\n"); - } + dma_tx_addr = dma_map_single(hw->dev, (void *)t->tx_buf, + t->len, DMA_TO_DEVICE); + if (dma_mapping_error(hw->dev, dma_tx_addr)) + dev_err(hw->dev, "tx dma map error\n"); } if (t->rx_buf) { - if (t->rx_dma == 0) { /* if DMA_ADDR_INVALID, map it */ - dma_rx_addr = dma_map_single(hw->dev, - (void *)t->rx_buf, - t->len, DMA_FROM_DEVICE); - if (dma_mapping_error(hw->dev, dma_rx_addr)) - dev_err(hw->dev, "rx dma map error\n"); - } + dma_rx_addr = dma_map_single(hw->dev, (void *)t->rx_buf, + t->len, DMA_FROM_DEVICE); + if (dma_mapping_error(hw->dev, dma_rx_addr)) + dev_err(hw->dev, "rx dma map error\n"); } else { if (t->len > hw->dma_rx_tmpbuf_size) { int ret; @@ -398,10 +389,10 @@ static int au1550_spi_dma_txrxb(struct spi_device *spi, struct spi_transfer *t) DMA_FROM_DEVICE); } /* unmap buffers if mapped above */ - if (t->rx_buf && t->rx_dma == 0) + if (t->rx_buf) dma_unmap_single(hw->dev, dma_rx_addr, t->len, DMA_FROM_DEVICE); - if (t->tx_buf && t->tx_dma == 0) + if (t->tx_buf) dma_unmap_single(hw->dev, dma_tx_addr, t->len, DMA_TO_DEVICE); -- 2.43.2