Lines Matching refs:req
106 static void printADBreply(struct adb_request *req)
110 printk("adb reply (%d)", req->reply_len);
111 for(i = 0; i < req->reply_len; i++)
112 printk(" %x", req->reply[i]);
133 struct adb_request req; in adb_scan_bus() local
138 adb_request(&req, NULL, ADBREQ_SYNC | ADBREQ_REPLY, 1, in adb_scan_bus()
140 if (req.reply_len > 1) in adb_scan_bus()
157 adb_request(&req, NULL, ADBREQ_SYNC | ADBREQ_REPLY, 1, in adb_scan_bus()
164 adb_request(&req, NULL, ADBREQ_SYNC, 3, in adb_scan_bus()
172 adb_request(&req, NULL, ADBREQ_SYNC | ADBREQ_REPLY, 1, in adb_scan_bus()
174 if (req.reply_len <= 1) continue; in adb_scan_bus()
179 adb_request(&req, NULL, ADBREQ_SYNC | ADBREQ_REPLY, 1, in adb_scan_bus()
181 if (req.reply_len > 1) { in adb_scan_bus()
203 adb_request(&req, NULL, ADBREQ_SYNC, 3, in adb_scan_bus()
215 adb_request(&req, NULL, ADBREQ_SYNC | ADBREQ_REPLY, 1, in adb_scan_bus()
217 adb_handler[i].handler_id = req.reply[2]; in adb_scan_bus()
437 adb_probe_wakeup(struct adb_request *req) in adb_probe_wakeup() argument
446 adb_request(struct adb_request *req, void (*done)(struct adb_request *), in adb_request() argument
457 if (req == NULL && (flags & ADBREQ_NOSEND)) in adb_request()
460 if (req == NULL) { in adb_request()
465 req = &adb_sreq; in adb_request()
470 req->nbytes = nbytes+1; in adb_request()
471 req->done = done; in adb_request()
472 req->reply_expected = flags & ADBREQ_REPLY; in adb_request()
473 req->data[0] = ADB_PACKET; in adb_request()
476 req->data[i+1] = va_arg(list, int); in adb_request()
488 req->done = adb_probe_wakeup; in adb_request()
489 rc = adb_controller->send_request(req, 0); in adb_request()
490 if (rc || req->complete) in adb_request()
497 rc = adb_controller->send_request(req, flags & ADBREQ_SYNC); in adb_request()
573 struct adb_request req; in adb_try_handler_change() local
577 adb_request(&req, NULL, ADBREQ_SYNC, 3, in adb_try_handler_change()
579 adb_request(&req, NULL, ADBREQ_SYNC | ADBREQ_REPLY, 1, in adb_try_handler_change()
581 if (req.reply_len < 2) in adb_try_handler_change()
583 if (req.reply[2] != new_id) in adb_try_handler_change()
585 adb_handler[address].handler_id = req.reply[2]; in adb_try_handler_change()
613 static void adb_write_done(struct adb_request *req) in adb_write_done() argument
615 struct adbdev_state *state = (struct adbdev_state *) req->arg; in adb_write_done()
618 if (!req->complete) { in adb_write_done()
619 req->reply_len = 0; in adb_write_done()
620 req->complete = 1; in adb_write_done()
625 kfree(req); in adb_write_done()
635 req->next = NULL; in adb_write_done()
636 *ap = req; in adb_write_done()
643 do_adb_query(struct adb_request *req) in do_adb_query() argument
647 switch(req->data[1]) in do_adb_query()
650 if (req->nbytes < 3) in do_adb_query()
652 req->reply[0] = adb_handler[req->data[2]].original_address; in do_adb_query()
653 req->reply[1] = adb_handler[req->data[2]].handler_id; in do_adb_query()
654 req->complete = 1; in do_adb_query()
655 req->reply_len = 2; in do_adb_query()
656 adb_write_done(req); in do_adb_query()
710 struct adb_request *req; in adb_read() local
716 if (count > sizeof(req->reply)) in adb_read()
717 count = sizeof(req->reply); in adb_read()
722 req = NULL; in adb_read()
728 req = state->completed; in adb_read()
729 if (req != NULL) in adb_read()
730 state->completed = req->next; in adb_read()
733 if (req != NULL || ret != 0) in adb_read()
756 ret = req->reply_len; in adb_read()
759 if (ret > 0 && copy_to_user(buf, req->reply, ret)) in adb_read()
762 kfree(req); in adb_read()
771 struct adb_request *req; in adb_write() local
773 if (count < 2 || count > sizeof(req->data)) in adb_write()
781 req = (struct adb_request *) kmalloc(sizeof(struct adb_request), in adb_write()
783 if (req == NULL) in adb_write()
786 req->nbytes = count; in adb_write()
787 req->done = adb_write_done; in adb_write()
788 req->arg = (void *) state; in adb_write()
789 req->complete = 0; in adb_write()
792 if (copy_from_user(req->data, buf, count)) in adb_write()
801 if (req->data[0] == ADB_QUERY) { in adb_write()
803 ret = do_adb_query(req); in adb_write()
810 else if ((req->data[0] == ADB_PACKET)&&(count > 1) in adb_write()
811 &&(req->data[1] == ADB_BUSRESET)) { in adb_write()
819 req->reply_expected = ((req->data[1] & 0xc) == 0xc); in adb_write()
821 ret = adb_controller->send_request(req, 0); in adb_write()
834 kfree(req); in adb_write()