On Thu, Jun 24, 2010 at 5:43 PM, Kevin Hilman <khilman@xxxxxxxxxxxxxxxxxxx> wrote: > Implement the new runtime PM framework as a thin layer on top of the > omap_device API. Since we don't have an OMAP-specific bus, override > the runtime PM hooks for the platform_bus for the OMAP specific > implementation. [...] > +int platform_pm_runtime_suspend(struct device *dev) > +{ > + struct platform_device *pdev = to_platform_device(dev); > + struct omap_device *odev = to_omap_device(pdev); > + int r, ret = 0; > + > + dev_dbg(dev, "%s\n", __func__); > + > + if (dev->driver->pm && dev->driver->pm->runtime_suspend) > + ret = dev->driver->pm->runtime_suspend(dev); > + if (!ret && omap_device_is_valid(odev)) { > + r = omap_device_idle(pdev); > + WARN_ON(r); For the record, I should note here that this is *really* dangerous. When handed a random platform_device pointer, it is not safe to use to_omap_device() and dereference it with omap_device_is_valid(). There are no guarantees that the dereference is actually valid, particularly so when the platform_device has been dynamically allocated. It is only okay to use to_omap_device() when the code is already absolutely sure that the platform_device is in fact contained by a struct omap_device. There needs to be a different method to test if it is contained by an omap_device before doing the dereference. -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html