summaryrefslogtreecommitdiffstats
path: root/lib/swiotlb.c
diff options
context:
space:
mode:
authorGeert Uytterhoeven <geert+renesas@glider.be>2016-10-31 11:45:03 -0400
committerKonrad Rzeszutek Wilk <konrad@kernel.org>2016-11-07 15:06:26 -0500
commit0d2e18985a99bc8ff9ef260a7e10e6fcdc159f2a (patch)
tree0b468b5601fc48b09c1ca8930988b64475865e3d /lib/swiotlb.c
parentc8d2bc9bc39ebea8437fd974fdbc21847bb897a3 (diff)
swiotlb: Rate-limit printing when running out of SW-IOMMU space
If the system runs out of SW-IOMMU space, changes are high successive requests will fail, too, flooding the kernel log. This is true especially for streaming DMA, which is typically used repeatedly outside the driver's initialization routine. Add rate-limiting to fix this. While at it, get rid of the open-coded dev_name() handling by using the appropriate dev_err_*() variant. Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Signed-off-by: Konrad Rzeszutek Wilk <konrad@kernel.org>
Diffstat (limited to 'lib/swiotlb.c')
-rw-r--r--lib/swiotlb.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/swiotlb.c b/lib/swiotlb.c
index 22e13a0e19d7..6ce764410ae4 100644
--- a/lib/swiotlb.c
+++ b/lib/swiotlb.c
@@ -714,8 +714,8 @@ swiotlb_full(struct device *dev, size_t size, enum dma_data_direction dir,
714 * When the mapping is small enough return a static buffer to limit 714 * When the mapping is small enough return a static buffer to limit
715 * the damage, or panic when the transfer is too big. 715 * the damage, or panic when the transfer is too big.
716 */ 716 */
717 printk(KERN_ERR "DMA: Out of SW-IOMMU space for %zu bytes at " 717 dev_err_ratelimited(dev, "DMA: Out of SW-IOMMU space for %zu bytes\n",
718 "device %s\n", size, dev ? dev_name(dev) : "?"); 718 size);
719 719
720 if (size <= io_tlb_overflow || !do_panic) 720 if (size <= io_tlb_overflow || !do_panic)
721 return; 721 return;