diff mbox

[net-next,06/11] ACPI: bus: move acpi_match_device_ids() to linux/acpi.h

Message ID 1463127557-90824-7-git-send-email-Yisen.Zhuang@huawei.com
State Changes Requested, archived
Delegated to: David Miller
Headers show

Commit Message

Yisen.Zhuang(Zhuangyuzeng) May 13, 2016, 8:19 a.m. UTC
From: Hanjun Guo <hanjun.guo@linaro.org>

acpi_match_device_ids() will be used for drivers to match
different hardware versions, it will be compiled in non-ACPI
case, but acpi_match_device_ids() in acpi_bus.h and it can
only be used in ACPI case, so move it to linux/acpi.h and
introduce a stub function for it.

Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
Cc: Rafael J. Wysocki <rjw@rjwysocki.net>
Signed-off-by: Kejian Yan <yankejian@huawei.com>
Signed-off-by: Yisen Zhuang <Yisen.Zhuang@huawei.com>
---
 include/acpi/acpi_bus.h |  2 --
 include/linux/acpi.h    | 11 +++++++++++
 2 files changed, 11 insertions(+), 2 deletions(-)

Comments

Andy Shevchenko May 13, 2016, 1:15 p.m. UTC | #1
On Fri, 2016-05-13 at 16:19 +0800, Yisen Zhuang wrote:
> From: Hanjun Guo <hanjun.guo@linaro.org>
> 
> acpi_match_device_ids() will be used for drivers to match
> different hardware versions, it will be compiled in non-ACPI
> case, but acpi_match_device_ids() in acpi_bus.h and it can
> only be used in ACPI case, so move it to linux/acpi.h and
> introduce a stub function for it.

I somehow doubt this is right move.

Like I said in the previous comment the architectural split might make
this a bit better.

You might use 

#ifdef IS_ENABLED(CONFIG_ACPI)
#else
#endif

only once to some big part of code. If kernel is build without ACPI
support you even will not have this in your driver at all.

-- 
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Intel Finland Oy
yankejian May 16, 2016, 1:57 a.m. UTC | #2
On 2016/5/13 21:15, Andy Shevchenko wrote:
> On Fri, 2016-05-13 at 16:19 +0800, Yisen Zhuang wrote:
>> From: Hanjun Guo <hanjun.guo@linaro.org>
>>
>> acpi_match_device_ids() will be used for drivers to match
>> different hardware versions, it will be compiled in non-ACPI
>> case, but acpi_match_device_ids() in acpi_bus.h and it can
>> only be used in ACPI case, so move it to linux/acpi.h and
>> introduce a stub function for it.
> I somehow doubt this is right move.
>
> Like I said in the previous comment the architectural split might make
> this a bit better.
>
> You might use 
>
> #ifdef IS_ENABLED(CONFIG_ACPI)
> #else
> #endif
>
> only once to some big part of code. If kernel is build without ACPI
> support you even will not have this in your driver at all.

Hi Andy,

Thanks for your suggestions. It will add stub function instead in next submit.


> -- 
> Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> Intel Finland Oy
>
>
> .
>
diff mbox

Patch

diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h
index 3a93250..12cf2cb 100644
--- a/include/acpi/acpi_bus.h
+++ b/include/acpi/acpi_bus.h
@@ -513,8 +513,6 @@  void acpi_bus_unregister_driver(struct acpi_driver *driver);
 int acpi_bus_scan(acpi_handle handle);
 void acpi_bus_trim(struct acpi_device *start);
 acpi_status acpi_bus_get_ejd(acpi_handle handle, acpi_handle * ejd);
-int acpi_match_device_ids(struct acpi_device *device,
-			  const struct acpi_device_id *ids);
 int acpi_create_dir(struct acpi_device *);
 void acpi_remove_dir(struct acpi_device *);
 
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index 06ed7e5..e578bce 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -933,7 +933,18 @@  int __acpi_probe_device_table(struct acpi_probe_entry *start, int nr);
 					  (&ACPI_PROBE_TABLE_END(t) -	\
 					   &ACPI_PROBE_TABLE(t)));	\
 	})
+
+int acpi_match_device_ids(struct acpi_device *device,
+			  const struct acpi_device_id *ids);
+
 #else
+
+static inline int acpi_match_device_ids(struct acpi_device *device,
+					const struct acpi_device_id *ids)
+{
+	return -ENOENT;
+}
+
 static inline int acpi_dev_get_property(struct acpi_device *adev,
 					const char *name, acpi_object_type type,
 					const union acpi_object **obj)