From patchwork Fri Feb 12 17:43:33 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aleksey Makarov X-Patchwork-Id: 8294501 Return-Path: X-Original-To: patchwork-linux-acpi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 963EAC02AA for ; Fri, 12 Feb 2016 17:51:44 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B7CBE20421 for ; Fri, 12 Feb 2016 17:51:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E307D20212 for ; Fri, 12 Feb 2016 17:51:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752324AbcBLRvd (ORCPT ); Fri, 12 Feb 2016 12:51:33 -0500 Received: from mail-lf0-f42.google.com ([209.85.215.42]:34088 "EHLO mail-lf0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751860AbcBLRsx (ORCPT ); Fri, 12 Feb 2016 12:48:53 -0500 Received: by mail-lf0-f42.google.com with SMTP id j78so56279769lfb.1 for ; Fri, 12 Feb 2016 09:48:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=yt6snAIAf12ZcswtZFn0AfoI1y6PMZ9iJv/taTng/u0=; b=PaGwgRTDdk/mVncY/gZOYF4Wma4k5Db2oSBPLszWKfiggbEctv832prX4jWkyEmmVI Z1Ryp5BNA1O8oQyneokj4khCPSN9yQ7VjmhjJD4AfzvHnkgnKOQZYuihdGySFq5okQA4 AZsvQIeovZ2zBcM9dd7ZjU8vvwg35Ffc8k31g= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=yt6snAIAf12ZcswtZFn0AfoI1y6PMZ9iJv/taTng/u0=; b=Odo6i69GvJHgfoPyUy2X5tRo/6qlZq7+4sNggUtP+CkTs6Afxetijwx9zy1QtHu9Pd IHw3RiliVkO6QjbpHLkU7MAntddjFw3fdqMvCjke/Ea+2AiZx1D8KwRQU1fdb7U4hcYX j3E4vI4MqqH3o+EtraSnT9X5UKoH9YEI1lKLU376tNRitWv0Ub2sfyZ8yKX5NWZbdyhp DTY2dTEVmpYhzFLAIAtbICdjY5P3u8zJll3c3+P5G0P985HzIYFMsUSZa8XBWAmOaGw/ GjICTCHAH+F9/BdVxSRQXvS8dJ0CjQyEo3fhXG+Umsu+yzhTuzFfu0D/QNcb5cy9AbVb ZO7Q== X-Gm-Message-State: AG10YORk5KovU2R1sCACWLFkIqLTn4QiYZeTMUU3bN29S9tZJ2NFRXSqDbj8F04Iz+beZBPF X-Received: by 10.25.18.214 with SMTP id 83mr1071802lfs.52.1455299332629; Fri, 12 Feb 2016 09:48:52 -0800 (PST) Received: from turnip.localdomain (nivc-213.auriga.ru. [80.240.102.213]) by smtp.gmail.com with ESMTPSA id ei4sm2017549lbb.18.2016.02.12.09.48.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 12 Feb 2016 09:48:51 -0800 (PST) From: Aleksey Makarov To: linux-acpi@vger.kernel.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Aleksey Makarov , Russell King , Greg Kroah-Hartman , "Rafael J . Wysocki" , Leif Lindholm , Graeme Gregory , Al Stone , Christopher Covington , Len Brown Subject: [PATCH v2 2/9] ACPI: Change __init to __ref for early_acpi_os_unmap_memory() Date: Fri, 12 Feb 2016 20:43:33 +0300 Message-Id: <1455299022-11641-3-git-send-email-aleksey.makarov@linaro.org> X-Mailer: git-send-email 2.7.0 In-Reply-To: <1455299022-11641-1-git-send-email-aleksey.makarov@linaro.org> References: <1455299022-11641-1-git-send-email-aleksey.makarov@linaro.org> Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP early_acpi_os_unmap_memory() is marked as __init because it calls __acpi_unmap_table(), but only when acpi_gbl_permanent_mmap is not set. acpi_gbl_permanent_mmap is set in __init acpi_early_init() so it is safe to call early_acpi_os_unmap_memory() from anywhere We need this function to be non-__init because we need access to some tables at unpredictable time--it may be before or after acpi_gbl_permanent_mmap is set. For example, SPCR (Serial Port Console Redirection) table is needed each time a new console is registered. It can be quite early (console_initcall) or when a module is inserted. When this table accessed before acpi_gbl_permanent_mmap is set, the pointer should be unmapped. This is exactly what this function does. Signed-off-by: Aleksey Makarov --- drivers/acpi/osl.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c index 67da6fb..8a552cd 100644 --- a/drivers/acpi/osl.c +++ b/drivers/acpi/osl.c @@ -497,7 +497,11 @@ void __ref acpi_os_unmap_memory(void *virt, acpi_size size) } EXPORT_SYMBOL_GPL(acpi_os_unmap_memory); -void __init early_acpi_os_unmap_memory(void __iomem *virt, acpi_size size) +/* + * acpi_gbl_permanent_mmap is set in __init acpi_early_init() + * so it is safe to call early_acpi_os_unmap_memory() from anywhere + */ +void __ref early_acpi_os_unmap_memory(void __iomem *virt, acpi_size size) { if (!acpi_gbl_permanent_mmap) __acpi_unmap_table(virt, size);