Lines Matching defs:fsg

125  * (fsg->next_buffhd_to_fill) that points to the next buffer head to use.
237 struct fsg_dev *fsg;
312 if (common->fsg)
314 ERROR(common, "common->fsg is NULL in %s at %u\n", func, line);
347 static int fsg_set_halt(struct fsg_dev *fsg, struct usb_ep *ep)
351 if (ep == fsg->bulk_in)
353 else if (ep == fsg->bulk_out)
357 DBG(fsg, "%s set halt\n", name);
460 struct fsg_dev *fsg = fsg_from_func(f);
461 struct usb_request *req = fsg->common->ep0req;
466 if (!fsg_is_set(fsg->common))
469 ++fsg->common->ep0_req_tag; /* Record arrival of a new request */
472 dump_msg(fsg, "ep0-setup", (u8 *) ctrl, sizeof(*ctrl));
480 if (w_index != fsg->interface_number || w_value != 0 ||
488 DBG(fsg, "bulk reset request\n");
489 raise_exception(fsg->common, FSG_STATE_PROTOCOL_RESET);
496 if (w_index != fsg->interface_number || w_value != 0 ||
499 VDBG(fsg, "get max LUN\n");
500 *(u8 *)req->buf = _fsg_common_get_max_lun(fsg->common);
504 return ep0_queue(fsg->common);
507 VDBG(fsg,
520 static int start_transfer(struct fsg_dev *fsg, struct usb_ep *ep,
525 if (ep == fsg->bulk_in)
526 dump_msg(fsg, "bulk-in", req->buf, req->length);
540 WARNING(fsg, "error in submission: %s --> %d\n",
553 rc = start_transfer(common->fsg, common->fsg->bulk_in, bh->inreq);
571 rc = start_transfer(common->fsg, common->fsg->bulk_out, bh->outreq);
726 /* Don't know what to do if common->fsg is NULL */
834 /* Dunno what to do if common->fsg is NULL */
1467 static int halt_bulk_in_endpoint(struct fsg_dev *fsg)
1471 rc = fsg_set_halt(fsg, fsg->bulk_in);
1473 VDBG(fsg, "delayed bulk-in endpoint halt\n");
1476 WARNING(fsg, "usb_ep_set_halt -> %d\n", rc);
1484 rc = usb_ep_set_halt(fsg->bulk_in);
1489 static int wedge_bulk_in_endpoint(struct fsg_dev *fsg)
1493 DBG(fsg, "bulk-in set wedge\n");
1494 rc = usb_ep_set_wedge(fsg->bulk_in);
1496 VDBG(fsg, "delayed bulk-in endpoint wedge\n");
1499 WARNING(fsg, "usb_ep_set_wedge -> %d\n", rc);
1507 rc = usb_ep_set_wedge(fsg->bulk_in);
1535 /* Dunno what to do if common->fsg is NULL */
1580 fsg_set_halt(common->fsg, common->fsg->bulk_out);
1581 rc = halt_bulk_in_endpoint(common->fsg);
1583 /* Don't know what to do if common->fsg is NULL */
1593 /* Don't know what to do if common->fsg is NULL */
1617 rc = halt_bulk_in_endpoint(common->fsg);
1645 fsg_set_halt(common->fsg,
1646 common->fsg->bulk_out);
1709 /* Don't know what to do if common->fsg is NULL */
2182 static int received_cbw(struct fsg_dev *fsg, struct fsg_buffhd *bh)
2186 struct fsg_common *common = fsg->common;
2189 if (req->status || test_bit(IGNORE_BULK_OUT, &fsg->atomic_bitflags))
2196 DBG(fsg, "invalid CBW: len %u sig 0x%x\n",
2211 wedge_bulk_in_endpoint(fsg);
2212 set_bit(IGNORE_BULK_OUT, &fsg->atomic_bitflags);
2220 DBG(fsg, "non-meaningful CBW: lun = %u, flags = 0x%x, "
2229 fsg_set_halt(fsg, fsg->bulk_out);
2230 halt_bulk_in_endpoint(fsg);
2268 /* Don't know what to do if common->fsg is NULL */
2282 rc = fsg_is_set(common) ? received_cbw(common->fsg, bh) : -EIO;
2304 struct fsg_dev *fsg;
2312 if (common->fsg) {
2313 fsg = common->fsg;
2319 usb_ep_free_request(fsg->bulk_in, bh->inreq);
2323 usb_ep_free_request(fsg->bulk_out, bh->outreq);
2329 if (fsg->bulk_in_enabled) {
2330 usb_ep_disable(fsg->bulk_in);
2331 fsg->bulk_in_enabled = 0;
2333 if (fsg->bulk_out_enabled) {
2334 usb_ep_disable(fsg->bulk_out);
2335 fsg->bulk_out_enabled = 0;
2338 common->fsg = NULL;
2346 common->fsg = new_fsg;
2347 fsg = common->fsg;
2350 rc = config_ep_by_speed(common->gadget, &(fsg->function), fsg->bulk_in);
2353 rc = usb_ep_enable(fsg->bulk_in);
2356 fsg->bulk_in->driver_data = common;
2357 fsg->bulk_in_enabled = 1;
2359 rc = config_ep_by_speed(common->gadget, &(fsg->function),
2360 fsg->bulk_out);
2363 rc = usb_ep_enable(fsg->bulk_out);
2366 fsg->bulk_out->driver_data = common;
2367 fsg->bulk_out_enabled = 1;
2368 common->bulk_out_maxpacket = usb_endpoint_maxp(fsg->bulk_out->desc);
2369 clear_bit(IGNORE_BULK_OUT, &fsg->atomic_bitflags);
2375 rc = alloc_request(common, fsg->bulk_in, &bh->inreq);
2378 rc = alloc_request(common, fsg->bulk_out, &bh->outreq);
2400 struct fsg_dev *fsg = fsg_from_func(f);
2402 __raise_exception(fsg->common, FSG_STATE_CONFIG_CHANGE, fsg);
2408 struct fsg_dev *fsg = fsg_from_func(f);
2411 if (fsg->bulk_in_enabled) {
2412 usb_ep_disable(fsg->bulk_in);
2413 fsg->bulk_in_enabled = 0;
2415 if (fsg->bulk_out_enabled) {
2416 usb_ep_disable(fsg->bulk_out);
2417 fsg->bulk_out_enabled = 0;
2420 __raise_exception(fsg->common, FSG_STATE_CONFIG_CHANGE, NULL);
2453 if (likely(common->fsg)) {
2457 usb_ep_dequeue(common->fsg->bulk_in, bh->inreq);
2459 usb_ep_dequeue(common->fsg->bulk_out,
2468 if (common->fsg->bulk_in_enabled)
2469 usb_ep_fifo_flush(common->fsg->bulk_in);
2470 if (common->fsg->bulk_out_enabled)
2471 usb_ep_fifo_flush(common->fsg->bulk_out);
2523 &common->fsg->atomic_bitflags))
2524 usb_ep_clear_halt(common->fsg->bulk_in);
3025 struct fsg_dev *fsg = fsg_from_func(f);
3026 struct fsg_common *common = fsg->common;
3043 ret = fsg_common_set_cdev(fsg->common, c->cdev,
3044 fsg->common->can_stall);
3047 fsg_common_set_inquiry_string(fsg->common, NULL, NULL);
3065 fsg->gadget = gadget;
3072 fsg->interface_number = i;
3078 fsg->bulk_in = ep;
3083 fsg->bulk_out = ep;
3110 ERROR(fsg, "unable to autoconfigure all endpoints\n");
3114 if (fsg->common->state != FSG_STATE_TERMINATED) {
3115 raise_exception(fsg->common, FSG_STATE_EXIT);
3116 wait_for_completion(&fsg->common->thread_notifier);
3125 struct fsg_dev *fsg = fsg_from_func(f);
3126 struct fsg_common *common = fsg->common;
3128 DBG(fsg, "unbind\n");
3129 if (fsg->common->fsg == fsg) {
3130 __raise_exception(fsg->common, FSG_STATE_CONFIG_CHANGE, NULL);
3132 wait_event(common->fsg_wait, common->fsg != fsg);
3135 usb_free_all_descriptors(&fsg->function);
3539 struct fsg_dev *fsg;
3542 fsg = container_of(f, struct fsg_dev, function);
3549 kfree(fsg);
3556 struct fsg_dev *fsg;
3558 fsg = kzalloc(sizeof(*fsg), GFP_KERNEL);
3559 if (unlikely(!fsg))
3566 fsg->function.name = FSG_DRIVER_DESC;
3567 fsg->function.bind = fsg_bind;
3568 fsg->function.unbind = fsg_unbind;
3569 fsg->function.setup = fsg_setup;
3570 fsg->function.set_alt = fsg_set_alt;
3571 fsg->function.disable = fsg_disable;
3572 fsg->function.free_func = fsg_free;
3574 fsg->common = common;
3576 return &fsg->function;