* [PATCH v2 0/2] fixes and improvement for sprd hwspinlock @ 2020-10-30 3:46 Chunyan Zhang 2020-10-30 3:46 ` [PATCH v2 1/2] hwspinlock: sprd: fixed warning of unused variable 'sprd_hwspinlock_of_match' Chunyan Zhang 2020-10-30 3:46 ` [PATCH v2 2/2] hwspinlock: sprd: use module_platform_driver() instead postcore initcall Chunyan Zhang 0 siblings, 2 replies; 6+ messages in thread From: Chunyan Zhang @ 2020-10-30 3:46 UTC (permalink / raw) To: Ohad Ben-Cohen, Bjorn Andersson, Baolin Wang Cc: linux-remoteproc, linux-kernel, Orson Zhai, Chunyan Zhang, Chunyan Zhang From: Chunyan Zhang <chunyan.zhang@unisoc.com> Changes since v1: * Change to add __maybe_unsed rather than not use of_match_ptr(). Chunyan Zhang (2): hwspinlock: sprd: fixed warning of unused variable 'sprd_hwspinlock_of_match' hwspinlock: sprd: use module_platform_driver() instead postcore initcall drivers/hwspinlock/sprd_hwspinlock.c | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) -- 2.20.1 ^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v2 1/2] hwspinlock: sprd: fixed warning of unused variable 'sprd_hwspinlock_of_match' 2020-10-30 3:46 [PATCH v2 0/2] fixes and improvement for sprd hwspinlock Chunyan Zhang @ 2020-10-30 3:46 ` Chunyan Zhang [not found] ` <CADBw62oQj+K_-nyoZyMJSQ6VaqcNHbX9gbyLEzV9+Od1cVmC5A@mail.gmail.com> 2020-10-30 3:46 ` [PATCH v2 2/2] hwspinlock: sprd: use module_platform_driver() instead postcore initcall Chunyan Zhang 1 sibling, 1 reply; 6+ messages in thread From: Chunyan Zhang @ 2020-10-30 3:46 UTC (permalink / raw) To: Ohad Ben-Cohen, Bjorn Andersson, Baolin Wang Cc: linux-remoteproc, linux-kernel, Orson Zhai, Chunyan Zhang, Chunyan Zhang 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> --- 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 ^ permalink raw reply related [flat|nested] 6+ messages in thread
[parent not found: <CADBw62oQj+K_-nyoZyMJSQ6VaqcNHbX9gbyLEzV9+Od1cVmC5A@mail.gmail.com>]
* Re: [PATCH v2 1/2] hwspinlock: sprd: fixed warning of unused variable 'sprd_hwspinlock_of_match' [not found] ` <CADBw62oQj+K_-nyoZyMJSQ6VaqcNHbX9gbyLEzV9+Od1cVmC5A@mail.gmail.com> @ 2020-11-02 23:58 ` Bjorn Andersson 2020-11-03 2:00 ` Chunyan Zhang 0 siblings, 1 reply; 6+ messages in thread From: Bjorn Andersson @ 2020-11-02 23:58 UTC (permalink / raw) To: Baolin Wang Cc: Chunyan Zhang, Ohad Ben-Cohen, linux-remoteproc, linux-kernel, Orson Zhai, Chunyan Zhang 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 ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2 1/2] hwspinlock: sprd: fixed warning of unused variable 'sprd_hwspinlock_of_match' 2020-11-02 23:58 ` Bjorn Andersson @ 2020-11-03 2:00 ` Chunyan Zhang 0 siblings, 0 replies; 6+ messages in thread From: Chunyan Zhang @ 2020-11-03 2:00 UTC (permalink / raw) To: Bjorn Andersson Cc: Baolin Wang, Ohad Ben-Cohen, linux-remoteproc, linux-kernel, Orson Zhai, Chunyan Zhang On Tue, 3 Nov 2020 at 07:58, Bjorn Andersson <bjorn.andersson@linaro.org> wrote: > > 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() Ok, that's what the v1 does. Bjorn, could you please pick up the 1st patch in v1 [1]? Thanks, Chunyan [1] https://lkml.org/lkml/2020/10/26/87 > > 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 ^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v2 2/2] hwspinlock: sprd: use module_platform_driver() instead postcore initcall 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 @ 2020-10-30 3:46 ` Chunyan Zhang 2020-11-03 0:40 ` Bjorn Andersson 1 sibling, 1 reply; 6+ messages in thread From: Chunyan Zhang @ 2020-10-30 3:46 UTC (permalink / raw) To: Ohad Ben-Cohen, Bjorn Andersson, Baolin Wang Cc: linux-remoteproc, linux-kernel, Orson Zhai, Chunyan Zhang, Chunyan Zhang From: Chunyan Zhang <chunyan.zhang@unisoc.com> The hardware spinlock devices are defined in the DT, there's no need for init calls order, remove boilerplate code by using module_platform_driver. Signed-off-by: Chunyan Zhang <chunyan.zhang@unisoc.com> --- drivers/hwspinlock/sprd_hwspinlock.c | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/drivers/hwspinlock/sprd_hwspinlock.c b/drivers/hwspinlock/sprd_hwspinlock.c index 4c63e2546064..19d1924044e5 100644 --- a/drivers/hwspinlock/sprd_hwspinlock.c +++ b/drivers/hwspinlock/sprd_hwspinlock.c @@ -151,18 +151,7 @@ static struct platform_driver sprd_hwspinlock_driver = { .of_match_table = of_match_ptr(sprd_hwspinlock_of_match), }, }; - -static int __init sprd_hwspinlock_init(void) -{ - return platform_driver_register(&sprd_hwspinlock_driver); -} -postcore_initcall(sprd_hwspinlock_init); - -static void __exit sprd_hwspinlock_exit(void) -{ - platform_driver_unregister(&sprd_hwspinlock_driver); -} -module_exit(sprd_hwspinlock_exit); +module_platform_driver(sprd_hwspinlock_driver); MODULE_LICENSE("GPL v2"); MODULE_DESCRIPTION("Hardware spinlock driver for Spreadtrum"); -- 2.20.1 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v2 2/2] hwspinlock: sprd: use module_platform_driver() instead postcore initcall 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 0 siblings, 0 replies; 6+ messages in thread From: Bjorn Andersson @ 2020-11-03 0:40 UTC (permalink / raw) To: Chunyan Zhang Cc: Ohad Ben-Cohen, Baolin Wang, linux-remoteproc, linux-kernel, Orson Zhai, Chunyan Zhang On Thu 29 Oct 22:46 CDT 2020, Chunyan Zhang wrote: > From: Chunyan Zhang <chunyan.zhang@unisoc.com> > > The hardware spinlock devices are defined in the DT, there's no need for > init calls order, remove boilerplate code by using module_platform_driver. > > Signed-off-by: Chunyan Zhang <chunyan.zhang@unisoc.com> Applied this patch with Baolin's r-b. Thank you, Bjorn > --- > drivers/hwspinlock/sprd_hwspinlock.c | 13 +------------ > 1 file changed, 1 insertion(+), 12 deletions(-) > > diff --git a/drivers/hwspinlock/sprd_hwspinlock.c b/drivers/hwspinlock/sprd_hwspinlock.c > index 4c63e2546064..19d1924044e5 100644 > --- a/drivers/hwspinlock/sprd_hwspinlock.c > +++ b/drivers/hwspinlock/sprd_hwspinlock.c > @@ -151,18 +151,7 @@ static struct platform_driver sprd_hwspinlock_driver = { > .of_match_table = of_match_ptr(sprd_hwspinlock_of_match), > }, > }; > - > -static int __init sprd_hwspinlock_init(void) > -{ > - return platform_driver_register(&sprd_hwspinlock_driver); > -} > -postcore_initcall(sprd_hwspinlock_init); > - > -static void __exit sprd_hwspinlock_exit(void) > -{ > - platform_driver_unregister(&sprd_hwspinlock_driver); > -} > -module_exit(sprd_hwspinlock_exit); > +module_platform_driver(sprd_hwspinlock_driver); > > MODULE_LICENSE("GPL v2"); > MODULE_DESCRIPTION("Hardware spinlock driver for Spreadtrum"); > -- > 2.20.1 > ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2020-11-03 2:01 UTC | newest] Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 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 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
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.