From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1030593AbbDWSrW (ORCPT ); Thu, 23 Apr 2015 14:47:22 -0400 Received: from xavier.telenet-ops.be ([195.130.132.52]:52711 "EHLO xavier.telenet-ops.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755038AbbDWSrT (ORCPT ); Thu, 23 Apr 2015 14:47:19 -0400 From: Geert Uytterhoeven To: Thomas Petazzoni , =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= , Greg Kroah-Hartman Cc: devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, Geert Uytterhoeven Subject: [PATCH v2] staging: fbtft: Disable DMA support if DMA is not available Date: Thu, 23 Apr 2015 20:47:15 +0200 Message-Id: <1429814835-22957-1-git-send-email-geert@linux-m68k.org> X-Mailer: git-send-email 1.9.1 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org If NO_DMA=y: drivers/built-in.o: In function `fbtft_framebuffer_alloc': (.text+0xb53cae): undefined reference to `dmam_alloc_coherent' As DMA support is already optional, make it depend on HAS_DMA. If !HAS_DMA, "dma" will always be false, and the compiler will optimize away the call to dmam_alloc_coherent(). Signed-off-by: Geert Uytterhoeven --- v2: - Explain better how it works, - Keep the "= false" to avoid breakage (seen not only with gcc 4.1.2, but also with 4.6.3 and 4.9.0). --- drivers/staging/fbtft/fbtft-core.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/staging/fbtft/fbtft-core.c b/drivers/staging/fbtft/fbtft-core.c index 53b748be27124793..600dbdcaa716cd76 100644 --- a/drivers/staging/fbtft/fbtft-core.c +++ b/drivers/staging/fbtft/fbtft-core.c @@ -47,9 +47,14 @@ static unsigned long debug; module_param(debug, ulong, 0); MODULE_PARM_DESC(debug, "override device debug level"); +#ifdef CONFIG_HAS_DMA static bool dma = true; module_param(dma, bool, 0); MODULE_PARM_DESC(dma, "Use DMA buffer"); +#else +/* Do not remove the "= false", gcc needs it to optimize away the DMA calls */ +static const bool dma = false; +#endif void fbtft_dbg_hex(const struct device *dev, int groupsize, -- 1.9.1