From patchwork Mon Feb 15 18:05:25 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aleksey Makarov X-Patchwork-Id: 61954 Delivered-To: patch@linaro.org Received: by 10.112.43.199 with SMTP id y7csp1217547lbl; Mon, 15 Feb 2016 10:11:30 -0800 (PST) X-Received: by 10.98.72.215 with SMTP id q84mr25251554pfi.152.1455559890035; Mon, 15 Feb 2016 10:11:30 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 29si44796736pft.41.2016.02.15.10.11.29; Mon, 15 Feb 2016 10:11:30 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dkim=pass header.i=@linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752398AbcBOSLY (ORCPT + 30 others); Mon, 15 Feb 2016 13:11:24 -0500 Received: from mail-lb0-f170.google.com ([209.85.217.170]:35684 "EHLO mail-lb0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752282AbcBOSLU (ORCPT ); Mon, 15 Feb 2016 13:11:20 -0500 Received: by mail-lb0-f170.google.com with SMTP id bc4so82405415lbc.2 for ; Mon, 15 Feb 2016 10:11:19 -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=z3p9gvk02pzmImpleAqFeWsmAs2aRy6ngaxsO/KeR14=; b=QWe6jXP3K0V2XVLwCu6Rka/0qyRiv+AvFPMto9pB7euygtK/NIVPC4CYu1++oQhn1g AVS3tIsYIM0pcg81HSFOB26Vqm2TG81jh64f8bcPG0BhSAH3nPschfOwA0Co9oCz1BZR uoAEmGCCiyiJeiLb6D/xnJMr0MLpKQaM0HAw4= 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=z3p9gvk02pzmImpleAqFeWsmAs2aRy6ngaxsO/KeR14=; b=HRgW7SPdyyANI9wGqATDePHnuj3czc5cEABLc680n4h/kDoUGPwwyXLGc5cWTy/PBG SeyhcB/L53u7rsPdVWf045Y5N/XL7x3IWegn9W2QEbHgRq4bCuOWK2SXso/HXyfGDLe8 5sg08I8etCiRW3yhbznryW4DisIeMBaEw0TcGodbQI727crSXsHmLAZO+hqMudo3ZFha lm6F1FIRVisM/huzLtGBAHz/8v+Doq8uBUs5WwJHU/hc+kwwb0wRiglaJbQBcvKn+U+y tXUhSnmQpgjsbwJycaoFTdwXZRFV9dq8wTUgr0GbMGqdmR0woQtjKoeG8UmCBJ1TrNrh Zfrg== X-Gm-Message-State: AG10YORBdN1JUxZBzyExuq/p27RA+0yvpCY/jgqJJUE5fY4l04DF3eiEihjCpGJDnIsP304p X-Received: by 10.112.143.227 with SMTP id sh3mr7707805lbb.55.1455559877609; Mon, 15 Feb 2016 10:11:17 -0800 (PST) Received: from turnip.localdomain (nivc-213.auriga.ru. [80.240.102.213]) by smtp.gmail.com with ESMTPSA id i66sm3818526lfg.4.2016.02.15.10.11.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 15 Feb 2016 10:11:17 -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 v3 1/5] ACPI: change __init to __ref for early_acpi_os_unmap_memory() Date: Mon, 15 Feb 2016 21:05:25 +0300 Message-Id: <1455559532-8305-2-git-send-email-aleksey.makarov@linaro.org> X-Mailer: git-send-email 2.7.1 In-Reply-To: <1455559532-8305-1-git-send-email-aleksey.makarov@linaro.org> References: <1455559532-8305-1-git-send-email-aleksey.makarov@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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(-) -- 2.7.1 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);