firewire: sbp2: use scsi_dma_(un)map
Use the scsi_dma_map/scsi_dma_unmap helper to simplify the code a little. Signed-off-by: Clemens Ladisch <clemens@ladisch.de> Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>wifi-calibration
parent
473ffe6560
commit
f203022353
|
@ -1296,10 +1296,7 @@ static struct fw_driver sbp2_driver = {
|
||||||
static void sbp2_unmap_scatterlist(struct device *card_device,
|
static void sbp2_unmap_scatterlist(struct device *card_device,
|
||||||
struct sbp2_command_orb *orb)
|
struct sbp2_command_orb *orb)
|
||||||
{
|
{
|
||||||
if (scsi_sg_count(orb->cmd))
|
scsi_dma_unmap(orb->cmd);
|
||||||
dma_unmap_sg(card_device, scsi_sglist(orb->cmd),
|
|
||||||
scsi_sg_count(orb->cmd),
|
|
||||||
orb->cmd->sc_data_direction);
|
|
||||||
|
|
||||||
if (orb->request.misc & cpu_to_be32(COMMAND_ORB_PAGE_TABLE_PRESENT))
|
if (orb->request.misc & cpu_to_be32(COMMAND_ORB_PAGE_TABLE_PRESENT))
|
||||||
dma_unmap_single(card_device, orb->page_table_bus,
|
dma_unmap_single(card_device, orb->page_table_bus,
|
||||||
|
@ -1405,9 +1402,8 @@ static int sbp2_map_scatterlist(struct sbp2_command_orb *orb,
|
||||||
struct scatterlist *sg = scsi_sglist(orb->cmd);
|
struct scatterlist *sg = scsi_sglist(orb->cmd);
|
||||||
int i, n;
|
int i, n;
|
||||||
|
|
||||||
n = dma_map_sg(device->card->device, sg, scsi_sg_count(orb->cmd),
|
n = scsi_dma_map(orb->cmd);
|
||||||
orb->cmd->sc_data_direction);
|
if (n <= 0)
|
||||||
if (n == 0)
|
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1453,8 +1449,7 @@ static int sbp2_map_scatterlist(struct sbp2_command_orb *orb,
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
fail_page_table:
|
fail_page_table:
|
||||||
dma_unmap_sg(device->card->device, scsi_sglist(orb->cmd),
|
scsi_dma_unmap(orb->cmd);
|
||||||
scsi_sg_count(orb->cmd), orb->cmd->sc_data_direction);
|
|
||||||
fail:
|
fail:
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue