Lines Matching refs:req

113 static void printADBreply(struct adb_request *req)
117 printk("adb reply (%d)", req->reply_len);
118 for(i = 0; i < req->reply_len; i++)
119 printk(" %x", req->reply[i]);
129 struct adb_request req;
134 adb_request(&req, NULL, ADBREQ_SYNC | ADBREQ_REPLY, 1,
136 if (req.reply_len > 1)
153 adb_request(&req, NULL, ADBREQ_SYNC | ADBREQ_REPLY, 1,
160 adb_request(&req, NULL, ADBREQ_SYNC, 3,
168 adb_request(&req, NULL, ADBREQ_SYNC | ADBREQ_REPLY, 1,
170 if (req.reply_len <= 1) continue;
175 adb_request(&req, NULL, ADBREQ_SYNC | ADBREQ_REPLY, 1,
177 if (req.reply_len > 1) {
198 adb_request(&req, NULL, ADBREQ_SYNC, 3,
209 adb_request(&req, NULL, ADBREQ_SYNC | ADBREQ_REPLY, 1,
211 adb_handler[i].handler_id = req.reply[2];
412 static void adb_sync_req_done(struct adb_request *req)
414 struct completion *comp = req->arg;
420 adb_request(struct adb_request *req, void (*done)(struct adb_request *),
433 req->nbytes = nbytes+1;
434 req->done = done;
435 req->reply_expected = flags & ADBREQ_REPLY;
436 req->data[0] = ADB_PACKET;
439 req->data[i+1] = va_arg(list, int);
448 req->done = adb_sync_req_done;
449 req->arg = &comp;
453 rc = adb_controller->send_request(req, 0);
455 if ((flags & ADBREQ_SYNC) && !rc && !req->complete)
557 struct adb_request req;
561 adb_request(&req, NULL, ADBREQ_SYNC, 3,
563 adb_request(&req, NULL, ADBREQ_SYNC | ADBREQ_REPLY, 1,
565 if (req.reply_len < 2)
567 if (req.reply[2] != new_id)
569 adb_handler[address].handler_id = req.reply[2];
614 static void adb_write_done(struct adb_request *req)
616 struct adbdev_state *state = (struct adbdev_state *) req->arg;
619 if (!req->complete) {
620 req->reply_len = 0;
621 req->complete = 1;
626 kfree(req);
636 req->next = NULL;
637 *ap = req;
644 do_adb_query(struct adb_request *req)
648 switch(req->data[1]) {
650 if (req->nbytes < 3 || req->data[2] >= 16)
653 req->reply[0] = adb_handler[req->data[2]].original_address;
654 req->reply[1] = adb_handler[req->data[2]].handler_id;
656 req->complete = 1;
657 req->reply_len = 2;
658 adb_write_done(req);
719 struct adb_request *req;
725 if (count > sizeof(req->reply))
726 count = sizeof(req->reply);
728 req = NULL;
734 req = state->completed;
735 if (req != NULL)
736 state->completed = req->next;
739 if (req != NULL || ret != 0)
762 ret = req->reply_len;
765 if (ret > 0 && copy_to_user(buf, req->reply, ret))
768 kfree(req);
777 struct adb_request *req;
779 if (count < 2 || count > sizeof(req->data))
784 req = kmalloc(sizeof(struct adb_request),
786 if (req == NULL)
789 req->nbytes = count;
790 req->done = adb_write_done;
791 req->arg = (void *) state;
792 req->complete = 0;
795 if (copy_from_user(req->data, buf, count))
804 if (req->data[0] == ADB_QUERY) {
806 ret = do_adb_query(req);
813 else if ((req->data[0] == ADB_PACKET) && (count > 1)
814 && (req->data[1] == ADB_BUSRESET)) {
822 req->reply_expected = ((req->data[1] & 0xc) == 0xc);
824 ret = adb_controller->send_request(req, 0);
837 kfree(req);