Lines Matching refs:req

102 static void queue_complete_cb(struct pending_request *req);
106 struct pending_request *req; in __alloc_pending_request() local
108 req = (struct pending_request *)kmalloc(sizeof(struct pending_request), in __alloc_pending_request()
110 if (req != NULL) { in __alloc_pending_request()
111 memset(req, 0, sizeof(struct pending_request)); in __alloc_pending_request()
112 INIT_LIST_HEAD(&req->list); in __alloc_pending_request()
115 return req; in __alloc_pending_request()
123 static void free_pending_request(struct pending_request *req) in free_pending_request() argument
125 if (req->ibs) { in free_pending_request()
126 if (atomic_dec_and_test(&req->ibs->refcount)) { in free_pending_request()
127 atomic_sub(req->ibs->data_size, &iso_buffer_size); in free_pending_request()
128 kfree(req->ibs); in free_pending_request()
130 } else if (req->free_data) { in free_pending_request()
131 kfree(req->data); in free_pending_request()
133 free_hpsb_packet(req->packet); in free_pending_request()
134 kfree(req); in free_pending_request()
138 static void __queue_complete_req(struct pending_request *req) in __queue_complete_req() argument
140 struct file_info *fi = req->file_info; in __queue_complete_req()
141 list_del(&req->list); in __queue_complete_req()
142 list_add_tail(&req->list, &fi->req_complete); in __queue_complete_req()
148 static void queue_complete_req(struct pending_request *req) in queue_complete_req() argument
151 struct file_info *fi = req->file_info; in queue_complete_req()
154 __queue_complete_req(req); in queue_complete_req()
158 static void queue_complete_cb(struct pending_request *req) in queue_complete_cb() argument
160 struct hpsb_packet *packet = req->packet; in queue_complete_cb()
166 req->req.error = RAW1394_ERROR_SEND_ERROR; in queue_complete_cb()
169 req->req.error = RAW1394_ERROR_ABORTED; in queue_complete_cb()
172 req->req.error = RAW1394_ERROR_TIMEOUT; in queue_complete_cb()
175 req->req.error = (packet->ack_code << 16) | rcode; in queue_complete_cb()
180 req->req.length = 0; in queue_complete_cb()
183 if ((req->req.type == RAW1394_REQ_ASYNC_READ) || in queue_complete_cb()
184 (req->req.type == RAW1394_REQ_ASYNC_WRITE) || in queue_complete_cb()
185 (req->req.type == RAW1394_REQ_ASYNC_STREAM) || in queue_complete_cb()
186 (req->req.type == RAW1394_REQ_LOCK) || in queue_complete_cb()
187 (req->req.type == RAW1394_REQ_LOCK64)) in queue_complete_cb()
190 queue_complete_req(req); in queue_complete_cb()
268 struct pending_request *req; in host_reset() local
277 req = __alloc_pending_request(SLAB_ATOMIC); in host_reset()
279 if (req != NULL) { in host_reset()
280 req->file_info = fi; in host_reset()
281 req->req.type = RAW1394_REQ_BUS_RESET; in host_reset()
282 req->req.generation = get_hpsb_generation(host); in host_reset()
283 req->req.misc = (host->node_id << 16) in host_reset()
286 req->req.misc |= (NODEID_TO_NODE(host->irm_id) in host_reset()
290 queue_complete_req(req); in host_reset()
305 struct pending_request *req; in iso_receive() local
325 req = __alloc_pending_request(SLAB_ATOMIC); in iso_receive()
326 if (!req) break; in iso_receive()
332 kfree(req); in iso_receive()
344 req->file_info = fi; in iso_receive()
345 req->ibs = ibs; in iso_receive()
346 req->data = ibs->data; in iso_receive()
347 req->req.type = RAW1394_REQ_ISO_RECEIVE; in iso_receive()
348 req->req.generation = get_hpsb_generation(host); in iso_receive()
349 req->req.misc = 0; in iso_receive()
350 req->req.recvb = ptr2int(fi->iso_buffer); in iso_receive()
351 req->req.length = min(length, fi->iso_buffer_length); in iso_receive()
353 list_add_tail(&req->list, &reqs); in iso_receive()
360 req = list_entry(lh, struct pending_request, list); in iso_receive()
363 queue_complete_req(req); in iso_receive()
374 struct pending_request *req; in fcp_request() local
394 req = __alloc_pending_request(SLAB_ATOMIC); in fcp_request()
395 if (!req) break; in fcp_request()
401 kfree(req); in fcp_request()
413 req->file_info = fi; in fcp_request()
414 req->ibs = ibs; in fcp_request()
415 req->data = ibs->data; in fcp_request()
416 req->req.type = RAW1394_REQ_FCP_REQUEST; in fcp_request()
417 req->req.generation = get_hpsb_generation(host); in fcp_request()
418 req->req.misc = nodeid | (direction << 16); in fcp_request()
419 req->req.recvb = ptr2int(fi->fcp_buffer); in fcp_request()
420 req->req.length = length; in fcp_request()
422 list_add_tail(&req->list, &reqs); in fcp_request()
429 req = list_entry(lh, struct pending_request, list); in fcp_request()
432 queue_complete_req(req); in fcp_request()
442 struct pending_request *req; in raw1394_read() local
467 req = list_entry(lh, struct pending_request, list); in raw1394_read()
469 if (req->req.length) { in raw1394_read()
470 if (copy_to_user(int2ptr(req->req.recvb), req->data, in raw1394_read()
471 req->req.length)) { in raw1394_read()
472 req->req.error = RAW1394_ERROR_MEMFAULT; in raw1394_read()
475 __copy_to_user(buffer, &req->req, sizeof(req->req)); in raw1394_read()
477 free_pending_request(req); in raw1394_read()
482 static int state_opened(struct file_info *fi, struct pending_request *req) in state_opened() argument
484 if (req->req.type == RAW1394_REQ_INITIALIZE) { in state_opened()
485 switch (req->req.misc) { in state_opened()
489 fi->protocol_version = req->req.misc; in state_opened()
490 req->req.error = RAW1394_ERROR_NONE; in state_opened()
491 req->req.generation = atomic_read(&internal_generation); in state_opened()
495 req->req.error = RAW1394_ERROR_COMPAT; in state_opened()
496 req->req.misc = RAW1394_KERNELAPI_VERSION; in state_opened()
499 req->req.error = RAW1394_ERROR_STATE_ORDER; in state_opened()
502 req->req.length = 0; in state_opened()
503 queue_complete_req(req); in state_opened()
507 static int state_initialized(struct file_info *fi, struct pending_request *req) in state_initialized() argument
513 if (req->req.generation != atomic_read(&internal_generation)) { in state_initialized()
514 req->req.error = RAW1394_ERROR_GENERATION; in state_initialized()
515 req->req.generation = atomic_read(&internal_generation); in state_initialized()
516 req->req.length = 0; in state_initialized()
517 queue_complete_req(req); in state_initialized()
521 switch (req->req.type) { in state_initialized()
528 req->req.misc = host_count; in state_initialized()
529 req->data = (quadlet_t *)khl; in state_initialized()
543 req->req.error = RAW1394_ERROR_NONE; in state_initialized()
544 req->req.length = min(req->req.length, in state_initialized()
546 * req->req.misc)); in state_initialized()
547 req->free_data = 1; in state_initialized()
557 if (req->req.misc < host_count) { in state_initialized()
559 while (req->req.misc--) { in state_initialized()
571 req->req.error = RAW1394_ERROR_NONE; in state_initialized()
572 req->req.generation = get_hpsb_generation(fi->host); in state_initialized()
573 req->req.misc = (fi->host->node_id << 16) in state_initialized()
576 req->req.misc |= NODEID_TO_NODE(fi->host->irm_id) << 8; in state_initialized()
579 req->req.error = RAW1394_ERROR_INVALID_ARG; in state_initialized()
582 req->req.length = 0; in state_initialized()
586 req->req.error = RAW1394_ERROR_STATE_ORDER; in state_initialized()
587 req->req.length = 0; in state_initialized()
591 queue_complete_req(req); in state_initialized()
595 static void handle_iso_listen(struct file_info *fi, struct pending_request *req) in handle_iso_listen() argument
597 int channel = req->req.misc; in handle_iso_listen()
601 req->req.error = RAW1394_ERROR_INVALID_ARG; in handle_iso_listen()
605 req->req.error = RAW1394_ERROR_ALREADY; in handle_iso_listen()
608 req->req.error = RAW1394_ERROR_ALREADY; in handle_iso_listen()
611 fi->iso_buffer = int2ptr(req->req.recvb); in handle_iso_listen()
612 fi->iso_buffer_length = req->req.length; in handle_iso_listen()
623 req->req.error = RAW1394_ERROR_INVALID_ARG; in handle_iso_listen()
627 req->req.length = 0; in handle_iso_listen()
628 queue_complete_req(req); in handle_iso_listen()
632 static void handle_fcp_listen(struct file_info *fi, struct pending_request *req) in handle_fcp_listen() argument
634 if (req->req.misc) { in handle_fcp_listen()
636 req->req.error = RAW1394_ERROR_ALREADY; in handle_fcp_listen()
638 fi->fcp_buffer = (u8 *)int2ptr(req->req.recvb); in handle_fcp_listen()
642 req->req.error = RAW1394_ERROR_ALREADY; in handle_fcp_listen()
648 req->req.length = 0; in handle_fcp_listen()
649 queue_complete_req(req); in handle_fcp_listen()
654 struct pending_request *req, int node) in handle_async_request() argument
657 u64 addr = req->req.address & 0xffffffffffffULL; in handle_async_request()
659 switch (req->req.type) { in handle_async_request()
662 packet = hpsb_make_readpacket(fi->host, node, addr, req->req.length); in handle_async_request()
667 if (req->req.length == 4) in handle_async_request()
668 req->data = &packet->header[3]; in handle_async_request()
670 req->data = packet->data; in handle_async_request()
678 req->req.length); in handle_async_request()
682 if (req->req.length == 4) { in handle_async_request()
683 if (copy_from_user(&packet->header[3], int2ptr(req->req.sendb), in handle_async_request()
684 req->req.length)) in handle_async_request()
685 req->req.error = RAW1394_ERROR_MEMFAULT; in handle_async_request()
687 if (copy_from_user(packet->data, int2ptr(req->req.sendb), in handle_async_request()
688 req->req.length)) in handle_async_request()
689 req->req.error = RAW1394_ERROR_MEMFAULT; in handle_async_request()
692 req->req.length = 0; in handle_async_request()
698 packet = hpsb_make_streampacket(fi->host, NULL, req->req.length, node & 0x3f/*channel*/, in handle_async_request()
699 (req->req.misc >> 16) & 0x3, req->req.misc & 0xf); in handle_async_request()
703 if (copy_from_user(packet->data, int2ptr(req->req.sendb), in handle_async_request()
704 req->req.length)) in handle_async_request()
705 req->req.error = RAW1394_ERROR_MEMFAULT; in handle_async_request()
707 req->req.length = 0; in handle_async_request()
712 if ((req->req.misc == EXTCODE_FETCH_ADD) in handle_async_request()
713 || (req->req.misc == EXTCODE_LITTLE_ADD)) { in handle_async_request()
714 if (req->req.length != 4) { in handle_async_request()
715 req->req.error = RAW1394_ERROR_INVALID_ARG; in handle_async_request()
719 if (req->req.length != 8) { in handle_async_request()
720 req->req.error = RAW1394_ERROR_INVALID_ARG; in handle_async_request()
726 req->req.misc, NULL, 0); in handle_async_request()
729 if (copy_from_user(packet->data, int2ptr(req->req.sendb), in handle_async_request()
730 req->req.length)) { in handle_async_request()
731 req->req.error = RAW1394_ERROR_MEMFAULT; in handle_async_request()
735 req->data = packet->data; in handle_async_request()
736 req->req.length = 4; in handle_async_request()
741 if ((req->req.misc == EXTCODE_FETCH_ADD) in handle_async_request()
742 || (req->req.misc == EXTCODE_LITTLE_ADD)) { in handle_async_request()
743 if (req->req.length != 8) { in handle_async_request()
744 req->req.error = RAW1394_ERROR_INVALID_ARG; in handle_async_request()
748 if (req->req.length != 16) { in handle_async_request()
749 req->req.error = RAW1394_ERROR_INVALID_ARG; in handle_async_request()
754 req->req.misc, NULL, 0); in handle_async_request()
757 if (copy_from_user(packet->data, int2ptr(req->req.sendb), in handle_async_request()
758 req->req.length)) { in handle_async_request()
759 req->req.error = RAW1394_ERROR_MEMFAULT; in handle_async_request()
763 req->data = packet->data; in handle_async_request()
764 req->req.length = 8; in handle_async_request()
768 req->req.error = RAW1394_ERROR_STATE_ORDER; in handle_async_request()
771 req->packet = packet; in handle_async_request()
773 if (req->req.error) { in handle_async_request()
774 req->req.length = 0; in handle_async_request()
775 queue_complete_req(req); in handle_async_request()
779 hpsb_set_packet_complete_task(packet, (void(*)(void*))queue_complete_cb, req); in handle_async_request()
782 list_add_tail(&req->list, &fi->req_pending); in handle_async_request()
785 packet->generation = req->req.generation; in handle_async_request()
788 req->req.error = RAW1394_ERROR_SEND_ERROR; in handle_async_request()
789 req->req.length = 0; in handle_async_request()
791 queue_complete_req(req); in handle_async_request()
796 static int handle_iso_send(struct file_info *fi, struct pending_request *req, in handle_iso_send() argument
801 packet = hpsb_make_isopacket(fi->host, req->req.length, channel & 0x3f, in handle_iso_send()
802 (req->req.misc >> 16) & 0x3, req->req.misc & 0xf); in handle_iso_send()
806 packet->speed_code = req->req.address & 0x3; in handle_iso_send()
808 req->packet = packet; in handle_iso_send()
810 if (copy_from_user(packet->data, int2ptr(req->req.sendb), in handle_iso_send()
811 req->req.length)) { in handle_iso_send()
812 req->req.error = RAW1394_ERROR_MEMFAULT; in handle_iso_send()
813 req->req.length = 0; in handle_iso_send()
814 queue_complete_req(req); in handle_iso_send()
818 req->req.length = 0; in handle_iso_send()
819 hpsb_set_packet_complete_task(packet, (void (*)(void*))queue_complete_req, req); in handle_iso_send()
822 list_add_tail(&req->list, &fi->req_pending); in handle_iso_send()
826 packet->generation = req->req.generation; in handle_iso_send()
829 req->req.error = RAW1394_ERROR_SEND_ERROR; in handle_iso_send()
830 queue_complete_req(req); in handle_iso_send()
836 static int handle_async_send(struct file_info *fi, struct pending_request *req) in handle_async_send() argument
839 int header_length = req->req.misc & 0xffff; in handle_async_send()
840 int expect_response = req->req.misc >> 16; in handle_async_send()
842 if ((header_length > req->req.length) || in handle_async_send()
845 req->req.error = RAW1394_ERROR_INVALID_ARG; in handle_async_send()
846 req->req.length = 0; in handle_async_send()
847 queue_complete_req(req); in handle_async_send()
851 packet = alloc_hpsb_packet(req->req.length-header_length); in handle_async_send()
852 req->packet = packet; in handle_async_send()
855 if (copy_from_user(packet->header, int2ptr(req->req.sendb), in handle_async_send()
857 req->req.error = RAW1394_ERROR_MEMFAULT; in handle_async_send()
858 req->req.length = 0; in handle_async_send()
859 queue_complete_req(req); in handle_async_send()
863 if (copy_from_user(packet->data, ((u8*) int2ptr(req->req.sendb)) + header_length, in handle_async_send()
865 req->req.error = RAW1394_ERROR_MEMFAULT; in handle_async_send()
866 req->req.length = 0; in handle_async_send()
867 queue_complete_req(req); in handle_async_send()
878 packet->data_size=req->req.length-header_length; in handle_async_send()
880 req->req.length = 0; in handle_async_send()
881 hpsb_set_packet_complete_task(packet, (void(*)(void*))queue_complete_cb, req); in handle_async_send()
884 list_add_tail(&req->list, &fi->req_pending); in handle_async_send()
888 packet->generation = req->req.generation; in handle_async_send()
891 req->req.error = RAW1394_ERROR_SEND_ERROR; in handle_async_send()
892 queue_complete_req(req); in handle_async_send()
901 struct pending_request *req; in arm_read() local
964 req = __alloc_pending_request(SLAB_ATOMIC); in arm_read()
965 if (!req) { in arm_read()
979 req->data = kmalloc(size, SLAB_ATOMIC); in arm_read()
980 if (!(req->data)) { in arm_read()
981 free_pending_request(req); in arm_read()
987 req->free_data=1; in arm_read()
988 req->file_info = fi; in arm_read()
989 req->req.type = RAW1394_REQ_ARM; in arm_read()
990 req->req.generation = get_hpsb_generation(host); in arm_read()
991 req->req.misc = ( ((length << 16) & (0xFFFF0000)) | (ARM_READ & 0xFF)); in arm_read()
992 req->req.tag = arm_addr->arm_tag; in arm_read()
993 req->req.recvb = arm_addr->recvb; in arm_read()
994 req->req.length = size; in arm_read()
995 arm_req_resp = (struct arm_request_response *) (req->data); in arm_read()
996 arm_req = (struct arm_request *) ((byte_t *)(req->data) + in arm_read()
1016 arm_req->generation = req->req.generation; in arm_read()
1028 queue_complete_req(req); in arm_read()
1037 struct pending_request *req; in arm_write() local
1101 req = __alloc_pending_request(SLAB_ATOMIC); in arm_write()
1102 if (!req) { in arm_write()
1111 req->data = kmalloc(size, SLAB_ATOMIC); in arm_write()
1112 if (!(req->data)) { in arm_write()
1113 free_pending_request(req); in arm_write()
1119 req->free_data=1; in arm_write()
1120 req->file_info = fi; in arm_write()
1121 req->req.type = RAW1394_REQ_ARM; in arm_write()
1122 req->req.generation = get_hpsb_generation(host); in arm_write()
1123 req->req.misc = ( ((length << 16) & (0xFFFF0000)) | (ARM_WRITE & 0xFF)); in arm_write()
1124 req->req.tag = arm_addr->arm_tag; in arm_write()
1125 req->req.recvb = arm_addr->recvb; in arm_write()
1126 req->req.length = size; in arm_write()
1127 arm_req_resp = (struct arm_request_response *) (req->data); in arm_write()
1128 arm_req = (struct arm_request *) ((byte_t *)(req->data) + in arm_write()
1141 arm_req->generation = req->req.generation; in arm_write()
1155 queue_complete_req(req); in arm_write()
1164 struct pending_request *req; in arm_lock() local
1277 req = __alloc_pending_request(SLAB_ATOMIC); in arm_lock()
1278 if (!req) { in arm_lock()
1287 req->data = kmalloc(size, SLAB_ATOMIC); in arm_lock()
1288 if (!(req->data)) { in arm_lock()
1289 free_pending_request(req); in arm_lock()
1295 req->free_data=1; in arm_lock()
1296 arm_req_resp = (struct arm_request_response *) (req->data); in arm_lock()
1297 arm_req = (struct arm_request *) ((byte_t *)(req->data) + in arm_lock()
1323 req->file_info = fi; in arm_lock()
1324 req->req.type = RAW1394_REQ_ARM; in arm_lock()
1325 req->req.generation = get_hpsb_generation(host); in arm_lock()
1326 req->req.misc = ( (((sizeof(*store)) << 16) & (0xFFFF0000)) | in arm_lock()
1328 req->req.tag = arm_addr->arm_tag; in arm_lock()
1329 req->req.recvb = arm_addr->recvb; in arm_lock()
1330 req->req.length = size; in arm_lock()
1331 arm_req->generation = req->req.generation; in arm_lock()
1353 queue_complete_req(req); in arm_lock()
1362 struct pending_request *req; in arm_lock64() local
1484 req = __alloc_pending_request(SLAB_ATOMIC); in arm_lock64()
1485 if (!req) { in arm_lock64()
1494 req->data = kmalloc(size, SLAB_ATOMIC); in arm_lock64()
1495 if (!(req->data)) { in arm_lock64()
1496 free_pending_request(req); in arm_lock64()
1502 req->free_data=1; in arm_lock64()
1503 arm_req_resp = (struct arm_request_response *) (req->data); in arm_lock64()
1504 arm_req = (struct arm_request *) ((byte_t *)(req->data) + in arm_lock64()
1530 req->file_info = fi; in arm_lock64()
1531 req->req.type = RAW1394_REQ_ARM; in arm_lock64()
1532 req->req.generation = get_hpsb_generation(host); in arm_lock64()
1533 req->req.misc = ( (((sizeof(*store)) << 16) & (0xFFFF0000)) | in arm_lock64()
1535 req->req.tag = arm_addr->arm_tag; in arm_lock64()
1536 req->req.recvb = arm_addr->recvb; in arm_lock64()
1537 req->req.length = size; in arm_lock64()
1538 arm_req->generation = req->req.generation; in arm_lock64()
1560 queue_complete_req(req); in arm_lock64()
1566 static int arm_register(struct file_info *fi, struct pending_request *req) in arm_register() argument
1582 (u32) ((req->req.address >>32) & 0xFFFF), in arm_register()
1583 (u32) (req->req.address & 0xFFFFFFFF), in arm_register()
1584 req->req.length, ((req->req.misc >> 8) & 0xFF), in arm_register()
1585 (req->req.misc & 0xFF),((req->req.misc >> 16) & 0xFFFF)); in arm_register()
1587 if ((((req->req.address) & ~(0xFFFFFFFFFFFFULL)) != 0) || in arm_register()
1588 (((req->req.address + req->req.length) & ~(0xFFFFFFFFFFFFULL)) != 0)) { in arm_register()
1589 req->req.length = 0; in arm_register()
1595 req->req.length = 0; in arm_register()
1599 addr->addr_space_buffer = (u8 *)vmalloc(req->req.length); in arm_register()
1602 req->req.length = 0; in arm_register()
1606 if ((req->req.sendb)== (unsigned long)NULL) { in arm_register()
1608 memset(addr->addr_space_buffer, 0,req->req.length); in arm_register()
1611 if (copy_from_user(addr->addr_space_buffer,int2ptr(req->req.sendb), in arm_register()
1612 req->req.length)) { in arm_register()
1619 addr->arm_tag = req->req.tag; in arm_register()
1620 addr->start = req->req.address; in arm_register()
1621 addr->end = req->req.address + req->req.length; in arm_register()
1622 addr->access_rights = (u8) (req->req.misc & 0x0F); in arm_register()
1623 addr->notification_options = (u8) ((req->req.misc >> 4) & 0x0F); in arm_register()
1624 addr->client_transactions = (u8) ((req->req.misc >> 8) & 0x0F); in arm_register()
1627 addr->recvb = req->req.recvb; in arm_register()
1628 addr->rec_length = (u16) ((req->req.misc >> 16) & 0xFFFF); in arm_register()
1685 if (copy_to_user(int2ptr(req->req.recvb), in arm_register()
1694 free_pending_request(req); /* immediate success or fail */ in arm_register()
1700 retval = hpsb_register_addrspace(&raw1394_highlevel, &arm_ops, req->req.address, in arm_register()
1701 req->req.address + req->req.length); in arm_register()
1713 free_pending_request(req); /* immediate success or fail */ in arm_register()
1717 static int arm_unregister(struct file_info *fi, struct pending_request *req) in arm_unregister() argument
1732 (u32) ((req->req.address >>32) & 0xFFFF), in arm_unregister()
1733 (u32) (req->req.address & 0xFFFFFFFF)); in arm_unregister()
1739 if (addr->start == req->req.address) { in arm_unregister()
1783 free_pending_request(req); /* immediate success or fail */ in arm_unregister()
1798 free_pending_request(req); /* immediate success or fail */ in arm_unregister()
1802 static int reset_notification(struct file_info *fi, struct pending_request *req) in reset_notification() argument
1805 (req->req.misc == RAW1394_NOTIFY_OFF)?"OFF":"ON"); in reset_notification()
1806 if ((req->req.misc == RAW1394_NOTIFY_OFF) || in reset_notification()
1807 (req->req.misc == RAW1394_NOTIFY_ON)) { in reset_notification()
1808 fi->notification=(u8)req->req.misc; in reset_notification()
1809 …free_pending_request(req); /* we have to free the request, because we queue no response, and there… in reset_notification()
1816 static int write_phypacket(struct file_info *fi, struct pending_request *req) in write_phypacket() argument
1822 data = be32_to_cpu((u32)req->req.sendb); in write_phypacket()
1826 req->req.length=0; in write_phypacket()
1827 req->packet=packet; in write_phypacket()
1828 hpsb_set_packet_complete_task(packet, (void(*)(void*))queue_complete_cb, req); in write_phypacket()
1830 list_add_tail(&req->list, &fi->req_pending); in write_phypacket()
1832 packet->generation = req->req.generation; in write_phypacket()
1837 req->req.error = RAW1394_ERROR_SEND_ERROR; in write_phypacket()
1838 req->req.length = 0; in write_phypacket()
1839 queue_complete_req(req); in write_phypacket()
1844 static int get_config_rom(struct file_info *fi, struct pending_request *req) in get_config_rom() argument
1849 quadlet_t *data = kmalloc(req->req.length, SLAB_KERNEL); in get_config_rom()
1853 req->req.length, &return_size, &rom_version); in get_config_rom()
1854 if (copy_to_user(int2ptr(req->req.recvb), data, in get_config_rom()
1855 req->req.length)) in get_config_rom()
1857 if (copy_to_user(int2ptr(req->req.tag), &return_size, in get_config_rom()
1860 if (copy_to_user(int2ptr(req->req.address), &rom_version, in get_config_rom()
1863 if (copy_to_user(int2ptr(req->req.sendb), &status, in get_config_rom()
1868 …free_pending_request(req); /* we have to free the request, because we queue no response, and there… in get_config_rom()
1873 static int update_config_rom(struct file_info *fi, struct pending_request *req) in update_config_rom() argument
1876 quadlet_t *data = kmalloc(req->req.length, SLAB_KERNEL); in update_config_rom()
1878 if (copy_from_user(data,int2ptr(req->req.sendb), in update_config_rom()
1879 req->req.length)) { in update_config_rom()
1883 data, req->req.length, in update_config_rom()
1884 (unsigned char) req->req.misc); in update_config_rom()
1885 if (copy_to_user(int2ptr(req->req.recvb), in update_config_rom()
1891 …free_pending_request(req); /* we have to free the request, because we queue no response, and there… in update_config_rom()
1896 static int state_connected(struct file_info *fi, struct pending_request *req) in state_connected() argument
1898 int node = req->req.address >> 48; in state_connected()
1900 req->req.error = RAW1394_ERROR_NONE; in state_connected()
1902 switch (req->req.type) { in state_connected()
1905 queue_complete_req(req); in state_connected()
1909 return handle_iso_send(fi, req, node); in state_connected()
1912 return arm_register(fi, req); in state_connected()
1915 return arm_unregister(fi, req); in state_connected()
1918 return reset_notification(fi, req); in state_connected()
1921 handle_iso_listen(fi, req); in state_connected()
1925 handle_fcp_listen(fi, req); in state_connected()
1929 if (req->req.misc == RAW1394_LONG_RESET) { in state_connected()
1932 …free_pending_request(req); /* we have to free the request, because we queue no response, and there… in state_connected()
1935 if (req->req.misc == RAW1394_SHORT_RESET) { in state_connected()
1938 …free_pending_request(req); /* we have to free the request, because we queue no response, and there… in state_connected()
1944 return get_config_rom(fi, req); in state_connected()
1947 return update_config_rom(fi, req); in state_connected()
1950 if (req->req.generation != get_hpsb_generation(fi->host)) { in state_connected()
1951 req->req.error = RAW1394_ERROR_GENERATION; in state_connected()
1952 req->req.generation = get_hpsb_generation(fi->host); in state_connected()
1953 req->req.length = 0; in state_connected()
1954 queue_complete_req(req); in state_connected()
1958 switch (req->req.type) { in state_connected()
1960 return write_phypacket(fi, req); in state_connected()
1962 return handle_async_send(fi, req); in state_connected()
1965 if (req->req.length == 0) { in state_connected()
1966 req->req.error = RAW1394_ERROR_INVALID_ARG; in state_connected()
1967 queue_complete_req(req); in state_connected()
1971 return handle_async_request(fi, req, node); in state_connected()
1979 struct pending_request *req; in raw1394_write() local
1986 req = alloc_pending_request(); in raw1394_write()
1987 if (req == NULL) { in raw1394_write()
1990 req->file_info = fi; in raw1394_write()
1992 if (copy_from_user(&req->req, buffer, sizeof(struct raw1394_request))) { in raw1394_write()
1993 free_pending_request(req); in raw1394_write()
1999 retval = state_opened(fi, req); in raw1394_write()
2003 retval = state_initialized(fi, req); in raw1394_write()
2007 retval = state_connected(fi, req); in raw1394_write()
2012 free_pending_request(req); in raw1394_write()
2025 struct pending_request *req; in __rawiso_event_in_queue() local
2028 req = list_entry(lh, struct pending_request, list); in __rawiso_event_in_queue()
2029 if (req->req.type == RAW1394_REQ_RAWISO_ACTIVITY) { in __rawiso_event_in_queue()
2046 struct pending_request *req = __alloc_pending_request(SLAB_ATOMIC); in queue_rawiso_event() local
2048 if (req) { in queue_rawiso_event()
2049 req->file_info = fi; in queue_rawiso_event()
2050 req->req.type = RAW1394_REQ_RAWISO_ACTIVITY; in queue_rawiso_event()
2051 req->req.generation = get_hpsb_generation(fi->host); in queue_rawiso_event()
2052 __queue_complete_req(req); in queue_rawiso_event()
2392 struct pending_request *req; in raw1394_release() local
2477 req = list_entry(lh, struct pending_request, list); in raw1394_release()
2479 free_pending_request(req); in raw1394_release()