summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIwona Winiarska <iwona.winiarska@intel.com>2021-07-02 17:10:10 +0300
committerJae Hyun Yoo <jae.hyun.yoo@intel.com>2021-07-14 20:10:33 +0300
commit12438d7847e57486a52105f25239fa424275ced5 (patch)
tree031f62cd152056271af8cbe6ea59e9dcf4850995
parentdaee5b9f522896762be5c2423a8dc3d5d92a4f07 (diff)
downloadlinux-12438d7847e57486a52105f25239fa424275ced5.tar.xz
mfd: intel-peci-client: Extend MFD cell id with additional parameter
If we're only using CPU number as MFD cell id, we don't have a way to avoid a collision in case we have multiple adapters able to communicate with the same CPUs. [ 794.916872] sysfs: cannot create duplicate filename '/bus/platform/devices/peci-cputemp.0' [ 795.452507] intel_peci_client 1-30: Failed to register child devices: -17 [ 795.460238] intel_peci_client: probe of 1-30 failed with error -17 To fix this problem, let's use both adapter number and cpu number to calculate MFD cell id. Change-Id: If0559a0b629081e6201b4ce93cb8bc649dd2a258 Signed-off-by: Iwona Winiarska <iwona.winiarska@intel.com>
-rw-r--r--drivers/mfd/intel-peci-client.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/mfd/intel-peci-client.c b/drivers/mfd/intel-peci-client.c
index 9b4ed8b0d4ca..3eb2c59a2424 100644
--- a/drivers/mfd/intel-peci-client.c
+++ b/drivers/mfd/intel-peci-client.c
@@ -108,7 +108,7 @@ static int peci_client_probe(struct peci_client *client)
{
struct device *dev = &client->dev;
struct peci_client_manager *priv;
- uint cpu_no;
+ int device_id;
int ret;
priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
@@ -117,13 +117,14 @@ static int peci_client_probe(struct peci_client *client)
dev_set_drvdata(dev, priv);
priv->client = client;
- cpu_no = client->addr - PECI_BASE_ADDR;
ret = peci_client_get_cpu_gen_info(priv);
if (ret)
return ret;
- ret = devm_mfd_add_devices(dev, cpu_no, peci_functions,
+ device_id = (client->adapter->nr << 4) | (client->addr - PECI_BASE_ADDR);
+
+ ret = devm_mfd_add_devices(dev, device_id, peci_functions,
ARRAY_SIZE(peci_functions), NULL, 0, NULL);
if (ret < 0) {
dev_err(dev, "Failed to register child devices: %d\n", ret);