Skip to content

Commit 942d5e7

Browse files
ludovicbarrestorulf
authored andcommitted
mmc: mmci_sdmmc: fix DMA API warning max segment size
Turning on CONFIG_DMA_API_DEBUG_SG results in the following warning: WARNING: CPU: 1 PID: 85 at kernel/dma/debug.c:1302 debug_dma_map_sg+0x2a0/0x3cc mmci-pl18x 58005000.sdmmc: DMA-API: mapping sg segment longer than device claims to support [len=126976] [max=65536] dma api debug checks and compares the segment size to dma_get_max_seg_size (dev->dma_parms->max_segment_size), the sdmmc variant has an internal DMA and should define its max_segment_size constraint to avoid this warning. This Patch defines the dev->dma_parms->max_segment_size with the constraint already set for mmc core (host->mmc->max_seg_size). Signed-off-by: Ludovic Barre <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Ulf Hansson <[email protected]>
1 parent fe8d33b commit 942d5e7

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

drivers/mmc/host/mmci_stm32_sdmmc.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -119,20 +119,19 @@ static void sdmmc_idma_unprep_data(struct mmci_host *host,
119119
static int sdmmc_idma_setup(struct mmci_host *host)
120120
{
121121
struct sdmmc_idma *idma;
122+
struct device *dev = mmc_dev(host->mmc);
122123

123-
idma = devm_kzalloc(mmc_dev(host->mmc), sizeof(*idma), GFP_KERNEL);
124+
idma = devm_kzalloc(dev, sizeof(*idma), GFP_KERNEL);
124125
if (!idma)
125126
return -ENOMEM;
126127

127128
host->dma_priv = idma;
128129

129130
if (host->variant->dma_lli) {
130-
idma->sg_cpu = dmam_alloc_coherent(mmc_dev(host->mmc),
131-
SDMMC_LLI_BUF_LEN,
131+
idma->sg_cpu = dmam_alloc_coherent(dev, SDMMC_LLI_BUF_LEN,
132132
&idma->sg_dma, GFP_KERNEL);
133133
if (!idma->sg_cpu) {
134-
dev_err(mmc_dev(host->mmc),
135-
"Failed to alloc IDMA descriptor\n");
134+
dev_err(dev, "Failed to alloc IDMA descriptor\n");
136135
return -ENOMEM;
137136
}
138137
host->mmc->max_segs = SDMMC_LLI_BUF_LEN /
@@ -143,7 +142,7 @@ static int sdmmc_idma_setup(struct mmci_host *host)
143142
host->mmc->max_seg_size = host->mmc->max_req_size;
144143
}
145144

146-
return 0;
145+
return dma_set_max_seg_size(dev, host->mmc->max_seg_size);
147146
}
148147

149148
static int sdmmc_idma_start(struct mmci_host *host, unsigned int *datactrl)

0 commit comments

Comments
 (0)