diff options
Diffstat (limited to 'drivers/char/ipmi/ipmi_ssif.c')
-rw-r--r-- | drivers/char/ipmi/ipmi_ssif.c | 37 |
1 files changed, 31 insertions, 6 deletions
diff --git a/drivers/char/ipmi/ipmi_ssif.c b/drivers/char/ipmi/ipmi_ssif.c index 5673ffff00be..cca6e5bc1cea 100644 --- a/drivers/char/ipmi/ipmi_ssif.c +++ b/drivers/char/ipmi/ipmi_ssif.c @@ -174,7 +174,6 @@ enum ssif_stat_indexes { }; struct ssif_addr_info { - unsigned short addr; struct i2c_board_info binfo; char *adapter_name; int debug; @@ -1154,10 +1153,6 @@ static bool ssif_dbg_probe; module_param_named(dbg_probe, ssif_dbg_probe, bool, 0); MODULE_PARM_DESC(dbg_probe, "Enable debugging of probing of adapters."); -static int use_thread; -module_param(use_thread, int, 0); -MODULE_PARM_DESC(use_thread, "Use the thread interface."); - static bool ssif_tryacpi = true; module_param_named(tryacpi, ssif_tryacpi, bool, 0); MODULE_PARM_DESC(tryacpi, "Setting this to zero will disable the default scan of the interfaces identified via ACPI"); @@ -1405,6 +1400,34 @@ static bool check_acpi(struct ssif_info *ssif_info, struct device *dev) return false; } +static int find_slave_address(struct i2c_client *client, int slave_addr) +{ + struct ssif_addr_info *info; + + if (slave_addr) + return slave_addr; + + /* + * Came in without a slave address, search around to see if + * the other sources have a slave address. This lets us pick + * up an SMBIOS slave address when using ACPI. + */ + list_for_each_entry(info, &ssif_infos, link) { + if (info->binfo.addr != client->addr) + continue; + if (info->adapter_name && client->adapter->name && + strcmp_nospace(info->adapter_name, + client->adapter->name)) + continue; + if (info->slave_addr) { + slave_addr = info->slave_addr; + break; + } + } + + return slave_addr; +} + /* * Global enables we care about. */ @@ -1447,6 +1470,8 @@ static int ssif_probe(struct i2c_client *client, const struct i2c_device_id *id) } } + slave_addr = find_slave_address(client, slave_addr); + pr_info(PFX "Trying %s-specified SSIF interface at i2c address 0x%x, adapter %s, slave address 0x%x\n", ipmi_addr_src_to_str(ssif_info->addr_source), client->addr, client->adapter->name, slave_addr); @@ -1935,7 +1960,7 @@ static int decode_dmi(const struct dmi_device *dmi_dev) slave_addr = data[6]; } - return new_ssif_client(myaddr, NULL, 0, 0, SI_SMBIOS); + return new_ssif_client(myaddr, NULL, 0, slave_addr, SI_SMBIOS); } static void dmi_iterator(void) |