Linux clock framework development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Brian Masney" <bmasney@redhat.com>
Cc: wsa+renesas@sang-engineering.com, linux-clk@vger.kernel.org
Subject: Re: [PATCH 1/4] driver: core: add subsys_driver() macro
Date: Tue, 08 Sep 2026 17:58:45 +0000	[thread overview]
Message-ID: <20260908175845.A6A4D1F00A3A@smtp.kernel.org> (raw)
In-Reply-To: <20260908-subsys_initcall-v1-1-cbccf4cd4288@redhat.com>

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.

> +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.

> +
>  #endif	/* _DEVICE_DRIVER_H_ */

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260908-subsys_initcall-v1-0-cbccf4cd4288@redhat.com?part=1

  reply	other threads:[~2026-09-08 17:58 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 [this message]
2026-09-08 18:19     ` Brian Masney
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=20260908175845.A6A4D1F00A3A@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox