From: Bjorn Andersson <bjorn.andersson@linaro.org>
To: Baolin Wang <baolin.wang7@gmail.com>
Cc: Chunyan Zhang <zhang.lyra@gmail.com>,
Ohad Ben-Cohen <ohad@wizery.com>,
"linux-remoteproc@vger.kernel.org"
<linux-remoteproc@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Orson Zhai <orsonzhai@gmail.com>,
Chunyan Zhang <chunyan.zhang@unisoc.com>
Subject: Re: [PATCH v2 1/2] hwspinlock: sprd: fixed warning of unused variable 'sprd_hwspinlock_of_match'
Date: Mon, 2 Nov 2020 17:58:24 -0600 [thread overview]
Message-ID: <20201102235824.GB223412@builder.lan> (raw)
In-Reply-To: <CADBw62oQj+K_-nyoZyMJSQ6VaqcNHbX9gbyLEzV9+Od1cVmC5A@mail.gmail.com>
On Mon 02 Nov 17:34 CST 2020, Baolin Wang wrote:
> On Friday, October 30, 2020, Chunyan Zhang <zhang.lyra@gmail.com> wrote:
> > From: Chunyan Zhang <chunyan.zhang@unisoc.com>
> >
> > The macro function of_match_ptr() is NULL if CONFIG_OF is not set, then
> > Clang compiler would complain the of_device_id variable is unused.
> >
> > But using of_match_ptr() is space saving, for this case, the unused
> structure
> > 'sprd_hwspinlock_of_match' would be not built into symbol table if
> CONFIG_OF
> > is not set, probably depends on the compiler though.
> >
> > So adding __maybe_unsed seems a good approach to fix this warning.
> >
> > Reported-by: kernel test robot <lkp@intel.com>
> > Fixes: d8c8bbbb1aba ("hwspinlock: sprd: Add hardware spinlock driver")
> > Signed-off-by: Chunyan Zhang <chunyan.zhang@unisoc.com>
> > ---
>
> I'd like to remove this wrapper, and just depend on the CONFIG_OF. But I
> have no objection for this patch. So
> Reviewed-by: Baolin Wang <baolin.wang7@gmail.com>
>
As noted on the first line of the probe function, this driver isn't
going to do anything when CONFIG_OF is disabled - and I don't think we
should worry too much about space savings during COMPILE_TEST.
So I would prefer that we simply drop the of_match_ptr()
But I believe that's what you're saying as well Baolin?
Regards,
Bjorn
>
> > drivers/hwspinlock/sprd_hwspinlock.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/hwspinlock/sprd_hwspinlock.c
> b/drivers/hwspinlock/sprd_hwspinlock.c
> > index 36dc8038bbb4..4c63e2546064 100644
> > --- a/drivers/hwspinlock/sprd_hwspinlock.c
> > +++ b/drivers/hwspinlock/sprd_hwspinlock.c
> > @@ -138,7 +138,7 @@ static int sprd_hwspinlock_probe(struct
> platform_device *pdev)
> > SPRD_HWLOCKS_NUM);
> > }
> >
> > -static const struct of_device_id sprd_hwspinlock_of_match[] = {
> > +static const __maybe_unused struct of_device_id
> sprd_hwspinlock_of_match[] = {
> > { .compatible = "sprd,hwspinlock-r3p0", },
> > { /* sentinel */ }
> > };
> > --
> > 2.20.1
> >
> >
>
> --
> Baolin Wang
next prev parent reply other threads:[~2020-11-02 23:58 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-30 3:46 [PATCH v2 0/2] fixes and improvement for sprd hwspinlock Chunyan Zhang
2020-10-30 3:46 ` [PATCH v2 1/2] hwspinlock: sprd: fixed warning of unused variable 'sprd_hwspinlock_of_match' Chunyan Zhang
[not found] ` <CADBw62oQj+K_-nyoZyMJSQ6VaqcNHbX9gbyLEzV9+Od1cVmC5A@mail.gmail.com>
2020-11-02 23:58 ` Bjorn Andersson [this message]
2020-11-03 2:00 ` Chunyan Zhang
2020-10-30 3:46 ` [PATCH v2 2/2] hwspinlock: sprd: use module_platform_driver() instead postcore initcall Chunyan Zhang
2020-11-03 0:40 ` Bjorn Andersson
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=20201102235824.GB223412@builder.lan \
--to=bjorn.andersson@linaro.org \
--cc=baolin.wang7@gmail.com \
--cc=chunyan.zhang@unisoc.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-remoteproc@vger.kernel.org \
--cc=ohad@wizery.com \
--cc=orsonzhai@gmail.com \
--cc=zhang.lyra@gmail.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