Re: [PATCH 0/3] fbdev: Guard sysfs interfaces under CONFIG_FB_DEVICE

From
Andy Shevchenko <hidden>
Date
2025-12-09 14:25:47
Also in
dri-devel, linux-omap, linux-staging, lkml
Reply to
Helge Deller, 2025-12-09
On Tue, Dec 9, 2025 at 10:23 AM Helge Deller [off-list ref] wrote:
On 12/9/25 08:27, Thomas Zimmermann wrote:
...
This whole series adds a whole lot of ifdef'ery, which I think is the
worst approach. It makes the code less readable and leads to two code
paths, which may trigger different build errors depending on the config.

I'm sure it must be possible to do the same without adding more #ifdefs,
e.g. by introducing a function like   dev_of_fbinfo(fbinfo)  which
simply returns NULL for the FB_DEVICE=n case.  Then, that value can be tested
like
        if (dev_of_fbinfo(fbinfo))
                {...do-the-things...}
For the FB_DEVICE=n case this will then be optimized out by the compiler,
while you still have full compiler syntax checking.

Thoughts?
I second you. I am also not a fan of ifdeffery when it can be avoided.

-- 
With Best Regards,
Andy Shevchenko
Thread (11 messages) 11 messages, 4 authors, last reply 2025-12-10
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