Lines Matching refs:usb4

44 	struct usb4_port *usb4 = tb_to_usb4_port_device(dev);  in link_show()  local
45 struct tb_port *port = usb4->port; in link_show()
76 static int usb4_port_offline(struct usb4_port *usb4) in usb4_port_offline() argument
78 struct tb_port *port = usb4->port; in usb4_port_offline()
100 static void usb4_port_online(struct usb4_port *usb4) in usb4_port_online() argument
102 struct tb_port *port = usb4->port; in usb4_port_online()
111 struct usb4_port *usb4 = tb_to_usb4_port_device(dev); in offline_show() local
113 return sysfs_emit(buf, "%d\n", usb4->offline); in offline_show()
119 struct usb4_port *usb4 = tb_to_usb4_port_device(dev); in offline_store() local
120 struct tb_port *port = usb4->port; in offline_store()
129 pm_runtime_get_sync(&usb4->dev); in offline_store()
136 if (val == usb4->offline) in offline_store()
146 ret = usb4_port_offline(usb4); in offline_store()
150 usb4_port_online(usb4); in offline_store()
154 usb4->offline = val; in offline_store()
160 pm_runtime_mark_last_busy(&usb4->dev); in offline_store()
161 pm_runtime_put_autosuspend(&usb4->dev); in offline_store()
170 struct usb4_port *usb4 = tb_to_usb4_port_device(dev); in rescan_store() local
171 struct tb_port *port = usb4->port; in rescan_store()
183 pm_runtime_get_sync(&usb4->dev); in rescan_store()
191 if (!usb4->offline) { in rescan_store()
202 pm_runtime_mark_last_busy(&usb4->dev); in rescan_store()
203 pm_runtime_put_autosuspend(&usb4->dev); in rescan_store()
219 struct usb4_port *usb4 = tb_to_usb4_port_device(dev); in service_attr_is_visible() local
225 return usb4->can_offline ? attr->mode : 0; in service_attr_is_visible()
241 struct usb4_port *usb4 = container_of(dev, struct usb4_port, dev); in usb4_port_device_release() local
243 kfree(usb4); in usb4_port_device_release()
261 struct usb4_port *usb4; in usb4_port_device_add() local
264 usb4 = kzalloc(sizeof(*usb4), GFP_KERNEL); in usb4_port_device_add()
265 if (!usb4) in usb4_port_device_add()
268 usb4->port = port; in usb4_port_device_add()
269 usb4->dev.type = &usb4_port_device_type; in usb4_port_device_add()
270 usb4->dev.parent = &port->sw->dev; in usb4_port_device_add()
271 dev_set_name(&usb4->dev, "usb4_port%d", port->port); in usb4_port_device_add()
273 ret = device_register(&usb4->dev); in usb4_port_device_add()
275 put_device(&usb4->dev); in usb4_port_device_add()
279 if (dev_fwnode(&usb4->dev)) { in usb4_port_device_add()
280 ret = component_add(&usb4->dev, &connector_ops); in usb4_port_device_add()
282 dev_err(&usb4->dev, "failed to add component\n"); in usb4_port_device_add()
283 device_unregister(&usb4->dev); in usb4_port_device_add()
287 pm_runtime_no_callbacks(&usb4->dev); in usb4_port_device_add()
288 pm_runtime_set_active(&usb4->dev); in usb4_port_device_add()
289 pm_runtime_enable(&usb4->dev); in usb4_port_device_add()
290 pm_runtime_set_autosuspend_delay(&usb4->dev, TB_AUTOSUSPEND_DELAY); in usb4_port_device_add()
291 pm_runtime_mark_last_busy(&usb4->dev); in usb4_port_device_add()
292 pm_runtime_use_autosuspend(&usb4->dev); in usb4_port_device_add()
294 return usb4; in usb4_port_device_add()
304 void usb4_port_device_remove(struct usb4_port *usb4) in usb4_port_device_remove() argument
306 if (dev_fwnode(&usb4->dev)) in usb4_port_device_remove()
307 component_del(&usb4->dev, &connector_ops); in usb4_port_device_remove()
308 device_unregister(&usb4->dev); in usb4_port_device_remove()
317 int usb4_port_device_resume(struct usb4_port *usb4) in usb4_port_device_resume() argument
319 return usb4->offline ? usb4_port_offline(usb4) : 0; in usb4_port_device_resume()