From nobody Fri Oct 10 04:03:50 2025 Received: from fout-a8-smtp.messagingengine.com (fout-a8-smtp.messagingengine.com [103.168.172.151]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 34304289E38; Mon, 16 Jun 2025 18:58:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.151 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750100317; cv=none; b=fK/dUFmuH+k1FDlyRbUj3ba6nPusjtWSUdGjejf1XDfMB2LNtgOMFscwStnleJL3yb8Bwl/KAlWc4HSVOb9n8llgMiTqvjhzY6gDUkz/C9t2e2l1cYiS261AXmzt3CUZLZKQcwPXGZlNRsIDO0kKGhF8UKnva9xDCZtVodox55U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750100317; c=relaxed/simple; bh=fp7k0Eu4zr5HIsAn2D7maSlX3jOFNWn4nN+HaopU02k=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Rvmvdu5LqGC3oJVT4C19ihJwLMuvW60K51+Vlea+0EZcSRLWirWp7neNvFbPdOn7c99CsYgBYqIk3/8R6GjxFzWFUqIE+kSUwPV9qKwqjanP+44Ibw5SZjrIgbja+Yjwkj92oikbcd/iT+tv9UcUQscMz8jcMFskRV2jzZu5Vhk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ragnatech.se; spf=pass smtp.mailfrom=ragnatech.se; dkim=pass (2048-bit key) header.d=ragnatech.se header.i=@ragnatech.se header.b=faDYVJOI; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=U/CBU7IW; arc=none smtp.client-ip=103.168.172.151 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ragnatech.se Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ragnatech.se Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ragnatech.se header.i=@ragnatech.se header.b="faDYVJOI"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="U/CBU7IW" Received: from phl-compute-02.internal (phl-compute-02.phl.internal [10.202.2.42]) by mailfout.phl.internal (Postfix) with ESMTP id 4F9861380109; Mon, 16 Jun 2025 14:58:33 -0400 (EDT) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-02.internal (MEProxy); Mon, 16 Jun 2025 14:58:33 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ragnatech.se; h= cc:cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm3; t=1750100313; x=1750186713; bh=xNoR0XdSng3gARyJWZQvehUw6CyacJ/aimazB5nzGzQ=; b= faDYVJOI6LZbdWJSE5IW71Co+SpTZ6iP6MbAhxmWkI//Yfk3l8QeE5QsPgk8rwaC /7AKTn/1Cea1PM344iJ62Js2krHVJ/YJxwJKSkUpGpq0MRVFl58GN6EsKjiN8SBM eer/4fGoFxbxWsPYSvIOkehGq3X6o+dq5MPhScMfo7rmWar1wZH/ay+jYkXaOztQ 9cqZG2fdWxcG+hBW/8bj7o5NIglj6pA7EG73tR+4F+M+WWcPScVBaQsTl0jCyq7a VNDDkYJYi6pOpfgNCw8J3Try97aH2OaK55dpA9+G7XF/JKDuB/45q0SCG3xEEFg+ LOnwHAOisG2Wd8xSHQLNwg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1750100313; x= 1750186713; bh=xNoR0XdSng3gARyJWZQvehUw6CyacJ/aimazB5nzGzQ=; b=U /CBU7IW/tlmUP+EfowmCclSfZEtiO1vkc9KDu4ZAZgogNW1RfLa9AmYcm8/+hDTp B9OnaA0X1RRhWXik39vjI72/hwXNq1b4ZRh1BId/Lo2xbpjStjvH2NJMgv100QbM +3aqjHxYdqx5gyeJyxh3QUzJw20CRmgTvEiX7j3rQplgq0WaH/lTsnkS15SBhyDo j8RjsGFJe7JUE4BvzvCm+nZ+CVro1y0ORbI+DHyRl4hloia8l8wT/H4Q1/Nv42w+ JyCIyVN6sN9llPSFK4VM3+44hE1D1vpQG/Es/+6anLmoZbmrnlXTN0xUs9A5SA7k vAdTZkS5sWxH0qKBwNULQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtddugddvjeefiecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdp uffrtefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivg hnthhsucdlqddutddtmdenucfjughrpefhvfevufffkffojghfgggtgfesthekredtredt jeenucfhrhhomheppfhikhhlrghsucfunpguvghrlhhunhguuceonhhikhhlrghsrdhsoh guvghrlhhunhguodhrvghnvghsrghssehrrghgnhgrthgvtghhrdhsvgeqnecuggftrfgr thhtvghrnhepheeigfeuveeutdefhfehgeekvedtleeuueekveefudehhffhjeffgfegff elfeegnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhep nhhikhhlrghsrdhsohguvghrlhhunhgusehrrghgnhgrthgvtghhrdhsvgdpnhgspghrtg hpthhtohepledpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtohepmhgthhgvhhgrsges khgvrhhnvghlrdhorhhgpdhrtghpthhtohepghgvvghrthdorhgvnhgvshgrshesghhlih guvghrrdgsvgdprhgtphhtthhopehsrghkrghrihdrrghilhhusheslhhinhhugidrihhn thgvlhdrtghomhdprhgtphhtthhopehlrghurhgvnhhtrdhpihhntghhrghrthesihguvg grshhonhgsohgrrhgurdgtohhmpdhrtghpthhtoheplhhinhhugidqmhgvughirgesvhhg vghrrdhkvghrnhgvlhdrohhrghdprhgtphhtthhopehlihhnuhigqdhrvghnvghsrghsqd hsohgtsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtoheplhhinhhugidqkhgv rhhnvghlsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtohepnhhikhhlrghsrd hsohguvghrlhhunhguodhrvghnvghsrghssehrrghgnhgrthgvtghhrdhsvgdprhgtphht thhopehlrghurhgvnhhtrdhpihhntghhrghrthdorhgvnhgvshgrshesihguvggrshhonh gsohgrrhgurdgtohhm X-ME-Proxy: Feedback-ID: i80c9496c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 16 Jun 2025 14:58:32 -0400 (EDT) From: =?UTF-8?q?Niklas=20S=C3=B6derlund?= To: Mauro Carvalho Chehab , Geert Uytterhoeven , Sakari Ailus , Laurent Pinchart , linux-media@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org Cc: =?UTF-8?q?Niklas=20S=C3=B6derlund?= , Laurent Pinchart Subject: [PATCH v2 1/3] media: rcar-vin: Fold interrupt helpers into only callers Date: Mon, 16 Jun 2025 20:57:20 +0200 Message-ID: <20250616185722.980722-2-niklas.soderlund+renesas@ragnatech.se> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250616185722.980722-1-niklas.soderlund+renesas@ragnatech.se> References: <20250616185722.980722-1-niklas.soderlund+renesas@ragnatech.se> 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" Content-Transfer-Encoding: quoted-printable The call sites using the interrupt helper functions have all been reworked to only one for each. Fold each of them into the only call sites left. This fixes a possible interrupt loss in case an interrupt occurs between reading VNINTS_REG in rvin_get_interrupt_status() and reading it again in rvin_ack_interrupt(). While at it rename the variable holding the current interrupt status to make the code easier to read. Signed-off-by: Niklas S=C3=B6derlund Reviewed-by: Laurent Pinchart --- * Changes since v1 - Extend commit message per Laurent's suggestion to indicate the possible fix of interrupt loss. - Fix spelling of each. --- .../platform/renesas/rcar-vin/rcar-dma.c | 27 +++++-------------- 1 file changed, 6 insertions(+), 21 deletions(-) diff --git a/drivers/media/platform/renesas/rcar-vin/rcar-dma.c b/drivers/m= edia/platform/renesas/rcar-vin/rcar-dma.c index d4faa5a4e757..e1dae46b06d4 100644 --- a/drivers/media/platform/renesas/rcar-vin/rcar-dma.c +++ b/drivers/media/platform/renesas/rcar-vin/rcar-dma.c @@ -903,21 +903,6 @@ static int rvin_setup(struct rvin_dev *vin) return 0; } =20 -static void rvin_disable_interrupts(struct rvin_dev *vin) -{ - rvin_write(vin, 0, VNIE_REG); -} - -static u32 rvin_get_interrupt_status(struct rvin_dev *vin) -{ - return rvin_read(vin, VNINTS_REG); -} - -static void rvin_ack_interrupt(struct rvin_dev *vin) -{ - rvin_write(vin, rvin_read(vin, VNINTS_REG), VNINTS_REG); -} - static bool rvin_capture_active(struct rvin_dev *vin) { return rvin_read(vin, VNMS_REG) & VNMS_CA; @@ -1040,22 +1025,22 @@ static void rvin_capture_stop(struct rvin_dev *vin) static irqreturn_t rvin_irq(int irq, void *data) { struct rvin_dev *vin =3D data; - u32 int_status, vnms; + u32 status, vnms; int slot; unsigned int handled =3D 0; unsigned long flags; =20 spin_lock_irqsave(&vin->qlock, flags); =20 - int_status =3D rvin_get_interrupt_status(vin); - if (!int_status) + status =3D rvin_read(vin, VNINTS_REG); + if (!status) goto done; =20 - rvin_ack_interrupt(vin); + rvin_write(vin, status, VNINTS_REG); handled =3D 1; =20 /* Nothing to do if nothing was captured. */ - if (!(int_status & VNINTS_FIS)) + if (!(status & VNINTS_FIS)) goto done; =20 /* Nothing to do if not running. */ @@ -1400,7 +1385,7 @@ void rvin_stop_streaming(struct rvin_dev *vin) rvin_set_stream(vin, 0); =20 /* disable interrupts */ - rvin_disable_interrupts(vin); + rvin_write(vin, 0, VNIE_REG); =20 /* Return unprocessed buffers from hardware. */ for (unsigned int i =3D 0; i < HW_BUFFER_NUM; i++) { --=20 2.49.0