Exemple #1
0
static int _omap_device_notifier_call(struct notifier_block *nb,
				      unsigned long event, void *dev)
{
	struct platform_device *pdev = to_platform_device(dev);
	struct omap_device *od;
	int err;

	switch (event) {
	case BUS_NOTIFY_REMOVED_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_BIND_DRIVER:
		od = to_omap_device(pdev);
		if (od && (od->_state == OMAP_DEVICE_STATE_ENABLED) &&
		    pm_runtime_status_suspended(dev)) {
			od->_driver_status = BUS_NOTIFY_BIND_DRIVER;
			pm_runtime_set_active(dev);
		}
		break;
	case BUS_NOTIFY_ADD_DEVICE:
		if (pdev->dev.of_node)
			omap_device_build_from_dt(pdev);
		omap_auxdata_legacy_init(dev);
		/* fall through */
	default:
		od = to_omap_device(pdev);
		if (od)
			od->_driver_status = event;
	}

	return NOTIFY_DONE;
}
Exemple #2
0
static int _omap_device_notifier_call(struct notifier_block *nb,
                                      unsigned long event, void *dev)
{
    struct platform_device *pdev = to_platform_device(dev);
    struct omap_device *od;

    switch (event) {
    case BUS_NOTIFY_DEL_DEVICE:
        if (pdev->archdata.od)
            omap_device_delete(pdev->archdata.od);
        break;
    case BUS_NOTIFY_ADD_DEVICE:
        if (pdev->dev.of_node)
            omap_device_build_from_dt(pdev);
        omap_auxdata_legacy_init(dev);
    /* fall through */
    default:
        od = to_omap_device(pdev);
        if (od)
            od->_driver_status = event;
    }

    return NOTIFY_DONE;
}