Linux-mediatek Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Chunhui Li <chunhui.li@mediatek.com>
To: Petr Mladek <pmladek@suse.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	John Ogness <john.ogness@linutronix.de>,
	Sergey Senozhatsky <senozhatsky@chromium.org>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	AngeloGioacchino Del Regno
	<angelogioacchino.delregno@collabora.com>
Cc: <linux-kernel@vger.kernel.org>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-mediatek@lists.infradead.org>, <wsd_upstream@mediatek.com>,
	Chunhui Li <chunhui.li@mediatek.com>
Subject: [PATCH] printk: fix _entry_ptr build warning
Date: Wed, 6 Mar 2024 17:26:47 +0800	[thread overview]
Message-ID: <20240306092647.16010-1-chunhui.li@mediatek.com> (raw)

We build with Werror and suffer build error when
enable CONFIG_PRINTK_INDEX, such as
gfp.h:223:2: error: unused variable '_entry_ptr'
ratelimit.h:31:3: error: unused variable '_entry_ptr'
kallsyms.h:172:2: error: unused variable '_entry_ptr'
[-Werror,-Wunused-variable]

Fix the warning by appending __attribute__((unused)).

Signed-off-by: Chunhui Li <chunhui.li@mediatek.com>
---
 include/linux/printk.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/printk.h b/include/linux/printk.h
index 8ef499ab3c1e..749c1c4257f1 100644
--- a/include/linux/printk.h
+++ b/include/linux/printk.h
@@ -392,7 +392,7 @@ struct pi_entry {
 				.level = __builtin_constant_p(_level) ? (_level) : NULL, \
 				.subsys_fmt_prefix = _subsys_fmt_prefix,\
 			};						\
-			static const struct pi_entry *_entry_ptr	\
+			static const struct pi_entry *_entry_ptr __attribute__((unused)) \
 			__used __section(".printk_index") = &_entry;	\
 		}							\
 	} while (0)
-- 
2.18.0



             reply	other threads:[~2024-03-06  9:40 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-06  9:26 Chunhui Li [this message]
2024-03-06 19:40 ` [PATCH] printk: fix _entry_ptr build warning Nathan Chancellor
2024-03-07  8:46   ` Chunhui Li (李春辉)

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=20240306092647.16010-1-chunhui.li@mediatek.com \
    --to=chunhui.li@mediatek.com \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=john.ogness@linutronix.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=matthias.bgg@gmail.com \
    --cc=pmladek@suse.com \
    --cc=rostedt@goodmis.org \
    --cc=senozhatsky@chromium.org \
    --cc=wsd_upstream@mediatek.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