Lines Matching refs:bh

415 		struct fsg_buffhd *bh, unsigned int length)  in set_bulk_out_req_length()  argument
419 bh->bulk_out_intended_length = length; in set_bulk_out_req_length()
423 bh->outreq->length = length; in set_bulk_out_req_length()
492 struct fsg_buffhd *bh = req->context; in bulk_in_complete() local
501 bh->inreq_busy = 0; in bulk_in_complete()
502 bh->state = BUF_STATE_EMPTY; in bulk_in_complete()
509 struct fsg_buffhd *bh = req->context; in bulk_out_complete() local
512 if (req->status || req->actual != bh->bulk_out_intended_length) in bulk_out_complete()
515 bh->bulk_out_intended_length); in bulk_out_complete()
520 bh->outreq_busy = 0; in bulk_out_complete()
521 bh->state = BUF_STATE_FULL; in bulk_out_complete()
687 struct fsg_buffhd *bh; in do_read() local
738 bh = common->next_buffhd_to_fill; in do_read()
739 while (bh->state != BUF_STATE_EMPTY) { in do_read()
751 bh->inreq->length = 0; in do_read()
752 bh->state = BUF_STATE_FULL; in do_read()
760 (char __user *)bh->buf); in do_read()
782 bh->inreq->length = nread; in do_read()
783 bh->state = BUF_STATE_FULL; in do_read()
796 bh->inreq->zero = 0; in do_read()
797 START_TRANSFER_OR(common, bulk_in, bh->inreq, in do_read()
798 &bh->inreq_busy, &bh->state) in do_read()
802 common->next_buffhd_to_fill = bh->next; in do_read()
814 struct fsg_buffhd *bh; in do_write() local
858 bh = common->next_buffhd_to_fill; in do_write()
859 if (bh->state == BUF_STATE_EMPTY && get_some_more) { in do_write()
901 bh->outreq->length = amount; in do_write()
902 bh->bulk_out_intended_length = amount; in do_write()
903 bh->outreq->short_not_ok = 1; in do_write()
904 START_TRANSFER_OR(common, bulk_out, bh->outreq, in do_write()
905 &bh->outreq_busy, &bh->state) in do_write()
909 common->next_buffhd_to_fill = bh->next; in do_write()
914 bh = common->next_buffhd_to_drain; in do_write()
915 if (bh->state == BUF_STATE_EMPTY && !get_some_more) in do_write()
917 if (bh->state == BUF_STATE_FULL) { in do_write()
918 common->next_buffhd_to_drain = bh->next; in do_write()
919 bh->state = BUF_STATE_EMPTY; in do_write()
922 if (bh->outreq->status != 0) { in do_write()
928 amount = bh->outreq->actual; in do_write()
934 (char __user *)bh->buf); in do_write()
967 if (bh->outreq->actual != bh->outreq->length) { in do_write()
997 struct fsg_buffhd *bh = common->next_buffhd_to_fill; in do_verify() local
1050 (char __user *)bh->buf); in do_verify()
1080 static int do_inquiry(struct fsg_common *common, struct fsg_buffhd *bh) in do_inquiry() argument
1084 u8 *buf = (u8 *) bh->buf; in do_inquiry()
1108 static int do_request_sense(struct fsg_common *common, struct fsg_buffhd *bh) in do_request_sense() argument
1111 u8 *buf = (u8 *) bh->buf; in do_request_sense()
1159 static int do_read_capacity(struct fsg_common *common, struct fsg_buffhd *bh) in do_read_capacity() argument
1164 u8 *buf = (u8 *) bh->buf; in do_read_capacity()
1178 static int do_read_header(struct fsg_common *common, struct fsg_buffhd *bh) in do_read_header() argument
1183 u8 *buf = (u8 *) bh->buf; in do_read_header()
1201 static int do_read_toc(struct fsg_common *common, struct fsg_buffhd *bh) in do_read_toc() argument
1206 u8 *buf = (u8 *) bh->buf; in do_read_toc()
1229 static int do_mode_sense(struct fsg_common *common, struct fsg_buffhd *bh) in do_mode_sense() argument
1233 u8 *buf = (u8 *) bh->buf; in do_mode_sense()
1348 struct fsg_buffhd *bh) in do_read_format_capacities() argument
1351 u8 *buf = (u8 *) bh->buf; in do_read_format_capacities()
1365 static int do_mode_select(struct fsg_common *common, struct fsg_buffhd *bh) in do_mode_select() argument
1417 struct fsg_buffhd *bh = fsg->common->next_buffhd_to_fill; in pad_with_zeros() local
1418 u32 nkeep = bh->inreq->length; in pad_with_zeros()
1422 bh->state = BUF_STATE_EMPTY; /* For the first iteration */ in pad_with_zeros()
1427 while (bh->state != BUF_STATE_EMPTY) { in pad_with_zeros()
1434 memset(bh->buf + nkeep, 0, nsend - nkeep); in pad_with_zeros()
1435 bh->inreq->length = nsend; in pad_with_zeros()
1436 bh->inreq->zero = 0; in pad_with_zeros()
1437 start_transfer(fsg, fsg->bulk_in, bh->inreq, in pad_with_zeros()
1438 &bh->inreq_busy, &bh->state); in pad_with_zeros()
1439 bh = fsg->common->next_buffhd_to_fill = bh->next; in pad_with_zeros()
1448 struct fsg_buffhd *bh; in throw_away_data() local
1452 for (bh = common->next_buffhd_to_drain; in throw_away_data()
1453 bh->state != BUF_STATE_EMPTY || common->usb_amount_left > 0; in throw_away_data()
1454 bh = common->next_buffhd_to_drain) { in throw_away_data()
1457 if (bh->state == BUF_STATE_FULL) { in throw_away_data()
1458 bh->state = BUF_STATE_EMPTY; in throw_away_data()
1459 common->next_buffhd_to_drain = bh->next; in throw_away_data()
1462 if (bh->outreq->actual != bh->outreq->length || in throw_away_data()
1463 bh->outreq->status != 0) { in throw_away_data()
1472 bh = common->next_buffhd_to_fill; in throw_away_data()
1473 if (bh->state == BUF_STATE_EMPTY in throw_away_data()
1479 bh->outreq->length = amount; in throw_away_data()
1480 bh->bulk_out_intended_length = amount; in throw_away_data()
1481 bh->outreq->short_not_ok = 1; in throw_away_data()
1482 START_TRANSFER_OR(common, bulk_out, bh->outreq, in throw_away_data()
1483 &bh->outreq_busy, &bh->state) in throw_away_data()
1487 common->next_buffhd_to_fill = bh->next; in throw_away_data()
1503 struct fsg_buffhd *bh = common->next_buffhd_to_fill; in finish_reply() local
1533 bh->inreq->zero = 0; in finish_reply()
1534 START_TRANSFER_OR(common, bulk_in, bh->inreq, in finish_reply()
1535 &bh->inreq_busy, &bh->state) in finish_reply()
1537 common->next_buffhd_to_fill = bh->next; in finish_reply()
1543 bh->inreq->zero = 1; in finish_reply()
1544 START_TRANSFER_OR(common, bulk_in, bh->inreq, in finish_reply()
1545 &bh->inreq_busy, &bh->state) in finish_reply()
1549 common->next_buffhd_to_fill = bh->next; in finish_reply()
1600 struct fsg_buffhd *bh; in send_status() local
1607 bh = common->next_buffhd_to_fill; in send_status()
1608 while (bh->state != BUF_STATE_EMPTY) { in send_status()
1634 csw = (void *)bh->buf; in send_status()
1641 bh->inreq->length = USB_BULK_CS_WRAP_LEN; in send_status()
1642 bh->inreq->zero = 0; in send_status()
1643 START_TRANSFER_OR(common, bulk_in, bh->inreq, in send_status()
1644 &bh->inreq_busy, &bh->state) in send_status()
1648 common->next_buffhd_to_fill = bh->next; in send_status()
1773 struct fsg_buffhd *bh; in do_scsi_command() local
1783 bh = common->next_buffhd_to_fill; in do_scsi_command()
1784 common->next_buffhd_to_drain = bh; in do_scsi_command()
1785 while (bh->state != BUF_STATE_EMPTY) { in do_scsi_command()
1802 reply = do_inquiry(common, bh); in do_scsi_command()
1811 reply = do_mode_select(common, bh); in do_scsi_command()
1821 reply = do_mode_select(common, bh); in do_scsi_command()
1830 reply = do_mode_sense(common, bh); in do_scsi_command()
1840 reply = do_mode_sense(common, bh); in do_scsi_command()
1888 reply = do_read_capacity(common, bh); in do_scsi_command()
1900 reply = do_read_header(common, bh); in do_scsi_command()
1912 reply = do_read_toc(common, bh); in do_scsi_command()
1922 reply = do_read_format_capacities(common, bh); in do_scsi_command()
1931 reply = do_request_sense(common, bh); in do_scsi_command()
2032 bh->inreq->length = reply; in do_scsi_command()
2033 bh->state = BUF_STATE_FULL; in do_scsi_command()
2042 static int received_cbw(struct fsg_dev *fsg, struct fsg_buffhd *bh) in received_cbw() argument
2044 struct usb_request *req = bh->outreq; in received_cbw()
2108 struct fsg_buffhd *bh; in get_next_command() local
2112 bh = common->next_buffhd_to_fill; in get_next_command()
2113 while (bh->state != BUF_STATE_EMPTY) { in get_next_command()
2120 set_bulk_out_req_length(common, bh, USB_BULK_CB_WRAP_LEN); in get_next_command()
2121 bh->outreq->short_not_ok = 1; in get_next_command()
2122 START_TRANSFER_OR(common, bulk_out, bh->outreq, in get_next_command()
2123 &bh->outreq_busy, &bh->state) in get_next_command()
2132 while (bh->state != BUF_STATE_FULL) { in get_next_command()
2138 rc = fsg_is_set(common) ? received_cbw(common->fsg, bh) : -EIO; in get_next_command()
2139 bh->state = BUF_STATE_EMPTY; in get_next_command()
2185 struct fsg_buffhd *bh = &common->buffhds[i]; in do_set_interface() local
2187 if (bh->inreq) { in do_set_interface()
2188 usb_ep_free_request(fsg->bulk_in, bh->inreq); in do_set_interface()
2189 bh->inreq = NULL; in do_set_interface()
2191 if (bh->outreq) { in do_set_interface()
2192 usb_ep_free_request(fsg->bulk_out, bh->outreq); in do_set_interface()
2193 bh->outreq = NULL; in do_set_interface()
2238 struct fsg_buffhd *bh = &common->buffhds[i]; in do_set_interface() local
2240 rc = alloc_request(common, fsg->bulk_in, &bh->inreq); in do_set_interface()
2243 rc = alloc_request(common, fsg->bulk_out, &bh->outreq); in do_set_interface()
2246 bh->inreq->buf = bh->outreq->buf = bh->buf; in do_set_interface()
2247 bh->inreq->context = bh->outreq->context = bh; in do_set_interface()
2248 bh->inreq->complete = bulk_in_complete; in do_set_interface()
2249 bh->outreq->complete = bulk_out_complete; in do_set_interface()
2281 struct fsg_buffhd *bh; in handle_exception() local
2289 bh = &common->buffhds[i]; in handle_exception()
2290 if (bh->inreq_busy) in handle_exception()
2291 usb_ep_dequeue(common->fsg->bulk_in, bh->inreq); in handle_exception()
2292 if (bh->outreq_busy) in handle_exception()
2294 bh->outreq); in handle_exception()
2301 bh = &common->buffhds[i]; in handle_exception()
2302 num_active += bh->inreq_busy + bh->outreq_busy; in handle_exception()
2321 bh = &common->buffhds[i]; in handle_exception()
2322 bh->state = BUF_STATE_EMPTY; in handle_exception()
2436 struct fsg_buffhd *bh; in fsg_common_init() local
2493 bh = common->buffhds; in fsg_common_init()
2498 bh->next = bh + 1; in fsg_common_init()
2499 ++bh; in fsg_common_init()
2501 bh->inreq_busy = 0; in fsg_common_init()
2502 bh->outreq_busy = 0; in fsg_common_init()
2503 bh->buf = memalign(CONFIG_SYS_CACHELINE_SIZE, FSG_BUFLEN); in fsg_common_init()
2504 if (unlikely(!bh->buf)) { in fsg_common_init()
2509 bh->next = common->buffhds; in fsg_common_init()
2570 struct fsg_buffhd *bh = common->buffhds; in fsg_common_release() local
2573 kfree(bh->buf); in fsg_common_release()
2574 } while (++bh, --i); in fsg_common_release()