Re: [PATCH] driver core: add missing kernel-doc for union members
From: Thomas Weißschuh
Date: Tue Jun 23 2026 - 16:13:33 EST
On 2026-06-23 12:00:22-0700, Randy Dunlap wrote:
> The use of __SYSFS_FUNCTION_ALTERNATIVE() adds an anonymous union (or
> struct if CONFIG_CFI=y).*
>
> Describe the additional struct/union members to avoid docs build
> warnings.
>
> Warning: include/linux/device.h:117 struct member 'show_const' not described in 'device_attribute'
> Warning: include/linux/device.h:117 struct member 'store_const' not described in 'device_attribute'
>
> *: kernel-doc ignores CONFIG_ symbols in source files; it is using the
> first definition of __SYSFS_FUNCTION_ALTERNATIVE(), which is struct
> instead of union.
>
> Fixes: 434506b86a6c ("driver core: Allow the constification of device attributes")
> Signed-off-by: Randy Dunlap <rdunlap@xxxxxxxxxxxxx>
Thanks!
Reviewed-by: Thomas Weißschuh <linux@xxxxxxxxxxxxxx>
> ---
> Cc: Thomas Weißschuh <linux@xxxxxxxxxxxxxx>
> Cc: "Rafael J. Wysocki" <rafael@xxxxxxxxxx>
> Cc: Danilo Krummrich <dakr@xxxxxxxxxx>
> Cc: driver-core@xxxxxxxxxxxxxxx
> Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
> Cc: stable@xxxxxxxxxxxxxxx
>
> include/linux/device.h | 2 ++
> 1 file changed, 2 insertions(+)
>
> --- linux-next-20260619.orig/include/linux/device.h
> +++ linux-next-20260619/include/linux/device.h
> @@ -99,7 +99,9 @@ struct device_type {
> * struct device_attribute - Interface for exporting device attributes.
> * @attr: sysfs attribute definition.
> * @show: Show handler.
> + * @show_const: Show handler (read-only).
Not a big fan of the wording, but I won't bikeshed.
The subject could also be a bit more specific.
> * @store: Store handler.
> + * @store_const: Store handler (read-only).
> */
> struct device_attribute {
> struct attribute attr;