linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1 1/2] PCI: Stub out read/write/raw/find functions
@ 2018-12-01 20:41 Sinan Kaya
  2018-12-01 20:41 ` [PATCH v1 2/2] PCI/ACPI: alloc ACPI to be built without PCI support Sinan Kaya
  2018-12-17 19:27 ` [PATCH v1 1/2] PCI: Stub out read/write/raw/find functions Bjorn Helgaas
  0 siblings, 2 replies; 8+ messages in thread
From: Sinan Kaya @ 2018-12-01 20:41 UTC (permalink / raw)
  To: linux-pci; +Cc: Sinan Kaya, Bjorn Helgaas

Need stub functions in order to be able to compile ACPI without PCI
support.

Signed-off-by: Sinan Kaya <okaya@kernel.org>
---
 include/linux/pci.h | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)

diff --git a/include/linux/pci.h b/include/linux/pci.h
index 11c71c4ecf75..15407f469d41 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -682,10 +682,22 @@ struct pci_ops {
  * ACPI needs to be able to access PCI config space before we've done a
  * PCI bus scan and created pci_bus structures.
  */
+#ifdef CONFIG_PCI
 int raw_pci_read(unsigned int domain, unsigned int bus, unsigned int devfn,
 		 int reg, int len, u32 *val);
 int raw_pci_write(unsigned int domain, unsigned int bus, unsigned int devfn,
 		  int reg, int len, u32 val);
+#else
+static inline int raw_pci_read(unsigned int domain, unsigned int bus,
+			       unsigned int devfn, int reg, int len, u32 *val)
+{
+	*val = 0;
+	return -EINVAL;
+}
+static inline int raw_pci_write(unsigned int domain, unsigned int bus,
+				unsigned int devfn, int reg, int len, u32 val)
+{ return -EINVAL; }
+#endif
 
 #ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT
 typedef u64 pci_bus_addr_t;
@@ -1599,7 +1611,27 @@ pci_release_mem_regions(struct pci_dev *pdev)
 }
 
 #else /* CONFIG_PCI is not enabled */
+static inline int pci_bus_read_config_byte(struct pci_bus *bus,
+		unsigned int devfn, int where, u8 *val)
+{ return -EINVAL; }
 
+static inline int pci_bus_read_config_word(struct pci_bus *bus,
+		unsigned int devfn, int where, u16 *val)
+{ return -EINVAL; }
+static inline int pci_bus_read_config_dword(struct pci_bus *bus,
+		unsigned int devfn, int where, u32 *val)
+{ return -EINVAL; }
+static inline int pci_bus_write_config_byte(struct pci_bus *bus,
+		unsigned int devfn, int where, u8 val)
+{ return -EINVAL; }
+static inline int pci_bus_write_config_word(struct pci_bus *bus,
+		unsigned int devfn, int where, u16 val)
+{ return -EINVAL; }
+static inline int pci_bus_write_config_dword(struct pci_bus *bus,
+		unsigned int devfn, int where, u32 val)
+{ return -EINVAL; }
+static inline struct pci_bus *pci_find_bus(int domain, int busnr)
+{ return NULL; }
 static inline void pci_set_flags(int flags) { }
 static inline void pci_add_flags(int flags) { }
 static inline void pci_clear_flags(int flags) { }
-- 
2.19.0


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v1 2/2] PCI/ACPI: alloc ACPI to be built without PCI support
  2018-12-01 20:41 [PATCH v1 1/2] PCI: Stub out read/write/raw/find functions Sinan Kaya
@ 2018-12-01 20:41 ` Sinan Kaya
  2018-12-02 17:43   ` Sinan Kaya
                     ` (2 more replies)
  2018-12-17 19:27 ` [PATCH v1 1/2] PCI: Stub out read/write/raw/find functions Bjorn Helgaas
  1 sibling, 3 replies; 8+ messages in thread
From: Sinan Kaya @ 2018-12-01 20:41 UTC (permalink / raw)
  To: linux-pci
  Cc: Sinan Kaya, Thomas Gleixner, Ingo Molnar, H. Peter Anvin, x86,
	Rafael J. Wysocki, Len Brown, Bjorn Helgaas, Robert Moore,
	Lv Zheng

We are compiling PCI code today for systems with ACPI and no PCI
device present. Remove the useless code and reduce the tight
dependency.

Signed-off-by: Sinan Kaya <okaya@kernel.org>
---
 arch/x86/include/asm/pci_x86.h | 5 +++++
 drivers/acpi/Kconfig           | 1 -
 drivers/acpi/Makefile          | 2 +-
 drivers/acpi/internal.h        | 5 +++++
 drivers/pci/Makefile           | 2 +-
 include/acpi/acpi_drivers.h    | 5 +++++
 include/linux/acpi.h           | 6 ++++++
 include/linux/pci.h            | 4 ++++
 8 files changed, 27 insertions(+), 3 deletions(-)

diff --git a/arch/x86/include/asm/pci_x86.h b/arch/x86/include/asm/pci_x86.h
index 959d618dbb17..940cf12e7d05 100644
--- a/arch/x86/include/asm/pci_x86.h
+++ b/arch/x86/include/asm/pci_x86.h
@@ -121,7 +121,12 @@ extern void __init dmi_check_pciprobe(void);
 extern void __init dmi_check_skip_isa_align(void);
 
 /* some common used subsys_initcalls */
+#ifdef CONFIG_PCI
 extern int __init pci_acpi_init(void);
+#else
+static inline int  __init pci_acpi_init(void)
+{ return -EINVAL; }
+#endif
 extern void __init pcibios_irq_init(void);
 extern int __init pcibios_init(void);
 extern int pci_legacy_init(void);
diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig
index 7cea769c37df..a0abcb3bd673 100644
--- a/drivers/acpi/Kconfig
+++ b/drivers/acpi/Kconfig
@@ -9,7 +9,6 @@ config ARCH_SUPPORTS_ACPI
 menuconfig ACPI
 	bool "ACPI (Advanced Configuration and Power Interface) Support"
 	depends on ARCH_SUPPORTS_ACPI
-	depends on PCI
 	select PNP
 	default y if X86
 	help
diff --git a/drivers/acpi/Makefile b/drivers/acpi/Makefile
index edc039313cd6..7c6afc111d76 100644
--- a/drivers/acpi/Makefile
+++ b/drivers/acpi/Makefile
@@ -39,7 +39,7 @@ acpi-y				+= processor_core.o
 acpi-$(CONFIG_ARCH_MIGHT_HAVE_ACPI_PDC) += processor_pdc.o
 acpi-y				+= ec.o
 acpi-$(CONFIG_ACPI_DOCK)	+= dock.o
-acpi-y				+= pci_root.o pci_link.o pci_irq.o
+acpi-$(CONFIG_PCI)		+= pci_root.o pci_link.o pci_irq.o
 obj-$(CONFIG_ACPI_MCFG)		+= pci_mcfg.o
 acpi-y				+= acpi_lpss.o acpi_apd.o
 acpi-y				+= acpi_platform.o
diff --git a/drivers/acpi/internal.h b/drivers/acpi/internal.h
index 530a3f675490..b7060dae2789 100644
--- a/drivers/acpi/internal.h
+++ b/drivers/acpi/internal.h
@@ -25,8 +25,13 @@ int acpi_osi_init(void);
 acpi_status acpi_os_initialize1(void);
 void init_acpi_device_notify(void);
 int acpi_scan_init(void);
+#ifdef CONFIG_PCI
 void acpi_pci_root_init(void);
 void acpi_pci_link_init(void);
+#else
+static inline void acpi_pci_root_init(void) {}
+static inline void acpi_pci_link_init(void) {}
+#endif
 void acpi_processor_init(void);
 void acpi_platform_init(void);
 void acpi_pnp_init(void);
diff --git a/drivers/pci/Makefile b/drivers/pci/Makefile
index f2bda77a2df1..657d642fcc67 100644
--- a/drivers/pci/Makefile
+++ b/drivers/pci/Makefile
@@ -11,6 +11,7 @@ ifdef CONFIG_PCI
 obj-$(CONFIG_PROC_FS)		+= proc.o
 obj-$(CONFIG_SYSFS)		+= slot.o
 obj-$(CONFIG_OF)		+= of.o
+obj-$(CONFIG_ACPI)		+= pci-acpi.o
 endif
 
 obj-$(CONFIG_PCI_QUIRKS)	+= quirks.o
@@ -20,7 +21,6 @@ obj-$(CONFIG_PCI_MSI)		+= msi.o
 obj-$(CONFIG_PCI_ATS)		+= ats.o
 obj-$(CONFIG_PCI_IOV)		+= iov.o
 obj-$(CONFIG_PCI_BRIDGE_EMUL)	+= pci-bridge-emul.o
