From patchwork Wed Aug 7 16:41:00 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: 13756509 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 7CCE5C3DA7F for ; Wed, 7 Aug 2024 16:46:45 +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=oj/mEgRJYtIwdaksx32TxtMuBFoci5qydekOmkmw+Ag=; b=NqhBSWd/s5DCCkEc6KM4PmzjXu 8t2/fGO472gPBpChdE5K8PfZVlQ+OGaA35EKFaGMDyuZy3HVX0x15TK9mEz3FNQ51gIP5OSWncLJc FkgTLM6LkwaKnNZapYwB3ighfmhDR6+EjzCcvIWYsZxB8oHa+Dbuc+15RhxwTJn/P2LjHMmnua2Ob F7lA0tWXKnrG4M5hdgxIFox0APDpk+wNYxGbEAK85DF5c40fnNbylkX+f1Qz6YHzbFi9GNfAJBler 3YbeTqhontYTP43mNNoq/XptXrX2Lie9FA7EIHTCDuf6QMsh6n2KfOXDjUVtfnzJisnOfHZaukZf8 1Lboj2ig==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sbjo3-00000005jIH-1k1d; Wed, 07 Aug 2024 16:46:35 +0000 Received: from sin.source.kernel.org ([145.40.73.55]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sbjjB-00000005iLc-3pxU for linux-arm-kernel@lists.infradead.org; Wed, 07 Aug 2024 16:41:35 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id 1916FCE1160; Wed, 7 Aug 2024 16:41:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8D906C4AF09; Wed, 7 Aug 2024 16:41:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1723048890; bh=ccXcEeQL3zwTliX+fL/YPtI60G1ap2M3mIMmWEQqc9k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=auhIdVb7zJ4H1Ypu91Fosbd7mn6zdNP4vPH2fW7emF4GLAubSLqCtAnpJDg25p8vC mtupaAjKElqpacjOEKJ9woVlXcRuPfdWJLxCzhXn7PrgDqBY/onmzKuCNUyFlocs3V EtI7HlTMN2zWmgO9k96GyxcxeqRZzPHlGfJlgCwdR46HlLkWvxCue71SiJBu013Wwb F7AVXyiy0sIzZ2jsIq0Fu/RvuQL2FyyY1KLq9MbDRyQL//WVFTJPl0U5qJ39Cml7Bs g684ba5+WOuloXSVErw3b68vsm6HcrVIXWWjGDvJirKtF+JJFBTrtOB8AbgDP7mLCe PrmeRpYVV/qWQ== 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 v2 08/12] irqchip/armada-370-xp: Dynamically allocate the driver private structure Date: Wed, 7 Aug 2024 18:41:00 +0200 Message-ID: <20240807164104.4140-9-kabel@kernel.org> X-Mailer: git-send-email 2.44.2 In-Reply-To: <20240807164104.4140-1-kabel@kernel.org> References: <20240807164104.4140-1-kabel@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240807_094134_159337_0A29FF98 X-CRM114-Status: GOOD ( 14.08 ) 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 5710ce206cca..f8658a232f21 100644 --- a/drivers/irqchip/irq-armada-370-xp.c +++ b/drivers/irqchip/irq-armada-370-xp.c @@ -187,7 +187,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) { @@ -575,7 +575,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); @@ -726,7 +726,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); @@ -735,7 +735,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 */ @@ -824,11 +824,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;