Lines Matching refs:bh

418 		struct fsg_buffhd *bh, unsigned int length)  in set_bulk_out_req_length()  argument
422 bh->bulk_out_intended_length = length; in set_bulk_out_req_length()
426 bh->outreq->length = length; in set_bulk_out_req_length()
495 struct fsg_buffhd *bh = req->context; in bulk_in_complete() local
504 bh->inreq_busy = 0; in bulk_in_complete()
505 bh->state = BUF_STATE_EMPTY; in bulk_in_complete()
512 struct fsg_buffhd *bh = req->context; in bulk_out_complete() local
515 if (req->status || req->actual != bh->bulk_out_intended_length) in bulk_out_complete()
518 bh->bulk_out_intended_length); in bulk_out_complete()
523 bh->outreq_busy = 0; in bulk_out_complete()
524 bh->state = BUF_STATE_FULL; in bulk_out_complete()
696 struct fsg_buffhd *bh; in do_read() local
747 bh = common->next_buffhd_to_fill; in do_read()
748 while (bh->state != BUF_STATE_EMPTY) { in do_read()
760 bh->inreq->length = 0; in do_read()
761 bh->state = BUF_STATE_FULL; in do_read()
769 (char __user *)bh->buf); in do_read()
791 bh->inreq->length = nread; in do_read()
792 bh->state = BUF_STATE_FULL; in do_read()
805 bh->inreq->zero = 0; in do_read()
806 START_TRANSFER_OR(common, bulk_in, bh->inreq, in do_read()
807 &bh->inreq_busy, &bh->state) in do_read()
811 common->next_buffhd_to_fill = bh->next; in do_read()
823 struct fsg_buffhd *bh; in do_write() local
868 bh = common->next_buffhd_to_fill; in do_write()
869 if (bh->state == BUF_STATE_EMPTY && get_some_more) { in do_write()
911 bh->outreq->length = amount; in do_write()
912 bh->bulk_out_intended_length = amount; in do_write()
913 bh->outreq->short_not_ok = 1; in do_write()
914 START_TRANSFER_OR(common, bulk_out, bh->outreq, in do_write()
915 &bh->outreq_busy, &bh->state) in do_write()
919 common->next_buffhd_to_fill = bh->next; in do_write()
924 bh = common->next_buffhd_to_drain; in do_write()
925 if (bh->state == BUF_STATE_EMPTY && !get_some_more) in do_write()
927 if (bh->state == BUF_STATE_FULL) { in do_write()
928 common->next_buffhd_to_drain = bh->next; in do_write()
929 bh->state = BUF_STATE_EMPTY; in do_write()
932 if (bh->outreq->status != 0) { in do_write()
938 amount = bh->outreq->actual; in do_write()
944 (char __user *)bh->buf); in do_write()
977 if (bh->outreq->actual != bh->outreq->length) { in do_write()
1011 struct fsg_buffhd *bh = common->next_buffhd_to_fill; in do_verify() local
1064 (char __user *)bh->buf); in do_verify()
1094 static int do_inquiry(struct fsg_common *common, struct fsg_buffhd *bh) in do_inquiry() argument
1098 u8 *buf = (u8 *) bh->buf; in do_inquiry()
1122 static int do_request_sense(struct fsg_common *common, struct fsg_buffhd *bh) in do_request_sense() argument
1125 u8 *buf = (u8 *) bh->buf; in do_request_sense()
1173 static int do_read_capacity(struct fsg_common *common, struct fsg_buffhd *bh) in do_read_capacity() argument
1178 u8 *buf = (u8 *) bh->buf; in do_read_capacity()
1192 static int do_read_header(struct fsg_common *common, struct fsg_buffhd *bh) in do_read_header() argument
1197 u8 *buf = (u8 *) bh->buf; in do_read_header()
1215 static int do_read_toc(struct fsg_common *common, struct fsg_buffhd *bh) in do_read_toc() argument
1220 u8 *buf = (u8 *) bh->buf; in do_read_toc()
1243 static int do_mode_sense(struct fsg_common *common, struct fsg_buffhd *bh) in do_mode_sense() argument
1247 u8 *buf = (u8 *) bh->buf; in do_mode_sense()
1362 struct fsg_buffhd *bh) in do_read_format_capacities() argument
1365 u8 *buf = (u8 *) bh->buf; in do_read_format_capacities()
1379 static int do_mode_select(struct fsg_common *common, struct fsg_buffhd *bh) in do_mode_select() argument
1431 struct fsg_buffhd *bh = fsg->common->next_buffhd_to_fill; in pad_with_zeros() local
1432 u32 nkeep = bh->inreq->length; in pad_with_zeros()
1436 bh->state = BUF_STATE_EMPTY; /* For the first iteration */ in pad_with_zeros()
1441 while (bh->state != BUF_STATE_EMPTY) { in pad_with_zeros()
1449 memset(bh->buf + nkeep, 0, nsend - nkeep); in pad_with_zeros()
1450 bh->inreq->length = nsend; in pad_with_zeros()
1451 bh->inreq->zero = 0; in pad_with_zeros()
1452 start_transfer(fsg, fsg->bulk_in, bh->inreq, in pad_with_zeros()
1453 &bh->inreq_busy, &bh->state); in pad_with_zeros()
1454 bh = fsg->common->next_buffhd_to_fill = bh->next; in pad_with_zeros()
1463 struct fsg_buffhd *bh; in throw_away_data() local
1467 for (bh = common->next_buffhd_to_drain; in throw_away_data()
1468 bh->state != BUF_STATE_EMPTY || common->usb_amount_left > 0; in throw_away_data()
1469 bh = common->next_buffhd_to_drain) { in throw_away_data()
1472 if (bh->state == BUF_STATE_FULL) { in throw_away_data()
1473 bh->state = BUF_STATE_EMPTY; in throw_away_data()
1474 common->next_buffhd_to_drain = bh->next; in throw_away_data()
1477 if (bh->outreq->actual != bh->outreq->length || in throw_away_data()
1478 bh->outreq->status != 0) { in throw_away_data()
1487 bh = common->next_buffhd_to_fill; in throw_away_data()
1488 if (bh->state == BUF_STATE_EMPTY in throw_away_data()
1495 bh->outreq->length = amount; in throw_away_data()
1496 bh->bulk_out_intended_length = amount; in throw_away_data()
1497 bh->outreq->short_not_ok = 1; in throw_away_data()
1498 START_TRANSFER_OR(common, bulk_out, bh->outreq, in throw_away_data()
1499 &bh->outreq_busy, &bh->state) in throw_away_data()
1503 common->next_buffhd_to_fill = bh->next; in throw_away_data()
1519 struct fsg_buffhd *bh = common->next_buffhd_to_fill; in finish_reply() local
1549 bh->inreq->zero = 0; in finish_reply()
1550 START_TRANSFER_OR(common, bulk_in, bh->inreq, in finish_reply()
1551 &bh->inreq_busy, &bh->state) in finish_reply()
1553 common->next_buffhd_to_fill = bh->next; in finish_reply()
1559 bh->inreq->zero = 1; in finish_reply()
1560 START_TRANSFER_OR(common, bulk_in, bh->inreq, in finish_reply()
1561 &bh->inreq_busy, &bh->state) in finish_reply()
1565 common->next_buffhd_to_fill = bh->next; in finish_reply()
1616 struct fsg_buffhd *bh; in send_status() local
1623 bh = common->next_buffhd_to_fill; in send_status()
1624 while (bh->state != BUF_STATE_EMPTY) { in send_status()
1650 csw = (void *)bh->buf; in send_status()
1657 bh->inreq->length = USB_BULK_CS_WRAP_LEN; in send_status()
1658 bh->inreq->zero = 0; in send_status()
1659 START_TRANSFER_OR(common, bulk_in, bh->inreq, in send_status()
1660 &bh->inreq_busy, &bh->state) in send_status()
1664 common->next_buffhd_to_fill = bh->next; in send_status()
1792 struct fsg_buffhd *bh; in do_scsi_command() local
1803 bh = common->next_buffhd_to_fill; in do_scsi_command()
1804 common->next_buffhd_to_drain = bh; in do_scsi_command()
1805 while (bh->state != BUF_STATE_EMPTY) { in do_scsi_command()
1817 rc = rkusb_cmd_process(common, bh, &reply); in do_scsi_command()
1832 reply = do_inquiry(common, bh); in do_scsi_command()
1841 reply = do_mode_select(common, bh); in do_scsi_command()
1851 reply = do_mode_select(common, bh); in do_scsi_command()
1860 reply = do_mode_sense(common, bh); in do_scsi_command()
1870 reply = do_mode_sense(common, bh); in do_scsi_command()
1918 reply = do_read_capacity(common, bh); in do_scsi_command()
1930 reply = do_read_header(common, bh); in do_scsi_command()
1942 reply = do_read_toc(common, bh); in do_scsi_command()
1952 reply = do_read_format_capacities(common, bh); in do_scsi_command()
1961 reply = do_request_sense(common, bh); in do_scsi_command()
2072 bh->inreq->length = reply; in do_scsi_command()
2073 bh->state = BUF_STATE_FULL; in do_scsi_command()
2082 static int received_cbw(struct fsg_dev *fsg, struct fsg_buffhd *bh) in received_cbw() argument
2084 struct usb_request *req = bh->outreq; in received_cbw()
2148 struct fsg_buffhd *bh; in get_next_command() local
2152 bh = common->next_buffhd_to_fill; in get_next_command()
2153 while (bh->state != BUF_STATE_EMPTY) { in get_next_command()
2160 set_bulk_out_req_length(common, bh, USB_BULK_CB_WRAP_LEN); in get_next_command()
2161 bh->outreq->short_not_ok = 1; in get_next_command()
2162 START_TRANSFER_OR(common, bulk_out, bh->outreq, in get_next_command()
2163 &bh->outreq_busy, &bh->state) in get_next_command()
2172 while (bh->state != BUF_STATE_FULL) { in get_next_command()
2178 rc = fsg_is_set(common) ? received_cbw(common->fsg, bh) : -EIO; in get_next_command()
2179 bh->state = BUF_STATE_EMPTY; in get_next_command()
2225 struct fsg_buffhd *bh = &common->buffhds[i]; in do_set_interface() local
2227 if (bh->inreq) { in do_set_interface()
2228 usb_ep_free_request(fsg->bulk_in, bh->inreq); in do_set_interface()
2229 bh->inreq = NULL; in do_set_interface()
2231 if (bh->outreq) { in do_set_interface()
2232 usb_ep_free_request(fsg->bulk_out, bh->outreq); in do_set_interface()
2233 bh->outreq = NULL; in do_set_interface()
2282 struct fsg_buffhd *bh = &common->buffhds[i]; in do_set_interface() local
2284 rc = alloc_request(common, fsg->bulk_in, &bh->inreq); in do_set_interface()
2287 rc = alloc_request(common, fsg->bulk_out, &bh->outreq); in do_set_interface()
2290 bh->inreq->buf = bh->outreq->buf = bh->buf; in do_set_interface()
2291 bh->inreq->context = bh->outreq->context = bh; in do_set_interface()
2292 bh->inreq->complete = bulk_in_complete; in do_set_interface()
2293 bh->outreq->complete = bulk_out_complete; in do_set_interface()
2325 struct fsg_buffhd *bh; in handle_exception() local
2333 bh = &common->buffhds[i]; in handle_exception()
2334 if (bh->inreq_busy) in handle_exception()
2335 usb_ep_dequeue(common->fsg->bulk_in, bh->inreq); in handle_exception()
2336 if (bh->outreq_busy) in handle_exception()
2338 bh->outreq); in handle_exception()
2345 bh = &common->buffhds[i]; in handle_exception()
2346 num_active += bh->inreq_busy + bh->outreq_busy; in handle_exception()
2365 bh = &common->buffhds[i]; in handle_exception()
2366 bh->state = BUF_STATE_EMPTY; in handle_exception()
2480 struct fsg_buffhd *bh; in fsg_common_init() local
2538 bh = common->buffhds; in fsg_common_init()
2543 bh->next = bh + 1; in fsg_common_init()
2544 ++bh; in fsg_common_init()
2546 bh->inreq_busy = 0; in fsg_common_init()
2547 bh->outreq_busy = 0; in fsg_common_init()
2548 bh->buf = memalign(CONFIG_SYS_CACHELINE_SIZE, FSG_BUFLEN); in fsg_common_init()
2549 if (unlikely(!bh->buf)) { in fsg_common_init()
2554 bh->next = common->buffhds; in fsg_common_init()
2615 struct fsg_buffhd *bh = common->buffhds; in fsg_common_release() local
2618 kfree(bh->buf); in fsg_common_release()
2619 } while (++bh, --i); in fsg_common_release()