static int intel_th_remove(struct device *dev) { struct intel_th_driver *thdrv = to_intel_th_driver(dev->driver); struct intel_th_device *thdev = to_intel_th_device(dev); struct intel_th_device *hub = to_intel_th_device(dev->parent); int err; if (thdev->type == INTEL_TH_SWITCH) { err = device_for_each_child(dev, thdev, intel_th_child_remove); if (err) return err; } if (thdrv->attr_group) sysfs_remove_group(&thdev->dev.kobj, thdrv->attr_group); pm_runtime_get_sync(dev); thdrv->remove(thdev); if (intel_th_output_assigned(thdev)) { struct intel_th_driver *hubdrv = to_intel_th_driver(dev->parent->driver); if (hub->dev.driver) /* does not talk to hardware */ hubdrv->unassign(hub, thdev); } pm_runtime_disable(dev); pm_runtime_set_active(dev); pm_runtime_enable(dev); return 0; }
static int intel_th_remove(struct device *dev) { struct intel_th_driver *thdrv = to_intel_th_driver(dev->driver); struct intel_th_device *thdev = to_intel_th_device(dev); struct intel_th_device *hub = to_intel_th_device(dev->parent); int err; if (thdev->type == INTEL_TH_SWITCH) { err = device_for_each_child(dev, thdev, intel_th_child_remove); if (err) return err; } thdrv->remove(thdev); if (intel_th_output_assigned(thdev)) { struct intel_th_driver *hubdrv = to_intel_th_driver(dev->parent->driver); if (hub->dev.driver) hubdrv->unassign(hub, thdev); } return 0; }
static int intel_th_probe(struct device *dev) { struct intel_th_driver *thdrv = to_intel_th_driver(dev->driver); struct intel_th_device *thdev = to_intel_th_device(dev); struct intel_th_driver *hubdrv; struct intel_th_device *hub = NULL; int ret; if (thdev->type == INTEL_TH_SWITCH) hub = thdev; else if (dev->parent) hub = to_intel_th_device(dev->parent); if (!hub || !hub->dev.driver) return -EPROBE_DEFER; hubdrv = to_intel_th_driver(hub->dev.driver); ret = thdrv->probe(to_intel_th_device(dev)); if (ret) return ret; if (thdev->type == INTEL_TH_OUTPUT && !intel_th_output_assigned(thdev)) ret = hubdrv->assign(hub, thdev); return ret; }
static int intel_th_probe(struct device *dev) { struct intel_th_driver *thdrv = to_intel_th_driver(dev->driver); struct intel_th_device *thdev = to_intel_th_device(dev); struct intel_th_driver *hubdrv; struct intel_th_device *hub = NULL; int ret; if (thdev->type == INTEL_TH_SWITCH) hub = thdev; else if (dev->parent) hub = to_intel_th_device(dev->parent); if (!hub || !hub->dev.driver) return -EPROBE_DEFER; hubdrv = to_intel_th_driver(hub->dev.driver); pm_runtime_set_active(dev); pm_runtime_no_callbacks(dev); pm_runtime_enable(dev); ret = thdrv->probe(to_intel_th_device(dev)); if (ret) goto out_pm; if (thdrv->attr_group) { ret = sysfs_create_group(&thdev->dev.kobj, thdrv->attr_group); if (ret) goto out; } if (thdev->type == INTEL_TH_OUTPUT && !intel_th_output_assigned(thdev)) /* does not talk to hardware */ ret = hubdrv->assign(hub, thdev); out: if (ret) thdrv->remove(thdev); out_pm: if (ret) pm_runtime_disable(dev); return ret; }
static void intel_th_output_deactivate(struct intel_th_device *thdev) { struct intel_th_driver *thdrv = to_intel_th_driver(thdev->dev.driver); if (thdrv->deactivate) thdrv->deactivate(thdev); else intel_th_trace_disable(thdev); }
static int intel_th_match(struct device *dev, struct device_driver *driver) { struct intel_th_driver *thdrv = to_intel_th_driver(driver); struct intel_th_device *thdev = to_intel_th_device(dev); if (thdev->type == INTEL_TH_SWITCH && (!thdrv->enable || !thdrv->disable)) return 0; return !strcmp(thdev->name, driver->name); }
static int intel_th_output_activate(struct intel_th_device *thdev) { struct intel_th_driver *thdrv = to_intel_th_driver(thdev->dev.driver); if (thdrv->activate) return thdrv->activate(thdev); intel_th_trace_enable(thdev); return 0; }