aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/firewire
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/firewire')
-rw-r--r--drivers/firewire/fw-ohci.c3
-rw-r--r--drivers/firewire/fw-sbp2.c16
-rw-r--r--drivers/firewire/fw-transaction.c9
-rw-r--r--drivers/firewire/fw-transaction.h4
4 files changed, 16 insertions, 16 deletions
diff --git a/drivers/firewire/fw-ohci.c b/drivers/firewire/fw-ohci.c
index 41476abc0693..db703758db98 100644
--- a/drivers/firewire/fw-ohci.c
+++ b/drivers/firewire/fw-ohci.c
@@ -224,6 +224,7 @@ ohci_update_phy_reg(struct fw_card *card, int addr,
224 u32 val, old; 224 u32 val, old;
225 225
226 reg_write(ohci, OHCI1394_PhyControl, OHCI1394_PhyControl_Read(addr)); 226 reg_write(ohci, OHCI1394_PhyControl, OHCI1394_PhyControl_Read(addr));
227 flush_writes(ohci);
227 msleep(2); 228 msleep(2);
228 val = reg_read(ohci, OHCI1394_PhyControl); 229 val = reg_read(ohci, OHCI1394_PhyControl);
229 if ((val & OHCI1394_PhyControl_ReadDone) == 0) { 230 if ((val & OHCI1394_PhyControl_ReadDone) == 0) {
@@ -586,7 +587,7 @@ static void context_stop(struct context *ctx)
586 break; 587 break;
587 588
588 fw_notify("context_stop: still active (0x%08x)\n", reg); 589 fw_notify("context_stop: still active (0x%08x)\n", reg);
589 msleep(1); 590 mdelay(1);
590 } 591 }
591} 592}
592 593
diff --git a/drivers/firewire/fw-sbp2.c b/drivers/firewire/fw-sbp2.c
index e5e5b0a2b8a9..3e4a369d0057 100644
--- a/drivers/firewire/fw-sbp2.c
+++ b/drivers/firewire/fw-sbp2.c
@@ -840,7 +840,6 @@ complete_command_orb(struct sbp2_orb *base_orb, struct sbp2_status *status)
840 container_of(base_orb, struct sbp2_command_orb, base); 840 container_of(base_orb, struct sbp2_command_orb, base);
841 struct fw_unit *unit = orb->unit; 841 struct fw_unit *unit = orb->unit;
842 struct fw_device *device = fw_device(unit->device.parent); 842 struct fw_device *device = fw_device(unit->device.parent);
843 struct scatterlist *sg;
844 int result; 843 int result;
845 844
846 if (status != NULL) { 845 if (status != NULL) {
@@ -876,11 +875,10 @@ complete_command_orb(struct sbp2_orb *base_orb, struct sbp2_status *status)
876 dma_unmap_single(device->card->device, orb->base.request_bus, 875 dma_unmap_single(device->card->device, orb->base.request_bus,
877 sizeof(orb->request), DMA_TO_DEVICE); 876 sizeof(orb->request), DMA_TO_DEVICE);
878 877
879 if (orb->cmd->use_sg > 0) { 878 if (scsi_sg_count(orb->cmd) > 0)
880 sg = (struct scatterlist *)orb->cmd->request_buffer; 879 dma_unmap_sg(device->card->device, scsi_sglist(orb->cmd),
881 dma_unmap_sg(device->card->device, sg, orb->cmd->use_sg, 880 scsi_sg_count(orb->cmd),
882 orb->cmd->sc_data_direction); 881 orb->cmd->sc_data_direction);
883 }
884 882
885 if (orb->page_table_bus != 0) 883 if (orb->page_table_bus != 0)
886 dma_unmap_single(device->card->device, orb->page_table_bus, 884 dma_unmap_single(device->card->device, orb->page_table_bus,
@@ -901,8 +899,8 @@ static int sbp2_command_orb_map_scatterlist(struct sbp2_command_orb *orb)
901 int sg_len, l, i, j, count; 899 int sg_len, l, i, j, count;
902 dma_addr_t sg_addr; 900 dma_addr_t sg_addr;
903 901
904 sg = (struct scatterlist *)orb->cmd->request_buffer; 902 sg = scsi_sglist(orb->cmd);
905 count = dma_map_sg(device->card->device, sg, orb->cmd->use_sg, 903 count = dma_map_sg(device->card->device, sg, scsi_sg_count(orb->cmd),
906 orb->cmd->sc_data_direction); 904 orb->cmd->sc_data_direction);
907 if (count == 0) 905 if (count == 0)
908 goto fail; 906 goto fail;
@@ -971,7 +969,7 @@ static int sbp2_command_orb_map_scatterlist(struct sbp2_command_orb *orb)
971 return 0; 969 return 0;
972 970
973 fail_page_table: 971 fail_page_table:
974 dma_unmap_sg(device->card->device, sg, orb->cmd->use_sg, 972 dma_unmap_sg(device->card->device, sg, scsi_sg_count(orb->cmd),
975 orb->cmd->sc_data_direction); 973 orb->cmd->sc_data_direction);
976 fail: 974 fail:
977 return -ENOMEM; 975 return -ENOMEM;
@@ -1031,7 +1029,7 @@ static int sbp2_scsi_queuecommand(struct scsi_cmnd *cmd, scsi_done_fn_t done)
1031 orb->request.misc |= 1029 orb->request.misc |=
1032 COMMAND_ORB_DIRECTION(SBP2_DIRECTION_TO_MEDIA); 1030 COMMAND_ORB_DIRECTION(SBP2_DIRECTION_TO_MEDIA);
1033 1031
1034 if (cmd->use_sg && sbp2_command_orb_map_scatterlist(orb) < 0) 1032 if (scsi_sg_count(cmd) && sbp2_command_orb_map_scatterlist(orb) < 0)
1035 goto fail_mapping; 1033 goto fail_mapping;
1036 1034
1037 fw_memcpy_to_be32(&orb->request, &orb->request, sizeof(orb->request)); 1035 fw_memcpy_to_be32(&orb->request, &orb->request, sizeof(orb->request));
diff --git a/drivers/firewire/fw-transaction.c b/drivers/firewire/fw-transaction.c
index 80d0121463d0..3ce8e2fbe15f 100644
--- a/drivers/firewire/fw-transaction.c
+++ b/drivers/firewire/fw-transaction.c
@@ -605,8 +605,10 @@ fw_send_response(struct fw_card *card, struct fw_request *request, int rcode)
605 * check is sufficient to ensure we don't send response to 605 * check is sufficient to ensure we don't send response to
606 * broadcast packets or posted writes. 606 * broadcast packets or posted writes.
607 */ 607 */
608 if (request->ack != ACK_PENDING) 608 if (request->ack != ACK_PENDING) {
609 kfree(request);
609 return; 610 return;
611 }
610 612
611 if (rcode == RCODE_COMPLETE) 613 if (rcode == RCODE_COMPLETE)
612 fw_fill_response(&request->response, request->request_header, 614 fw_fill_response(&request->response, request->request_header,
@@ -628,11 +630,6 @@ fw_core_handle_request(struct fw_card *card, struct fw_packet *p)
628 unsigned long flags; 630 unsigned long flags;
629 int tcode, destination, source; 631 int tcode, destination, source;
630 632
631 if (p->payload_length > 2048) {
632 /* FIXME: send error response. */
633 return;
634 }
635
636 if (p->ack != ACK_PENDING && p->ack != ACK_COMPLETE) 633 if (p->ack != ACK_PENDING && p->ack != ACK_COMPLETE)
637 return; 634 return;
638 635
diff --git a/drivers/firewire/fw-transaction.h b/drivers/firewire/fw-transaction.h
index 5abed193f4a6..5ceaccd10564 100644
--- a/drivers/firewire/fw-transaction.h
+++ b/drivers/firewire/fw-transaction.h
@@ -123,6 +123,10 @@ typedef void (*fw_transaction_callback_t)(struct fw_card *card, int rcode,
123 size_t length, 123 size_t length,
124 void *callback_data); 124 void *callback_data);
125 125
126/*
127 * Important note: The callback must guarantee that either fw_send_response()
128 * or kfree() is called on the @request.
129 */
126typedef void (*fw_address_callback_t)(struct fw_card *card, 130typedef void (*fw_address_callback_t)(struct fw_card *card,
127 struct fw_request *request, 131 struct fw_request *request,
128 int tcode, int destination, int source, 132 int tcode, int destination, int source,