diff mbox series

[v11,2/7] ACPI / OSL: Stub out acpi_os_(read/write)_pci_configurations()

Message ID 20181218025606.32668-3-okaya@kernel.org (mailing list archive)
State Changes Requested, archived
Headers show
Series ACPI: Allow ACPI to be built without CONFIG_PCI set | expand

Commit Message

Sinan Kaya Dec. 18, 2018, 2:56 a.m. UTC
Getting ready to allow CONFIG_PCI to be unset with ACPI enabled. Stub out
acpi_os_read_pci_configuration and acpi_os_write_pci_configuration
functions when CONFIG_PCI is not defined.

Signed-off-by: Sinan Kaya <okaya@kernel.org>
---
 drivers/acpi/osl.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

Comments

Christoph Hellwig Dec. 18, 2018, 7:32 a.m. UTC | #1
On Tue, Dec 18, 2018 at 02:56:01AM +0000, Sinan Kaya wrote:
> Getting ready to allow CONFIG_PCI to be unset with ACPI enabled. Stub out
> acpi_os_read_pci_configuration and acpi_os_write_pci_configuration
> functions when CONFIG_PCI is not defined.
> 
> Signed-off-by: Sinan Kaya <okaya@kernel.org>
> ---
>  drivers/acpi/osl.c | 14 ++++++++++++++
>  1 file changed, 14 insertions(+)
> 
> diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c
> index b48874b8e1ea..524fd5f33ea4 100644
> --- a/drivers/acpi/osl.c
> +++ b/drivers/acpi/osl.c
> @@ -773,6 +773,7 @@ acpi_status
>  acpi_os_read_pci_configuration(struct acpi_pci_id * pci_id, u32 reg,
>  			       u64 *value, u32 width)
>  {
> +#ifdef CONFIG_PCI
>  	int result, size;
>  	u32 value32;
>  
> @@ -799,12 +800,19 @@ acpi_os_read_pci_configuration(struct acpi_pci_id * pci_id, u32 reg,
>  	*value = value32;
>  
>  	return (result ? AE_ERROR : AE_OK);
> +#else
> +	int rc;
> +
> +	rc = pr_warn_once("PCI configuration space access is not supported\n");
> +	return rc ? AE_SUPPORT : AE_OK;
> +#endif

Normally we provide a full separate stub version.  If we have enough
of them in a separate file.
Sinan Kaya Dec. 19, 2018, 10:22 p.m. UTC | #2
On 12/18/2018 8:32 AM, Christoph Hellwig wrote:
>> +
>> +	rc = pr_warn_once("PCI configuration space access is not supported\n");
>> +	return rc ? AE_SUPPORT : AE_OK;
>> +#endif
> Normally we provide a full separate stub version.  If we have enough
> of them in a separate file.
> 

I removed the dependent functions from ACPICA and moved #ifdef outside of these
two function scopes.

Got rid of the inline piece.
diff mbox series

Patch

diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c
index b48874b8e1ea..524fd5f33ea4 100644
--- a/drivers/acpi/osl.c
+++ b/drivers/acpi/osl.c
@@ -773,6 +773,7 @@  acpi_status
 acpi_os_read_pci_configuration(struct acpi_pci_id * pci_id, u32 reg,
 			       u64 *value, u32 width)
 {
+#ifdef CONFIG_PCI
 	int result, size;
 	u32 value32;
 
@@ -799,12 +800,19 @@  acpi_os_read_pci_configuration(struct acpi_pci_id * pci_id, u32 reg,
 	*value = value32;
 
 	return (result ? AE_ERROR : AE_OK);
+#else
+	int rc;
+
+	rc = pr_warn_once("PCI configuration space access is not supported\n");
+	return rc ? AE_SUPPORT : AE_OK;
+#endif
 }
 
 acpi_status
 acpi_os_write_pci_configuration(struct acpi_pci_id * pci_id, u32 reg,
 				u64 value, u32 width)
 {
+#ifdef CONFIG_PCI
 	int result, size;
 
 	switch (width) {
@@ -826,6 +834,12 @@  acpi_os_write_pci_configuration(struct acpi_pci_id * pci_id, u32 reg,
 				reg, size, value);
 
 	return (result ? AE_ERROR : AE_OK);
+#else
+	int rc;
+
+	rc = pr_warn_once("PCI configuration space access is not supported\n");
+	return rc ? AE_SUPPORT : AE_OK;
+#endif
 }
 
 static void acpi_os_execute_deferred(struct work_struct *work)