From patchwork Fri Nov 22 23:37:04 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lv Zheng X-Patchwork-Id: 3224541 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.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 3BB879F3AE for ; Fri, 22 Nov 2013 23:37:37 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 54AC8207AA for ; Fri, 22 Nov 2013 23:37:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5F074207A1 for ; Fri, 22 Nov 2013 23:37:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755795Ab3KVXhe (ORCPT ); Fri, 22 Nov 2013 18:37:34 -0500 Received: from mail-pd0-f179.google.com ([209.85.192.179]:60145 "EHLO mail-pd0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755614Ab3KVXhd (ORCPT ); Fri, 22 Nov 2013 18:37:33 -0500 Received: by mail-pd0-f179.google.com with SMTP id r10so1908529pdi.10 for ; Fri, 22 Nov 2013 15:37:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=FocI08+eeE/yuoFY+m839C7MspCJq192YcfNOa85qvo=; b=RPvhcm4nAh++AeC8tACE567mHwef8y6IWBAMnjjVo11RDX9429NiGZMnuQzzhbe+DG m+L//efwgOH657vWkdmHvlbaVmxWGLXseqdSOW60nYsjaxkxyY0+q8Dl3QITY+ktug0d kliPiFJhDdeVCQ8qUW4lmJcS7rry3uNJFtI0Rk9N46a7ldrXrvMgZuzGDgk6Pqd+9TiJ 7as+0ptTkAvHR4chHX5/vLyAFMjK6Y8T9OddgnQpMop24K0PoxVnWmDoHWTLz0bvw9ah Db+NhX3p0MBUAz8exWn7lg+7WqMiUtbhxcvVawP9RDbxxoQFnxu3/MmY35TneFaXSpdA 8HHQ== X-Received: by 10.68.89.162 with SMTP id bp2mr5217287pbb.151.1385163453220; Fri, 22 Nov 2013 15:37:33 -0800 (PST) Received: from localhost.localdomain ([121.76.27.197]) by mx.google.com with ESMTPSA id qf7sm63155750pac.14.2013.11.22.15.37.28 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 22 Nov 2013 15:37:32 -0800 (PST) From: Lv Zheng To: "Rafael J. Wysocki" , Len Brown Cc: Lv Zheng , Lv Zheng , , linux-acpi@vger.kernel.org Subject: [PATCH 4/4] ACPI: Add support to force header inclusion rules for . Date: Sat, 23 Nov 2013 07:37:04 +0800 Message-Id: <2930f1fabbb8319c11180c8db3d1693adc71aac1.1385163359.git.lv.zheng@intel.com> X-Mailer: git-send-email 1.7.10 In-Reply-To: References: Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Spam-Status: No, score=-7.3 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, 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 From: Lv Zheng As there is only CONFIG_ACPI=n processing in the , it is not safe to include , and directly for source out of Linux ACPI subsystems. This patch adds error messaging to warn developers of such wrong inclusions. In order not to be bisected and reverted as a wrong commit, warning messages are carefully split into a seperate patch other than the wrong inclusion cleanups. Signed-off-by: Lv Zheng --- drivers/acpi/acpica/Makefile | 2 +- include/acpi/acpi_bus.h | 5 +++++ include/acpi/acpi_drivers.h | 5 +++++ include/acpi/platform/aclinux.h | 10 ++++++++++ 4 files changed, 21 insertions(+), 1 deletion(-) diff --git a/drivers/acpi/acpica/Makefile b/drivers/acpi/acpica/Makefile index 4383040..7738677 100644 --- a/drivers/acpi/acpica/Makefile +++ b/drivers/acpi/acpica/Makefile @@ -2,7 +2,7 @@ # Makefile for ACPICA Core interpreter # -ccflags-y := -Os +ccflags-y := -Os -DLINUXIZED_ACPICA ccflags-$(CONFIG_ACPI_DEBUG) += -DACPI_DEBUG_OUTPUT # use acpi.o to put all files here into acpi.o modparam namespace diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h index 0af9667..0b1ea80 100644 --- a/include/acpi/acpi_bus.h +++ b/include/acpi/acpi_bus.h @@ -26,6 +26,11 @@ #ifndef __ACPI_BUS_H__ #define __ACPI_BUS_H__ +/* is not safe for CONFIG_ACPI=n environment */ +#ifndef _LINUX_ACPI_H +#error "Please don't include direclty, including instead." +#endif + #include diff --git a/include/acpi/acpi_drivers.h b/include/acpi/acpi_drivers.h index f3f1219..f5bed3a 100644 --- a/include/acpi/acpi_drivers.h +++ b/include/acpi/acpi_drivers.h @@ -26,6 +26,11 @@ #ifndef __ACPI_DRIVERS_H__ #define __ACPI_DRIVERS_H__ +/* is not safe for CONFIG_ACPI=n environment */ +#ifndef _LINUX_ACPI_H +#error "Please don't include directly, including instead." +#endif + #define ACPI_MAX_STRING 80 diff --git a/include/acpi/platform/aclinux.h b/include/acpi/platform/aclinux.h index 28f4f4d..0e05771 100644 --- a/include/acpi/platform/aclinux.h +++ b/include/acpi/platform/aclinux.h @@ -44,6 +44,16 @@ #ifndef __ACLINUX_H__ #define __ACLINUX_H__ +#ifdef __KERNEL__ + +/* ACPICA external files should not include ACPICA headers directly. */ + +#if !defined(LINUXIZED_ACPICA) && !defined(_LINUX_ACPI_H) +#error "Please don't include directly, including instead." +#endif + +#endif + /* Common (in-kernel/user-space) ACPICA configuration */ #define ACPI_USE_SYSTEM_CLIBRARY