diff mbox series

[2/8] drm: renesas: rcar-du: annotate rcar_cmm_read() with __maybe_unused

Message ID f2b721e28b9ee2711d7848abf1774ecb8ce8e5e2.1725962479.git.jani.nikula@intel.com (mailing list archive)
State New, archived
Headers show
Series drm: fix and enable warnings on unused static inlines | expand

Commit Message

Jani Nikula Sept. 10, 2024, 10:03 a.m. UTC
Building with clang and and W=1 leads to warning about unused
rcar_cmm_read(). Fix by annotating it with __maybe_unused.

See also commit 6863f5643dd7 ("kbuild: allow Clang to find unused static
inline functions for W=1 build").

Signed-off-by: Jani Nikula <jani.nikula@intel.com>

---

Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Cc: linux-renesas-soc@vger.kernel.org
Cc: Nathan Chancellor <nathan@kernel.org>
---
 drivers/gpu/drm/renesas/rcar-du/rcar_cmm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Geert Uytterhoeven Sept. 10, 2024, 12:39 p.m. UTC | #1
Hi Jani,

On Tue, Sep 10, 2024 at 12:06 PM Jani Nikula <jani.nikula@intel.com> wrote:
> Building with clang and and W=1 leads to warning about unused
> rcar_cmm_read(). Fix by annotating it with __maybe_unused.
>
> See also commit 6863f5643dd7 ("kbuild: allow Clang to find unused static
> inline functions for W=1 build").
>
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>

Thanks for your patch!

> --- a/drivers/gpu/drm/renesas/rcar-du/rcar_cmm.c
> +++ b/drivers/gpu/drm/renesas/rcar-du/rcar_cmm.c
> @@ -32,7 +32,7 @@ struct rcar_cmm {
>         } lut;
>  };
>
> -static inline int rcar_cmm_read(struct rcar_cmm *rcmm, u32 reg)
> +static inline __maybe_unused int rcar_cmm_read(struct rcar_cmm *rcmm, u32 reg)
>  {
>         return ioread32(rcmm->base + reg);
>  }

This function was never used. Why not remove it instead?

Gr{oetje,eeting}s,

                        Geert
Jani Nikula Sept. 10, 2024, 1:36 p.m. UTC | #2
On Tue, 10 Sep 2024, Geert Uytterhoeven <geert@linux-m68k.org> wrote:
> Hi Jani,
>
> On Tue, Sep 10, 2024 at 12:06 PM Jani Nikula <jani.nikula@intel.com> wrote:
>> Building with clang and and W=1 leads to warning about unused
>> rcar_cmm_read(). Fix by annotating it with __maybe_unused.
>>
>> See also commit 6863f5643dd7 ("kbuild: allow Clang to find unused static
>> inline functions for W=1 build").
>>
>> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
>
> Thanks for your patch!
>
>> --- a/drivers/gpu/drm/renesas/rcar-du/rcar_cmm.c
>> +++ b/drivers/gpu/drm/renesas/rcar-du/rcar_cmm.c
>> @@ -32,7 +32,7 @@ struct rcar_cmm {
>>         } lut;
>>  };
>>
>> -static inline int rcar_cmm_read(struct rcar_cmm *rcmm, u32 reg)
>> +static inline __maybe_unused int rcar_cmm_read(struct rcar_cmm *rcmm, u32 reg)
>>  {
>>         return ioread32(rcmm->base + reg);
>>  }
>
> This function was never used. Why not remove it instead?

Can do if that's what the maintainers desire. It's just that sometimes
it's better to have the implementation reviewed and ready waiting for
the users than requiring the first user to add the implementation. I
opted for __maybe_unused across the series.

BR,
Jani.

>
> Gr{oetje,eeting}s,
>
>                         Geert
Laurent Pinchart Sept. 11, 2024, 9:51 a.m. UTC | #3
On Tue, Sep 10, 2024 at 04:36:01PM +0300, Jani Nikula wrote:
> On Tue, 10 Sep 2024, Geert Uytterhoeven <geert@linux-m68k.org> wrote:
> > Hi Jani,
> >
> > On Tue, Sep 10, 2024 at 12:06 PM Jani Nikula <jani.nikula@intel.com> wrote:
> >> Building with clang and and W=1 leads to warning about unused
> >> rcar_cmm_read(). Fix by annotating it with __maybe_unused.
> >>
> >> See also commit 6863f5643dd7 ("kbuild: allow Clang to find unused static
> >> inline functions for W=1 build").
> >>
> >> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
> >
> > Thanks for your patch!
> >
> >> --- a/drivers/gpu/drm/renesas/rcar-du/rcar_cmm.c
> >> +++ b/drivers/gpu/drm/renesas/rcar-du/rcar_cmm.c
> >> @@ -32,7 +32,7 @@ struct rcar_cmm {
> >>         } lut;
> >>  };
> >>
> >> -static inline int rcar_cmm_read(struct rcar_cmm *rcmm, u32 reg)
> >> +static inline __maybe_unused int rcar_cmm_read(struct rcar_cmm *rcmm, u32 reg)
> >>  {
> >>         return ioread32(rcmm->base + reg);
> >>  }
> >
> > This function was never used. Why not remove it instead?
> 
> Can do if that's what the maintainers desire. It's just that sometimes
> it's better to have the implementation reviewed and ready waiting for
> the users than requiring the first user to add the implementation. I
> opted for __maybe_unused across the series.

Jiapeng Chong has sent a patch to drop the function, and I've reviewed
it. See https://lore.kernel.org/r/20240619075436.86407-1-jiapeng.chong@linux.alibaba.com

I've sent a pull request for v6.12 but it hasn't been processed in time
:-( See https://lore.kernel.org/r/20240822234445.GA23541@pendragon.ideasonboard.com
Jani Nikula Sept. 11, 2024, 10:21 a.m. UTC | #4
On Wed, 11 Sep 2024, Laurent Pinchart <laurent.pinchart@ideasonboard.com> wrote:
> Jiapeng Chong has sent a patch to drop the function, and I've reviewed
> it. See https://lore.kernel.org/r/20240619075436.86407-1-jiapeng.chong@linux.alibaba.com

Even better, thanks!

BR,
Jani.
diff mbox series

Patch

diff --git a/drivers/gpu/drm/renesas/rcar-du/rcar_cmm.c b/drivers/gpu/drm/renesas/rcar-du/rcar_cmm.c
index 26a2f5ad8ee5..ea52b0af9226 100644
--- a/drivers/gpu/drm/renesas/rcar-du/rcar_cmm.c
+++ b/drivers/gpu/drm/renesas/rcar-du/rcar_cmm.c
@@ -32,7 +32,7 @@  struct rcar_cmm {
 	} lut;
 };
 
-static inline int rcar_cmm_read(struct rcar_cmm *rcmm, u32 reg)
+static inline __maybe_unused int rcar_cmm_read(struct rcar_cmm *rcmm, u32 reg)
 {
 	return ioread32(rcmm->base + reg);
 }