Commit 380c6246 authored by Srinivas Kandagatla's avatar Srinivas Kandagatla Committed by Greg Kroah-Hartman

slimbus: core: use slim_device_update_status() to update status

use slim_device_update_status() instead of directly calling
the device_status() callback. Move slim_device_update_status() before
probe to avoid forward declaration too.
Signed-off-by: default avatarSrinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent cfb32101
...@@ -42,6 +42,23 @@ static int slim_device_match(struct device *dev, struct device_driver *drv) ...@@ -42,6 +42,23 @@ static int slim_device_match(struct device *dev, struct device_driver *drv)
return !!slim_match(sbdrv->id_table, sbdev); return !!slim_match(sbdrv->id_table, sbdev);
} }
static void slim_device_update_status(struct slim_device *sbdev,
enum slim_device_status status)
{
struct slim_driver *sbdrv;
if (sbdev->status == status)
return;
sbdev->status = status;
if (!sbdev->dev.driver)
return;
sbdrv = to_slim_driver(sbdev->dev.driver);
if (sbdrv->device_status)
sbdrv->device_status(sbdev, sbdev->status);
}
static int slim_device_probe(struct device *dev) static int slim_device_probe(struct device *dev)
{ {
struct slim_device *sbdev = to_slim_device(dev); struct slim_device *sbdev = to_slim_device(dev);
...@@ -55,8 +72,7 @@ static int slim_device_probe(struct device *dev) ...@@ -55,8 +72,7 @@ static int slim_device_probe(struct device *dev)
/* try getting the logical address after probe */ /* try getting the logical address after probe */
ret = slim_get_logical_addr(sbdev); ret = slim_get_logical_addr(sbdev);
if (!ret) { if (!ret) {
if (sbdrv->device_status) slim_device_update_status(sbdev, SLIM_DEVICE_STATUS_UP);
sbdrv->device_status(sbdev, sbdev->status);
} else { } else {
dev_err(&sbdev->dev, "Failed to get logical address\n"); dev_err(&sbdev->dev, "Failed to get logical address\n");
ret = -EPROBE_DEFER; ret = -EPROBE_DEFER;
...@@ -297,23 +313,6 @@ int slim_unregister_controller(struct slim_controller *ctrl) ...@@ -297,23 +313,6 @@ int slim_unregister_controller(struct slim_controller *ctrl)
} }
EXPORT_SYMBOL_GPL(slim_unregister_controller); EXPORT_SYMBOL_GPL(slim_unregister_controller);
static void slim_device_update_status(struct slim_device *sbdev,
enum slim_device_status status)
{
struct slim_driver *sbdrv;
if (sbdev->status == status)
return;
sbdev->status = status;
if (!sbdev->dev.driver)
return;
sbdrv = to_slim_driver(sbdev->dev.driver);
if (sbdrv->device_status)
sbdrv->device_status(sbdev, sbdev->status);
}
/** /**
* slim_report_absent() - Controller calls this function when a device * slim_report_absent() - Controller calls this function when a device
* reports absent, OR when the device cannot be communicated with * reports absent, OR when the device cannot be communicated with
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment