Skip to content

Commit b5a73bf

Browse files
author
Christoph Hellwig
committed
scsi: check that busses support the DMA API before setting dma parameters
We'll start throwing warnings soon when dma_set_seg_boundary and dma_set_max_seg_size are called on devices for buses that don't fully support the DMA API. Prepare for that by making the calls in the SCSI midlayer conditional. Signed-off-by: Christoph Hellwig <[email protected]> Reviewed-by: Robin Murphy <[email protected]> Reviewed-by: Martin K. Petersen <[email protected]>
1 parent 833bd28 commit b5a73bf

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

drivers/scsi/scsi_lib.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1988,8 +1988,15 @@ void scsi_init_limits(struct Scsi_Host *shost, struct queue_limits *lim)
19881988
if (shost->no_highmem)
19891989
lim->features |= BLK_FEAT_BOUNCE_HIGH;
19901990

1991-
dma_set_seg_boundary(dev, shost->dma_boundary);
1992-
dma_set_max_seg_size(dev, shost->max_segment_size);
1991+
/*
1992+
* Propagate the DMA formation properties to the dma-mapping layer as
1993+
* a courtesy service to the LLDDs. This needs to check that the buses
1994+
* actually support the DMA API first, though.
1995+
*/
1996+
if (dev->dma_parms) {
1997+
dma_set_seg_boundary(dev, shost->dma_boundary);
1998+
dma_set_max_seg_size(dev, shost->max_segment_size);
1999+
}
19932000
}
19942001
EXPORT_SYMBOL_GPL(scsi_init_limits);
19952002

0 commit comments

Comments
 (0)