All of lore.kernel.org
 help / color / mirror / Atom feed
From: Brian Masney <bmasney@redhat.com>
To: sashiko-reviews@lists.linux.dev
Cc: wsa+renesas@sang-engineering.com, linux-clk@vger.kernel.org
Subject: Re: [PATCH 1/4] driver: core: add subsys_driver() macro
Date: Tue, 8 Sep 2026 14:19:18 -0400	[thread overview]
Message-ID: <aqBRpviTCjwo3weo@redhat.com> (raw)
In-Reply-To: <20260908175845.A6A4D1F00A3A@smtp.kernel.org>

On Tue, Sep 08, 2026 at 05:58:45PM +0000, sashiko-bot@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
> - [Low] Missing semicolons after macro invocations in `subsys_driver`.
> --
> 
> commit cdf3179a9f2205efd1b552f70b7522e1db5ee888
> Author: Brian Masney <bmasney@redhat.com>
> 
> driver: core: add subsys_driver() macro
> 
> Add a new macro subsys_driver() to eliminate some boilerplate code in
> drivers that need to register earlier in the boot at the subsys_initcall
> level.
> 
> > diff --git a/include/linux/device/driver.h b/include/linux/device/driver.h
> > index 768a1334c0a1d..29fbc01ef06fc 100644
> > --- a/include/linux/device/driver.h
> > +++ b/include/linux/device/driver.h
> > @@ -297,4 +297,35 @@ static int __init __driver##_init(void) \
> >  } \
> >  device_initcall(__driver##_init);
> >  
> > +/**
> > + * subsys_driver() - Helper macro for drivers that don't do anything special
> 
> [ ... ]
> 
> > + */
> > +#define subsys_driver(__driver, __register, __unregister, ...) \
> > +static int __init __driver##_init(void) \
> > +{ \
> > +	return __register(&(__driver), ##__VA_ARGS__); \
> > +} \
> > +subsys_initcall(__driver##_init) \
> 
> [Severity: Low]
> Are we missing a semicolon at the end of this line? This relies on underlying
> macros providing a trailing semicolon in their expansions. While it compiles
> today, it makes the macro brittle. If the initcall infrastructure is ever
> refactored to not include an internal trailing semicolon, drivers using
> subsys_driver could fail to compile.

The other code in this file (like module_driver + friends) has a semicolon
however checkpatch.pl complains if the semicolon is there. I didn't know
if the semicolon was legacy. I ended up going with the approach to
satisfy checkpatch.pl.

I have no opinion either way about this.

> 
> > +static void __exit __driver##_exit(void) \
> > +{ \
> > +	__unregister(&(__driver), ##__VA_ARGS__); \
> > +} \
> > +module_exit(__driver##_exit)
> 
> [Severity: Low]
> Could we also add a semicolon at the end of the macro definition? Omitting it
> is inconsistent with similar kernel macros like module_driver and relies entirely
> on how the user invokes the macro.

Same comment as above applies here as well.

Brian


  reply	other threads:[~2026-09-08 18:19 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-08 17:47 [PATCH 0/4] driver: core: add subsys_platform_driver() to reduce boilerplate code in drivers Brian Masney
2026-09-08 17:47 ` [PATCH 1/4] driver: core: add subsys_driver() macro Brian Masney
2026-09-08 17:58   ` sashiko-bot
2026-09-08 18:19     ` Brian Masney [this message]
2026-09-09  7:49       ` Geert Uytterhoeven
2026-09-09 11:44   ` Abel Vesa
2026-09-09 15:14   ` Geert Uytterhoeven
2026-09-08 17:47 ` [PATCH 2/4] driver: core: platform: add subsys_platform_driver() macro Brian Masney
2026-09-09 11:44   ` Abel Vesa
2026-09-09 15:16   ` Geert Uytterhoeven
2026-09-08 17:47 ` [PATCH 3/4] clk: qcom: convert drivers over to use subsys_platform_driver() Brian Masney
2026-09-09 11:25   ` Konrad Dybcio
2026-09-09 11:45   ` Abel Vesa
2026-09-09 12:10     ` Brian Masney
2026-09-08 17:47 ` [PATCH 4/4] clk: renesas: " Brian Masney
2026-09-08 18:09   ` sashiko-bot
2026-09-09 15:19   ` Geert Uytterhoeven
2026-09-09 14:40 ` [PATCH 0/4] driver: core: add subsys_platform_driver() to reduce boilerplate code in drivers Pankaj Patil

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=aqBRpviTCjwo3weo@redhat.com \
    --to=bmasney@redhat.com \
    --cc=linux-clk@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=wsa+renesas@sang-engineering.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 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.