From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796028925; b=qb6YOE6PWtRMJtwaz7DYn/E50gzdP6HQoysog70L5F6smWkct8tNSibCWIgmjuBfL/3g O1nJ0gQdIkqQCmhkZ0k6nNxTU9+/IoI+UmesHWOW39jfHJmfcsboSpFp6yim1HvtYk/Zw LuSPjqelk+5LkF56SXE3+dX8+XtkmHyvZGSotpuW/nfB5/VjO5eGTa2JI8YUnPESY/Z9x 7bTViFIrkOfvgHc/XkznaNPgtuLP+305IXOAIaZ3jNXq7IN6DjBkIyC0ibotMNInSfvHh LEK8HVLp+z8zCQ4pl0dSUhSwR6yMyHUXaO8XZlGf0FTPEglWIgXXoEI40ZzQWzU758w== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796028925; h=Received:DKIM-Signature:From:Date:Subject:MIME-Version:Content-Type: Content-Transfer-Encoding:Message-Id:References:In-Reply-To:To:Cc: X-Mailer; bh=UrTpw0y1ZcFjO3qdXPCypsCSMYt32uatJb5od5lxQLg=; b=ItawIIw9xKGb8FquBmIYzyJxF80fqLXSQmBiBzZCgpgDYHEq/K5HoFM0BiHonB23aUFd 82bz87bgp5NtUSJJpvfr9NTZzuSRJEWi+NISe75gFRKiH5vQogDaaqoZEUZM2D6WrpBhK MJdrexSr08+ooJkkDPK51T8TFjFZk/ug5NzqtmgJwZwZcHCFLHT99L+6ANuh+pMLwMV3A vSiPHuV1UYfJzHJ4z5uRv1KZanqW43cOEVG6rKJhcR92nJydGG7F5+ZXG0X/lZ3zhJbM3 ohI3uuU65/bcXfRbVm/7+K8HKsqWRgMparHviWB/XmK0GvcjVLv55j8ueDo3c+blK0A== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=YSCe0KRD; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A4503606A33B; Mon, 30 Nov 2026 08:55:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=YSCe0KRD Received: by smtp.kernel.org (Postfix) with ESMTPSA id A8E881F0089B; Mon, 30 Nov 2026 08:55:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796028925; bh=UrTpw0y1ZcFjO3qdXPCypsCSMYt32uatJb5od5lxQLg=; h=From:Date:Subject:References:In-Reply-To:To:Cc; b=YSCe0KRDpBduldmXgd/PRlexm+mujvAYYcXu4RgAtSJYQvWBVAUISXcbSqveY+xxR h4/4z7o3RH/roRHE7xXHh6IwhEBZn82lSZ3Gve6AgXLWWevZZlODKNz1hFBN68bWfY MAQeNp6K8zQVJxqW6nac+g6TRQCOGqjV7fhZ2RG0ByrtOxM4Cc42Eptt/Uo1yAFFZS V/iCnrMvwgyNRJR4YzTObNYFE1fMAY4NRX4s35BB9oAE+iWBFbtOSN1zd7A3KAVC26 cMhMK4YDRbopfDtlv6FfECD1mLLITxlzYW3TCcSXey5FZDRYi1peNKMEX4BnTWdPbj kFD7p6Yc18xuA== From: Lorenzo Pieralisi Date: Mon, 30 Nov 2026 09:54:36 +0100 Subject: [PATCH RFC v2 4/9] clocksource/drivers/arm_arch_timer_mmio: Dispose IRQ mappings on probe failure X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20261130-acpi-static-table-irq-probe-defer-v2-4-7e854fe7aecd@kernel.org> References: <20261130-acpi-static-table-irq-probe-defer-v2-0-7e854fe7aecd@kernel.org> In-Reply-To: <20261130-acpi-static-table-irq-probe-defer-v2-0-7e854fe7aecd@kernel.org> To: "Rafael J. Wysocki" , Mark Rutland , Marc Zyngier , Daniel Lezcano , Thomas Gleixner , Greg Kroah-Hartman , Danilo Krummrich , Hanjun Guo , Sudeep Holla , Robin Murphy , Catalin Marinas , Will Deacon , Bartosz Golaszewski , Andy Shevchenko , Leo Yan Cc: linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, driver-core@lists.linux.dev, Lorenzo Pieralisi X-Mailer: b4 0.15.2 On probe failure the driver does not dispose the IRQ mappings that were carried out before the probe function hit an error condition. Add code to dispose the IRQ mappings on driver probe failure. Signed-off-by: Lorenzo Pieralisi --- Cc: Mark Rutland Cc: Marc Zyngier --- drivers/clocksource/arm_arch_timer_mmio.c | 45 ++++++++++++++++++++++++++----- 1 file changed, 38 insertions(+), 7 deletions(-) diff --git a/drivers/clocksource/arm_arch_timer_mmio.c b/drivers/clocksource/arm_arch_timer_mmio.c index d678f764d3bb..825f236d0c52 100644 --- a/drivers/clocksource/arm_arch_timer_mmio.c +++ b/drivers/clocksource/arm_arch_timer_mmio.c @@ -191,6 +191,33 @@ static irqreturn_t arch_timer_mmio_handler(int irq, void *dev_id) return IRQ_NONE; } +static void arch_timer_mmio_unmap_irq(int *irq) +{ + if (!(*irq)) + return; + + irq_dispose_mapping(*irq); + *irq = 0; +} + +static void arch_timer_mmio_unmap_frame_irqs(struct arch_timer_mem_frame *frame) +{ + arch_timer_mmio_unmap_irq(&frame->phys_irq); + arch_timer_mmio_unmap_irq(&frame->virt_irq); +} + +static void arch_timer_mmio_unmap_irqs(struct arch_timer_mem *gt_block) +{ + for (unsigned int i = 0; i < ARCH_TIMER_MEM_MAX_FRAMES; i++) { + struct arch_timer_mem_frame *frame = >_block->frame[i]; + + if (!frame->valid) + continue; + + arch_timer_mmio_unmap_frame_irqs(frame); + } +} + static struct arch_timer_mem_frame *find_best_frame(struct platform_device *pdev) { struct arch_timer_mem_frame *frame, *best_frame = NULL; @@ -398,6 +425,7 @@ static int arch_timer_mmio_probe(struct platform_device *pdev) frame = find_best_frame(pdev); if (!frame) { + arch_timer_mmio_unmap_irqs(at->gt_block); dev_err(&pdev->dev, "Unable to find a suitable frame in timer @ %pa\n", &at->gt_block->cntctlbase); @@ -405,14 +433,17 @@ static int arch_timer_mmio_probe(struct platform_device *pdev) } ret = arch_timer_mmio_frame_register(pdev, frame); - if (!ret) - dev_info(&pdev->dev, - "mmio timer running at %lu.%02luMHz (%s)\n", - (unsigned long)at->rate / 1000000, - (unsigned long)(at->rate / 10000) % 100, - at->access == VIRT_ACCESS ? "virt" : "phys"); + if (ret) { + arch_timer_mmio_unmap_irqs(at->gt_block); + return ret; + } - return ret; + dev_info(&pdev->dev, "mmio timer running at %lu.%02luMHz (%s)\n", + (unsigned long)at->rate / 1000000, + (unsigned long)(at->rate / 10000) % 100, + at->access == VIRT_ACCESS ? "virt" : "phys"); + + return 0; } static const struct of_device_id arch_timer_mmio_of_table[] = { -- 2.53.0