static uint8_t gb_control_disconnected(struct gb_operation *operation) { int retval; struct gb_control_connected_request *request = gb_operation_get_request_payload(operation); if (gb_operation_get_request_payload_size(operation) < sizeof(*request)) { gb_error("dropping short message\n"); return GB_OP_INVALID; } retval = gb_notify(le16_to_cpu(request->cport_id), GB_EVT_DISCONNECTED); if (retval) { gb_error("Cannot notify GB driver of disconnect event.\n"); /* * don't return, we still want to reset the cport and stop listening * on the CPort. */ } #ifdef CONFIG_ARCH_CHIP_TSB unipro_reset_cport(le16_to_cpu(request->cport_id), NULL, NULL); #endif retval = gb_stop_listening(le16_to_cpu(request->cport_id)); if (retval) { gb_error("Can not disconnect cport %d: error %d\n", le16_to_cpu(request->cport_id), retval); return GB_OP_INVALID; } return GB_OP_SUCCESS; }
static int reset_cport(unsigned int cportid, struct usbdev_s *dev) { struct cport_reset_priv *priv; priv = zalloc(sizeof(*priv)); if (!priv) { return -ENOMEM; } wd_static(&priv->timeout_wd); priv->dev = dev; /* a ref for the watchdog and one for the unipro stack */ atomic_init(&priv->refcount, 2); wd_start(&priv->timeout_wd, RESET_TIMEOUT_DELAY, cport_reset_timeout, 1, priv); return unipro_reset_cport(cportid, cport_reset_cb, priv); }
static uint8_t gb_control_disconnected(struct gb_operation *operation) { int retval; struct gb_control_connected_request *request = gb_operation_get_request_payload(operation); if (gb_operation_get_request_payload_size(operation) < sizeof(*request)) { gb_error("dropping short message\n"); return GB_OP_INVALID; } unipro_reset_cport(le16_to_cpu(request->cport_id), NULL, NULL); retval = gb_stop_listening(le16_to_cpu(request->cport_id)); if (retval) { gb_error("Can not disconnect cport %d: error %d\n", le16_to_cpu(request->cport_id), retval); return GB_OP_INVALID; } return GB_OP_SUCCESS; }