]> Git Repo - linux.git/commitdiff
ARM: OMAP2+: Fix omap_device for module reload on PM runtime forbid
authorTony Lindgren <[email protected]>
Fri, 12 Feb 2016 16:56:52 +0000 (08:56 -0800)
committerTony Lindgren <[email protected]>
Fri, 12 Feb 2016 16:56:52 +0000 (08:56 -0800)
If a driver PM runtime is disabled via sysfs, and the module is
unloaded, PM runtime can't do anything to disable the device. Let's
let the interconnect disable the device on BUS_NOTIFY_UNBOUND_DRIVER.

Otherwise omap_device will produce and error on the following module
reload. This can be easily tested with something like:

# modprobe omap_hsmmc
# echo on > /sys/devices/platform/68000000.ocp/4809c000.mmc/power/control
# rmmod omap_hsmmc
# modprobe omap_hsmmc

Cc: Alan Stern <[email protected]>
Cc: Nishanth Menon <[email protected]>
Cc: Rafael J. Wysocki <[email protected]>
Cc: Tero Kristo <[email protected]>
Reported-by: Ulf Hansson <[email protected]>
Acked-by: Kevin Hilman <[email protected]>
Acked-by: Ulf Hansson <[email protected]>
Signed-off-by: Tony Lindgren <[email protected]>
arch/arm/mach-omap2/omap_device.c

index ebd83690ba48ee86c282ea0de092f37584515902..f7ff3b9dad8784aeab4d3752061514a8498774ae 100644 (file)
@@ -191,12 +191,22 @@ static int _omap_device_notifier_call(struct notifier_block *nb,
 {
        struct platform_device *pdev = to_platform_device(dev);
        struct omap_device *od;
+       int err;
 
        switch (event) {
        case BUS_NOTIFY_DEL_DEVICE:
                if (pdev->archdata.od)
                        omap_device_delete(pdev->archdata.od);
                break;
+       case BUS_NOTIFY_UNBOUND_DRIVER:
+               od = to_omap_device(pdev);
+               if (od && (od->_state == OMAP_DEVICE_STATE_ENABLED)) {
+                       dev_info(dev, "enabled after unload, idling\n");
+                       err = omap_device_idle(pdev);
+                       if (err)
+                               dev_err(dev, "failed to idle\n");
+               }
+               break;
        case BUS_NOTIFY_ADD_DEVICE:
                if (pdev->dev.of_node)
                        omap_device_build_from_dt(pdev);
This page took 0.060561 seconds and 4 git commands to generate.