git: 0b3e4b3cc9bf - stable/14 - linuxkpi: Fix `__ATTR_RO()` in <linux/sysfs.h>

From: Vladimir Kondratyev <wulf_at_FreeBSD.org>
Date: Sat, 17 Feb 2024 21:32:42 UTC
The branch stable/14 has been updated by wulf:

URL: https://cgit.FreeBSD.org/src/commit/?id=0b3e4b3cc9bf1dda9d86636da02e6f8f96282d6f

commit 0b3e4b3cc9bf1dda9d86636da02e6f8f96282d6f
Author:     Jean-Sébastien Pédron <dumbbell@FreeBSD.org>
AuthorDate: 2023-12-08 21:57:24 +0000
Commit:     Vladimir Kondratyev <wulf@FreeBSD.org>
CommitDate: 2024-02-17 20:58:35 +0000

    linuxkpi: Fix `__ATTR_RO()` in <linux/sysfs.h>
    
    [Why]
    The passed structure may not have a `.store` field. This is the case in
    the amdgpu DRM driver starting with Linux 5.18.
    
    Reviewed by:    manu
    Approved by:    manu
    Differential Revision:  https://reviews.freebsd.org/D43023
    
    (cherry picked from commit d752a5e82ac92603fadf82e7de75878e1f5d054a)
---
 sys/compat/linuxkpi/common/include/linux/sysfs.h | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/sys/compat/linuxkpi/common/include/linux/sysfs.h b/sys/compat/linuxkpi/common/include/linux/sysfs.h
index 8b4160453a3a..4a65095d9eb1 100644
--- a/sys/compat/linuxkpi/common/include/linux/sysfs.h
+++ b/sys/compat/linuxkpi/common/include/linux/sysfs.h
@@ -54,7 +54,10 @@ struct attribute_group {
 	.attr = { .name = __stringify(_name), .mode = _mode },		\
 	.show = _show, .store  = _store,				\
 }
-#define	__ATTR_RO(_name)	__ATTR(_name, 0444, _name##_show, NULL)
+#define	__ATTR_RO(_name) {						\
+	.attr = { .name = __stringify(_name), .mode = 0444 },		\
+	.show = _name##_show,						\
+}
 #define	__ATTR_WO(_name)	__ATTR(_name, 0200, NULL, _name##_store)
 #define	__ATTR_RW(_name)	__ATTR(_name, 0644, _name##_show, _name##_store)
 #define	__ATTR_NULL	{ .attr = { .name = NULL } }