From patchwork Mon Jul 15 10:51:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marek_Beh=C3=BAn?= X-Patchwork-Id: 13733318 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 819ABC3DA59 for ; Mon, 15 Jul 2024 10:55:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc: To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=QofF0zz0LDUUxpkpyoaFGCeAmvT0I2BEWIwFVTBb6UQ=; b=e2pdnD8MT4X/a185w027cd7MbD ZP+xy+yUdczbPhevRVguVpNg5wRPhuZHmBwFC9GBJqnhVK7F0wlKnOh/VFS+ZRjD02WLdiBUdaUDE bKtfhA2OQ2DRIrnlIcnRIOW7/HTaxp/SHCkaePAe6daacZqfZi8LPqibBpZ+PtXpv/9udsFHBKbdc 9YHc7ghDtwZ9RS0YJcUGERy1d1bfHLmpHLw072HBNNKbe3OG3JxGK2K8N32I+F6aDnoK66s4Z9edE pNXy5FMW5VVQEBqwZNCWhZEdsQfcy1cZj7bgSd2wYnraJaxWnKDd5n0wuuuyipGqkOjWAdMnuoYJt eOILz6dA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sTJM7-00000006mB0-1xPU; Mon, 15 Jul 2024 10:54:55 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sTJJk-00000006lRW-1t4m for linux-arm-kernel@lists.infradead.org; Mon, 15 Jul 2024 10:52:29 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id C199D60EBB; Mon, 15 Jul 2024 10:52:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 511F8C4AF0E; Mon, 15 Jul 2024 10:52:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1721040747; bh=VYQRkozTTwq0Fzfg652NVv12AcjgIvyvsKeTMS7aBA0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VfZDUHB4NrItWgyzeV8FrTuN8arI83JkIrvZp/ZGsQwRERGFKRUbCWHixxZYbIRC6 RdYZmZqhE8ejThGEGoyAuBtkd50G9NHEs41o1owOrUY6TE+uKqsJk7mJpgxy9k+RVA XgAUUekS7sHS3UFVD2KAcmNRPLVESZ1QEH57apn6N+FV+3SL2iXhykiSTE6Vuq2kLD nKF8cNLJjO5yAoquc6SCMPnwSRgzwR5NVwSAfe0clLZpD843ahUcOdMI9zMimyTV7g qC11hSFu0x4E4RGwWHFb8eTylIeYjw6VTuhV+hq16KccgQAi+OZyhGAfPU6KP/rIQE gkWI0v8Xj7ISQ== From: =?utf-8?q?Marek_Beh=C3=BAn?= To: Andrew Lunn , Gregory Clement , Sebastian Hesselbarth , Thomas Gleixner , linux-arm-kernel@lists.infradead.org, arm@kernel.org, Andy Shevchenko , Hans de Goede , =?utf-8?q?Ilpo_J=C3=A4rvinen?= Cc: =?utf-8?q?Marek_Beh=C3=BAn?= Subject: [PATCH 09/13] irqchip/armada-370-xp: Dynamically allocate the driver private structure Date: Mon, 15 Jul 2024 12:51:52 +0200 Message-ID: <20240715105156.18388-10-kabel@kernel.org> X-Mailer: git-send-email 2.44.2 In-Reply-To: <20240715105156.18388-1-kabel@kernel.org> References: <20240715105156.18388-1-kabel@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240715_035228_560140_FFE66388 X-CRM114-Status: GOOD ( 14.10 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Dynamically allocate the driver private structure. This concludes the conversion of this driver to modern style. Signed-off-by: Marek BehĂșn --- drivers/irqchip/irq-armada-370-xp.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/drivers/irqchip/irq-armada-370-xp.c b/drivers/irqchip/irq-armada-370-xp.c index 08d251ad72fd..e8daa967e5fc 100644 --- a/drivers/irqchip/irq-armada-370-xp.c +++ b/drivers/irqchip/irq-armada-370-xp.c @@ -180,7 +180,7 @@ struct mpic { u32 doorbell_mask; }; -static struct mpic mpic_data; +static struct mpic *mpic_data __ro_after_init; static inline bool mpic_is_ipi_available(struct mpic *mpic) { @@ -576,7 +576,7 @@ static int mpic_starting_cpu(unsigned int cpu) static int mpic_cascaded_starting_cpu(unsigned int cpu) { - struct mpic *mpic = &mpic_data; + struct mpic *mpic = mpic_data; mpic_perf_init(mpic); mpic_reenable_percpu(mpic); @@ -731,7 +731,7 @@ static void __exception_irq_entry mpic_handle_irq(struct pt_regs *regs) static int mpic_suspend(void) { - struct mpic *mpic = &mpic_data; + struct mpic *mpic = mpic_data; mpic->doorbell_mask = readl(mpic->per_cpu + MPIC_IN_DRBEL_MASK); @@ -740,7 +740,7 @@ static int mpic_suspend(void) static void mpic_resume(void) { - struct mpic *mpic = &mpic_data; + struct mpic *mpic = mpic_data; bool src0, src1; /* Re-enable interrupts */ @@ -833,11 +833,17 @@ static int __init mpic_map_region(struct device_node *np, int index, static int __init mpic_of_init(struct device_node *node, struct device_node *parent) { - struct mpic *mpic = &mpic_data; phys_addr_t phys_base; unsigned int nr_irqs; + struct mpic *mpic; int err; + mpic = kzalloc(sizeof(*mpic), GFP_KERNEL); + if (WARN_ON(!mpic)) + return -ENOMEM; + + mpic_data = mpic; + err = mpic_map_region(node, 0, &mpic->base, &phys_base); if (err) return err;