Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Srinivas Kandagatla and committed by
Greg Kroah-Hartman
380c6246 cfb32101

+18 -19
+18 -19
drivers/slimbus/core.c
··· 42 42 return !!slim_match(sbdrv->id_table, sbdev); 43 43 } 44 44 45 + static void slim_device_update_status(struct slim_device *sbdev, 46 + enum slim_device_status status) 47 + { 48 + struct slim_driver *sbdrv; 49 + 50 + if (sbdev->status == status) 51 + return; 52 + 53 + sbdev->status = status; 54 + if (!sbdev->dev.driver) 55 + return; 56 + 57 + sbdrv = to_slim_driver(sbdev->dev.driver); 58 + if (sbdrv->device_status) 59 + sbdrv->device_status(sbdev, sbdev->status); 60 + } 61 + 45 62 static int slim_device_probe(struct device *dev) 46 63 { 47 64 struct slim_device *sbdev = to_slim_device(dev); ··· 72 55 /* try getting the logical address after probe */ 73 56 ret = slim_get_logical_addr(sbdev); 74 57 if (!ret) { 75 - if (sbdrv->device_status) 76 - sbdrv->device_status(sbdev, sbdev->status); 58 + slim_device_update_status(sbdev, SLIM_DEVICE_STATUS_UP); 77 59 } else { 78 60 dev_err(&sbdev->dev, "Failed to get logical address\n"); 79 61 ret = -EPROBE_DEFER; ··· 312 296 return 0; 313 297 } 314 298 EXPORT_SYMBOL_GPL(slim_unregister_controller); 315 - 316 - static void slim_device_update_status(struct slim_device *sbdev, 317 - enum slim_device_status status) 318 - { 319 - struct slim_driver *sbdrv; 320 - 321 - if (sbdev->status == status) 322 - return; 323 - 324 - sbdev->status = status; 325 - if (!sbdev->dev.driver) 326 - return; 327 - 328 - sbdrv = to_slim_driver(sbdev->dev.driver); 329 - if (sbdrv->device_status) 330 - sbdrv->device_status(sbdev, sbdev->status); 331 - } 332 299 333 300 /** 334 301 * slim_report_absent() - Controller calls this function when a device