On 1/12/26 22:16, Greg KH wrote:
On Mon, Jan 12, 2026 at 08:59:09PM -0800, Chintan Patel wrote:
Replace direct accesses to info->dev with fb_dbg() and fb_info()
helpers to avoid build failures when CONFIG_FB_DEVICE=n.

Why is there a fb_* specific logging helper?  dev_info() and dev_dbg()
should be used instead.


You’re correct that dev_dbg()/dev_info() are the standard logging APIs.

The reason I switched to fb_dbg()/fb_info() is not stylistic: direct
dereferences of info->dev / fb_info->dev are invalid when
CONFIG_FB_DEVICE=n, which causes compile-time errors.

fb_dbg() and fb_info() are framebuffer-specific helpers that handle
this case correctly, allowing logging without touching info->dev.


Fixes: a06d03f9f238 ("staging: fbtft: Make FB_DEVICE dependency optional")

Is this really a bug?

The build failure occurs when CONFIG_FB_DEVICE=n, where direct
dereferences of info->dev / fb_info->dev are not valid. This was reported by the kernel test robot.

That said, I’m fine dropping the Fixes tag if you don’t consider this a
regression.

Reported-by: kernel test robot <[email protected]>
Closes: 
https://lore.kernel.org/oe-kbuild-all/[email protected]
Signed-off-by: Chintan Patel <[email protected]>

Changes in v6:
- Switch debug/info logging to fb_dbg() and fb_info()(suggested by Thomas 
Zimmermann)
- Drop dev_of_fbinfo() usage in favor of framebuffer helpers that implicitly
   handle the debug/info context.
- Drop __func__ usage per review feedback(suggested by greg k-h)
- Add Fixes tag for a06d03f9f238 ("staging: fbtft: Make FB_DEVICE dependency 
optional")
   (suggested by Andy Shevchenko)

Changes in v5:
- Initial attempt to replace info->dev accesses using
   dev_of_fbinfo() helper
---

The changelog stuff goes below the --- line.

Ack.


  drivers/staging/fbtft/fbtft-core.c | 19 +++++++++----------
  1 file changed, 9 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/fbtft/fbtft-core.c 
b/drivers/staging/fbtft/fbtft-core.c
index 8a5ccc8ae0a1..1b3b62950205 100644
--- a/drivers/staging/fbtft/fbtft-core.c
+++ b/drivers/staging/fbtft/fbtft-core.c
@@ -365,9 +365,9 @@ static int fbtft_fb_setcolreg(unsigned int regno, unsigned 
int red,
        unsigned int val;
        int ret = 1;
- dev_dbg(info->dev,
-               "%s(regno=%u, red=0x%X, green=0x%X, blue=0x%X, trans=0x%X)\n",
-               __func__, regno, red, green, blue, transp);
+       fb_dbg(info,
+              "regno=%u, red=0x%X, green=0x%X, blue=0x%X, trans=0x%X\n",
+              regno, red, green, blue, transp);

I dont understand what is wrong with the existing dev_dbg() line (with
the exception that __func__ should not be in it.

switch (info->fix.visual) {
        case FB_VISUAL_TRUECOLOR:
@@ -391,8 +391,7 @@ static int fbtft_fb_blank(int blank, struct fb_info *info)
        struct fbtft_par *par = info->par;
        int ret = -EINVAL;
- dev_dbg(info->dev, "%s(blank=%d)\n",
-               __func__, blank);
+       fb_dbg(info, "blank=%d\n", blank);

Same here, what's wrong with dev_dbg()?


Same reason: dereferencing info->dev is invalid when CONFIG_FB_DEVICE=n. fb_dbg() handles this correctly without needing info->dev.

if (!par->fbtftops.blank)
                return ret;
@@ -793,11 +792,11 @@ int fbtft_register_framebuffer(struct fb_info *fb_info)
        if (spi)
                sprintf(text2, ", spi%d.%d at %d MHz", spi->controller->bus_num,
                        spi_get_chipselect(spi, 0), spi->max_speed_hz / 
1000000);
-       dev_info(fb_info->dev,
-                "%s frame buffer, %dx%d, %d KiB video memory%s, fps=%lu%s\n",
-                fb_info->fix.id, fb_info->var.xres, fb_info->var.yres,
-                fb_info->fix.smem_len >> 10, text1,
-                HZ / fb_info->fbdefio->delay, text2);
+       fb_info(fb_info,
+               "%s frame buffer, %dx%d, %d KiB video memory%s, fps=%lu%s\n",
+               fb_info->fix.id, fb_info->var.xres, fb_info->var.yres,
+               fb_info->fix.smem_len >> 10, text1,
+               HZ / fb_info->fbdefio->delay, text2);

When drivers work properly, they are quiet.  Why is this needed at all
except as a debug message?

Agreed. The informational message during framebuffer registration is not
necessary. I will either remove it entirely or convert it to a debug-only message.

I’ll rework the patch accordingly and resend.

Thanks again for the guidance.


Reply via email to