/** * usb4_usb3_port_match() - Matches USB4 port device with USB 3.x port device * @usb4_port_dev: USB4 port device * @usb3_port_fwnode: USB 3.x port firmware node * * Checks if USB 3.x port @usb3_port_fwnode is tunneled through USB4 port @usb4_port_dev. * Returns true if match is found, false otherwise. * * Function is designed to be used with component framework (component_match_add).
*/ bool usb4_usb3_port_match(struct device *usb4_port_dev, conststruct fwnode_handle *usb3_port_fwnode)
{ struct fwnode_handle *nhi_fwnode __free(fwnode_handle) = NULL; struct usb4_port *usb4; struct tb_switch *sw; struct tb_nhi *nhi;
u8 usb4_port_num; struct tb *tb;
usb4 = tb_to_usb4_port_device(usb4_port_dev); if (!usb4) returnfalse;
sw = usb4->port->sw;
tb = sw->tb;
nhi = tb->nhi;
nhi_fwnode = fwnode_find_reference(usb3_port_fwnode, "usb4-host-interface", 0); if (IS_ERR(nhi_fwnode)) returnfalse;
/* Check if USB3 fwnode references same NHI where USB4 port resides */ if (!device_match_fwnode(&nhi->pdev->dev, nhi_fwnode)) returnfalse;
if (fwnode_property_read_u8(usb3_port_fwnode, "usb4-port-number", &usb4_port_num)) returnfalse;
/* * Always need some platform help to cycle the modes so that * retimers can be accessed through the sideband.
*/ return usb4->can_offline ? attr->mode : 0;
}
/** * usb4_port_device_add() - Add USB4 port device * @port: Lane 0 adapter port to add the USB4 port * * Creates and registers a USB4 port device for @port. Returns the new * USB4 port device pointer or ERR_PTR() in case of error.
*/ struct usb4_port *usb4_port_device_add(struct tb_port *port)
{ struct usb4_port *usb4; int ret;
usb4 = kzalloc(sizeof(*usb4), GFP_KERNEL); if (!usb4) return ERR_PTR(-ENOMEM);
/** * usb4_port_device_remove() - Removes USB4 port device * @usb4: USB4 port device * * Unregisters the USB4 port device from the system. The device will be * released when the last reference is dropped.
*/ void usb4_port_device_remove(struct usb4_port *usb4)
{
component_del(&usb4->dev, &connector_ops);
device_unregister(&usb4->dev);
}
/** * usb4_port_device_resume() - Resumes USB4 port device * @usb4: USB4 port device * * Used to resume USB4 port device after sleep state.
*/ int usb4_port_device_resume(struct usb4_port *usb4)
{ return usb4->offline ? usb4_port_offline(usb4) : 0;
}
Messung V0.5
¤ Dauer der Verarbeitung: 0.12 Sekunden
(vorverarbeitet)
¤
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.