/* WARNING: From here it is not very safe to access anything hanging off wusb_dev  */
static void __wusbhc_dev_disconnect(struct wusbhc *wusbhc, struct wusb_port *port)
/* WARNING: From here it is not very safe to access anything hanging off wusb_dev  */
static void __wusbhc_dev_disconnect(struct wusbhc *wusbhc, struct wusb_port *port)
{
	struct wusb_dev *wusb_dev = port->wusb_dev;
	port->status &= ~(USB_PORT_STAT_CONNECTION | USB_PORT_STAT_ENABLE
			  | USB_PORT_STAT_SUSPEND | USB_PORT_STAT_RESET
			  | USB_PORT_STAT_LOW_SPEED | USB_PORT_STAT_HIGH_SPEED);
	port->change |= USB_PORT_STAT_C_CONNECTION | USB_PORT_STAT_C_ENABLE;
	if (wusb_dev) {
		dev_dbg(wusbhc->dev, "disconnecting device from port %d\n", wusb_dev->port_idx);
		if (!list_empty(&wusb_dev->cack_node))
			list_del_init(&wusb_dev->cack_node);
		wusb_dev_put(wusb_dev);
	}
	port->wusb_dev = NULL;
	if (wusbhc->active)
		wusbhc_gtk_rekey(wusbhc);
}