lkml.org 
[lkml]   [2022]   [Mar]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH 2/2] regulator: rt5759: Add support for Richtek RT5759 DCDC converter
Krzysztof Kozlowski <krzk@kernel.org> 於 2022年3月26日 週六 上午12:08寫道:
>
> On 25/03/2022 17:05, Mark Brown wrote:
> > On Fri, Mar 25, 2022 at 04:55:25PM +0100, Krzysztof Kozlowski wrote:
> >
> >> You mention board, some of_device_get_match_data() so you talk about
> >> runtime. maybe_unused is not about runtime. It is about build time.
> >
> >> The code you sent cannot have this structure unused. If you think
> >> otherwise, please provide argument, but not about runtime (again). You
> >> can for example build it without OF and see...
> >
> > If you use of_match_ptr() in the struct device (which is good practice,
> > didn't check if this driver does it) then that causes the ID table to be
> > unreferenced as of_match_ptr() compiles to NULL when !OF.
>
> Yep, then the case is obvious, but the driver does not use it.
>
> +static struct i2c_driver rt5759_driver = {
> + .driver = {
> + .name = "rt5759",
> + .of_match_table = rt5759_device_table,
>
> Therefore the of_device_id cannot be unused, so __maybe_unused is not
> correct. This can be fixed in two different ways, which we did not
> discuss yet...
>
As my past experience, '__maybe_unused' must be added to fix W=1 build
warning when OF=n
You can refer to the below link.
https://lore.kernel.org/lkml/1598234713-8532-1-git-send-email-u0084500@gmail.com/

And it's based on 'of_match_ptr' is used.

I tried to remove only __maybe_unused and build with x86 config that
CONFIG_OF=n.
There's no warning or error message when compiling the rt5759 source code.

If so, I will remove only '__maybe_unused'.
May I ask whether 'of_match_ptr' need to be added or not?

> Best regards,
> Krzysztof

\
 
 \ /
  Last update: 2022-03-26 01:59    [W:0.081 / U:0.736 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site