[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1520401742-29371-1-git-send-email-anjiandi@codeaurora.org>
Date: Tue, 6 Mar 2018 23:49:02 -0600
From: Jiandi An <anjiandi@...eaurora.org>
To: minyard@....org, arnd@...db.de, gregkh@...uxfoundation.org,
anjiandi@...eaurora.org
Cc: openipmi-developer@...ts.sourceforge.net,
linux-kernel@...r.kernel.org
Subject: [PATCH] ipmi:ssif: Fix double probe from tryacpi and trydmi
IPMI SSIF driver's parameter tryacpi and trydmi both
are set to true. The addition of IPMI DMI driver to
create platform device for each IPMI device causes
SSIF probe to be done twice on the same SMB I2C address
for BMC. Fix is to not call trydmi if tryacpi is able
to find I2C address for BMC from SPMI ACPI table and
probe successfully.
Signed-off-by: Jiandi An <anjiandi@...eaurora.org>
---
drivers/char/ipmi/ipmi_ssif.c | 35 ++++++++++++++++++++++++-----------
1 file changed, 24 insertions(+), 11 deletions(-)
diff --git a/drivers/char/ipmi/ipmi_ssif.c b/drivers/char/ipmi/ipmi_ssif.c
index 9d3b0fa..5c57363 100644
--- a/drivers/char/ipmi/ipmi_ssif.c
+++ b/drivers/char/ipmi/ipmi_ssif.c
@@ -1981,29 +1981,41 @@ static int try_init_spmi(struct SPMITable *spmi)
return new_ssif_client(myaddr, NULL, 0, 0, SI_SPMI, NULL);
}
-static void spmi_find_bmc(void)
+static int spmi_find_bmc(void)
{
acpi_status status;
struct SPMITable *spmi;
int i;
+ int rc = 0;
if (acpi_disabled)
- return;
+ return -EPERM;
if (acpi_failure)
- return;
+ return -ENODEV;
for (i = 0; ; i++) {
status = acpi_get_table(ACPI_SIG_SPMI, i+1,
(struct acpi_table_header **)&spmi);
- if (status != AE_OK)
- return;
+ if (status != AE_OK) {
+ if (i == 0)
+ return -ENODEV;
+ else
+ return 0;
+ }
- try_init_spmi(spmi);
+ rc = try_init_spmi(spmi);
+ if (rc)
+ return rc;
}
+
+ return 0;
}
#else
-static void spmi_find_bmc(void) { }
+static int spmi_find_bmc(void)
+{
+ return -ENODEV;
+}
#endif
#ifdef CONFIG_DMI
@@ -2104,12 +2116,13 @@ static int init_ipmi_ssif(void)
addr[i]);
}
- if (ssif_tryacpi)
+ if (ssif_tryacpi) {
ssif_i2c_driver.driver.acpi_match_table =
ACPI_PTR(ssif_acpi_match);
-
- if (ssif_tryacpi)
- spmi_find_bmc();
+ rv = spmi_find_bmc();
+ if (!rv)
+ ssif_trydmi = false;
+ }
if (ssif_trydmi) {
rv = platform_driver_register(&ipmi_driver);
--
Jiandi An
Qualcomm Datacenter Technologies, Inc. as an affiliate of Qualcomm Technologies, Inc.
Qualcomm Technologies, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project.
Powered by blists - more mailing lists