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: 8317681 Return-Path: X-Original-To: patchwork-linux-acpi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 6482A9F6E4 for ; Mon, 15 Feb 2016 18:14:14 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 80F7920154 for ; Mon, 15 Feb 2016 18:14:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2761D203B4 for ; Mon, 15 Feb 2016 18:14:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752351AbcBOSLW (ORCPT ); Mon, 15 Feb 2016 13:11:22 -0500 Received: from mail-lb0-f180.google.com ([209.85.217.180]:34155 "EHLO mail-lb0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752285AbcBOSLU (ORCPT ); Mon, 15 Feb 2016 13:11:20 -0500 Received: by mail-lb0-f180.google.com with SMTP id ut4so6715000lbc.1 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=WbmY8wtwK6F+GnSBp7QmtpCqk6PBBaUEK5VXmV7AQFImO8Xk6G8BhxA8QnhySZhWh4 /SN0gH5yMXp6/zmuHI7+R0x/wHPbKCKK5tF7GwsKMX+XRaPW82sygHjGRRGYyDWev5cJ 3of4EC/pb2zyc7doF3cuaE51jXP2i7FcU13rGBY8WvTvN4pm/YAGhXKp1d3lnH31evVR Ww9u9KIhSTep+i2paz423TOpl2S/SoAP4ZcJV5rK0KzQujZvdhBJfO1zvddK2CcDQlv6 RMripAvyy1B4bq/mvmL9/ceXmVEsW2nerV0Hy/kCZxiQH2o1wTZXdQ4DfKWWBnrT6BOf zMhw== X-Gm-Message-State: AG10YOQl49gVT2iF+XB1ZVrPUYhQ00/C7sDI36Mc82s5an/8tsQLmwwx/pQKk9JkXa6ZsYCi 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-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Spam-Status: No, score=-6.8 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);