aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/firewire/fw-sbp2.c21
1 files changed, 9 insertions, 12 deletions
diff --git a/drivers/firewire/fw-sbp2.c b/drivers/firewire/fw-sbp2.c
index f488ff8903fc..7c53be0387fb 100644
--- a/drivers/firewire/fw-sbp2.c
+++ b/drivers/firewire/fw-sbp2.c
@@ -416,21 +416,11 @@ sbp2_send_management_orb(struct fw_unit *unit, int node_id, int generation,
416 if (orb == NULL) 416 if (orb == NULL)
417 return -ENOMEM; 417 return -ENOMEM;
418 418
419 /*
420 * The sbp2 device is going to send a block read request to
421 * read out the request from host memory, so map it for dma.
422 */
423 orb->base.request_bus =
424 dma_map_single(device->card->device, &orb->request,
425 sizeof(orb->request), DMA_TO_DEVICE);
426 if (dma_mapping_error(orb->base.request_bus))
427 goto out;
428
429 orb->response_bus = 419 orb->response_bus =
430 dma_map_single(device->card->device, &orb->response, 420 dma_map_single(device->card->device, &orb->response,
431 sizeof(orb->response), DMA_FROM_DEVICE); 421 sizeof(orb->response), DMA_FROM_DEVICE);
432 if (dma_mapping_error(orb->response_bus)) 422 if (dma_mapping_error(orb->response_bus))
433 goto out; 423 goto fail_mapping_response;
434 424
435 orb->request.response.high = 0; 425 orb->request.response.high = 0;
436 orb->request.response.low = orb->response_bus; 426 orb->request.response.low = orb->response_bus;
@@ -456,6 +446,12 @@ sbp2_send_management_orb(struct fw_unit *unit, int node_id, int generation,
456 init_completion(&orb->done); 446 init_completion(&orb->done);
457 orb->base.callback = complete_management_orb; 447 orb->base.callback = complete_management_orb;
458 448
449 orb->base.request_bus =
450 dma_map_single(device->card->device, &orb->request,
451 sizeof(orb->request), DMA_TO_DEVICE);
452 if (dma_mapping_error(orb->base.request_bus))
453 goto fail_mapping_request;
454
459 sbp2_send_orb(&orb->base, unit, 455 sbp2_send_orb(&orb->base, unit,
460 node_id, generation, sd->management_agent_address); 456 node_id, generation, sd->management_agent_address);
461 457
@@ -487,9 +483,10 @@ sbp2_send_management_orb(struct fw_unit *unit, int node_id, int generation,
487 out: 483 out:
488 dma_unmap_single(device->card->device, orb->base.request_bus, 484 dma_unmap_single(device->card->device, orb->base.request_bus,
489 sizeof(orb->request), DMA_TO_DEVICE); 485 sizeof(orb->request), DMA_TO_DEVICE);
486 fail_mapping_request:
490 dma_unmap_single(device->card->device, orb->response_bus, 487 dma_unmap_single(device->card->device, orb->response_bus,
491 sizeof(orb->response), DMA_FROM_DEVICE); 488 sizeof(orb->response), DMA_FROM_DEVICE);
492 489 fail_mapping_response:
493 if (response) 490 if (response)
494 fw_memcpy_from_be32(response, 491 fw_memcpy_from_be32(response,
495 orb->response, sizeof(orb->response)); 492 orb->response, sizeof(orb->response));