-obj-$(CONFIG_ACPI)		+= pci-acpi.o
 obj-$(CONFIG_PCI_LABEL)		+= pci-label.o
 obj-$(CONFIG_X86_INTEL_MID)	+= pci-mid.o
 obj-$(CONFIG_PCI_SYSCALL)	+= syscall.o
diff --git a/include/acpi/acpi_drivers.h b/include/acpi/acpi_drivers.h
index 14499757338f..9b7f87d86448 100644
--- a/include/acpi/acpi_drivers.h
+++ b/include/acpi/acpi_drivers.h
@@ -88,7 +88,12 @@ int acpi_pci_link_free_irq(acpi_handle handle);
 
 struct pci_bus;
 
+#ifdef CONFIG_PCI
 struct pci_dev *acpi_get_pci_dev(acpi_handle);
+#else
+static inline struct pci_dev *acpi_get_pci_dev(acpi_handle hndl)
+{ return NULL; }
+#endif
 
 /* Arch-defined function to add a bus to the system */
 
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index ed80f147bd50..3273e7a62128 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -340,7 +340,13 @@ struct pci_dev;
 int acpi_pci_irq_enable (struct pci_dev *dev);
 void acpi_penalize_isa_irq(int irq, int active);
 bool acpi_isa_irq_available(int irq);
+#ifdef CONFIG_PCI
 void acpi_penalize_sci_irq(int irq, int trigger, int polarity);
+#else
+static inline void acpi_penalize_sci_irq(int irq, int trigger,
+					int polarity)
+{}
+#endif
 void acpi_pci_irq_disable (struct pci_dev *dev);
 
 extern int ec_read(u8 addr, u8 *val);
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 15407f469d41..206c6a55e538 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -1992,7 +1992,11 @@ int pcibios_set_pcie_reset_state(struct pci_dev *dev,
 				 enum pcie_reset_state state);
 int pcibios_add_device(struct pci_dev *dev);
 void pcibios_release_device(struct pci_dev *dev);
+#ifdef CONFIG_PCI
 void pcibios_penalize_isa_irq(int irq, int active);
+#else
+static inline void pcibios_penalize_isa_irq(int irq, int active) {}
+#endif
 int pcibios_alloc_irq(struct pci_dev *dev);
 void pcibios_free_irq(struct pci_dev *dev);
 resource_size_t pcibios_default_alignment(void);
-- 
2.19.0


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH v1 2/2] PCI/ACPI: alloc ACPI to be built without PCI support
  2018-12-01 20:41 ` [PATCH v1 2/2] PCI/ACPI: alloc ACPI to be built without PCI support Sinan Kaya
@ 2018-12-02 17:43   ` Sinan Kaya
  2018-12-03  8:19   ` Ingo Molnar
  2018-12-17 19:28   ` Bjorn Helgaas
  2 siblings, 0 replies; 8+ messages in thread
From: Sinan Kaya @ 2018-12-02 17:43 UTC (permalink / raw)
  To: linux-pci
  Cc: Thomas Gleixner, Ingo Molnar, H. Peter Anvin, x86,
	Rafael J. Wysocki, Len Brown, Bjorn Helgaas, Robert Moore,
	Lv Zheng, open list:ACPI

+linux-acpi was dropped for some reason.

