if (is_gb_host_device(dev)) {
hd = to_gb_host_device(dev);
} elseif (is_gb_module(dev)) {
module = to_gb_module(dev);
hd = module->hd;
} elseif (is_gb_interface(dev)) {
intf = to_gb_interface(dev);
module = intf->module;
hd = intf->hd;
} elseif (is_gb_control(dev)) {
control = to_gb_control(dev);
intf = control->intf;
module = intf->module;
hd = intf->hd;
} elseif (is_gb_bundle(dev)) {
bundle = to_gb_bundle(dev);
intf = bundle->intf;
module = intf->module;
hd = intf->hd;
} elseif (is_gb_svc(dev)) {
svc = to_gb_svc(dev);
hd = svc->hd;
} else {
dev_WARN(dev, "uevent for unknown greybus device \"type\"!\n"); return -EINVAL;
}
if (add_uevent_var(env, "BUS=%u", hd->bus_id)) return -ENOMEM;
if (module) { if (add_uevent_var(env, "MODULE=%u", module->module_id)) return -ENOMEM;
}
if (intf) { if (add_uevent_var(env, "INTERFACE=%u", intf->interface_id)) return -ENOMEM; if (add_uevent_var(env, "GREYBUS_ID=%08x/%08x",
intf->vendor_id, intf->product_id)) return -ENOMEM;
}
if (bundle) { // FIXME // add a uevent that can "load" a bundle type // This is what we need to bind a driver to so use the info // in gmod here as well
if (add_uevent_var(env, "BUNDLE=%u", bundle->id)) return -ENOMEM; if (add_uevent_var(env, "BUNDLE_CLASS=%02x", bundle->class)) return -ENOMEM;
}
/* * Unbound bundle devices are always deactivated. During probe, the * Runtime PM is set to enabled and active and the usage count is * incremented. If the driver supports runtime PM, it should call * pm_runtime_put() in its probe routine and pm_runtime_get_sync() * in remove routine.
*/
pm_runtime_set_autosuspend_delay(dev, GB_BUNDLE_AUTOSUSPEND_MS);
pm_runtime_use_autosuspend(dev);
pm_runtime_get_noresume(dev);
pm_runtime_set_active(dev);
pm_runtime_enable(dev);
retval = driver->probe(bundle, id); if (retval) { /* * Catch buggy drivers that fail to destroy their connections.
*/
WARN_ON(!list_empty(&bundle->connections));
retval = pm_runtime_get_sync(dev); if (retval < 0)
dev_err(dev, "failed to resume bundle: %d\n", retval);
/* * Disable (non-offloaded) connections early in case the interface is * already gone to avoid unceccessary operation timeouts during * driver disconnect. Otherwise, only disable incoming requests.
*/
list_for_each_entry(connection, &bundle->connections, bundle_links) { if (gb_connection_is_offloaded(connection)) continue;
if (bundle->intf->disconnected)
gb_connection_disable_forced(connection); else
gb_connection_disable_rx(connection);
}
driver->disconnect(bundle);
/* Catch buggy drivers that fail to destroy their connections. */
WARN_ON(!list_empty(&bundle->connections));
if (!bundle->intf->disconnected)
gb_control_bundle_deactivate(bundle->intf->control, bundle->id);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.