summaryrefslogtreecommitdiffstats
path: root/drivers/slimbus
diff options
context:
space:
mode:
authorSrinivas Kandagatla <srinivas.kandagatla@linaro.org>2018-09-17 01:45:41 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-09-25 20:21:02 +0200
commit8f3d5fcde9df6c0b24ec127a18dd1e2e9f54f8e8 (patch)
tree0213a005ca6d1a22ae36630b52edfb99c744d4ad /drivers/slimbus
parentslimbus: core: match device tree based devices correctly (diff)
downloadlinux-8f3d5fcde9df6c0b24ec127a18dd1e2e9f54f8e8.tar.xz
linux-8f3d5fcde9df6c0b24ec127a18dd1e2e9f54f8e8.zip
slimbus: core: update device status in probe
device status update can be racy with probe in some cases, so make sure it take lock during the probe. Also after probe the device is expected to be ready for communications, so make sure that a logical address can be assigned to it after probe. If it fails to do so then probe defer such instances. Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/slimbus')
-rw-r--r--drivers/slimbus/core.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/drivers/slimbus/core.c b/drivers/slimbus/core.c
index 7cd635eb44ed..1888fafc0e73 100644
--- a/drivers/slimbus/core.c
+++ b/drivers/slimbus/core.c
@@ -43,8 +43,23 @@ static int slim_device_probe(struct device *dev)
{
struct slim_device *sbdev = to_slim_device(dev);
struct slim_driver *sbdrv = to_slim_driver(dev->driver);
+ int ret;
+
+ ret = sbdrv->probe(sbdev);
+ if (ret)
+ return ret;
+
+ /* try getting the logical address after probe */
+ ret = slim_get_logical_addr(sbdev);
+ if (!ret) {
+ if (sbdrv->device_status)
+ sbdrv->device_status(sbdev, sbdev->status);
+ } else {
+ dev_err(&sbdev->dev, "Failed to get logical address\n");
+ ret = -EPROBE_DEFER;
+ }
- return sbdrv->probe(sbdev);
+ return ret;
}
static int slim_device_remove(struct device *dev)