linux-acpi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel@ffwll.ch>
To: Lv Zheng <lv.zheng@intel.com>
Cc: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>,
	Len Brown <len.brown@intel.com>,
	Matthew Garrett <mjg59@srcf.ucam.org>,
	Daniel Vetter <daniel.vetter@ffwll.ch>,
	intel-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org,
	Lv Zheng <zetalog@gmail.com>,
	linux-acpi@vger.kernel.org
Subject: Re: [Intel-gfx] [PATCH 1/3] ACPI/i915: Fix wrong <acpi/acpi.h> inclusion in i915 opregion module.
Date: Wed, 4 Dec 2013 09:16:16 +0100	[thread overview]
Message-ID: <20131204081616.GY27344@phenom.ffwll.local> (raw)
In-Reply-To: <58025298b10c01a76adeed0f27e12d4b764ad99c.1386116927.git.lv.zheng@intel.com>

On Wed, Dec 04, 2013 at 08:38:08AM +0800, Lv Zheng wrote:
> 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 <acpi/acpi.h> 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 <linux/acpi_io.h> 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 <linux/acpi.h> for CONFIG_ACPI=y
> build environment and cleans up its inclusions by converting them into
> <linux/acpi.h> inclusions.
> 
> Doclink: https://01.org/linuxgraphics/sites/default/files/documentation/acpi_igd_opregion_spec.pdf
> Cc: Matthew Garrett <mjg59@srcf.ucam.org>
> Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
> Cc: intel-gfx@lists.freedesktop.org
> Signed-off-by: Lv Zheng <lv.zheng@intel.com>

Makes sense. Acked for merging through acpi trees (or whatever else is
appropriate, patch seems to be part of a series).

Cheers, Daniel