On 12/1/2018 3:41 PM, Sinan Kaya wrote:
> We are compiling PCI code today for systems with ACPI and no PCI
> device present. Remove the useless code and reduce the tight
> dependency.
> 
> Signed-off-by: Sinan Kaya <okaya@kernel.org>
> ---
>   arch/x86/include/asm/pci_x86.h | 5 +++++
>   drivers/acpi/Kconfig           | 1 -
>   drivers/acpi/Makefile          | 2 +-
>   drivers/acpi/internal.h        | 5 +++++
>   drivers/pci/Makefile           | 2 +-
>   include/acpi/acpi_drivers.h    | 5 +++++
>   include/linux/acpi.h           | 6 ++++++
>   include/linux/pci.h            | 4 ++++
>   8 files changed, 27 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/x86/include/asm/pci_x86.h b/arch/x86/include/asm/pci_x86.h
> index 959d618dbb17..940cf12e7d05 100644
> --- a/arch/x86/include/asm/pci_x86.h
> +++ b/arch/x86/include/asm/pci_x86.h
> @@ -121,7 +121,12 @@ extern void __init dmi_check_pciprobe(void);
>   extern void __init dmi_check_skip_isa_align(void);
>   
>   /* some common used subsys_initcalls */
> +#ifdef CONFIG_PCI
>   extern int __init pci_acpi_init(void);
> +#else
> +static inline int  __init pci_acpi_init(void)
> +{ return -EINVAL; }
> +#endif
>   extern void __init pcibios_irq_init(void);
>   extern int __init pcibios_init(void);
>   extern int pci_legacy_init(void);
> diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig
> index 7cea769c37df..a0abcb3bd673 100644
> --- a/drivers/acpi/Kconfig
> +++ b/drivers/acpi/Kconfig
> @@ -9,7 +9,6 @@ config ARCH_SUPPORTS_ACPI
>   menuconfig ACPI
>   	bool "ACPI (Advanced Configuration and Power Interface) Support"
>   	depends on ARCH_SUPPORTS_ACPI
> -	depends on PCI
>   	select PNP
>   	default y if X86
>   	help
> diff --git a/drivers/acpi/Makefile b/drivers/acpi/Makefile
> index edc039313cd6..7c6afc111d76 100644
> --- a/drivers/acpi/Makefile
> +++ b/drivers/acpi/Makefile
> @@ -39,7 +39,7 @@ acpi-y				+= processor_core.o
>   acpi-$(CONFIG_ARCH_MIGHT_HAVE_ACPI_PDC) += processor_pdc.o
>   acpi-y				+= ec.o
>   acpi-$(CONFIG_ACPI_DOCK)	+= dock.o
> -acpi-y				+= pci_root.o pci_link.o pci_irq.o
> +acpi-$(CONFIG_PCI)		+= pci_root.o pci_link.o pci_irq.o
>   obj-$(CONFIG_ACPI_MCFG)		+= pci_mcfg.o
>   acpi-y				+= acpi_lpss.o acpi_apd.o
>   acpi-y				+= acpi_platform.o
> diff --git a/drivers/acpi/internal.h b/drivers/acpi/internal.h
> index 530a3f675490..b7060dae2789 100644
> --- a/drivers/acpi/internal.h
> +++ b/drivers/acpi/internal.h
> @@ -25,8 +25,13 @@ int acpi_osi_init(void);
>   acpi_status acpi_os_initialize1(void);
>   void init_acpi_device_notify(void);
>   int acpi_scan_init(void);
> +#ifdef CONFIG_PCI
>   void acpi_pci_root_init(void);
>   void acpi_pci_link_init(void);
> +#else
> +static inline void acpi_pci_root_init(void) {}
> +static inline void acpi_pci_link_init(void) {}
> +#endif
>   void acpi_processor_init(void);
>   void acpi_platform_init(void);
>   void acpi_pnp_init(void);
> diff --git a/drivers/pci/Makefile b/drivers/pci/Makefile
> index f2bda77a2df1..657d642fcc67 100644
> --- a/drivers/pci/Makefile
> +++ b/drivers/pci/Makefile
> @@ -11,6 +11,7 @@ ifdef CONFIG_PCI
>   obj-$(CONFIG_PROC_FS)		+= proc.o
>   obj-$(CONFIG_SYSFS)		+= slot.o
>   obj-$(CONFIG_OF)		+= of.o
> +obj-$(CONFIG_ACPI)		+= pci-acpi.o
>   endif
>   
>   obj-$(CONFIG_PCI_QUIRKS)	+= quirks.o
> @@ -20,7 +21,6 @@ obj-$(CONFIG_PCI_MSI)		+= msi.o
>   obj-$(CONFIG_PCI_ATS)		+= ats.o
>   obj-$(CONFIG_PCI_IOV)		+= iov.o
>   obj-$(CONFIG_PCI_BRIDGE_EMUL)	+= pci-bridge-emul.o
> -obj-$(CONFIG_ACPI)		+= pci-acpi.o
>   obj-$(CONFIG_PCI_LABEL)		+= pci-label.o
>   obj-$(CONFIG_X86_INTEL_MID)	+= pci-mid.o
>   obj-$(CONFIG_PCI_SYSCALL)	+= syscall.o
> diff --git a/include/acpi/acpi_drivers.h b/include/acpi/acpi_drivers.h
> index 14499757338f..9b7f87d86448 100644
> --- a/include/acpi/acpi_drivers.h
> +++ b/include/acpi/acpi_drivers.h
> @@ -88,7 +88,12 @@ int acpi_pci_link_free_irq(acpi_handle handle);
>   
>   struct pci_bus;
>   
> +#ifdef CONFIG_PCI
>   struct pci_dev *acpi_get_pci_dev(acpi_handle);
> +#else
> +static inline struct pci_dev *acpi_get_pci_dev(acpi_handle hndl)
> +{ return NULL; }
> +#endif
>   
>   /* Arch-defined function to add a bus to the system */
>   
> diff --git a/include/linux/acpi.h b/include/linux/acpi.h
> index ed80f147bd50..3273e7a62128 100644
> --- a/include/linux/acpi.h
> +++ b/include/linux/acpi.h
> @@ -340,7 +340,13 @@ struct pci_dev;
>   int acpi_pci_irq_enable (struct pci_dev *dev);
>   void acpi_penalize_isa_irq(int irq, int active);
>   bool acpi_isa_irq_available(int irq);
> +#ifdef CONFIG_PCI
>   void acpi_penalize_sci_irq(int irq, int trigger, int polarity);
> +#else
> +static inline void acpi_penalize_sci_irq(int irq, int trigger,
> +					int polarity)
> +{}
> +#endif
>   void acpi_pci_irq_disable (struct pci_dev *dev);
>   
>   extern int ec_read(u8 addr, u8 *val);
> diff --git a/include/linux/pci.h b/include/linux/pci.h
> index 15407f469d41..206c6a55e538 100644
> --- a/include/linux/pci.h
> +++ b/include/linux/pci.h
> @@ -1992,7 +1992,11 @@ int pcibios_set_pcie_reset_state(struct pci_dev *dev,
>   				 enum pcie_reset_state state);
>   int pcibios_add_device(struct pci_dev *dev);
>   void pcibios_release_device(struct pci_dev *dev);
> +#ifdef CONFIG_PCI
>   void pcibios_penalize_isa_irq(int irq, int active);
> +#else
> +static inline void pcibios_penalize_isa_irq(int irq, int active) {}
> +#endif
>   int pcibios_alloc_irq(struct pci_dev *dev);
>   void pcibios_free_irq(struct pci_dev *dev);
>   resource_size_t pcibios_default_alignment(void);
> 

I'll fix the typo in commit message on the next revision. Seeking feedback at
this moment.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v1 2/2] PCI/ACPI: alloc ACPI to be built without PCI support
  2018-12-01 20:41 ` [PATCH v1 2/2] PCI/ACPI: alloc ACPI to be built without PCI support Sinan Kaya
  2018-12-02 17:43   ` Sinan Kaya
@ 2018-12-03  8:19   ` Ingo Molnar
  2018-12-03 14:02     ` Sinan Kaya
  2018-12-17 19:28   ` Bjorn Helgaas
  2 siblings, 1 reply; 8+ messages in thread
From: Ingo Molnar @ 2018-12-03  8:19 UTC (permalink / raw)
  To: Sinan Kaya
  Cc: linux-pci, Thomas Gleixner, Ingo Molnar, H. Peter Anvin, x86,
	Rafael J. Wysocki, Len Brown, Bjorn Helgaas, Robert Moore,
	Lv Zheng


* Sinan Kaya <okaya@kernel.org> wrote:

> We are compiling PCI code today for systems with ACPI and no PCI
> device present. Remove the useless code and reduce the tight
> dependency.
> 
> Signed-off-by: Sinan Kaya <okaya@kernel.org>
> ---
>  arch/x86/include/asm/pci_x86.h | 5 +++++
>  drivers/acpi/Kconfig           | 1 -
>  drivers/acpi/Makefile          | 2 +-
>  drivers/acpi/internal.h        | 5 +++++
>  drivers/pci/Makefile           | 2 +-
>  include/acpi/acpi_drivers.h    | 5 +++++
>  include/linux/acpi.h           | 6 ++++++
>  include/linux/pci.h            | 4 ++++
>  8 files changed, 27 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/x86/include/asm/pci_x86.h b/arch/x86/include/asm/pci_x86.h
> index 959d618dbb17..940cf12e7d05 100644
> --- a/arch/x86/include/asm/pci_x86.h
> +++ b/arch/x86/include/asm/pci_x86.h
> @@ -121,7 +121,12 @@ extern void __init dmi_check_pciprobe(void);
>  extern void __init dmi_check_skip_isa_align(void);
>  
>  /* some common used subsys_initcalls */
> +#ifdef CONFIG_PCI
>  extern int __init pci_acpi_init(void);
> +#else
> +static inline int  __init pci_acpi_init(void)
> +{ return -EINVAL; }
> +#endif

No objections to removing the dependency, but that's nowhere near
standard kernel style. ;-)

(There are similar problems elsewhere in the patch as well, please fix 
all of them.)

Thanks,

	Ingo

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v1 2/2] PCI/ACPI: alloc ACPI to be built without PCI support
  2018-12-03  8:19   ` Ingo Molnar
