Commit be26a07c authored by Chintan Patel's avatar Chintan Patel Committed by Helge Deller
Browse files

staging: fbtft: Fix build failure when CONFIG_FB_DEVICE=n



When CONFIG_FB_DEVICE is disabled, struct fb_info does
not provide a valid dev pointer. Direct dereferences of
fb_info->dev therefore result in build failures.

Fix this by avoiding direct accesses to fb_info->dev and
switching the affected debug logging to framebuffer helpers
that do not rely on a device pointer.

This fixes the following build failure reported by the
kernel test robot.

Fixes: a06d03f9f238 ("staging: fbtft: Make FB_DEVICE dependency optional")
Reported-by: default avatarkernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202601110740.Y9XK5HtN-lkp@intel.com


Reviewed-by: default avatarAndy Shevchenko <andriy.shevchenko@intel.com>
Signed-off-by: default avatarChintan Patel <chintanlike@gmail.com>
Signed-off-by: default avatarHelge Deller <deller@gmx.de>
parent cbfb9c71
Loading
Loading
Loading
Loading
+9 −10
Original line number Diff line number Diff line
@@ -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);

	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);

	if (!par->fbtftops.blank)
		return ret;
@@ -793,7 +792,7 @@ 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,
	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,