Lines Matching defs:req

116 static void printADBreply(struct adb_request *req)
120 printk("adb reply (%d)", req->reply_len);
121 for(i = 0; i < req->reply_len; i++)
122 printk(" %x", req->reply[i]);
132 struct adb_request req;
137 adb_request(&req, NULL, ADBREQ_SYNC | ADBREQ_REPLY, 1,
139 if (req.reply_len > 1)
156 adb_request(&req, NULL, ADBREQ_SYNC | ADBREQ_REPLY, 1,
163 adb_request(&req, NULL, ADBREQ_SYNC, 3,
171 adb_request(&req, NULL, ADBREQ_SYNC | ADBREQ_REPLY, 1,
173 if (req.reply_len <= 1) continue;
178 adb_request(&req, NULL, ADBREQ_SYNC | ADBREQ_REPLY, 1,
180 if (req.reply_len > 1) {
202 adb_request(&req, NULL, ADBREQ_SYNC, 3,
214 adb_request(&req, NULL, ADBREQ_SYNC | ADBREQ_REPLY, 1,
216 adb_handler[i].handler_id = req.reply[2];
396 static void adb_sync_req_done(struct adb_request *req)
398 struct completion *comp = req->arg;
404 adb_request(struct adb_request *req, void (*done)(struct adb_request *),
417 req->nbytes = nbytes+1;
418 req->done = done;
419 req->reply_expected = flags & ADBREQ_REPLY;
420 req->data[0] = ADB_PACKET;
423 req->data[i+1] = va_arg(list, int);
432 req->done = adb_sync_req_done;
433 req->arg = &comp;
437 rc = adb_controller->send_request(req, 0);
439 if ((flags & ADBREQ_SYNC) && !rc && !req->complete)
539 struct adb_request req;
543 adb_request(&req, NULL, ADBREQ_SYNC, 3,
545 adb_request(&req, NULL, ADBREQ_SYNC | ADBREQ_REPLY, 1,
547 if (req.reply_len < 2)
549 if (req.reply[2] != new_id)
551 adb_handler[address].handler_id = req.reply[2];
593 static void adb_write_done(struct adb_request *req)
595 struct adbdev_state *state = (struct adbdev_state *) req->arg;
598 if (!req->complete) {
599 req->reply_len = 0;
600 req->complete = 1;
605 kfree(req);
615 req->next = NULL;
616 *ap = req;
623 do_adb_query(struct adb_request *req)
627 switch(req->data[1])
630 if (req->nbytes < 3)
633 req->reply[0] = adb_handler[req->data[2]].original_address;
634 req->reply[1] = adb_handler[req->data[2]].handler_id;
636 req->complete = 1;
637 req->reply_len = 2;
638 adb_write_done(req);
699 struct adb_request *req;
705 if (count > sizeof(req->reply))
706 count = sizeof(req->reply);
710 req = NULL;
716 req = state->completed;
717 if (req != NULL)
718 state->completed = req->next;
721 if (req != NULL || ret != 0)
744 ret = req->reply_len;
747 if (ret > 0 && copy_to_user(buf, req->reply, ret))
750 kfree(req);
759 struct adb_request *req;
761 if (count < 2 || count > sizeof(req->data))
768 req = kmalloc(sizeof(struct adb_request),
770 if (req == NULL)
773 req->nbytes = count;
774 req->done = adb_write_done;
775 req->arg = (void *) state;
776 req->complete = 0;
779 if (copy_from_user(req->data, buf, count))
788 if (req->data[0] == ADB_QUERY) {
790 ret = do_adb_query(req);
797 else if ((req->data[0] == ADB_PACKET)&&(count > 1)
798 &&(req->data[1] == ADB_BUSRESET)) {
806 req->reply_expected = ((req->data[1] & 0xc) == 0xc);
808 ret = adb_controller->send_request(req, 0);
821 kfree(req);