From patchwork Tue Mar 30 06:04:44 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jisheng Zhang X-Patchwork-Id: 12171703 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_2 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E62CFC433DB for ; Tue, 30 Mar 2021 06:06:58 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 286F460190 for ; Tue, 30 Mar 2021 06:06:58 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 286F460190 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=synaptics.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:Message-ID:Subject:Cc:To:From:Date: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=Jh05Zwe4C5pkWgX9p0i8cyqB/ONa3d9KQzYXAeyiLD0=; b=PS4zrK/Ynr9dzBdZCIeblFVzBL fYzxID6G+c38oYrRYKXt3qKh7MdRAVOiKWLHvhqyvJ6d05t8MSU3PHOwg13GwQKRscJOaSWUZVesp qLBorAK+d8oym0yjb0fZPXdFUfjl2FQxNlE3nIXnaWtq94SYINx1IvfJboYV8zldRsXodPM25eaxR /jLHH9wJUz+4xBeMlG5uUWH2DDYUf7RwnYBYNjZ1TvCDyeDqML/zvUp8DcR17kgkPzWRze1HKTBa6 YiJSK8qB75UzIntcXw+KHaFdR6Waq2oczNTNZjVYwtKD5WA5wcyMEQxv0+wcVrYQoMF+cXhAIc9pR 7FxmxBjg==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lR7Us-002oQF-5g; Tue, 30 Mar 2021 06:05:02 +0000 Received: from mail-mw2nam12on2082.outbound.protection.outlook.com ([40.107.244.82] helo=NAM12-MW2-obe.outbound.protection.outlook.com) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lR7Un-002oPQ-Sl for linux-arm-kernel@lists.infradead.org; Tue, 30 Mar 2021 06:04:59 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Fy6+Ru7QzNPhIW1Y/kAYmvx3kHyDLb8ObA1bC1SkVELp9naCG1qEa44wbsT+e3DZSDukAI47jtsUNCrhJII37wfocv5CIeSYevWV0/U+1HCrrBM8kr6bL0h1ODBu3YNZpoMrD5n9A8Fpu1ZkoB934j72V7HV5O+5k7b2+JwXXaP8YHLAmP6r4gFfVRXU7a8nbb+YknSondpOTLmokrNq7qW9DJeBx0OFZXMwIdzVjkqVrMZXNkJBlyqcIo72Ng/nmvHn7udw5URREFdXzPzViWh4kw9hudVOfWux/fltoop4JJhhzby0zpiqD1mUK0ij233MCuwxw+KMK3BI9Mi5Vg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=wbUL23JQVY/vzRxGYpY/GLh1yvtFaiRkKS6X55J/I20=; b=JmBxQg5raa8a+iNCZLqti5nS0n6t5fXrIzxIYun9HgRS8G3lPOYxO71XNRNGxELZdRyk5YUXDpOKHIX9Rch9POjUNvQdeUg9pTP3jYE4oVPjqiutXswbdHk9+F0T3JfqsX5MsHuKH76wxgBl0wqSkfAQs4zfCwQxevnuBB/OJM8X/cH6y98a3Y7CpSW5sVe5Ccg6k4WU9JsuZa+I7snL18TPM8as0y4x8/ZaCEgz7Cv2ZoDrihw2Ilgtrilsjm00CIi5ml692BfjciuBaUvFyu0p2L3RHz5O9Mydib2JvOTbV3rkWA+2vFI+esFn7nQbRDO6QYIV1NUt1oSNJCZjfQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=synaptics.com; dmarc=pass action=none header.from=synaptics.com; dkim=pass header.d=synaptics.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Synaptics.onmicrosoft.com; s=selector2-Synaptics-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=wbUL23JQVY/vzRxGYpY/GLh1yvtFaiRkKS6X55J/I20=; b=UAwWbgufJqM3++Ys6TsOD5jNNrWKDrFqUH0apcEswgsQwQLog61sPlFRoUSgar7MM16KzXGmMkoNsl399zSr2ZrTPhj8rrX6AUU4DHnlS/F2OG7zuZc9MrC4aXWoMQS8lCVwE0cf78MS4hAiY6VoM0owXAUNSd1SKfPsZREDn+M= Authentication-Results: arm.com; dkim=none (message not signed) header.d=none;arm.com; dmarc=none action=none header.from=synaptics.com; Received: from BY5PR03MB5345.namprd03.prod.outlook.com (2603:10b6:a03:219::16) by SJ0PR03MB5757.namprd03.prod.outlook.com (2603:10b6:a03:2d8::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3977.26; Tue, 30 Mar 2021 06:04:52 +0000 Received: from BY5PR03MB5345.namprd03.prod.outlook.com ([fe80::8569:341f:4bc6:5b72]) by BY5PR03MB5345.namprd03.prod.outlook.com ([fe80::8569:341f:4bc6:5b72%9]) with mapi id 15.20.3977.033; Tue, 30 Mar 2021 06:04:52 +0000 Date: Tue, 30 Mar 2021 14:04:44 +0800 From: Jisheng Zhang To: Mark Rutland , Marc Zyngier , Daniel Lezcano , Thomas Gleixner Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH] clocksource/arm_arch_timer: add __ro_after_init and __init Message-ID: <20210330140444.4fb2a7cb@xhacker.debian> X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.33; x86_64-pc-linux-gnu) X-Originating-IP: [192.147.44.204] X-ClientProxiedBy: BYAPR05CA0029.namprd05.prod.outlook.com (2603:10b6:a03:c0::42) To BY5PR03MB5345.namprd03.prod.outlook.com (2603:10b6:a03:219::16) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from xhacker.debian (192.147.44.204) by BYAPR05CA0029.namprd05.prod.outlook.com (2603:10b6:a03:c0::42) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3999.16 via Frontend Transport; Tue, 30 Mar 2021 06:04:50 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e81156b9-f143-4c58-31cd-08d8f341bbad X-MS-TrafficTypeDiagnostic: SJ0PR03MB5757: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:421; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 98oLclO8b93TihgZgKF5XDpCpilKq4RnvTHuAwxHeih6C73j/NW1LN28AfWs1txHOhw3wOIqHiPYLFsrTuQmu46Ee/zeaBDadiU5YjfBUP08RORbsVTXgmCLq5Sb9skRuMTssVJw04mmHT7pQh/gci69hn4b7Oe5b/8JBInjj2DVVhMRbns3o6dB/zjG8ZTAtwNvES+D0tMmC9BR2u+kA2Yst11NIFuQwMs03FkOuXyBCalFqy8y7OtPVl+EOVQwIwPApgPjmaF12ojba/S0TpuEcjDV3Pnvsgyg8g26BzuipZJBnTtIpypOuEUsA3I3y6+R3mMmJuHB+W0YSVAG9tgHlPPLJOZSjDaN9+Okpc1MZwbjLmW/s77E/hQLIPDwgK88qugdq6VSDyf1BYNNbCGPCRacIrTjbGqerv8cVDV+NMcNnL1/zoT4AngwmeXhEAJNN8vxcWipjNaUyrJyTWU8umQDMwSRPr8Zh17mCwpgF9dOklELNc+pmXk/6KOEyEj/795lvJ6sdr6FP2GVLxfz+tNFl/OI4UGpJRn7yw4uy6Qrb/Wts7pUFE5ZhhYUzyBYGtR9oyAIKZu+bd1Poxjnytd15Q4r3Og5mR3GYPaTnVYLpEx8RS6BX6A5eaAJZd0GAf9iqxNwY5lympNUVVDiolG6x8JKrxO6JBTXqBE= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BY5PR03MB5345.namprd03.prod.outlook.com; PTR:; CAT:NONE; SFS:(396003)(136003)(376002)(366004)(39860400002)(346002)(38100700001)(478600001)(16526019)(110136005)(186003)(2906002)(26005)(86362001)(52116002)(9686003)(66946007)(4326008)(1076003)(7696005)(8936002)(316002)(956004)(8676002)(6506007)(6666004)(83380400001)(55016002)(5660300002)(66476007)(66556008); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: eVThID5p30PYrGfm9BmmwFsBnf2+6sGrZezKbnKBpwKK8IK5hsnyMniKCJxtTeVwFl6vUn6Z73J87YGFqPyWWfeUb8awl+up/PGeEjD7Z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6uv0RdNWkX70ufu8hJ1PMZEVXl2pPLk3wpVpAWqMnbyG9N2VGYh7jAzF3hFhoK6tOOLj6WlUqMnbTVMcei1jjSTBhH+Gf0OVEbY1WLKFcysQ6QfTyn3uBVv1ZjGyNgl4 X-OriginatorOrg: synaptics.com X-MS-Exchange-CrossTenant-Network-Message-Id: e81156b9-f143-4c58-31cd-08d8f341bbad X-MS-Exchange-CrossTenant-AuthSource: BY5PR03MB5345.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Mar 2021 06:04:52.1203 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 335d1fbc-2124-4173-9863-17e7051a2a0e X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: pQEvdj6USPn/fKM+rBWe2scHHbgrBnkbzT2PdZwQxWF+J1vEcv34mycp+KUQFWTkSUXsZfXPOU0HYTtp7uVmmg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR03MB5757 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210330_070458_097871_DC46BED6 X-CRM114-Status: GOOD ( 13.34 ) 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 Some functions are not needed after booting, so mark them as __init to move them to the .init section. Some global variables are never modified after init, so can be __ro_after_init. Signed-off-by: Jisheng Zhang Acked-by: Marc Zyngier --- drivers/clocksource/arm_arch_timer.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/drivers/clocksource/arm_arch_timer.c b/drivers/clocksource/arm_arch_timer.c index d0177824c518..1b885964fb34 100644 --- a/drivers/clocksource/arm_arch_timer.c +++ b/drivers/clocksource/arm_arch_timer.c @@ -51,7 +51,7 @@ static unsigned arch_timers_present __initdata; -static void __iomem *arch_counter_base; +static void __iomem *arch_counter_base __ro_after_init; struct arch_timer { void __iomem *base; @@ -60,15 +60,16 @@ struct arch_timer { #define to_arch_timer(e) container_of(e, struct arch_timer, evt) -static u32 arch_timer_rate; -static int arch_timer_ppi[ARCH_TIMER_MAX_TIMER_PPI]; +static u32 arch_timer_rate __ro_after_init; +u32 arch_timer_rate1 __ro_after_init; +static int arch_timer_ppi[ARCH_TIMER_MAX_TIMER_PPI] __ro_after_init; static struct clock_event_device __percpu *arch_timer_evt; -static enum arch_timer_ppi_nr arch_timer_uses_ppi = ARCH_TIMER_VIRT_PPI; -static bool arch_timer_c3stop; -static bool arch_timer_mem_use_virtual; -static bool arch_counter_suspend_stop; +static enum arch_timer_ppi_nr arch_timer_uses_ppi __ro_after_init = ARCH_TIMER_VIRT_PPI; +static bool arch_timer_c3stop __ro_after_init; +static bool arch_timer_mem_use_virtual __ro_after_init; +static bool arch_counter_suspend_stop __ro_after_init; #ifdef CONFIG_GENERIC_GETTIMEOFDAY static enum vdso_clock_mode vdso_default = VDSO_CLOCKMODE_ARCHTIMER; #else @@ -76,7 +77,7 @@ static enum vdso_clock_mode vdso_default = VDSO_CLOCKMODE_NONE; #endif /* CONFIG_GENERIC_GETTIMEOFDAY */ static cpumask_t evtstrm_available = CPU_MASK_NONE; -static bool evtstrm_enable = IS_ENABLED(CONFIG_ARM_ARCH_TIMER_EVTSTREAM); +static bool evtstrm_enable __ro_after_init = IS_ENABLED(CONFIG_ARM_ARCH_TIMER_EVTSTREAM); static int __init early_evtstrm_cfg(char *buf) { @@ -176,7 +177,7 @@ static notrace u64 arch_counter_get_cntvct(void) * to exist on arm64. arm doesn't use this before DT is probed so even * if we don't have the cp15 accessors we won't have a problem. */ -u64 (*arch_timer_read_counter)(void) = arch_counter_get_cntvct; +u64 (*arch_timer_read_counter)(void) __ro_after_init = arch_counter_get_cntvct; EXPORT_SYMBOL_GPL(arch_timer_read_counter); static u64 arch_counter_read(struct clocksource *cs) @@ -925,7 +926,7 @@ static int validate_timer_rate(void) * rate was probed first, and don't verify that others match. If the first node * probed has a clock-frequency property, this overrides the HW register. */ -static void arch_timer_of_configure_rate(u32 rate, struct device_node *np) +static void __init arch_timer_of_configure_rate(u32 rate, struct device_node *np) { /* Who has more than one independent system counter? */ if (arch_timer_rate) @@ -939,7 +940,7 @@ static void arch_timer_of_configure_rate(u32 rate, struct device_node *np) pr_warn("frequency not available\n"); } -static void arch_timer_banner(unsigned type) +static void __init arch_timer_banner(unsigned type) { pr_info("%s%s%s timer(s) running at %lu.%02luMHz (%s%s%s).\n", type & ARCH_TIMER_TYPE_CP15 ? "cp15" : "",