> ---
>  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 ++-
>  include/acpi/acpi_io.h            |   17 +++++++++++++++++
>  include/linux/acpi.h              |    1 +
>  include/linux/acpi_io.h           |   18 ------------------
>  11 files changed, 21 insertions(+), 27 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 <linux/module.h>
>  #include <linux/init.h>
>  #include <linux/acpi.h>
> -#include <linux/acpi_io.h>
>  #include <linux/slab.h>
>  #include <linux/io.h>
>  #include <linux/kref.h>
> 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 <linux/cper.h>
>  #include <linux/acpi.h>
> -#include <linux/acpi_io.h>
>  
>  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 <linux/module.h>
>  #include <linux/init.h>
>  #include <linux/acpi.h>
> -#include <linux/acpi_io.h>
>  #include <linux/io.h>
>  #include <linux/interrupt.h>
>  #include <linux/timer.h>
> 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 <linux/mm.h>
>  #include <linux/slab.h>
>  #include <linux/acpi.h>
> -#include <linux/acpi_io.h>
>  
>  /* 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 <linux/workqueue.h>
>  #include <linux/nmi.h>
>  #include <linux/acpi.h>
> -#include <linux/acpi_io.h>
>  #include <linux/efi.h>
>  #include <linux/ioport.h>
>  #include <linux/list.h>
> 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 <linux/acpi.h>
> -#include <linux/acpi_io.h>
>  #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/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 <linux/io.h>
> +
> +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 d9099b1..726a6aa 100644
> --- a/include/linux/acpi.h
> +++ b/include/linux/acpi.h
> @@ -42,6 +42,7 @@
>  #include <acpi/acpi_bus.h>
>  #include <acpi/acpi_drivers.h>
>  #include <acpi/acpi_numa.h>
> +#include <acpi/acpi_io.h>
>  #include <asm/acpi.h>
>  
>  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 <linux/io.h>
> -#include <acpi/acpi.h>	/* 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
> -- 
> 1.7.10
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch

  reply	other threads:[~2013-12-04  8:15 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-22 23:26 [PATCH 0/4] ACPI: Cleanup header inclusions Lv Zheng
2013-11-22 23:27 ` [PATCH 1/4] ACPICA: Linux: Cleanup wrong ACPICA inclusions Lv Zheng
2013-11-25 23:54   ` Rafael J. Wysocki
2013-11-22 23:29 ` [PATCH 2/4] ACPI: Cleanup <acpi/acpi_bus.h> and <acpi/acpi_drivers.h> inclusions Lv Zheng
2013-11-26  0:06   ` Rafael J. Wysocki
2013-11-26  0:29     ` Zheng, Lv
2013-11-22 23:32 ` [PATCH 3/4] ACPICA: Cleanup <acpi/acpi.h> inclusions Lv Zheng
2013-11-22 23:37 ` [PATCH 4/4] ACPI: Add support to force header inclusion rules for <linux/acpi.h> Lv Zheng
2013-11-26  0:09   ` [UPDATE PATCH " Rafael J. Wysocki
2013-11-26  0:32     ` Zheng, Lv
2013-11-26  5:21 ` [PATCH v2] ACPI: Cleanup <acpi/acpi.h>, <acpi/acpi_bus.h> and <acpi/acpi_drivers.h> inclusions Lv Zheng
2013-11-26 20:29   ` Rafael J. Wysocki
2013-11-26 20:27     ` Matthew Garrett
2013-11-26 20:29     ` Konrad Rzeszutek Wilk
2013-11-27  0:29       ` Rafael J. Wysocki
2013-11-28  1:12         ` Zheng, Lv
2013-11-28  2:34       ` Zheng, Lv
2013-11-26 20:54     ` Greg Kroah-Hartman
2013-11-28  0:54     ` Zheng, Lv
2013-11-28 14:18     ` Rafael J. Wysocki
2013-12-03 23:57       ` Rafael J. Wysocki
2013-12-04  3:31         ` Zheng, Lv
2013-11-26 21:07   ` Bjorn Helgaas
2013-12-04  0:41 ` [UPDTE PATCH 0/3] ACPI: Cleanup direct ACPICA inclusions Lv Zheng
2013-12-04  0:38   ` [PATCH 1/3] ACPI/i915: Fix wrong <acpi/acpi.h> inclusion in i915 opregion module Lv Zheng
2013-12-04  8:16     ` Daniel Vetter [this message]
2013-12-05 13:04     ` Jani Nikula
2013-12-04  0:38   ` [PATCH 2/3] ACPI/SFI: Fix wrong <acpi/acpi.h> inclusion in SFI/ACPI wrapper - acpi_disabled linkage Lv Zheng
2013-12-04  0:38   ` [RFC PATCH 3/3] ACPI/IBFT: Fix wrong <acpi/acpi.h> inclusion in iSCSI boot firmware module Lv Zheng
2013-12-05 14:25 ` [PATCH v2] ACPI/i915: Fix wrong <acpi/acpi.h> inclusion in i915 opregion module Lv Zheng
2013-12-06  8:51 ` [PATCH v3 0/6] ACPI: Cleanup header inclusions Lv Zheng
2013-12-06  8:51   ` [PATCH v3 1/6] ACPI: Clean up incorrect inclusions of ACPICA headers Lv Zheng
2013-12-06  8:51   ` [PATCH v3 2/6] ACPI: Clean up inclusions of ACPI header files Lv Zheng
2013-12-06 14:31     ` Konrad Rzeszutek Wilk
2013-12-06  8:51   ` [PATCH v3 3/6] SFI: Fix warnings reported by W=1 builds Lv Zheng
2013-12-06  8:52   ` [PATCH v3 4/6] ACPI/i915: Fix wrong <acpi/acpi.h> inclusion in i915 opregion module Lv Zheng
2013-12-06  8:52   ` [PATCH v3 5/6] ACPI/SFI: Fix wrong <acpi/acpi.h> inclusion in SFI/ACPI wrapper - acpi_disabled linkage Lv Zheng
2013-12-06 14:53     ` Zheng, Lv
2013-12-09 23:15       ` Bjorn Helgaas
2013-12-12  1:38         ` Rafael J. Wysocki
2013-12-06  8:52   ` [PATCH v3 6/6] ACPI/IBFT: Fix wrong <acpi/acpi.h> inclusion in iSCSI boot firmware module Lv Zheng
2013-12-06 15:01     ` Zheng, Lv

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20131204081616.GY27344@phenom.ffwll.local \
    --to=daniel@ffwll.ch \
    --cc=daniel.vetter@ffwll.ch \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=len.brown@intel.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lv.zheng@intel.com \
    --cc=mjg59@srcf.ucam.org \
    --cc=rafael.j.wysocki@intel.com \
    --cc=zetalog@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).