I'm looking for a best practices solution for the following.

Commit 0fbcf4af7c introduces a problem when compiling ipmi/ipmi_si_intf.c
for platforms that do not have acpi support.

The offending code is here ...

2822 static struct platform_driver ipmi_driver = {
2823         .driver = {
2824                 .name = DEVICE_NAME,
2825                 .of_match_table = of_ipmi_match,
2826                 .acpi_match_table = ACPI_PTR(acpi_ipmi_match),
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2827         },
2828         .probe          = ipmi_probe,
2829         .remove         = ipmi_remove,
2830 };

Compile succeeds if line 2826 is conditionally compiled with
CONFIG_ACPI.

Suggested patch for that would be ....

diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c
index 73e6b2a..f4a1099 100644
--- a/drivers/char/ipmi/ipmi_si_intf.c
+++ b/drivers/char/ipmi/ipmi_si_intf.c
@@ -2814,7 +2814,9 @@ static struct platform_driver ipmi_driver = {
         .driver = {
                 .name = DEVICE_NAME,
                 .of_match_table = of_ipmi_match,
+#ifdef CONFIG_ACPI
                 .acpi_match_table = ACPI_PTR(acpi_ipmi_match),
+#endif
         },
         .probe          = ipmi_probe,
         .remove         = ipmi_remove,
---


Alternatively, we could move #include <linux/acpi.h> out of the
conditional CONFIG_ACPI compile, here ....

2055 #ifdef CONFIG_ACPI
2056
2057 #include <linux/acpi.h>
2058

acpi.h already contains conditional compile directives for CONFIG_ACPI,
so it could be considered redundant to conditionally compile the
whole header.

Suggested patch for that would be ....

diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c
index f4a1099..7e9807d 100644
--- a/drivers/char/ipmi/ipmi_si_intf.c
+++ b/drivers/char/ipmi/ipmi_si_intf.c
@@ -68,6 +68,7 @@
  #include <linux/of_platform.h>
  #include <linux/of_address.h>
  #include <linux/of_irq.h>
+#[email protected] <linux/acpi.h>
  
  #define PFX "ipmi_si: "
  
@@ -2048,8 +2049,6 @@ static int hardcode_find_bmc(void)
  
  #ifdef CONFIG_ACPI
  
-#include <linux/acpi.h>
-
  /*
   * Once we get an ACPI failure, we don't try any more, because we go
   * through the tables sequentially.  Once we don't find a table, there





------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140
_______________________________________________
Openipmi-developer mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openipmi-developer

Reply via email to