From nobody Thu Apr 9 19:00:49 2026 Received: from mail-wm1-f48.google.com (mail-wm1-f48.google.com [209.85.128.48]) (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 168C13644C5 for ; Fri, 6 Mar 2026 12:41:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772800907; cv=none; b=Q+w+B8TfSF4wqnT1CMyG+U6xg5u+p4u6mSh9Res9y40zFfUjZUxuwc21NR/Olvs+J9thvih1tTs4yC8FfNY91bH1d8KDfOrdnrFawbqu6Ay7ZEOdnc2XXgymnyDnOaEd9Yf5CZF3FEjk5C0KvdKp4NvjWFx9n26Iyv+xpIy+qkA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772800907; c=relaxed/simple; bh=1BaQ5eOGmq5cxUJDWe8gk0vsUkz4EwiNSGLh3VMzngE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=rh2Pbgw4c88zU1A1a5PsJdVQfbEaYqlL63Kry1GYTx1ah3RSIPhUJ01u6bL24syUAVg3eLeJkifpsO8WWl4ofTO/5qFfQvL9EaWhH+4byZV6ffUdGaMGSlbpZDc2XZzcbMODEDYJV44mOhVmT7bGdt4jNRwExYuZBjDG142yiL8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=tuxon.dev; spf=pass smtp.mailfrom=tuxon.dev; dkim=pass (2048-bit key) header.d=tuxon.dev header.i=@tuxon.dev header.b=ntIAK4q7; arc=none smtp.client-ip=209.85.128.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=tuxon.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=tuxon.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=tuxon.dev header.i=@tuxon.dev header.b="ntIAK4q7" Received: by mail-wm1-f48.google.com with SMTP id 5b1f17b1804b1-48375f10628so60976925e9.1 for ; Fri, 06 Mar 2026 04:41:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tuxon.dev; s=google; t=1772800904; x=1773405704; 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=GmNjUk7kVZWIP4LPt/EwE/P4I5p8ejRGJw2udSg4T6w=; b=ntIAK4q7nvcmULy9GXsHRaTDuW1bApJS7IvPGxskFo7Uv4lm7h8kHBrdYxwHSK1Yz6 +j4om18I6EwulezJehAbPlWD0lBdfVVDfguUTTd1Q6tf6AFd+m2yVe5y14yONS0Y3EfO vXNbbb9ygguyHN/zWV7tV0ogJeKMPR+hpPKSWC/b9Yg0tQt2rD4TWfAgngj1Hq/qcAfl g1JT9ibQQ1WNdEoab9y9sPH0nrUcEDZYKL2IkBY+cqH+uyaOkl/mNDFHK+5L6N+wl+Ss CVJf+/KThSudQJCr7vy/qaqGofzNV7w9GQhr6O7eyk7Rxz7+O7XnsV4aI/5S6KaV6X2F GUoQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1772800904; x=1773405704; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=GmNjUk7kVZWIP4LPt/EwE/P4I5p8ejRGJw2udSg4T6w=; b=SPKUH3lZVoCe7EIHlzWQBCMFxeVuqzOUDNi4sPy+475CQio3fipssCV6AIfmD6ESI5 NZ3JhF8/BKyBjS8Spoy0Kfqg8sYtQ4obaruhE8+SO2/sgdK7X7OZPWr615XFGHzit5OI kyVst7yaSVFc8MiBpGuHAc3TE9rcLhjFo2k7B1oQgacg4jy1qBZ0NrW2j6p4JWnoVLty miah/oD7kumHHb3S9ok/8j/BqCC7fVoFiRWCCVw5gc2ipA2DZcLH6fOoFpEpfUWPdsjP 1187PJ7zwq3YgNQkrEPU5AK75aV0AUjsfsCmNU3QcrMXF5TyE64iZkzRhbURcvZRYA/3 TjNQ== X-Forwarded-Encrypted: i=1; AJvYcCVJllEO6ZCgIGY7A26Jnc8Dvv8qtosHp0dwVOm+fj+0GDwF9pqznV/GLo01JOFe0D6lC/p6AJUi4ubbEa0=@vger.kernel.org X-Gm-Message-State: AOJu0YzkOelNvjrNRyj0tTVHU7f/Wn7EVCLxYFHMbv40UVjGCIojgaZ0 1E4ScGGECAX0QZB5RtNL583KG83HTJG4fFQ60uUFQt3mLvJotXQtcG50+ljVcestuHY= X-Gm-Gg: ATEYQzx+QClrYve5C6Ga0gh3/13nQRIKrXWZRv0e8TBJzEo/abS3mwiWO5HaAFb8VcZ oiDvbwBp+6c69CLgC5vCst9lgiBFS77LBMf15jTg3nKVIWTRk2dmDmBVhlQDTB/HlLgzPAY15rY YhrP/EYa9joqsn9oyKr23bf6i+/pJA5MoMbrHHYavj09Wq2OcSOv7IHhtN1PLmNC2455k46u6hF Ipwxy93TIkE0j0ZqTjrYS2SdWo+Vd0OS6FoRtx4MkPYGv9SK4XwjEfuzLYJub09iR/NiajiwWrT rebr5aL9lBq9ajREjbL/PjPzzO7Oy8mG/gYXIO1ELieOogXE1JUnmZeo7cnRp1iLZKG1MuvYfHU BLqrS8y6fnJtghmxJJXayOJ2kWs4/P6ZMw305xXjDWSBuhe9JDDOWZgeelRZL+/vdLph4JgNJmM +rliDJ+ojUNEDGifeD59owzuBV7395oQkwL0/Edk6F49J7WyLQKG5D X-Received: by 2002:a05:600c:6085:b0:479:2f95:5179 with SMTP id 5b1f17b1804b1-4852692fec0mr32246445e9.15.1772800904402; Fri, 06 Mar 2026 04:41:44 -0800 (PST) Received: from claudiu-X670E-Pro-RS.. ([82.78.167.134]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-485276b0c38sm38150505e9.9.2026.03.06.04.41.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Mar 2026 04:41:43 -0800 (PST) From: Claudiu X-Google-Original-From: Claudiu To: vkoul@kernel.org, Frank.Li@kernel.org, biju.das.jz@bp.renesas.com, geert+renesas@glider.be, fabrizio.castro.jz@renesas.com, prabhakar.mahadev-lad.rj@bp.renesas.com Cc: claudiu.beznea@tuxon.dev, dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org, Frank Li , Claudiu Beznea Subject: [PATCH v9 6/8] dmaengine: sh: rz-dmac: Add rz_dmac_invalidate_lmdesc() Date: Fri, 6 Mar 2026 14:41:31 +0200 Message-ID: <20260306124133.2304687-7-claudiu.beznea.uj@bp.renesas.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260306124133.2304687-1-claudiu.beznea.uj@bp.renesas.com> References: <20260306124133.2304687-1-claudiu.beznea.uj@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Biju Das Add rz_dmac_invalidate_lmdesc() so that the same code can be shared between rz_dmac_terminate_all() and rz_dmac_free_chan_resources(). Based on a patch in the BSP by Long Luu . Signed-off-by: Biju Das Reviewed-by: Frank Li [claudiu.beznea: adjusted the commit description; defined the lmdesc inside the for block to have more compact code] Signed-off-by: Claudiu Beznea --- Changes in v9: - collected tags Changes in v8: - none Changes in v7: - none Changes in v6: - none Changes in v5: - adjusted the commit description - defined the lmdesc inside the for block drivers/dma/sh/rz-dmac.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/drivers/dma/sh/rz-dmac.c b/drivers/dma/sh/rz-dmac.c index 9c159c53e3ee..274c9cd40713 100644 --- a/drivers/dma/sh/rz-dmac.c +++ b/drivers/dma/sh/rz-dmac.c @@ -249,6 +249,13 @@ static void rz_lmdesc_setup(struct rz_dmac_chan *chann= el, * Descriptors preparation */ =20 +static void rz_dmac_invalidate_lmdesc(struct rz_dmac_chan *channel) +{ + for (struct rz_lmdesc *lmdesc =3D channel->lmdesc.base; + lmdesc < channel->lmdesc.base + DMAC_NR_LMDESC; lmdesc++) + lmdesc->header =3D 0; +} + static void rz_dmac_lmdesc_recycle(struct rz_dmac_chan *channel) { struct rz_lmdesc *lmdesc =3D channel->lmdesc.head; @@ -455,15 +462,12 @@ static void rz_dmac_free_chan_resources(struct dma_ch= an *chan) { struct rz_dmac_chan *channel =3D to_rz_dmac_chan(chan); struct rz_dmac *dmac =3D to_rz_dmac(chan->device); - struct rz_lmdesc *lmdesc =3D channel->lmdesc.base; struct rz_dmac_desc *desc, *_desc; unsigned long flags; - unsigned int i; =20 spin_lock_irqsave(&channel->vc.lock, flags); =20 - for (i =3D 0; i < DMAC_NR_LMDESC; i++) - lmdesc[i].header =3D 0; + rz_dmac_invalidate_lmdesc(channel); =20 rz_dmac_disable_hw(channel); list_splice_tail_init(&channel->ld_active, &channel->ld_free); @@ -555,15 +559,12 @@ rz_dmac_prep_slave_sg(struct dma_chan *chan, struct s= catterlist *sgl, static int rz_dmac_terminate_all(struct dma_chan *chan) { struct rz_dmac_chan *channel =3D to_rz_dmac_chan(chan); - struct rz_lmdesc *lmdesc =3D channel->lmdesc.base; unsigned long flags; - unsigned int i; LIST_HEAD(head); =20 spin_lock_irqsave(&channel->vc.lock, flags); rz_dmac_disable_hw(channel); - for (i =3D 0; i < DMAC_NR_LMDESC; i++) - lmdesc[i].header =3D 0; + rz_dmac_invalidate_lmdesc(channel); =20 list_splice_tail_init(&channel->ld_active, &channel->ld_free); list_splice_tail_init(&channel->ld_queue, &channel->ld_free); --=20 2.43.0