@ 2018-12-03 14:02     ` Sinan Kaya
  0 siblings, 0 replies; 8+ messages in thread
From: Sinan Kaya @ 2018-12-03 14:02 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-pci, Thomas Gleixner, Ingo Molnar, H. Peter Anvin, x86,
	Rafael J. Wysocki, Len Brown, Bjorn Helgaas, Robert Moore,
	Lv Zheng

On 12/3/2018 3:19 AM, Ingo Molnar wrote:
> 
> * Sinan Kaya <okaya@kernel.org> wrote:
> 
>> We are compiling PCI code today for systems with ACPI and no PCI
>> device present. Remove the useless code and reduce the tight
>> dependency.
>>
>> Signed-off-by: Sinan Kaya <okaya@kernel.org>
>> ---
>>   arch/x86/include/asm/pci_x86.h | 5 +++++
>>   drivers/acpi/Kconfig           | 1 -
>>   drivers/acpi/Makefile          | 2 +-
>>   drivers/acpi/internal.h        | 5 +++++
>>   drivers/pci/Makefile           | 2 +-
>>   include/acpi/acpi_drivers.h    | 5 +++++
>>   include/linux/acpi.h           | 6 ++++++
>>   include/linux/pci.h            | 4 ++++
>>   8 files changed, 27 insertions(+), 3 deletions(-)
>>
>> diff --git a/arch/x86/include/asm/pci_x86.h b/arch/x86/include/asm/pci_x86.h
>> index 959d618dbb17..940cf12e7d05 100644
>> --- a/arch/x86/include/asm/pci_x86.h
>> +++ b/arch/x86/include/asm/pci_x86.h
>> @@ -121,7 +121,12 @@ extern void __init dmi_check_pciprobe(void);
>>   extern void __init dmi_check_skip_isa_align(void);
>>   
>>   /* some common used subsys_initcalls */
>> +#ifdef CONFIG_PCI
>>   extern int __init pci_acpi_init(void);
>> +#else
>> +static inline int  __init pci_acpi_init(void)
>> +{ return -EINVAL; }
>> +#endif
> 
> No objections to removing the dependency, but that's nowhere near
> standard kernel style. ;-)
> 

Great,

> (There are similar problems elsewhere in the patch as well, please fix
> all of them.)

I sure can fix them but I copied the stub style from existing other stub
functions in the same file and did run checkpatch before submitting.

If you can point me to the specific ones you would like to see or give an
idea what it needs to look like, I can change it.

I saw three different styles as follows:

static inline int  __init pci_acpi_init(void) {}

static inline int  __init pci_acpi_init(void)
{}

static inline int  __init pci_acpi_init(void)
{
}


> 
> Thanks,
> 
> 	Ingo
> 


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v1 1/2] PCI: Stub out read/write/raw/find functions
  2018-12-01 20:41 [PATCH v1 1/2] PCI: Stub out read/write/raw/find functions Sinan Kaya
  2018-12-01 20:41 ` [PATCH v1 2/2] PCI/ACPI: alloc ACPI to be built without PCI support Sinan Kaya
@ 2018-12-17 19:27 ` Bjorn Helgaas
  2018-12-18  1:52   ` Sinan Kaya
  1 sibling, 1 reply; 8+ messages in thread
From: Bjorn Helgaas @ 2018-12-17 19:27 UTC (permalink / raw)
  To: Sinan Kaya; +Cc: linux-pci

On Sat, Dec 01, 2018 at 08:41:35PM +0000, Sinan Kaya wrote:
> Need stub functions in order to be able to compile ACPI without PCI
> support.
> 
> Signed-off-by: Sinan Kaya <okaya@kernel.org>

I can't tell where this series is since I only got the pieces that
touch PCI and the version numbers and n/n numbers don't make much
sense then, so apologies if I'm responding to an obsolete patch.

