drivers/staging/fbtft/fbtft-core.c | 20 +++++++++++++++++-- drivers/staging/fbtft/fbtft-sysfs.c | 8 ++++++++ drivers/video/fbdev/omap2/omapfb/Kconfig | 2 +- .../video/fbdev/omap2/omapfb/omapfb-sysfs.c | 11 ++++++++++ drivers/video/fbdev/sh_mobile_lcdcfb.c | 4 ++++ 5 files changed, 42 insertions(+), 3 deletions(-)
Hi all, This small series makes several legacy fbdev drivers buildable with CONFIG_FB_DEVICE=n. Currently, multiple fbdev drivers rely on fb_info->dev and sysfs attribute registration unconditionally, which leads to build failures whenever FB_DEVICE is disabled. Thomas previously noted that FB_DEVICE should eventually become optional and that drivers should not depend on sysfs or fb_info->dev being present unless the Kconfig explicitly selects it. This series pushes in that direction by tightening the FB_DEVICE dependency boundary without changing any runtime behaviour when FB_DEVICE=y. What this series does *not* change - No functional behaviour changes when FB_DEVICE=y. - No removal of sysfs interfaces. - No changes to fbops, memory allocation, or display update paths. Build & test coverage Tested with the following combinations: 1. **FB=y, FB_DEVICE=y** - Baseline configuration; no regressions expected. 2. **FB=y, FB_DEVICE=n** - Drivers build successfully. - No sysfs attributes are created. - fbdev devices operate normally (where applicable). 3. **FB=n** - Drivers depend on FB, so they properly do not build, unchanged. Motivation This moves fbdev closer to supporting FB_DEVICE as truly optional, helps reduce Kconfig entanglement, and clears several long-standing TODO items as suggested by Thomas Zimmermann around legacy sysfs usage inside fbdev drivers. Feedback is welcome, especially on whether the guard boundaries around sysfs are placed correctly or whether more logic should be pulled under CONFIG_FB_DEVICE. Thanks, Chintan Chintan Patel (3): fbtft: Make sysfs and dev_*() logging conditional on FB_DEVICE omapfb: Guard sysfs code under CONFIG_FB_DEVICE sh_mobile_lcdc: Guard overlay sysfs interfaces under CONFIG_FB_DEVICE drivers/staging/fbtft/fbtft-core.c | 20 +++++++++++++++++-- drivers/staging/fbtft/fbtft-sysfs.c | 8 ++++++++ drivers/video/fbdev/omap2/omapfb/Kconfig | 2 +- .../video/fbdev/omap2/omapfb/omapfb-sysfs.c | 11 ++++++++++ drivers/video/fbdev/sh_mobile_lcdcfb.c | 4 ++++ 5 files changed, 42 insertions(+), 3 deletions(-) -- 2.43.0
Hi Am 09.12.25 um 05:27 schrieb Chintan Patel: > Hi all, > > This small series makes several legacy fbdev drivers buildable with > CONFIG_FB_DEVICE=n. Currently, multiple fbdev drivers rely on fb_info->dev > and sysfs attribute registration unconditionally, which leads to build > failures whenever FB_DEVICE is disabled. > > Thomas previously noted that FB_DEVICE should eventually become optional > and that drivers should not depend on sysfs or fb_info->dev being present > unless the Kconfig explicitly selects it. This series pushes in that > direction by tightening the FB_DEVICE dependency boundary without changing > any runtime behaviour when FB_DEVICE=y. > > What this series does *not* change > > - No functional behaviour changes when FB_DEVICE=y. > - No removal of sysfs interfaces. > - No changes to fbops, memory allocation, or display update paths. > > Build & test coverage > > Tested with the following combinations: > > 1. **FB=y, FB_DEVICE=y** > - Baseline configuration; no regressions expected. > > 2. **FB=y, FB_DEVICE=n** > - Drivers build successfully. > - No sysfs attributes are created. > - fbdev devices operate normally (where applicable). > > 3. **FB=n** > - Drivers depend on FB, so they properly do not build, unchanged. > > Motivation > > This moves fbdev closer to supporting FB_DEVICE as truly optional, helps > reduce Kconfig entanglement, and clears several long-standing TODO items > as suggested by Thomas Zimmermann around legacy sysfs usage inside fbdev > drivers. > > Feedback is welcome, especially on whether the guard boundaries around > sysfs are placed correctly or whether more logic should be pulled under > CONFIG_FB_DEVICE. I left a comment on the first patch. If things still build nicely, then Acked-by: Thomas Zimmermann <tzimmermann@suse.de> for the series. Best regards Thomas > > Thanks, > Chintan > > Chintan Patel (3): > fbtft: Make sysfs and dev_*() logging conditional on FB_DEVICE > omapfb: Guard sysfs code under CONFIG_FB_DEVICE > sh_mobile_lcdc: Guard overlay sysfs interfaces under CONFIG_FB_DEVICE > > drivers/staging/fbtft/fbtft-core.c | 20 +++++++++++++++++-- > drivers/staging/fbtft/fbtft-sysfs.c | 8 ++++++++ > drivers/video/fbdev/omap2/omapfb/Kconfig | 2 +- > .../video/fbdev/omap2/omapfb/omapfb-sysfs.c | 11 ++++++++++ > drivers/video/fbdev/sh_mobile_lcdcfb.c | 4 ++++ > 5 files changed, 42 insertions(+), 3 deletions(-) > -- -- Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Frankenstr. 146, 90461 Nürnberg, Germany, www.suse.com GF: Jochen Jaser, Andrew McDonald, Werner Knoblich, (HRB 36809, AG Nürnberg)
On 12/9/25 08:27, Thomas Zimmermann wrote:
> Hi
>
> Am 09.12.25 um 05:27 schrieb Chintan Patel:
>> Hi all,
>>
>> This small series makes several legacy fbdev drivers buildable with
>> CONFIG_FB_DEVICE=n. Currently, multiple fbdev drivers rely on fb_info->dev
>> and sysfs attribute registration unconditionally, which leads to build
>> failures whenever FB_DEVICE is disabled.
>>
>> Thomas previously noted that FB_DEVICE should eventually become optional
>> and that drivers should not depend on sysfs or fb_info->dev being present
>> unless the Kconfig explicitly selects it. This series pushes in that
>> direction by tightening the FB_DEVICE dependency boundary without changing
>> any runtime behaviour when FB_DEVICE=y.
>>
>> What this series does *not* change
>>
>> - No functional behaviour changes when FB_DEVICE=y.
>> - No removal of sysfs interfaces.
>> - No changes to fbops, memory allocation, or display update paths.
>>
>> Build & test coverage
>>
>> Tested with the following combinations:
>>
>> 1. **FB=y, FB_DEVICE=y**
>> - Baseline configuration; no regressions expected.
>>
>> 2. **FB=y, FB_DEVICE=n**
>> - Drivers build successfully.
>> - No sysfs attributes are created.
>> - fbdev devices operate normally (where applicable).
>>
>> 3. **FB=n**
>> - Drivers depend on FB, so they properly do not build, unchanged.
>>
>> Motivation
>>
>> This moves fbdev closer to supporting FB_DEVICE as truly optional, helps
>> reduce Kconfig entanglement, and clears several long-standing TODO items
>> as suggested by Thomas Zimmermann around legacy sysfs usage inside fbdev
>> drivers.
>>
>> Feedback is welcome, especially on whether the guard boundaries around
>> sysfs are placed correctly or whether more logic should be pulled under
>> CONFIG_FB_DEVICE.
>
> I left a comment on the first patch. If things still build nicely, then
>
> Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
>
> for the series.
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?
Helge
On Tue, Dec 9, 2025 at 10:23 AM Helge Deller <deller@gmx.de> 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
On 12/9/25 06:25, Andy Shevchenko wrote:
> On Tue, Dec 9, 2025 at 10:23 AM Helge Deller <deller@gmx.de> 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.
>
Thank you for the review! Will do the change.
Hi
Am 09.12.25 um 09:22 schrieb Helge Deller:
> On 12/9/25 08:27, Thomas Zimmermann wrote:
>> Hi
>>
>> Am 09.12.25 um 05:27 schrieb Chintan Patel:
>>> Hi all,
>>>
>>> This small series makes several legacy fbdev drivers buildable with
>>> CONFIG_FB_DEVICE=n. Currently, multiple fbdev drivers rely on
>>> fb_info->dev
>>> and sysfs attribute registration unconditionally, which leads to build
>>> failures whenever FB_DEVICE is disabled.
>>>
>>> Thomas previously noted that FB_DEVICE should eventually become
>>> optional
>>> and that drivers should not depend on sysfs or fb_info->dev being
>>> present
>>> unless the Kconfig explicitly selects it. This series pushes in that
>>> direction by tightening the FB_DEVICE dependency boundary without
>>> changing
>>> any runtime behaviour when FB_DEVICE=y.
>>>
>>> What this series does *not* change
>>>
>>> - No functional behaviour changes when FB_DEVICE=y.
>>> - No removal of sysfs interfaces.
>>> - No changes to fbops, memory allocation, or display update paths.
>>>
>>> Build & test coverage
>>>
>>> Tested with the following combinations:
>>>
>>> 1. **FB=y, FB_DEVICE=y**
>>> - Baseline configuration; no regressions expected.
>>>
>>> 2. **FB=y, FB_DEVICE=n**
>>> - Drivers build successfully.
>>> - No sysfs attributes are created.
>>> - fbdev devices operate normally (where applicable).
>>>
>>> 3. **FB=n**
>>> - Drivers depend on FB, so they properly do not build, unchanged.
>>>
>>> Motivation
>>>
>>> This moves fbdev closer to supporting FB_DEVICE as truly optional,
>>> helps
>>> reduce Kconfig entanglement, and clears several long-standing TODO
>>> items
>>> as suggested by Thomas Zimmermann around legacy sysfs usage inside
>>> fbdev
>>> drivers.
>>>
>>> Feedback is welcome, especially on whether the guard boundaries around
>>> sysfs are placed correctly or whether more logic should be pulled under
>>> CONFIG_FB_DEVICE.
>>
>> I left a comment on the first patch. If things still build nicely, then
>>
>> Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
>>
>> for the series.
>
> 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?
Your choice. I don't see this as an important fix. The FB_DEVICE=n case
is mostly useful for DRM-based systems that do not want to expose fbdev
interfaces to user space. Those are the vast majority today. The very
few special builds with fbdev drivers would likely use FB_DEVICE=y anyway.
Best regards
Thomas
>
> Helge
>
--
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstr. 146, 90461 Nürnberg, Germany, www.suse.com
GF: Jochen Jaser, Andrew McDonald, Werner Knoblich, (HRB 36809, AG Nürnberg)
© 2016 - 2025 Red Hat, Inc.