mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: Tony Luck <tony.luck@intel.com>, Borislav Petkov <bp@alien8.de>,
	Mauro Carvalho Chehab <mchehab@kernel.org>
Cc: Arnd Bergmann <arnd@arndb.de>, Qiuxu Zhuo <qiuxu.zhuo@intel.com>,
	linux-edac@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] EDAC, pnd2_edac: fix build error without CONFIG_EDAC_DEBUG
Date: Thu, 23 Mar 2017 16:16:35 +0100	[thread overview]
Message-ID: <20170323151649.658800-1-arnd@arndb.de> (raw)

Calling into functions inside of the #ifdef causes an obvious compile error:

drivers/edac/pnd2_edac.c: In function 'pnd2_init':
drivers/edac/pnd2_edac.c:1521:2: error: implicit declaration of function 'setup_pnd2_debug'; did you mean 'setup_log_buf'? [-Werror=implicit-function-declaration]
drivers/edac/pnd2_edac.c: In function 'pnd2_exit':
drivers/edac/pnd2_edac.c:1529:2: error: implicit declaration of function 'teardown_pnd2_debug' [-Werror=implicit-function-declaration]

This removes the #ifdef and instead uses an equivalent IS_ENABLED() check
so the compiler can silently drop the functions but still build-test them
and not need an #ifdef.

Fixes: 5c71ad17f97e ("EDAC, pnd2_edac: Add new EDAC driver for Intel SoC platforms")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/edac/pnd2_edac.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/edac/pnd2_edac.c b/drivers/edac/pnd2_edac.c
index 14d39f05226e..25693a4c14c3 100644
--- a/drivers/edac/pnd2_edac.c
+++ b/drivers/edac/pnd2_edac.c
@@ -1389,7 +1389,6 @@ static struct notifier_block pnd2_mce_dec = {
 	.notifier_call	= pnd2_mce_check_error,
 };
 
-#ifdef CONFIG_EDAC_DEBUG
 /*
  * Write an address to this file to exercise the address decode
  * logic in this driver.
@@ -1435,7 +1434,6 @@ static void teardown_pnd2_debug(void)
 {
 	debugfs_remove_recursive(pnd2_test);
 }
-#endif
 
 static int pnd2_probe(void)
 {
@@ -1518,7 +1516,8 @@ static int __init pnd2_init(void)
 		return -ENODEV;
 
 	mce_register_decode_chain(&pnd2_mce_dec);
-	setup_pnd2_debug();
+	if (IS_ENABLED(CONFIG_EDAC_DEBUG))
+		setup_pnd2_debug();
 
 	return 0;
 }
@@ -1526,7 +1525,8 @@ static int __init pnd2_init(void)
 static void __exit pnd2_exit(void)
 {
 	edac_dbg(2, "\n");
-	teardown_pnd2_debug();
+	if (IS_ENABLED(CONFIG_EDAC_DEBUG))
+		teardown_pnd2_debug();
 	mce_unregister_decode_chain(&pnd2_mce_dec);
 	pnd2_remove();
 }
-- 
2.9.0

             reply	other threads:[~2017-03-23 15:17 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-23 15:16 Arnd Bergmann [this message]
2017-03-23 15:27 ` Borislav Petkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170323151649.658800-1-arnd@arndb.de \
    --to=arnd@arndb.de \
    --cc=bp@alien8.de \
    --cc=linux-edac@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=qiuxu.zhuo@intel.com \
    --cc=tony.luck@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®