From patchwork Thu Dec 5 14:25:39 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lv Zheng X-Patchwork-Id: 3302311 Return-Path: X-Original-To: patchwork-intel-gfx@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 9C7909F37A for ; Fri, 6 Dec 2013 22:37:42 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6FA9F203B6 for ; Fri, 6 Dec 2013 22:37:41 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 4F886203E5 for ; Fri, 6 Dec 2013 22:37:40 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0ABCFFB2B3; Fri, 6 Dec 2013 14:37:39 -0800 (PST) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-pd0-f174.google.com (mail-pd0-f174.google.com [209.85.192.174]) by gabe.freedesktop.org (Postfix) with ESMTP id 692AFFB277 for ; Thu, 5 Dec 2013 06:25:59 -0800 (PST) Received: by mail-pd0-f174.google.com with SMTP id y13so24524337pdi.5 for ; Thu, 05 Dec 2013 06:25:59 -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=cLcjvG08h3IhUOQKM8hnT3HOjxrIwWX3efaKFWvu070=; b=JLtW+ZODJ2d8hTKfcGR/ljWHOqafMvtrR9nnkDAh+nY7FdqSD6Hvegd6PX3r/Ms4WV foXEIdn+l4VILJpxcO/RNGz1nD3dlP0ck5cJBNM91HS90AAanmrm6dpRhE/yFM1E2TUl ///1ElcmoEBXbCIlEVhoAHJ1k7VD4qYajJGvH0qbXIbvET/Nunjet59Mfu5ZLHF9Hm/a K3DQl0W7ss6bipAD2uMQL83mJ2evWzbGMPh5zQrJcw1NJBvSKgHFOHgZ8Sb41/KuHbXQ ANHtaPNebMWrM5KYUE6LdH3j1rXANROKhkqQOlq+3902sUiSNd8LIlaVOAZ62N7yqdwo SjTw== X-Received: by 10.66.162.195 with SMTP id yc3mr88828257pab.64.1386253559214; Thu, 05 Dec 2013 06:25:59 -0800 (PST) Received: from localhost.localdomain ([121.76.27.197]) by mx.google.com with ESMTPSA id ql10sm145059321pbc.44.2013.12.05.06.25.50 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 05 Dec 2013 06:25:58 -0800 (PST) From: Lv Zheng To: "Rafael J. Wysocki" , Len Brown Date: Thu, 5 Dec 2013 22:25:39 +0800 Message-Id: <239568bf8e41fd4987b03f0ece3570d4b7f7b08e.1386241253.git.lv.zheng@intel.com> X-Mailer: git-send-email 1.7.10 In-Reply-To: References: X-Mailman-Approved-At: Fri, 06 Dec 2013 14:37:37 -0800 Cc: Matthew Garrett , Daniel Vetter , intel-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org, Lv Zheng , linux-acpi@vger.kernel.org, Lv Zheng Subject: [Intel-gfx] [PATCH v2] ACPI/i915: Fix wrong inclusion in i915 opregion module. X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: intel-gfx-bounces@lists.freedesktop.org Errors-To: intel-gfx-bounces@lists.freedesktop.org X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable 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 In Linux kernel, ACPICA is wrapped and safely exported by CONFIG_ACPI. So all external modules should depend on CONFIG_ACPI rather than using ACPICA header directly for stubbing. But if we moves inclusions into "#ifdef CONFIG_ACPI", build breakge can help to detect wrong ACPICA dependent modules. One of the build breakage is: include/linux/acpi_io.h:7:45: error: unknown type name 'acpi_physical_address' include/linux/acpi_io.h:8:10: error: unknown type name 'acpi_size' include/linux/acpi_io.h:13:33: error: unknown type name 'acpi_physical_address' include/linux/acpi_io.h:15:40: warning: 'struct acpi_generic_address' declared inside parameter list [enabled by default] include/linux/acpi_io.h:15:40: warning: its scope is only this definition or declaration, which is probably not what you want [enabled by default] include/linux/acpi_io.h:16:43: warning: 'struct acpi_generic_address' declared inside parameter list [enabled by default] drivers/gpu/drm/i915/intel_opregion.c: In function 'intel_opregion_setup': drivers/gpu/drm/i915/intel_opregion.c:883:2: error: implicit declaration of function 'acpi_os_ioremap' [-Werror=implicit-function-declaration] drivers/gpu/drm/i915/intel_opregion.c:883:7: warning: assignment makes pointer from integer without a cast [enabled by default] The root causes of this breakage are: 1. The depends on CONFIG_ACPI=y as most of the prototypes exported by it are implemented in drivers/acpi/osl.c. 2. CONFIG_DRM_I915 uses the only "inline" function acpi_os_ioremap() to implement stubs but it shouldn't. Since ACPI IGD OpRegion is an ACPI-based mechanism, (please refer to the Doclink below), this patch fixes this issue by making drivers/gpu/drm/i915/intel_opregion.c dependent on CONFIG_ACPI. This is identical to other Intel DRM drivers' OpRegion support (e.x., drivers/gpu/drm/gma500/opregion.c). Since acpi_io.h is not safe for CONFIG_ACPI=y environment, this patch also moves it to include/acpi, includes it in for CONFIG_ACPI=y build environment and cleans up its inclusions by converting them into inclusions. After that, since all inclusions are CONFIG_ACPI dependent, the FIXME marked inclusion in is also deleted in this patch. Doclink: https://01.org/linuxgraphics/sites/default/files/documentation/acpi_igd_opregion_spec.pdf Cc: Matthew Garrett Cc: Daniel Vetter Cc: intel-gfx@lists.freedesktop.org Signed-off-by: Lv Zheng --- Updated due to: 1. Patch descripition is changed, "FIXME deletion" notes is added; 2. A mistake is fixed in the original patch. The change in the drivers/gpu/drm/i915/intel_opregion.c is not added to the quilt. It's lost as a process issues in my tests. This update fixes this issue by deleting linux/acpi_io.h inclusion from drivers/gpu/drm/i915/intel_opregion.c. Recursive build test environment is set up as follows: Following CONFIGs are enabled by default: CONFIG_DRM_I915=y CONFIG_DRM_GMA500=y CONFIG_ACPI_APEI=y CONFIG_ACPI_APEI_GHES=y CONFIG_ACPI_APEI_EINJ=y CONFIG_ACPI_APEI_ERST_DEBUG=y Following special CONFIG tests are enabled: CONFIG_ACPI=n Following special object tests are enabled: drivers/acpi/apei/erst.o drivers/acpi/apei/hest.o drivers/acpi/apei/ghes.o drivers/acpi/apei/einj.o drivers/acpi/apei/erst-dbg.o drivers/gpu/drm/i915/intel_opregion.o drivers/gpu/drm/gma500/opregion.o It is done after merging the patch and before signing-off the patch. --- drivers/acpi/apei/apei-base.c | 1 - drivers/acpi/apei/apei-internal.h | 1 - drivers/acpi/apei/ghes.c | 1 - drivers/acpi/nvs.c | 1 - drivers/acpi/osl.c | 1 - drivers/gpu/drm/gma500/opregion.c | 1 - drivers/gpu/drm/i915/Makefile | 3 +-- drivers/gpu/drm/i915/i915_drv.h | 3 ++- drivers/gpu/drm/i915/intel_opregion.c | 1 - include/acpi/acpi_io.h | 17 +++++++++++++++++ include/linux/acpi.h | 1 + include/linux/acpi_io.h | 18 ------------------ 12 files changed, 21 insertions(+), 28 deletions(-) create mode 100644 include/acpi/acpi_io.h delete mode 100644 include/linux/acpi_io.h diff --git a/drivers/acpi/apei/apei-base.c b/drivers/acpi/apei/apei-base.c index 6d2c49b..0760b75 100644 --- a/drivers/acpi/apei/apei-base.c +++ b/drivers/acpi/apei/apei-base.c @@ -34,7 +34,6 @@ #include #include #include -#include #include #include #include diff --git a/drivers/acpi/apei/apei-internal.h b/drivers/acpi/apei/apei-internal.h index 21ba34a..e5bcd91 100644 --- a/drivers/acpi/apei/apei-internal.h +++ b/drivers/acpi/apei/apei-internal.h @@ -8,7 +8,6 @@ #include #include -#include struct apei_exec_context; diff --git a/drivers/acpi/apei/ghes.c b/drivers/acpi/apei/ghes.c index a30bc31..694c486 100644 --- a/drivers/acpi/apei/ghes.c +++ b/drivers/acpi/apei/ghes.c @@ -33,7 +33,6 @@ #include #include #include -#include #include #include #include diff --git a/drivers/acpi/nvs.c b/drivers/acpi/nvs.c index 386a9fe..ef28613 100644 --- a/drivers/acpi/nvs.c +++ b/drivers/acpi/nvs.c @@ -12,7 +12,6 @@ #include #include #include -#include /* ACPI NVS regions, APEI may use it */ diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c index 7e2d814..63251b6 100644 --- a/drivers/acpi/osl.c +++ b/drivers/acpi/osl.c @@ -39,7 +39,6 @@ #include #include #include -#include #include #include #include diff --git a/drivers/gpu/drm/gma500/opregion.c b/drivers/gpu/drm/gma500/opregion.c index ad0d6de..13ec628 100644 --- a/drivers/gpu/drm/gma500/opregion.c +++ b/drivers/gpu/drm/gma500/opregion.c @@ -22,7 +22,6 @@ * */ #include -#include #include "psb_drv.h" #include "psb_intel_reg.h" diff --git a/drivers/gpu/drm/i915/Makefile b/drivers/gpu/drm/i915/Makefile index 41838ea..d4ae48b 100644 --- a/drivers/gpu/drm/i915/Makefile +++ b/drivers/gpu/drm/i915/Makefile @@ -38,7 +38,6 @@ i915-y := i915_drv.o i915_dma.o i915_irq.o \ intel_ringbuffer.o \ intel_overlay.o \ intel_sprite.o \ - intel_opregion.o \ intel_sideband.o \ intel_uncore.o \ dvo_ch7xxx.o \ @@ -51,7 +50,7 @@ i915-y := i915_drv.o i915_dma.o i915_irq.o \ i915-$(CONFIG_COMPAT) += i915_ioc32.o -i915-$(CONFIG_ACPI) += intel_acpi.o +i915-$(CONFIG_ACPI) += intel_acpi.o intel_opregion.o i915-$(CONFIG_DRM_I915_FBDEV) += intel_fbdev.o diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index ccdbecc..7f37b83 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h @@ -2336,8 +2336,8 @@ extern void intel_i2c_reset(struct drm_device *dev); /* intel_opregion.c */ struct intel_encoder; -extern int intel_opregion_setup(struct drm_device *dev); #ifdef CONFIG_ACPI +extern int intel_opregion_setup(struct drm_device *dev); extern void intel_opregion_init(struct drm_device *dev); extern void intel_opregion_fini(struct drm_device *dev); extern void intel_opregion_asle_intr(struct drm_device *dev); @@ -2346,6 +2346,7 @@ extern int intel_opregion_notify_encoder(struct intel_encoder *intel_encoder, extern int intel_opregion_notify_adapter(struct drm_device *dev, pci_power_t state); #else +static inline int intel_opregion_setup(struct drm_device *dev) { return 0; } static inline void intel_opregion_init(struct drm_device *dev) { return; } static inline void intel_opregion_fini(struct drm_device *dev) { return; } static inline void intel_opregion_asle_intr(struct drm_device *dev) { return; } diff --git a/drivers/gpu/drm/i915/intel_opregion.c b/drivers/gpu/drm/i915/intel_opregion.c index 6d69a9b..9a8804b 100644 --- a/drivers/gpu/drm/i915/intel_opregion.c +++ b/drivers/gpu/drm/i915/intel_opregion.c @@ -28,7 +28,6 @@ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt #include -#include #include #include diff --git a/include/acpi/acpi_io.h b/include/acpi/acpi_io.h new file mode 100644 index 0000000..2be8580 --- /dev/null +++ b/include/acpi/acpi_io.h @@ -0,0 +1,17 @@ +#ifndef _ACPI_IO_H_ +#define _ACPI_IO_H_ + +#include + +static inline void __iomem *acpi_os_ioremap(acpi_physical_address phys, + acpi_size size) +{ + return ioremap_cache(phys, size); +} + +void __iomem *acpi_os_get_iomem(acpi_physical_address phys, unsigned int size); + +int acpi_os_map_generic_address(struct acpi_generic_address *addr); +void acpi_os_unmap_generic_address(struct acpi_generic_address *addr); + +#endif diff --git a/include/linux/acpi.h b/include/linux/acpi.h index 115c610..72c88f4 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h @@ -42,6 +42,7 @@ #include #include #include +#include #include static inline acpi_handle acpi_device_handle(struct acpi_device *adev) diff --git a/include/linux/acpi_io.h b/include/linux/acpi_io.h deleted file mode 100644 index 2a5a139..0000000 --- a/include/linux/acpi_io.h +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef _ACPI_IO_H_ -#define _ACPI_IO_H_ - -#include -#include /* FIXME: inclusion should be removed */ - -static inline void __iomem *acpi_os_ioremap(acpi_physical_address phys, - acpi_size size) -{ - return ioremap_cache(phys, size); -} - -void __iomem *acpi_os_get_iomem(acpi_physical_address phys, unsigned int size); - -int acpi_os_map_generic_address(struct acpi_generic_address *addr); -void acpi_os_unmap_generic_address(struct acpi_generic_address *addr); - -#endif