diff options
author | Stefan Richter <stefanr@s5r6.in-berlin.de> | 2009-10-14 14:40:10 -0400 |
---|---|---|
committer | Stefan Richter <stefanr@s5r6.in-berlin.de> | 2009-10-31 06:40:51 -0400 |
commit | 19593ffdb6daa6ba691d247a2400cece12687c52 (patch) | |
tree | 18c3508bbdb5f2d1b1bf51ac653ec580043a9340 /drivers/firewire/ohci.c | |
parent | 5b189bf3633c3b73d4f08124a86f3e019953d412 (diff) |
firewire: ohci: 0 may be a valid DMA address
I was told that there are obscure architectures with non-coherent DMA
which may DMA-map to bus address 0. We shall not use 0 as a magic
number of uninitialized bus address variables.
The packet->payload_length > 0 test cannot be used either (except in
at_context_queue_packet) because local requests are not DMA-mapped
regardless of payload_length. Hence add a state flag to struct
fw_packet.
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Diffstat (limited to 'drivers/firewire/ohci.c')
-rw-r--r-- | drivers/firewire/ohci.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/firewire/ohci.c b/drivers/firewire/ohci.c index 418415564791..a71477541dc7 100644 --- a/drivers/firewire/ohci.c +++ b/drivers/firewire/ohci.c | |||
@@ -995,7 +995,8 @@ static int at_context_queue_packet(struct context *ctx, | |||
995 | packet->ack = RCODE_SEND_ERROR; | 995 | packet->ack = RCODE_SEND_ERROR; |
996 | return -1; | 996 | return -1; |
997 | } | 997 | } |
998 | packet->payload_bus = payload_bus; | 998 | packet->payload_bus = payload_bus; |
999 | packet->payload_mapped = true; | ||
999 | 1000 | ||
1000 | d[2].req_count = cpu_to_le16(packet->payload_length); | 1001 | d[2].req_count = cpu_to_le16(packet->payload_length); |
1001 | d[2].data_address = cpu_to_le32(payload_bus); | 1002 | d[2].data_address = cpu_to_le32(payload_bus); |
@@ -1023,7 +1024,7 @@ static int at_context_queue_packet(struct context *ctx, | |||
1023 | */ | 1024 | */ |
1024 | if (ohci->generation != packet->generation || | 1025 | if (ohci->generation != packet->generation || |
1025 | reg_read(ohci, OHCI1394_IntEventSet) & OHCI1394_busReset) { | 1026 | reg_read(ohci, OHCI1394_IntEventSet) & OHCI1394_busReset) { |
1026 | if (packet->payload_length > 0) | 1027 | if (packet->payload_mapped) |
1027 | dma_unmap_single(ohci->card.device, payload_bus, | 1028 | dma_unmap_single(ohci->card.device, payload_bus, |
1028 | packet->payload_length, DMA_TO_DEVICE); | 1029 | packet->payload_length, DMA_TO_DEVICE); |
1029 | packet->ack = RCODE_GENERATION; | 1030 | packet->ack = RCODE_GENERATION; |
@@ -1059,7 +1060,7 @@ static int handle_at_packet(struct context *context, | |||
1059 | /* This packet was cancelled, just continue. */ | 1060 | /* This packet was cancelled, just continue. */ |
1060 | return 1; | 1061 | return 1; |
1061 | 1062 | ||
1062 | if (packet->payload_bus) | 1063 | if (packet->payload_mapped) |
1063 | dma_unmap_single(ohci->card.device, packet->payload_bus, | 1064 | dma_unmap_single(ohci->card.device, packet->payload_bus, |
1064 | packet->payload_length, DMA_TO_DEVICE); | 1065 | packet->payload_length, DMA_TO_DEVICE); |
1065 | 1066 | ||
@@ -1723,7 +1724,7 @@ static int ohci_cancel_packet(struct fw_card *card, struct fw_packet *packet) | |||
1723 | if (packet->ack != 0) | 1724 | if (packet->ack != 0) |
1724 | goto out; | 1725 | goto out; |
1725 | 1726 | ||
1726 | if (packet->payload_bus) | 1727 | if (packet->payload_mapped) |
1727 | dma_unmap_single(ohci->card.device, packet->payload_bus, | 1728 | dma_unmap_single(ohci->card.device, packet->payload_bus, |
1728 | packet->payload_length, DMA_TO_DEVICE); | 1729 | packet->payload_length, DMA_TO_DEVICE); |
1729 | 1730 | ||