Skip to content

Commit 18aa0dd

Browse files
committed
Merge tag 'for-linus-6.12-1' of https://github.com/cminyard/linux-ipmi
Pull IPMI updates from Corey Minyard: "Some minor fixes and cleanups for IPMI. Nothing big. Handle a bogus BMC a little better, fix autoload on some systems, remove some deprecated interfaces from the docs" * tag 'for-linus-6.12-1' of https://github.com/cminyard/linux-ipmi: ipmi: docs: don't advertise deprecated sysfs entries ipmi:ssif: Improve detecting during probing ipmi: ipmi_ssif: fix module autoloading
2 parents 84bbfe6 + 64dce81 commit 18aa0dd

File tree

2 files changed

+25
-2
lines changed

2 files changed

+25
-2
lines changed

Documentation/driver-api/ipmi.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -540,7 +540,7 @@ at module load time (for a module) with::
540540
alerts_broken
541541

542542
The addresses are normal I2C addresses. The adapter is the string
543-
name of the adapter, as shown in /sys/class/i2c-adapter/i2c-<n>/name.
543+
name of the adapter, as shown in /sys/bus/i2c/devices/i2c-<n>/name.
544544
It is *NOT* i2c-<n> itself. Also, the comparison is done ignoring
545545
spaces, so if the name is "This is an I2C chip" you can say
546546
adapter_name=ThisisanI2cchip. This is because it's hard to pass in

drivers/char/ipmi/ipmi_ssif.c

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1368,8 +1368,20 @@ static int ssif_detect(struct i2c_client *client, struct i2c_board_info *info)
13681368
rv = do_cmd(client, 2, msg, &len, resp);
13691369
if (rv)
13701370
rv = -ENODEV;
1371-
else
1371+
else {
1372+
if (len < 3) {
1373+
rv = -ENODEV;
1374+
} else {
1375+
struct ipmi_device_id id;
1376+
1377+
rv = ipmi_demangle_device_id(resp[0] >> 2, resp[1],
1378+
resp + 2, len - 2, &id);
1379+
if (rv)
1380+
rv = -ENODEV; /* Error means a BMC probably isn't there. */
1381+
}
1382+
if (!rv && info)
13721383
strscpy(info->type, DEVICE_NAME, I2C_NAME_SIZE);
1384+
}
13731385
kfree(resp);
13741386
return rv;
13751387
}
@@ -1704,6 +1716,16 @@ static int ssif_probe(struct i2c_client *client)
17041716
ipmi_addr_src_to_str(ssif_info->addr_source),
17051717
client->addr, client->adapter->name, slave_addr);
17061718

1719+
/*
1720+
* Send a get device id command and validate its response to
1721+
* make sure a valid BMC is there.
1722+
*/
1723+
rv = ssif_detect(client, NULL);
1724+
if (rv) {
1725+
dev_err(&client->dev, "Not present\n");
1726+
goto out;
1727+
}
1728+
17071729
/* Now check for system interface capabilities */
17081730
msg[0] = IPMI_NETFN_APP_REQUEST << 2;
17091731
msg[1] = IPMI_GET_SYSTEM_INTERFACE_CAPABILITIES_CMD;
@@ -2085,6 +2107,7 @@ static const struct platform_device_id ssif_plat_ids[] = {
20852107
{ "dmi-ipmi-ssif", 0 },
20862108
{ }
20872109
};
2110+
MODULE_DEVICE_TABLE(platform, ssif_plat_ids);
20882111

20892112
static struct platform_driver ipmi_driver = {
20902113
.driver = {

0 commit comments

Comments
 (0)