Re: [PATCH v2 4/4] fbdev: sh_mobile_lcdc: Make FB_DEVICE dependency optional

From
Andy Shevchenko <hidden>
Date
2025-12-27 14:22:29
Also in
dri-devel, linux-omap, linux-staging, lkml
Reply to
Chintan Patel, 2025-12-19
On Fri, Dec 19, 2025 at 7:43 AM Chintan Patel [off-list ref] wrote:
The sh_mobile_lcdc driver exposes overlay configuration via sysfs, but the
core driver does not require CONFIG_FB_DEVICE.

Make sysfs support optional by defining overlay_sysfs_groups as NULL when
FB_DEVICE is disabled. The driver always sets .dev_groups, and the kernel
naturally skips NULL attribute groups while the code remains buildable
and type-checked.
v2:
- Replace CONFIG_FB_DEVICE ifdefs with NULL overlay_sysfs_groups
- Always populate .dev_groups
Same comment about the changelog in the commit messages.

...
quoted hunk ↗ jump to hunk
+#ifdef CONFIG_FB_DEVICE
 ATTRIBUTE_GROUPS(overlay_sysfs);
+#else
+/*
+ * When CONFIG_FB_DEVICE is disabled, define overlay_sysfs_groups as NULL.
+ * The compiler will optimize out the sysfs code paths when dev_groups is NULL.
+ */
+static const struct attribute_group *overlay_sysfs_groups[] = { NULL };
+#endif
Hmm... I'm wondering if PTR_IF() can anyhow help here.

-- 
With Best Regards,
Andy Shevchenko
Thread (11 messages) 11 messages, 2 authors, last reply 2025-12-28
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help