> ---
>  include/linux/pci.h | 32 ++++++++++++++++++++++++++++++++
>  1 file changed, 32 insertions(+)
> 
> diff --git a/include/linux/pci.h b/include/linux/pci.h
> index 11c71c4ecf75..15407f469d41 100644
> --- a/include/linux/pci.h
> +++ b/include/linux/pci.h
> @@ -682,10 +682,22 @@ struct pci_ops {
>   * ACPI needs to be able to access PCI config space before we've done a
>   * PCI bus scan and created pci_bus structures.
>   */
> +#ifdef CONFIG_PCI
>  int raw_pci_read(unsigned int domain, unsigned int bus, unsigned int devfn,
>  		 int reg, int len, u32 *val);
>  int raw_pci_write(unsigned int domain, unsigned int bus, unsigned int devfn,
>  		  int reg, int len, u32 val);
> +#else
> +static inline int raw_pci_read(unsigned int domain, unsigned int bus,
> +			       unsigned int devfn, int reg, int len, u32 *val)
> +{
> +	*val = 0;
> +	return -EINVAL;

Why do you return 0 here?  If a PCI config access fails, you usually
get ~0.

> +}
> +static inline int raw_pci_write(unsigned int domain, unsigned int bus,
> +				unsigned int devfn, int reg, int len, u32 val)
> +{ return -EINVAL; }
> +#endif
>  
>  #ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT
>  typedef u64 pci_bus_addr_t;
> @@ -1599,7 +1611,27 @@ pci_release_mem_regions(struct pci_dev *pdev)
>  }
>  
>  #else /* CONFIG_PCI is not enabled */
> +static inline int pci_bus_read_config_byte(struct pci_bus *bus,
> +		unsigned int devfn, int where, u8 *val)
> +{ return -EINVAL; }

Should these set *val as well?  To ~0 (or 0) to match above, I assume?

> +static inline int pci_bus_read_config_word(struct pci_bus *bus,
> +		unsigned int devfn, int where, u16 *val)
> +{ return -EINVAL; }
> +static inline int pci_bus_read_config_dword(struct pci_bus *bus,
> +		unsigned int devfn, int where, u32 *val)
> +{ return -EINVAL; }
> +static inline int pci_bus_write_config_byte(struct pci_bus *bus,
> +		unsigned int devfn, int where, u8 val)
> +{ return -EINVAL; }
> +static inline int pci_bus_write_config_word(struct pci_bus *bus,
> +		unsigned int devfn, int where, u16 val)
> +{ return -EINVAL; }
> +static inline int pci_bus_write_config_dword(struct pci_bus *bus,
> +		unsigned int devfn, int where, u32 val)
> +{ return -EINVAL; }
> +static inline struct pci_bus *pci_find_bus(int domain, int busnr)
> +{ return NULL; }
>  static inline void pci_set_flags(int flags) { }
>  static inline void pci_add_flags(int flags) { }
>  static inline void pci_clear_flags(int flags) { }
> -- 
> 2.19.0
> 

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v1 2/2] PCI/ACPI: alloc ACPI to be built without PCI support
  2018-12-01 20:41 ` [PATCH v1 2/2] PCI/ACPI: alloc ACPI to be built without PCI support Sinan Kaya
  2018-12-02 17:43   ` Sinan Kaya
  2018-12-03  8:19   ` Ingo Molnar
@ 2018-12-17 19:28   ` Bjorn Helgaas
  2 siblings, 0 replies; 8+ messages in thread
From: Bjorn Helgaas @ 2018-12-17 19:28 UTC (permalink / raw)
  To: Sinan Kaya
  Cc: linux-pci, Thomas Gleixner, Ingo Molnar, H. Peter Anvin, x86,
	Rafael J. Wysocki, Len Brown, Robert Moore, Lv Zheng

s/alloc/Allow/ in subject

On Sat, Dec 01, 2018 at 08:41:36PM +0000, Sinan Kaya wrote:
> We are compiling PCI code today for systems with ACPI and no PCI
> device present. Remove the useless code and reduce the tight
> dependency.
> 
> Signed-off-by: Sinan Kaya <okaya@kernel.org>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v1 1/2] PCI: Stub out read/write/raw/find functions
  2018-12-17 19:27 ` [PATCH v1 1/2] PCI: Stub out read/write/raw/find functions Bjorn Helgaas
@ 2018-12-18  1:52   ` Sinan Kaya
  0 siblings, 0 replies; 8+ messages in thread
From: Sinan Kaya @ 2018-12-18  1:52 UTC (permalink / raw)
  To: Bjorn Helgaas; +Cc: linux-pci

On Mon, Dec 17, 2018 at 8:27 PM Bjorn Helgaas <helgaas@kernel.org> wrote:
>
> On Sat, Dec 01, 2018 at 08:41:35PM +0000, Sinan Kaya wrote:
> > Need stub functions in order to be able to compile ACPI without PCI
> > support.
> >
> > Signed-off-by: Sinan Kaya <okaya@kernel.org>
>
> I can't tell where this series is since I only got the pieces that
> touch PCI and the version numbers and n/n numbers don't make much
> sense then, so apologies if I'm responding to an obsolete patch.

Yes, this is an older version of the patch series for removing coupling between
ACPI and PCI.

>
> > ---
> >  include/linux/pci.h | 32 ++++++++++++++++++++++++++++++++
> >  1 file changed, 32 insertions(+)
> >
> > diff --git a/include/linux/pci.h b/include/linux/pci.h
> > index 11c71c4ecf75..15407f469d41 100644
> > --- a/include/linux/pci.h
> > +++ b/include/linux/pci.h
> > @@ -682,10 +682,22 @@ struct pci_ops {
> >   * ACPI needs to be able to access PCI config space before we've done a
> >   * PCI bus scan and created pci_bus structures.
> >   */
> > +#ifdef CONFIG_PCI
> >  int raw_pci_read(unsigned int domain, unsigned int bus, unsigned int devfn,
> >                int reg, int len, u32 *val);
> >  int raw_pci_write(unsigned int domain, unsigned int bus, unsigned int devfn,
> >                 int reg, int len, u32 val);
> > +#else
> > +static inline int raw_pci_read(unsigned int domain, unsigned int bus,
> > +                            unsigned int devfn, int reg, int len, u32 *val)
> > +{
> > +     *val = 0;
> > +     return -EINVAL;
>
> Why do you return 0 here?  If a PCI config access fails, you usually
> get ~0.
>
> > +}
> > +static inline int raw_pci_write(unsigned int domain, unsigned int bus,
> > +                             unsigned int devfn, int reg, int len, u32 val)
> > +{ return -EINVAL; }
> > +#endif
> >
> >  #ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT
> >  typedef u64 pci_bus_addr_t;
> > @@ -1599,7 +1611,27 @@ pci_release_mem_regions(struct pci_dev *pdev)
> >  }
> >
> >  #else /* CONFIG_PCI is not enabled */
> > +static inline int pci_bus_read_config_byte(struct pci_bus *bus,
> > +             unsigned int devfn, int where, u8 *val)
> > +{ return -EINVAL; }
>
> Should these set *val as well?  To ~0 (or 0) to match above, I assume?
>
> > +static inline int pci_bus_read_config_word(struct pci_bus *bus,
> > +             unsigned int devfn, int where, u16 *val)
> > +{ return -EINVAL; }
> > +static inline int pci_bus_read_config_dword(struct pci_bus *bus,
> > +             unsigned int devfn, int where, u32 *val)
> > +{ return -EINVAL; }
> > +static inline int pci_bus_write_config_byte(struct pci_bus *bus,
> > +             unsigned int devfn, int where, u8 val)
> > +{ return -EINVAL; }
> > +static inline int pci_bus_write_config_word(struct pci_bus *bus,
> > +             unsigned int devfn, int where, u16 val)
> > +{ return -EINVAL; }
> > +static inline int pci_bus_write_config_dword(struct pci_bus *bus,
> > +             unsigned int devfn, int where, u32 val)
> > +{ return -EINVAL; }
> > +static inline struct pci_bus *pci_find_bus(int domain, int busnr)
> > +{ return NULL; }
> >  static inline void pci_set_flags(int flags) { }
> >  static inline void pci_add_flags(int flags) { }
> >  static inline void pci_clear_flags(int flags) { }
> > --
> > 2.19.0
> >

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2018-12-18  1:52 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-01 20:41 [PATCH v1 1/2] PCI: Stub out read/write/raw/find functions Sinan Kaya
2018-12-01 20:41 ` [PATCH v1 2/2] PCI/ACPI: alloc ACPI to be built without PCI support Sinan Kaya
2018-12-02 17:43   ` Sinan Kaya
2018-12-03  8:19   ` Ingo Molnar
2018-12-03 14:02     ` Sinan Kaya
2018-12-17 19:28   ` Bjorn Helgaas
2018-12-17 19:27 ` [PATCH v1 1/2] PCI: Stub out read/write/raw/find functions Bjorn Helgaas
2018-12-18  1:52   ` Sinan Kaya

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).