Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751972AbcDPUPi (ORCPT ); Sat, 16 Apr 2016 16:15:38 -0400 Received: from mout.kundenserver.de ([212.227.17.24]:59641 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751813AbcDPUPg (ORCPT ); Sat, 16 Apr 2016 16:15:36 -0400 From: Arnd Bergmann To: Thor Thayer , Doug Thompson , Borislav Petkov , Mauro Carvalho Chehab Cc: Arnd Bergmann , Alan Tull , Dinh Nguyen , linux-edac@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/2] EDAC, altera: avoid unused function warnings Date: Sat, 16 Apr 2016 22:13:56 +0200 Message-Id: <1460837650-1237650-2-git-send-email-arnd@arndb.de> X-Mailer: git-send-email 2.7.0 In-Reply-To: <1460837650-1237650-1-git-send-email-arnd@arndb.de> References: <1460837650-1237650-1-git-send-email-arnd@arndb.de> X-Provags-ID: V03:K0:+510sHWARZkgGnEqm34iDzUjV8Zk0sSZtmuu7Lk9SLBwCSiQIEG N5t+oAbcRihMOhljzeabXP+ttqbl4OL8AELEMNNtZmsh5lhisn1z5RQbDjBP1wojbaQLLyj Pd5mN5a/lQJPNRuemH8jI/xRovFD0tWlNVFnDgdJBt16JI89NK1jbTbTzVWqxCPJFrLDJjs jSbEgARtwpiWig7sXil7w== X-UI-Out-Filterresults: notjunk:1;V01:K0:F8B+rGLmbNQ=:TO9BjNAwYUYSHcWUPEIP8r hDhD7xzsWVAhofLmccKGPrfJRc54kX0W/g63yR5CvL/yhlyr7XeHfw6pQCAvAw5ZAy8yO9esW to9TvydoJUuwCDzubOzoTYE4m96X7Nbpu9jmwi5A6aJK/+0RvUEqAYk558YWYnkr03NbGhA3G aIefMehBTL1NCt85LQNGCkT/GdLNhscljyEklQpW+s7oF0RwigAp3x97kRFYASV4vc8ghhnyN fglMYZ+tSAuhpyfrQxo320NR3BvP1gUk5pdGpDcM+ZFUtZsFyqOvCfJdFnRrugtsdntMupmb5 VQmTBou1YLgAOhbjltMz1gvf9XxxIfmGu4qbcZGXg+owjFhQrJfEAk7cDOm71+STD6BZq9JPL tgsiFkkaYdrpXSv9vkycXEGTJHtAu24ySK2TcEvkIAOJFAfuHn78dUHhi/HjR75LOnKIrG+pp Yaq6wx9wH0uhTo9x0h7LU6ltBzR/867mY+F0XgnmKfBYqXhI4WugJKBAOQLWvUPsjCNhbYTR9 lnFTyQKOecCaHrWAtgisSKT1krd2XEVAIXuP8mb7r87PVWu8EBLRJv1WBbNTZXbnQY//FX8Wo h/pXs81PRyy3+lIspg6DH/boSXCmF6huYbGqJV7ChZy6kSf2s2ug0m9/1342jcZ3/quiDscsf NcnXy8O5cPQVGzhs3F+0MTeq9VK/RP+qpT+tM9rOdm2mhdQ9r3nqrQ8RpaLzfCTKXL4E= Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 4696 Lines: 135 The recently added Arria10 OCRAM ECC support caused some new harmless warnings about unused functions when it is disabled: drivers/edac/altera_edac.c:1067:20: error: 'altr_edac_a10_ecc_irq' defined but not used [-Werror=unused-function] drivers/edac/altera_edac.c:658:12: error: 'altr_check_ecc_deps' defined but not used [-Werror=unused-function] This rearranges the code slightly to have those two functions inside of the same #ifdef that hides their callers. It also manages to avoid a forward declaration of the IRQ handler in the process. Signed-off-by: Arnd Bergmann Fixes: c7b4be8db8bc ("EDAC, altera: Add Arria10 OCRAM ECC support") --- drivers/edac/altera_edac.c | 78 ++++++++++++++++++++++------------------------ 1 file changed, 37 insertions(+), 41 deletions(-) diff --git a/drivers/edac/altera_edac.c b/drivers/edac/altera_edac.c index cc987b4ce908..5b4d223d6d68 100644 --- a/drivers/edac/altera_edac.c +++ b/drivers/edac/altera_edac.c @@ -649,26 +649,6 @@ static ssize_t altr_edac_device_trig(struct file *file, return count; } -/* - * Test for memory's ECC dependencies upon entry because platform specific - * startup should have initialized the memory and enabled the ECC. - * Can't turn on ECC here because accessing un-initialized memory will - * cause CE/UE errors possibly causing an ABORT. - */ -static int altr_check_ecc_deps(struct altr_edac_device_dev *device) -{ - void __iomem *base = device->base; - const struct edac_device_prv_data *prv = device->data; - - if (readl(base + prv->ecc_en_ofst) & prv->ecc_enable_mask) - return 0; - - edac_printk(KERN_ERR, EDAC_DEVICE, - "%s: No ECC present or ECC disabled.\n", - device->edac_dev_name); - return -ENODEV; -} - static const struct file_operations altr_edac_device_inject_fops = { .open = simple_open, .write = altr_edac_device_trig, @@ -848,6 +828,25 @@ module_platform_driver(altr_edac_device_driver); /*********************** OCRAM EDAC Device Functions *********************/ #ifdef CONFIG_EDAC_ALTERA_OCRAM +/* + * Test for memory's ECC dependencies upon entry because platform specific + * startup should have initialized the memory and enabled the ECC. + * Can't turn on ECC here because accessing un-initialized memory will + * cause CE/UE errors possibly causing an ABORT. + */ +static int altr_check_ecc_deps(struct altr_edac_device_dev *device) +{ + void __iomem *base = device->base; + const struct edac_device_prv_data *prv = device->data; + + if (readl(base + prv->ecc_en_ofst) & prv->ecc_enable_mask) + return 0; + + edac_printk(KERN_ERR, EDAC_DEVICE, + "%s: No ECC present or ECC disabled.\n", + device->edac_dev_name); + return -ENODEV; +} static void *ocram_alloc_mem(size_t size, void **other) { @@ -883,6 +882,24 @@ static void ocram_free_mem(void *p, size_t size, void *other) gen_pool_free((struct gen_pool *)other, (u32)p, size); } +static irqreturn_t altr_edac_a10_ecc_irq(struct altr_edac_device_dev *dci, + bool sberr) +{ + void __iomem *base = dci->base; + + if (sberr) { + writel(ALTR_A10_ECC_SERRPENA, + base + ALTR_A10_ECC_INTSTAT_OFST); + edac_device_handle_ce(dci->edac_dev, 0, 0, dci->edac_dev_name); + } else { + writel(ALTR_A10_ECC_DERRPENA, + base + ALTR_A10_ECC_INTSTAT_OFST); + edac_device_handle_ue(dci->edac_dev, 0, 0, dci->edac_dev_name); + panic("\nEDAC:ECC_DEVICE[Uncorrectable errors]\n"); + } + return IRQ_HANDLED; +} + const struct edac_device_prv_data ocramecc_data = { .setup = altr_check_ecc_deps, .ce_clear_mask = (ALTR_OCR_ECC_EN | ALTR_OCR_ECC_SERR), @@ -899,9 +916,6 @@ const struct edac_device_prv_data ocramecc_data = { .inject_fops = &altr_edac_device_inject_fops, }; -static irqreturn_t altr_edac_a10_ecc_irq(struct altr_edac_device_dev *dci, - bool sberr); - const struct edac_device_prv_data a10_ocramecc_data = { .setup = altr_check_ecc_deps, .ce_clear_mask = ALTR_A10_ECC_SERRPENA, @@ -1061,24 +1075,6 @@ static ssize_t altr_edac_a10_device_trig(struct file *file, return count; } -static irqreturn_t altr_edac_a10_ecc_irq(struct altr_edac_device_dev *dci, - bool sberr) -{ - void __iomem *base = dci->base; - - if (sberr) { - writel(ALTR_A10_ECC_SERRPENA, - base + ALTR_A10_ECC_INTSTAT_OFST); - edac_device_handle_ce(dci->edac_dev, 0, 0, dci->edac_dev_name); - } else { - writel(ALTR_A10_ECC_DERRPENA, - base + ALTR_A10_ECC_INTSTAT_OFST); - edac_device_handle_ue(dci->edac_dev, 0, 0, dci->edac_dev_name); - panic("\nEDAC:ECC_DEVICE[Uncorrectable errors]\n"); - } - return IRQ_HANDLED; -} - static irqreturn_t altr_edac_a10_irq_handler(int irq, void *dev_id) { irqreturn_t rc = IRQ_NONE; -- 2.7.0