Linux Framebuffer Layer development
 help / color / mirror / Atom feed
* Re: [PATCH v3 3/4] fbdev: omapfb: Make FB_DEVICE dependency optional
From: Chintan Patel @ 2025-12-30 18:01 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: linux-fbdev, linux-staging, linux-omap, linux-kernel, dri-devel,
	tzimmermann, andy, deller, gregkh
In-Reply-To: <aVO5X0NKSdkH6Ab5@smile.fi.intel.com>



On 12/30/25 03:37, Andy Shevchenko wrote:
> On Mon, Dec 29, 2025 at 09:28:21PM -0800, Chintan Patel wrote:
>> omapfb provides several sysfs interfaces for framebuffer configuration
>> and debugging, but these are not required for the core driver.
>>
>> Remove the hard dependency on CONFIG_FB_DEVICE and make sysfs support
>> optional by using dev_of_fbinfo() to obtain the backing device at runtime.
>> When FB_DEVICE is disabled, sysfs operations are skipped while the code
>> still builds and is type-checked.
> 
> ...
> 
>> +		struct device *dev = dev_of_fbinfo(fbdev->fbs[i]);
> 
> Still the same issue I pointed out in v2 review.
> 
>>   		int t;
>> +
>> +		if (!dev)
>> +			continue;
> 
> ...
> 
>> +		struct device *dev = dev_of_fbinfo(fbdev->fbs[i]);
>> +
>> +		if (!dev)
>> +			continue;
> 
> Ditto.
Sorry about that. I had actually made your suggested changes but somehow 
I mistakenly send old patches instead of updated one. I will send 
updated one. Should I send v4 or v3 is fine?




^ permalink raw reply

* Re: [PATCH v3 0/4] fbdev: Make CONFIG_FB_DEVICE optional for drivers
From: Chintan Patel @ 2025-12-30 17:59 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: linux-fbdev, linux-staging, linux-omap, linux-kernel, dri-devel,
	tzimmermann, andy, deller, gregkh
In-Reply-To: <aVO4pslXIvnc00J3@smile.fi.intel.com>



On 12/30/25 03:33, Andy Shevchenko wrote:
> On Mon, Dec 29, 2025 at 09:28:18PM -0800, Chintan Patel wrote:
>> This series makes CONFIG_FB_DEVICE optional for fbdev drivers that use
>> it only for sysfs interfaces, addressing Thomas Zimmermann’s TODO to
>> remove hard FB_DEVICE dependencies.
>>
>> The series introduces a small helper, dev_of_fbinfo(), which returns
>> NULL when CONFIG_FB_DEVICE=n. This allows sysfs code paths to be skipped
>> via runtime checks, avoids #ifdef CONFIG_FB_DEVICE clutter, and keeps
>> full compile-time syntax checking.
> 
>> Signed-off-by: Chintan Patel <chintanlike@gmail.com>
>> ---
>> Changes in v3:
>> - Use PTR_IF() to conditionally include overlay_sysfs_group in
>>    overlay_sysfs_groups
>> - Decouple variable definition and assignment in fbtft_sysfs_init/exit
> 
> Any particular reasons you ignored my tag from v2?
> 
Ah.. This is typo. I see what happened now. Looks like my script picked 
wrong or old patches instead of new updated one. Should I send v4 or v4 
is fine?

^ permalink raw reply

* Re: [PATCH] staging: sm750fb: fix const array warning
From: Greg KH @ 2025-12-30 12:51 UTC (permalink / raw)
  To: Motti Kumar Babu
  Cc: sudipm.mukherjee, teddy.wang, skhan, linux-kernel-mentees,
	linux-fbdev, linux-staging, linux-kernel
In-Reply-To: <CAC9bbDKw-TGY81wecEnmhbMror0R=y8McTJGU5CPRf2N8UM9fQ@mail.gmail.com>

On Tue, Dec 30, 2025 at 05:42:43PM +0530, Motti Kumar Babu wrote:
> Hi Greg KH,
> 
> Yes, I have verified this change with a test build.
> 
> I ran make defconfig followed by make M=drivers/staging/sm750fb/ on the
> staging-testing branch, and the driver compiled successfully without any
> errors or new warnings.

defconfig will not enable this driver, are you sure you actually built
it?

And please do not top-post, or use html email.

thanks,

greg k-h

^ permalink raw reply

* Re: [PATCH v3 3/4] fbdev: omapfb: Make FB_DEVICE dependency optional
From: Andy Shevchenko @ 2025-12-30 11:37 UTC (permalink / raw)
  To: Chintan Patel
  Cc: linux-fbdev, linux-staging, linux-omap, linux-kernel, dri-devel,
	tzimmermann, andy, deller, gregkh
In-Reply-To: <20251230052827.4676-4-chintanlike@gmail.com>

On Mon, Dec 29, 2025 at 09:28:21PM -0800, Chintan Patel wrote:
> omapfb provides several sysfs interfaces for framebuffer configuration
> and debugging, but these are not required for the core driver.
> 
> Remove the hard dependency on CONFIG_FB_DEVICE and make sysfs support
> optional by using dev_of_fbinfo() to obtain the backing device at runtime.
> When FB_DEVICE is disabled, sysfs operations are skipped while the code
> still builds and is type-checked.

...

> +		struct device *dev = dev_of_fbinfo(fbdev->fbs[i]);

Still the same issue I pointed out in v2 review.

>  		int t;
> +
> +		if (!dev)
> +			continue;

...

> +		struct device *dev = dev_of_fbinfo(fbdev->fbs[i]);
> +
> +		if (!dev)
> +			continue;

Ditto.

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply

* Re: [PATCH v3 4/4] fbdev: sh_mobile_lcdc: Make FB_DEVICE dependency optional
From: Andy Shevchenko @ 2025-12-30 11:35 UTC (permalink / raw)
  To: Chintan Patel
  Cc: linux-fbdev, linux-staging, linux-omap, linux-kernel, dri-devel,
	tzimmermann, andy, deller, gregkh
In-Reply-To: <20251230052827.4676-5-chintanlike@gmail.com>

On Mon, Dec 29, 2025 at 09:28:22PM -0800, Chintan Patel 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 conditionally
> using PTR_IF(). The driver always sets .dev_groups, and the kernel
> naturally skips NULL attribute groups while the code remains buildable
> and type-checked.

...

> +static const struct attribute_group *overlay_sysfs_groups[] = {
> +	PTR_IF(IS_ENABLED(CONFIG_FB_DEVICE), &overlay_sysfs_group),
> +	NULL,

Please, drop comma at the end of the terminator entry.

> +};

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply

* Re: [PATCH v3 0/4] fbdev: Make CONFIG_FB_DEVICE optional for drivers
From: Andy Shevchenko @ 2025-12-30 11:33 UTC (permalink / raw)
  To: Chintan Patel
  Cc: linux-fbdev, linux-staging, linux-omap, linux-kernel, dri-devel,
	tzimmermann, andy, deller, gregkh
In-Reply-To: <20251230052827.4676-1-chintanlike@gmail.com>

On Mon, Dec 29, 2025 at 09:28:18PM -0800, Chintan Patel wrote:
> This series makes CONFIG_FB_DEVICE optional for fbdev drivers that use
> it only for sysfs interfaces, addressing Thomas Zimmermann’s TODO to
> remove hard FB_DEVICE dependencies.
> 
> The series introduces a small helper, dev_of_fbinfo(), which returns
> NULL when CONFIG_FB_DEVICE=n. This allows sysfs code paths to be skipped
> via runtime checks, avoids #ifdef CONFIG_FB_DEVICE clutter, and keeps
> full compile-time syntax checking.

> Signed-off-by: Chintan Patel <chintanlike@gmail.com>
> ---
> Changes in v3:
> - Use PTR_IF() to conditionally include overlay_sysfs_group in 
>   overlay_sysfs_groups
> - Decouple variable definition and assignment in fbtft_sysfs_init/exit

Any particular reasons you ignored my tag from v2?

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply

* Re: [PATCH v3 0/4] fbdev: Make CONFIG_FB_DEVICE optional for drivers
From: Geert Uytterhoeven @ 2025-12-30 10:42 UTC (permalink / raw)
  To: Chintan Patel
  Cc: linux-fbdev, linux-staging, linux-omap, linux-kernel, dri-devel,
	tzimmermann, andy, deller, gregkh
In-Reply-To: <20251230052827.4676-1-chintanlike@gmail.com>

Hi Chintan.

On Tue, 30 Dec 2025 at 06:29, Chintan Patel <chintanlike@gmail.com> wrote:
> This series makes CONFIG_FB_DEVICE optional for fbdev drivers that use
> it only for sysfs interfaces, addressing Thomas Zimmermann’s TODO to
> remove hard FB_DEVICE dependencies.
>
> The series introduces a small helper, dev_of_fbinfo(), which returns
> NULL when CONFIG_FB_DEVICE=n. This allows sysfs code paths to be skipped
> via runtime checks, avoids #ifdef CONFIG_FB_DEVICE clutter, and keeps
> full compile-time syntax checking.
>
> Signed-off-by: Chintan Patel <chintanlike@gmail.com>
> ---
> Changes in v3:
> - Use PTR_IF() to conditionally include overlay_sysfs_group in
>   overlay_sysfs_groups
> - Decouple variable definition and assignment in fbtft_sysfs_init/exit
>
> Changes in v2:
> - Add dev_of_fbinfo() helper (suggested by Geert Uytterhoeven)

by Helge Deller, not me.

> - Replace #ifdef CONFIG_FB_DEVICE blocks with runtime NULL checks
> - Switch to fb_dbg() / fb_info() logging (suggested by Thomas Zimmermann)

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply

* Re: [PATCH] fbdev: geode: lxfb: Use devm_request_mem_region
From: Helge Deller @ 2025-12-30 10:10 UTC (permalink / raw)
  To: Swaraj Gaikwad, Andres Salomon,
	moderated list:AMD GEODE PROCESSOR/CHIPSET SUPPORT,
	open list:FRAMEBUFFER LAYER, open list:FRAMEBUFFER LAYER,
	open list
  Cc: skhan, david.hunter.linux
In-Reply-To: <20251214012059.304043-1-swarajgaikwad1925@gmail.com>

Hello Swaraj,

On 12/14/25 02:20, Swaraj Gaikwad wrote:
> The lxfb driver currently uses pci_request_region() for memory
> reservation, which requires manual error handling and cleanup using
> pci_release_region().
> 
> Simplify the driver by migrating to the managed helper
> devm_request_mem_region(). This ensures that resources are automatically
> released on driver detach, allowing the removal of explicit cleanup code
> in the probe error path and the remove function.
> 
> This addresses the TODO item "Request memory regions in all fbdev
> drivers" in Documentation/gpu/todo.rst.
> 
> Signed-off-by: Swaraj Gaikwad <swarajgaikwad1925@gmail.com>
> ---
> Compile-tested only on x86_64.

I'm somewhat hesitated to apply your geode and arkfb patches.

IIRC, geode and arkfb chips were mostly (only?) used in some
laptops. That means, beside the arkfb and geode onboard graphics
chips there were no other (PCI) graphic cards which could conflict
at VGA addresses. So basically there is no real benefit for
those drivers to switching using devm_* functions.

Then, although your patches seem to be correct, it's hard to say
they are okay without actual testing.

That said, maybe someone still has the hardware and is able to test?

Helge
  
>   drivers/video/fbdev/geode/lxfb_core.c | 36 +++++++++------------------
>   1 file changed, 12 insertions(+), 24 deletions(-)
> 
> diff --git a/drivers/video/fbdev/geode/lxfb_core.c b/drivers/video/fbdev/geode/lxfb_core.c
> index cad99f5b7fe8..8189d6a13c5d 100644
> --- a/drivers/video/fbdev/geode/lxfb_core.c
> +++ b/drivers/video/fbdev/geode/lxfb_core.c
> @@ -335,25 +335,21 @@ static int lxfb_map_video_memory(struct fb_info *info, struct pci_dev *dev)
>   	if (ret)
>   		return ret;
> 
> -	ret = pci_request_region(dev, 0, "lxfb-framebuffer");
> +	if (!devm_request_mem_region(&dev->dev, pci_resource_start(dev, 0),
> +			      pci_resource_len(dev, 0), "lxfb-framebuffer"))
> +		return -EBUSY;
> 
> -	if (ret)
> -		return ret;
> -
> -	ret = pci_request_region(dev, 1, "lxfb-gp");
> -
> -	if (ret)
> -		return ret;
> +	if (!devm_request_mem_region(&dev->dev, pci_resource_start(dev, 1),
> +			      pci_resource_len(dev, 1), "lxfb-gp"))
> +		return -EBUSY;
> 
> -	ret = pci_request_region(dev, 2, "lxfb-vg");
> +	if (!devm_request_mem_region(&dev->dev, pci_resource_start(dev, 2),
> +			      pci_resource_len(dev, 2), "lxfb-vg"))
> +		return -EBUSY;
> 
> -	if (ret)
> -		return ret;
> -
> -	ret = pci_request_region(dev, 3, "lxfb-vp");
> -
> -	if (ret)
> -		return ret;
> +	if (!devm_request_mem_region(&dev->dev, pci_resource_start(dev, 3),
> +			      pci_resource_len(dev, 3), "lxfb-vp"))
> +		return -EBUSY;
> 
>   	info->fix.smem_start = pci_resource_start(dev, 0);
>   	info->fix.smem_len = vram ? vram : lx_framebuffer_size();
> @@ -546,19 +542,15 @@ static int lxfb_probe(struct pci_dev *pdev, const struct pci_device_id *id)
>   err:
>   	if (info->screen_base) {
>   		iounmap(info->screen_base);
> -		pci_release_region(pdev, 0);
>   	}
>   	if (par->gp_regs) {
>   		iounmap(par->gp_regs);
> -		pci_release_region(pdev, 1);
>   	}
>   	if (par->dc_regs) {
>   		iounmap(par->dc_regs);
> -		pci_release_region(pdev, 2);
>   	}
>   	if (par->vp_regs) {
>   		iounmap(par->vp_regs);
> -		pci_release_region(pdev, 3);
>   	}
> 
>   	fb_dealloc_cmap(&info->cmap);
> @@ -575,16 +567,12 @@ static void lxfb_remove(struct pci_dev *pdev)
>   	unregister_framebuffer(info);
> 
>   	iounmap(info->screen_base);
> -	pci_release_region(pdev, 0);
> 
>   	iounmap(par->gp_regs);
> -	pci_release_region(pdev, 1);
> 
>   	iounmap(par->dc_regs);
> -	pci_release_region(pdev, 2);
> 
>   	iounmap(par->vp_regs);
> -	pci_release_region(pdev, 3);
> 
>   	fb_dealloc_cmap(&info->cmap);
>   	framebuffer_release(info);
> 
> base-commit: a859eca0e4cc96f63ff125dbe5388d961558b0e9
> --
> 2.52.0
> 


^ permalink raw reply

* Re: [PATCH] fbdev: xilinxfb: request memory region before mapping framebuffer
From: Helge Deller @ 2025-12-30  9:57 UTC (permalink / raw)
  To: patdiviyam; +Cc: tzimmermann, linux-fbdev, dri-devel
In-Reply-To: <20251215225305.3820098-1-patdiviyam@gmail.com>

On 12/15/25 23:53, patdiviyam@gmail.com wrote:
> From: DiviyamPathak <patdiviyam@gmail.com>
> 
> The xilinxfb driver maps a physical framebuffer address with ioremap()
> without first reserving the memory region. This can conflict with other
> drivers accessing the same resource.
> 
> Request the memory region with devm_request_mem_region() before mapping
> the framebuffer and use managed mappings for proper lifetime handling.
> 
> This addresses the fbdev TODO about requesting memory regions and avoids
> potential resource conflicts.
> 
> Signed-off-by: DiviyamPathak <patdiviyam@gmail.com>

Was it tested it on physical hardware?
If not, could someone test?

Helge


> ---
>   drivers/video/fbdev/xilinxfb.c | 30 +++++++++++++++++-------------
>   1 file changed, 17 insertions(+), 13 deletions(-)
> 
> diff --git a/drivers/video/fbdev/xilinxfb.c b/drivers/video/fbdev/xilinxfb.c
> index 0a6e05cd155a..f18437490de8 100644
> --- a/drivers/video/fbdev/xilinxfb.c
> +++ b/drivers/video/fbdev/xilinxfb.c
> @@ -280,19 +280,27 @@ static int xilinxfb_assign(struct platform_device *pdev,
>   	/* Allocate the framebuffer memory */
>   	if (pdata->fb_phys) {
>   		drvdata->fb_phys = pdata->fb_phys;
> -		drvdata->fb_virt = ioremap(pdata->fb_phys, fbsize);
> +		/* Request the memory region before mapping */
> +		if (!devm_request_mem_region(dev, pdata->fb_phys, fbsize,
> +					DRIVER_NAME)) {
> +			dev_err(dev, "Cannot request framebuffer memory region\n");
> +			return -EBUSY;
> +		}
> +		drvdata->fb_virt = devm_ioremap(dev, pdata->fb_phys, fbsize);
> +		if (!drvdata->fb_virt) {
> +			dev_err(dev, "Could not map framebuffer memory\n");
> +			return -ENOMEM;
> +		}
>   	} else {
>   		drvdata->fb_alloced = 1;
>   		drvdata->fb_virt = dma_alloc_coherent(dev, PAGE_ALIGN(fbsize),
> -						      &drvdata->fb_phys,
> -						      GFP_KERNEL);
> -	}
> -
> -	if (!drvdata->fb_virt) {
> -		dev_err(dev, "Could not allocate frame buffer memory\n");
> -		return -ENOMEM;
> +					&drvdata->fb_phys,
> +					GFP_KERNEL);
> +		if (!drvdata->fb_virt) {
> +			dev_err(dev, "Could not allocate frame buffer memory\n");
> +			return -ENOMEM;
> +		}
>   	}
> -
>   	/* Clear (turn to black) the framebuffer */
>   	memset_io((void __iomem *)drvdata->fb_virt, 0, fbsize);
>   
> @@ -362,8 +370,6 @@ static int xilinxfb_assign(struct platform_device *pdev,
>   	if (drvdata->fb_alloced)
>   		dma_free_coherent(dev, PAGE_ALIGN(fbsize), drvdata->fb_virt,
>   				  drvdata->fb_phys);
> -	else
> -		iounmap(drvdata->fb_virt);
>   
>   	/* Turn off the display */
>   	xilinx_fb_out32(drvdata, REG_CTRL, 0);
> @@ -386,8 +392,6 @@ static void xilinxfb_release(struct device *dev)
>   	if (drvdata->fb_alloced)
>   		dma_free_coherent(dev, PAGE_ALIGN(drvdata->info.fix.smem_len),
>   				  drvdata->fb_virt, drvdata->fb_phys);
> -	else
> -		iounmap(drvdata->fb_virt);
>   
>   	/* Turn off the display */
>   	xilinx_fb_out32(drvdata, REG_CTRL, 0);


^ permalink raw reply

* Re: [PATCH] fbcon: Add check for return value
From: Helge Deller @ 2025-12-30  9:27 UTC (permalink / raw)
  To: Ваторопин Андрей
  Cc: linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org,
	linux-kernel@vger.kernel.org, lvc-project@linuxtesting.org
In-Reply-To: <20251217091036.249549-1-a.vatoropin@crpt.ru>

On 12/17/25 10:11, ÐаÑоÑопин ÐндÑей wrote:
> From: Andrey Vatoropin <a.vatoropin@crpt.ru>
> 
> If fbcon_open() fails when called from con2fb_acquire_newinfo() then
> info->fbcon_par pointer remains NULL which is later dereferenced.
> 
> Add check for return value of the function con2fb_acquire_newinfo() to
> avoid it.
> 
> Found by Linux Verification Center (linuxtesting.org) with SVACE.

I was unsure if I should apply this patch since we don't have a real problem.

This is inside the fbcon_init() function, so if con2fb_acquire_newinfo()
ever would have returned NULL, the kernel would have crashed and someone
would have reported it (or will report in the future if it happens).

Nevertheless, for correctness, I was tempted to change the check to a
WARN_ON() or BUG_ON() instead, but again: it never happened, so why
add bloat to the kernel ?

In the end, I've now applied this patch to the linux-fbdev git tree
as-is, just to avoid other people send similar patches based on
verification tool reports...

Thanks!
Helge
  
> Fixes: d1baa4ffa677 ("fbcon: set_con2fb_map fixes")
> Cc: stable@vger.kernel.org
> Signed-off-by: Andrey Vatoropin <a.vatoropin@crpt.ru>
> ---
>   drivers/video/fbdev/core/fbcon.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c
> index e7e07eb2142e..7453377f3433 100644
> --- a/drivers/video/fbdev/core/fbcon.c
> +++ b/drivers/video/fbdev/core/fbcon.c
> @@ -1047,7 +1047,8 @@ static void fbcon_init(struct vc_data *vc, bool init)
>   		return;
>   
>   	if (!info->fbcon_par)
> -		con2fb_acquire_newinfo(vc, info, vc->vc_num);
> +		if (con2fb_acquire_newinfo(vc, info, vc->vc_num))
> +			return;
>   
>   	/* If we are not the first console on this
>   	   fb, copy the font from that console */


^ permalink raw reply

* Re: [PATCH 1/3] drivers: video: fbdev: Remove hyperv_fb driver
From: Helge Deller @ 2025-12-30  9:06 UTC (permalink / raw)
  To: Prasanna Kumar T S M, linux-fbdev, dri-devel, linux-hyperv,
	ssengar, mhklinux, wei.liu, kys, haiyangz, decui
  Cc: linux-kernel
In-Reply-To: <1766809486-24731-1-git-send-email-ptsm@linux.microsoft.com>

On 12/27/25 05:24, Prasanna Kumar T S M wrote:
> The HyperV DRM driver is available since 5.14. This makes the hyperv_fb
> driver redundant, remove it.
> 
> Signed-off-by: Prasanna Kumar T S M <ptsm@linux.microsoft.com>
> ---
>   MAINTAINERS                     |   10 -
>   drivers/video/fbdev/Kconfig     |   11 -
>   drivers/video/fbdev/Makefile    |    1 -
>   drivers/video/fbdev/hyperv_fb.c | 1388 -------------------------------
>   4 files changed, 1410 deletions(-)
>   delete mode 100644 drivers/video/fbdev/hyperv_fb.c

applied to fbdev git tree.

Thanks!
Helge

^ permalink raw reply

* Re: [PATCH] fbdev: Use device_create_with_groups() to fix sysfs groups registration race
From: Helge Deller @ 2025-12-30  8:56 UTC (permalink / raw)
  To: Hans de Goede, Simona Vetter
  Cc: Thomas Zimmermann, dri-devel, linux-fbdev, stable, Shixiong Ou
In-Reply-To: <20251221165740.15821-1-johannes.goede@oss.qualcomm.com>

On 12/21/25 17:57, Hans de Goede wrote:
> The fbdev sysfs attributes are registered after sending the uevent for
> the device creation, leaving a race window where e.g. udev rules may
> not be able to access the sysfs attributes because the registration is
> not done yet.
> 
> Fix this by switching to device_create_with_groups(). This also results in
> a nice cleanup. After switching to device_create_with_groups() all that
> is left of fb_init_device() is setting the drvdata and that can be passed
> to device_create[_with_groups]() too. After which fb_init_device() can
> be completely removed.
> 
> Dropping fb_init_device() + fb_cleanup_device() in turn allows removing
> fb_info.class_flag as they were the only user of this field.
> 
> Fixes: 5fc830d6aca1 ("fbdev: Register sysfs groups through device_add_group")
> Cc: stable@vger.kernel.org
> Cc: Shixiong Ou <oushixiong@kylinos.cn>
> Signed-off-by: Hans de Goede <johannes.goede@oss.qualcomm.com>

applied to fbdev git tree.

Thanks!
Helge


> ---
> Note the fixes tag is technically wrong. This race has existed forever.
> The commit I picked for the fixes tag is a dependency of this change not
> the commit introducing the race. I don't believe that backporting this
> back any further is useful which is why I went with this commit.
> ---
>   drivers/video/fbdev/core/fbsysfs.c | 36 +++---------------------------
>   include/linux/fb.h                 |  1 -
>   2 files changed, 3 insertions(+), 34 deletions(-)
> 
> diff --git a/drivers/video/fbdev/core/fbsysfs.c b/drivers/video/fbdev/core/fbsysfs.c
> index b8344c40073b..baa2bae0fb5b 100644
> --- a/drivers/video/fbdev/core/fbsysfs.c
> +++ b/drivers/video/fbdev/core/fbsysfs.c
> @@ -12,8 +12,6 @@
>   
>   #include "fb_internal.h"
>   
> -#define FB_SYSFS_FLAG_ATTR 1
> -
>   static int activate(struct fb_info *fb_info, struct fb_var_screeninfo *var)
>   {
>   	int err;
> @@ -451,33 +449,7 @@ static struct attribute *fb_device_attrs[] = {
>   	NULL,
>   };
>   
> -static const struct attribute_group fb_device_attr_group = {
> -	.attrs          = fb_device_attrs,
> -};
> -
> -static int fb_init_device(struct fb_info *fb_info)
> -{
> -	int ret;
> -
> -	dev_set_drvdata(fb_info->dev, fb_info);
> -
> -	fb_info->class_flag |= FB_SYSFS_FLAG_ATTR;
> -
> -	ret = device_add_group(fb_info->dev, &fb_device_attr_group);
> -	if (ret)
> -		fb_info->class_flag &= ~FB_SYSFS_FLAG_ATTR;
> -
> -	return 0;
> -}
> -
> -static void fb_cleanup_device(struct fb_info *fb_info)
> -{
> -	if (fb_info->class_flag & FB_SYSFS_FLAG_ATTR) {
> -		device_remove_group(fb_info->dev, &fb_device_attr_group);
> -
> -		fb_info->class_flag &= ~FB_SYSFS_FLAG_ATTR;
> -	}
> -}
> +ATTRIBUTE_GROUPS(fb_device);
>   
>   int fb_device_create(struct fb_info *fb_info)
>   {
> @@ -485,14 +457,13 @@ int fb_device_create(struct fb_info *fb_info)
>   	dev_t devt = MKDEV(FB_MAJOR, node);
>   	int ret;
>   
> -	fb_info->dev = device_create(fb_class, fb_info->device, devt, NULL, "fb%d", node);
> +	fb_info->dev = device_create_with_groups(fb_class, fb_info->device, devt, fb_info,
> +						 fb_device_groups, "fb%d", node);
>   	if (IS_ERR(fb_info->dev)) {
>   		/* Not fatal */
>   		ret = PTR_ERR(fb_info->dev);
>   		pr_warn("Unable to create device for framebuffer %d; error %d\n", node, ret);
>   		fb_info->dev = NULL;
> -	} else {
> -		fb_init_device(fb_info);
>   	}
>   
>   	return 0;
> @@ -505,7 +476,6 @@ void fb_device_destroy(struct fb_info *fb_info)
>   	if (!fb_info->dev)
>   		return;
>   
> -	fb_cleanup_device(fb_info);
>   	device_destroy(fb_class, devt);
>   	fb_info->dev = NULL;
>   }
> diff --git a/include/linux/fb.h b/include/linux/fb.h
> index 05cc251035da..c3302d513546 100644
> --- a/include/linux/fb.h
> +++ b/include/linux/fb.h
> @@ -497,7 +497,6 @@ struct fb_info {
>   #if defined(CONFIG_FB_DEVICE)
>   	struct device *dev;		/* This is this fb device */
>   #endif
> -	int class_flag;                    /* private sysfs flags */
>   #ifdef CONFIG_FB_TILEBLITTING
>   	struct fb_tile_ops *tileops;    /* Tile Blitting */
>   #endif


^ permalink raw reply

* Re: [PATCH] fbdev: smscufx: properly copy ioctl memory to kernelspace
From: Helge Deller @ 2025-12-30  8:38 UTC (permalink / raw)
  To: Greg Kroah-Hartman, linux-fbdev, dri-devel
  Cc: linux-kernel, Tianchu Chen, stable, Steve Glendinning
In-Reply-To: <2025122802-radiance-vacancy-11da@gregkh>

On 12/28/25 14:17, Greg Kroah-Hartman wrote:
> The UFX_IOCTL_REPORT_DAMAGE ioctl does not properly copy data from
> userspace to kernelspace, and instead directly references the memory,
> which can cause problems if invalid data is passed from userspace.  Fix
> this all up by correctly copying the memory before accessing it within
> the kernel.
> 
> Reported-by: Tianchu Chen <flynnnchen@tencent.com>
> Cc: stable <stable@kernel.org>
> Cc: Steve Glendinning <steve.glendinning@shawell.net>
> Cc: Helge Deller <deller@gmx.de>
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> ---
>   drivers/video/fbdev/smscufx.c | 8 ++++++--
>   1 file changed, 6 insertions(+), 2 deletions(-)

applied to fbdev git tree.

Thanks!
Helge

^ permalink raw reply

* Re: [PATCH v2 14/19] video/vga: Add VGA_IS0_R
From: Helge Deller @ 2025-12-30  8:30 UTC (permalink / raw)
  To: Ville Syrjälä, Jani Nikula; +Cc: linux-fbdev, dri-devel
In-Reply-To: <aUQyVvduElkoz-hU@intel.com>

On 12/18/25 17:56, Ville Syrjälä wrote:
> On Tue, Dec 09, 2025 at 12:55:49PM +0200, Jani Nikula wrote:
>> On Tue, 09 Dec 2025, Ville Syrjala <ville.syrjala@linux.intel.com> wrote:
>>> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>>>
>>> Add a proper name for the "Input status register 0" IO address.
>>> Currently we have some code that does read addressed using the
>>> aliasing VGA_MSR_W define, making it unclear what register we're
>>> actually reading.
>>>
>>> v2: Remove stray '?'
>>>
>>> Cc: Helge Deller <deller@gmx.de>
> 
> Helge, can you toss me an ack to merge this via drm-intel please?

of course!

Acked-by: Helge Deller <deller@gmx.de>

  
>>> Cc: linux-fbdev@vger.kernel.org
>>> Cc: dri-devel@lists.freedesktop.org
>>> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
>>
>> Reviewed-by: Jani Nikula <jani.nikula@intel.com>
>>
>>> ---
>>>   include/video/vga.h | 1 +
>>>   1 file changed, 1 insertion(+)
>>>
>>> diff --git a/include/video/vga.h b/include/video/vga.h
>>> index 468764d6727a..2f13c371800b 100644
>>> --- a/include/video/vga.h
>>> +++ b/include/video/vga.h
>>> @@ -46,6 +46,7 @@
>>>   #define VGA_MIS_R   	0x3CC	/* Misc Output Read Register */
>>>   #define VGA_MIS_W   	0x3C2	/* Misc Output Write Register */
>>>   #define VGA_FTC_R	0x3CA	/* Feature Control Read Register */
>>> +#define VGA_IS0_R	0x3C2	/* Input Status Register 0 */
>>>   #define VGA_IS1_RC  	0x3DA	/* Input Status Register 1 - color emulation */
>>>   #define VGA_IS1_RM  	0x3BA	/* Input Status Register 1 - mono emulation */
>>>   #define VGA_PEL_D   	0x3C9	/* PEL Data Register */
>>
>> -- 
>> Jani Nikula, Intel
> 


^ permalink raw reply

* Re: [PATCH v3 4/4] fbdev: sh_mobile_lcdc: Make FB_DEVICE dependency optional
From: Helge Deller @ 2025-12-30  8:13 UTC (permalink / raw)
  To: Chintan Patel; +Cc: linux-fbdev, linux-omap, linux-kernel, dri-devel
In-Reply-To: <20251230052827.4676-5-chintanlike@gmail.com>

* Chintan Patel <chintanlike@gmail.com>:
> 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 conditionally
> using PTR_IF(). The driver always sets .dev_groups, and the kernel
> naturally skips NULL attribute groups while the code remains buildable
> and type-checked.
> 
> Suggested-by: Helge Deller <deller@gmx.de>
> Signed-off-by: Chintan Patel <chintanlike@gmail.com>
> ---
>  drivers/video/fbdev/sh_mobile_lcdcfb.c | 12 +++++++++++-
>  1 file changed, 11 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/video/fbdev/sh_mobile_lcdcfb.c b/drivers/video/fbdev/sh_mobile_lcdcfb.c
> index dd950e4ab5ce..cb7ed1ff9165 100644
> --- a/drivers/video/fbdev/sh_mobile_lcdcfb.c
> +++ b/drivers/video/fbdev/sh_mobile_lcdcfb.c
> @@ -1350,7 +1350,17 @@ static struct attribute *overlay_sysfs_attrs[] = {
>  	&dev_attr_overlay_rop3.attr,
>  	NULL,
>  };
> -ATTRIBUTE_GROUPS(overlay_sysfs);

Instead of replacing the ^ ATTRIBUTE_GROUPS() by the code below,
isn't it possible to just mark the overlay_sysfs_attrs[] array
_maybe_unused, and just do:
+ #ifdef CONFIG_FB_DEVICE
+ ATTRIBUTE_GROUPS(overlay_sysfs);
+ #endif

?

Helge


> +
> +#ifdef CONFIG_FB_DEVICE
> +static const struct attribute_group overlay_sysfs_group = {
> +	.attrs = overlay_sysfs_attrs,
> +};
> +#endif
> +
> +static const struct attribute_group *overlay_sysfs_groups[] = {
> +	PTR_IF(IS_ENABLED(CONFIG_FB_DEVICE), &overlay_sysfs_group),
> +	NULL,
> +};
>  
>  static const struct fb_fix_screeninfo sh_mobile_lcdc_overlay_fix  = {
>  	.id =		"SH Mobile LCDC",
> -- 
> 2.43.0
> 
> 

^ permalink raw reply

* Re: [PATCH v3 3/4] fbdev: omapfb: Make FB_DEVICE dependency optional
From: Helge Deller @ 2025-12-30  8:05 UTC (permalink / raw)
  To: Chintan Patel; +Cc: linux-fbdev, linux-omap, linux-kernel, dri-devel
In-Reply-To: <20251230052827.4676-4-chintanlike@gmail.com>

* Chintan Patel <chintanlike@gmail.com>:
> omapfb provides several sysfs interfaces for framebuffer configuration
> and debugging, but these are not required for the core driver.
> 
> Remove the hard dependency on CONFIG_FB_DEVICE and make sysfs support
> optional by using dev_of_fbinfo() to obtain the backing device at runtime.
> When FB_DEVICE is disabled, sysfs operations are skipped while the code
> still builds and is type-checked.
> 
> Suggested-by: Helge Deller <deller@gmx.de>
> Signed-off-by: Chintan Patel <chintanlike@gmail.com>

Reviewed-by: Helge Deller <deller@gmx.de>

> ---
>  drivers/video/fbdev/omap2/omapfb/Kconfig        |  3 ++-
>  drivers/video/fbdev/omap2/omapfb/omapfb-sysfs.c | 16 ++++++++++++----
>  2 files changed, 14 insertions(+), 5 deletions(-)

^ permalink raw reply

* Re: [PATCH v3 2/4] staging: fbtft: Make FB_DEVICE dependency optional
From: Helge Deller @ 2025-12-30  8:03 UTC (permalink / raw)
  To: Chintan Patel
  Cc: linux-fbdev, linux-staging, linux-omap, linux-kernel, dri-devel
In-Reply-To: <20251230052827.4676-3-chintanlike@gmail.com>

* Chintan Patel <chintanlike@gmail.com>:
> fbtft provides sysfs interfaces for debugging and gamma configuration,
> but these are not required for the core driver.
> 
> Drop the hard dependency on CONFIG_FB_DEVICE and make sysfs support
> optional by using dev_of_fbinfo() at runtime. When FB_DEVICE is disabled,
> sysfs operations are skipped while the code remains buildable and
> type-checked.
> 
> Suggested-by: Thomas Zimmermann <tzimmermann@suse.de>
> Suggested-by: Helge Deller <deller@gmx.de>
> Signed-off-by: Chintan Patel <chintanlike@gmail.com>

Reviewed-by: Helge Deller <deller@gmx.de>


^ permalink raw reply

* Re: [PATCH v3 1/4] fb: Add dev_of_fbinfo() helper for optional sysfs support
From: Helge Deller @ 2025-12-30  8:01 UTC (permalink / raw)
  To: Chintan Patel; +Cc: linux-fbdev, linux-kernel, dri-devel
In-Reply-To: <20251230052827.4676-2-chintanlike@gmail.com>

* Chintan Patel <chintanlike@gmail.com>:
> Add dev_of_fbinfo() to return the framebuffer struct device when
> CONFIG_FB_DEVICE is enabled, or NULL otherwise.
> 
> This allows fbdev drivers to use sysfs interfaces via runtime checks
> instead of CONFIG_FB_DEVICE ifdefs, keeping the code clean while
> remaining fully buildable.
> 
> Suggested-by: Helge Deller <deller@gmx.de>
> Signed-off-by: Chintan Patel <chintanlike@gmail.com>

Reviewed-by: Helge Deller <deller@gmx.de>

^ permalink raw reply

* Re: [PATCH] staging: sm750fb: fix const array warning
From: Greg KH @ 2025-12-30  7:42 UTC (permalink / raw)
  To: MottiKumar
  Cc: sudipm.mukherjee, teddy.wang, skhan, linux-kernel-mentees,
	linux-fbdev, linux-staging, linux-kernel
In-Reply-To: <20251226120417.2599020-1-mottikumarbabu@gmail.com>

On Fri, Dec 26, 2025 at 05:34:17PM +0530, MottiKumar wrote:
> Add a missing const to g_fbmode to fix a checkpatch warning:
> "static const char * array should probably be static const char * const"
> 
> Signed-off-by: MottiKumar <mottikumarbabu@gmail.com>
> ---
>  drivers/staging/sm750fb/sm750.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/sm750fb/sm750.c b/drivers/staging/sm750fb/sm750.c
> index d100b9e1d3d5..7afb58561a0c 100644
> --- a/drivers/staging/sm750fb/sm750.c
> +++ b/drivers/staging/sm750fb/sm750.c
> @@ -33,7 +33,7 @@
>  static int g_hwcursor = 1;
>  static int g_noaccel;
>  static int g_nomtrr;
> -static const char *g_fbmode[] = {NULL, NULL};
> +static const char * const g_fbmode[] = {NULL, NULL};
>  static const char *g_def_fbmode = "1024x768-32@60";
>  static char *g_settings;
>  static int g_dualview;
> -- 
> 2.43.0
> 
> 

Did you test build this change?  If not, please do so.

thanks,

greg k-h

^ permalink raw reply

* [PATCH v3 4/4] fbdev: sh_mobile_lcdc: Make FB_DEVICE dependency optional
From: Chintan Patel @ 2025-12-30  5:28 UTC (permalink / raw)
  To: linux-fbdev, linux-staging, linux-omap
  Cc: linux-kernel, dri-devel, tzimmermann, andy, deller, gregkh,
	Chintan Patel
In-Reply-To: <20251230052827.4676-1-chintanlike@gmail.com>

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 conditionally
using PTR_IF(). The driver always sets .dev_groups, and the kernel
naturally skips NULL attribute groups while the code remains buildable
and type-checked.

Suggested-by: Helge Deller <deller@gmx.de>
Signed-off-by: Chintan Patel <chintanlike@gmail.com>
---
 drivers/video/fbdev/sh_mobile_lcdcfb.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/drivers/video/fbdev/sh_mobile_lcdcfb.c b/drivers/video/fbdev/sh_mobile_lcdcfb.c
index dd950e4ab5ce..cb7ed1ff9165 100644
--- a/drivers/video/fbdev/sh_mobile_lcdcfb.c
+++ b/drivers/video/fbdev/sh_mobile_lcdcfb.c
@@ -1350,7 +1350,17 @@ static struct attribute *overlay_sysfs_attrs[] = {
 	&dev_attr_overlay_rop3.attr,
 	NULL,
 };
-ATTRIBUTE_GROUPS(overlay_sysfs);
+
+#ifdef CONFIG_FB_DEVICE
+static const struct attribute_group overlay_sysfs_group = {
+	.attrs = overlay_sysfs_attrs,
+};
+#endif
+
+static const struct attribute_group *overlay_sysfs_groups[] = {
+	PTR_IF(IS_ENABLED(CONFIG_FB_DEVICE), &overlay_sysfs_group),
+	NULL,
+};
 
 static const struct fb_fix_screeninfo sh_mobile_lcdc_overlay_fix  = {
 	.id =		"SH Mobile LCDC",
-- 
2.43.0


^ permalink raw reply related

* [PATCH v3 3/4] fbdev: omapfb: Make FB_DEVICE dependency optional
From: Chintan Patel @ 2025-12-30  5:28 UTC (permalink / raw)
  To: linux-fbdev, linux-staging, linux-omap
  Cc: linux-kernel, dri-devel, tzimmermann, andy, deller, gregkh,
	Chintan Patel
In-Reply-To: <20251230052827.4676-1-chintanlike@gmail.com>

omapfb provides several sysfs interfaces for framebuffer configuration
and debugging, but these are not required for the core driver.

Remove the hard dependency on CONFIG_FB_DEVICE and make sysfs support
optional by using dev_of_fbinfo() to obtain the backing device at runtime.
When FB_DEVICE is disabled, sysfs operations are skipped while the code
still builds and is type-checked.

Suggested-by: Helge Deller <deller@gmx.de>
Signed-off-by: Chintan Patel <chintanlike@gmail.com>
---
 drivers/video/fbdev/omap2/omapfb/Kconfig        |  3 ++-
 drivers/video/fbdev/omap2/omapfb/omapfb-sysfs.c | 16 ++++++++++++----
 2 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/drivers/video/fbdev/omap2/omapfb/Kconfig b/drivers/video/fbdev/omap2/omapfb/Kconfig
index f4cdf999a080..2d20e79adefc 100644
--- a/drivers/video/fbdev/omap2/omapfb/Kconfig
+++ b/drivers/video/fbdev/omap2/omapfb/Kconfig
@@ -5,7 +5,6 @@ config OMAP2_VRFB
 menuconfig FB_OMAP2
 	tristate "OMAP2+ frame buffer support"
 	depends on FB
-	depends on FB_DEVICE
 	depends on DRM_OMAP = n
 	depends on GPIOLIB
 	select FB_OMAP2_DSS
@@ -13,6 +12,8 @@ menuconfig FB_OMAP2
 	select FB_IOMEM_HELPERS
 	help
 	  Frame buffer driver for OMAP2+ based boards.
+	  FB_DEVICE is not required, but if enabled, provides sysfs interface
+	  for framebuffer configuration and debugging.
 
 if FB_OMAP2
 
diff --git a/drivers/video/fbdev/omap2/omapfb/omapfb-sysfs.c b/drivers/video/fbdev/omap2/omapfb/omapfb-sysfs.c
index 831b2c2fbdf9..ef555dd598aa 100644
--- a/drivers/video/fbdev/omap2/omapfb/omapfb-sysfs.c
+++ b/drivers/video/fbdev/omap2/omapfb/omapfb-sysfs.c
@@ -558,10 +558,14 @@ int omapfb_create_sysfs(struct omapfb2_device *fbdev)
 
 	DBG("create sysfs for fbs\n");
 	for (i = 0; i < fbdev->num_fbs; i++) {
+		struct device *dev = dev_of_fbinfo(fbdev->fbs[i]);
 		int t;
+
+		if (!dev)
+			continue;
+
 		for (t = 0; t < ARRAY_SIZE(omapfb_attrs); t++) {
-			r = device_create_file(fbdev->fbs[i]->dev,
-					&omapfb_attrs[t]);
+			r = device_create_file(dev, &omapfb_attrs[t]);
 
 			if (r) {
 				dev_err(fbdev->dev, "failed to create sysfs "
@@ -580,9 +584,13 @@ void omapfb_remove_sysfs(struct omapfb2_device *fbdev)
 
 	DBG("remove sysfs for fbs\n");
 	for (i = 0; i < fbdev->num_fbs; i++) {
+		struct device *dev = dev_of_fbinfo(fbdev->fbs[i]);
+
+		if (!dev)
+			continue;
+
 		for (t = 0; t < ARRAY_SIZE(omapfb_attrs); t++)
-			device_remove_file(fbdev->fbs[i]->dev,
-					&omapfb_attrs[t]);
+			device_remove_file(dev, &omapfb_attrs[t]);
 	}
 }
 
-- 
2.43.0


^ permalink raw reply related

* [PATCH v3 2/4] staging: fbtft: Make FB_DEVICE dependency optional
From: Chintan Patel @ 2025-12-30  5:28 UTC (permalink / raw)
  To: linux-fbdev, linux-staging, linux-omap
  Cc: linux-kernel, dri-devel, tzimmermann, andy, deller, gregkh,
	Chintan Patel
In-Reply-To: <20251230052827.4676-1-chintanlike@gmail.com>

fbtft provides sysfs interfaces for debugging and gamma configuration,
but these are not required for the core driver.

Drop the hard dependency on CONFIG_FB_DEVICE and make sysfs support
optional by using dev_of_fbinfo() at runtime. When FB_DEVICE is disabled,
sysfs operations are skipped while the code remains buildable and
type-checked.

Suggested-by: Thomas Zimmermann <tzimmermann@suse.de>
Suggested-by: Helge Deller <deller@gmx.de>
Signed-off-by: Chintan Patel <chintanlike@gmail.com>
---
 drivers/staging/fbtft/Kconfig       |  5 ++++-
 drivers/staging/fbtft/fbtft-sysfs.c | 20 ++++++++++++++++----
 2 files changed, 20 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/fbtft/Kconfig b/drivers/staging/fbtft/Kconfig
index c2655768209a..578412a2f379 100644
--- a/drivers/staging/fbtft/Kconfig
+++ b/drivers/staging/fbtft/Kconfig
@@ -2,11 +2,14 @@
 menuconfig FB_TFT
 	tristate "Support for small TFT LCD display modules"
 	depends on FB && SPI
-	depends on FB_DEVICE
 	depends on BACKLIGHT_CLASS_DEVICE
 	depends on GPIOLIB || COMPILE_TEST
 	select FB_BACKLIGHT
 	select FB_SYSMEM_HELPERS_DEFERRED
+	help
+	  Support for small TFT LCD display modules over SPI bus. FB_DEVICE
+	  is not required, but if enabled, provides sysfs interface for debugging
+	  and gamma curve configuration.
 
 if FB_TFT
 
diff --git a/drivers/staging/fbtft/fbtft-sysfs.c b/drivers/staging/fbtft/fbtft-sysfs.c
index e45c90a03a90..d05599d80011 100644
--- a/drivers/staging/fbtft/fbtft-sysfs.c
+++ b/drivers/staging/fbtft/fbtft-sysfs.c
@@ -203,14 +203,26 @@ static struct device_attribute debug_device_attr =
 
 void fbtft_sysfs_init(struct fbtft_par *par)
 {
-	device_create_file(par->info->dev, &debug_device_attr);
+	struct device *dev;
+
+	dev = dev_of_fbinfo(par->info);
+	if (!dev)
+		return;
+
+	device_create_file(dev, &debug_device_attr);
 	if (par->gamma.curves && par->fbtftops.set_gamma)
-		device_create_file(par->info->dev, &gamma_device_attrs[0]);
+		device_create_file(dev, &gamma_device_attrs[0]);
 }
 
 void fbtft_sysfs_exit(struct fbtft_par *par)
 {
-	device_remove_file(par->info->dev, &debug_device_attr);
+	struct device *dev;
+
+	dev = dev_of_fbinfo(par->info);
+	if (!dev)
+		return;
+
+	device_remove_file(dev, &debug_device_attr);
 	if (par->gamma.curves && par->fbtftops.set_gamma)
-		device_remove_file(par->info->dev, &gamma_device_attrs[0]);
+		device_remove_file(dev, &gamma_device_attrs[0]);
 }
-- 
2.43.0


^ permalink raw reply related

* [PATCH v3 1/4] fb: Add dev_of_fbinfo() helper for optional sysfs support
From: Chintan Patel @ 2025-12-30  5:28 UTC (permalink / raw)
  To: linux-fbdev, linux-staging, linux-omap
  Cc: linux-kernel, dri-devel, tzimmermann, andy, deller, gregkh,
	Chintan Patel
In-Reply-To: <20251230052827.4676-1-chintanlike@gmail.com>

Add dev_of_fbinfo() to return the framebuffer struct device when
CONFIG_FB_DEVICE is enabled, or NULL otherwise.

This allows fbdev drivers to use sysfs interfaces via runtime checks
instead of CONFIG_FB_DEVICE ifdefs, keeping the code clean while
remaining fully buildable.

Suggested-by: Helge Deller <deller@gmx.de>
Signed-off-by: Chintan Patel <chintanlike@gmail.com>
---
 include/linux/fb.h | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/include/linux/fb.h b/include/linux/fb.h
index 05cc251035da..dad3fb61a06a 100644
--- a/include/linux/fb.h
+++ b/include/linux/fb.h
@@ -628,6 +628,15 @@ static inline void unlock_fb_info(struct fb_info *info)
 	mutex_unlock(&info->lock);
 }
 
+static inline struct device *dev_of_fbinfo(const struct fb_info *info)
+{
+#ifdef CONFIG_FB_DEVICE
+	return info->dev;
+#else
+	return NULL;
+#endif
+}
+
 static inline void __fb_pad_aligned_buffer(u8 *dst, u32 d_pitch,
 					   u8 *src, u32 s_pitch, u32 height)
 {
-- 
2.43.0


^ permalink raw reply related

* [PATCH v3 0/4] fbdev: Make CONFIG_FB_DEVICE optional for drivers
From: Chintan Patel @ 2025-12-30  5:28 UTC (permalink / raw)
  To: linux-fbdev, linux-staging, linux-omap
  Cc: linux-kernel, dri-devel, tzimmermann, andy, deller, gregkh,
	Chintan Patel

This series makes CONFIG_FB_DEVICE optional for fbdev drivers that use
it only for sysfs interfaces, addressing Thomas Zimmermann’s TODO to
remove hard FB_DEVICE dependencies.

The series introduces a small helper, dev_of_fbinfo(), which returns
NULL when CONFIG_FB_DEVICE=n. This allows sysfs code paths to be skipped
via runtime checks, avoids #ifdef CONFIG_FB_DEVICE clutter, and keeps
full compile-time syntax checking.

Signed-off-by: Chintan Patel <chintanlike@gmail.com>
---
Changes in v3:
- Use PTR_IF() to conditionally include overlay_sysfs_group in 
  overlay_sysfs_groups
- Decouple variable definition and assignment in fbtft_sysfs_init/exit

Changes in v2:
- Add dev_of_fbinfo() helper (suggested by Geert Uytterhoeven)
- Replace #ifdef CONFIG_FB_DEVICE blocks with runtime NULL checks
- Switch to fb_dbg() / fb_info() logging (suggested by Thomas Zimmermann)

---

Chintan Patel (4):
  fb: Add dev_of_fbinfo() helper for optional sysfs support
  staging: fbtft: Make FB_DEVICE dependency optional
  fbdev: omapfb: Make FB_DEVICE dependency optional
  fbdev: sh_mobile_lcdc: Make FB_DEVICE dependency optional

 drivers/staging/fbtft/Kconfig                 |  5 ++++-
 drivers/staging/fbtft/fbtft-sysfs.c           | 20 +++++++++++++++----
 drivers/video/fbdev/omap2/omapfb/Kconfig      |  3 ++-
 .../video/fbdev/omap2/omapfb/omapfb-sysfs.c   | 16 +++++++++++----
 drivers/video/fbdev/sh_mobile_lcdcfb.c        | 12 ++++++++++-
 include/linux/fb.h                            |  9 +++++++++
 6 files changed, 54 insertions(+), 11 deletions(-)

-- 
2.43.0


^ permalink raw reply

* [PATCH 00/12] Recover sysfb after DRM probe failure
From: Zack Rusin @ 2025-12-29 21:58 UTC (permalink / raw)
  To: dri-devel
  Cc: Alex Deucher, amd-gfx, Ard Biesheuvel, Ce Sun, Chia-I Wu,
	Christian König, Danilo Krummrich, Dave Airlie, Deepak Rawat,
	Dmitry Osipenko, Gerd Hoffmann, Gurchetan Singh, Hans de Goede,
	Hawking Zhang, Helge Deller, intel-gfx, intel-xe, Jani Nikula,
	Javier Martinez Canillas, Jocelyn Falempe, Joonas Lahtinen,
	Lijo Lazar, linux-efi, linux-fbdev, linux-hyperv, linux-kernel,
	Lucas De Marchi, Lyude Paul, Maarten Lankhorst,
	Mario Limonciello (AMD), Mario Limonciello, Maxime Ripard,
	nouveau, Rodrigo Vivi, Simona Vetter, spice-devel,
	Thomas Hellström, Thomas Zimmermann, Timur Kristóf,
	Tvrtko Ursulin, virtualization, Vitaly Prosyak

Almost a rite of passage for every DRM developer and most Linux users
is upgrading your DRM driver/updating boot flags/changing some config
and having DRM driver fail at probe resulting in a blank screen.

Currently there's no way to recover from DRM driver probe failure. PCI
DRM driver explicitly throw out the existing sysfb to get exclusive
access to PCI resources so if the probe fails the system is left without
a functioning display driver.

Add code to sysfb to recever system framebuffer when DRM driver's probe
fails. This means that a DRM driver that fails to load reloads the system
framebuffer driver.

This works best with simpledrm. Without it Xorg won't recover because
it still tries to load the vendor specific driver which ends up usually
not working at all. With simpledrm the system recovers really nicely
ending up with a working console and not a blank screen.

There's a caveat in that some hardware might require some special magic
register write to recover EFI display. I'd appreciate it a lot if
maintainers could introduce a temporary failure in their drivers
probe to validate that the sysfb recovers and they get a working console.
The easiest way to double check it is by adding:
 /* XXX: Temporary failure to test sysfb restore - REMOVE BEFORE COMMIT */
 dev_info(&pdev->dev, "Testing sysfb restore: forcing probe failure\n");
 ret = -EINVAL;
 goto out_error;
or such right after the devm_aperture_remove_conflicting_pci_devices .

Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: amd-gfx@lists.freedesktop.org
Cc: Ard Biesheuvel <ardb@kernel.org>
Cc: Ce Sun <cesun102@amd.com>
Cc: Chia-I Wu <olvaffe@gmail.com>
Cc: "Christian König" <christian.koenig@amd.com>
Cc: Danilo Krummrich <dakr@kernel.org>
Cc: Dave Airlie <airlied@redhat.com>
Cc: Deepak Rawat <drawat.floss@gmail.com>
Cc: Dmitry Osipenko <dmitry.osipenko@collabora.com>
Cc: dri-devel@lists.freedesktop.org
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Gurchetan Singh <gurchetansingh@chromium.org>
Cc: Hans de Goede <hansg@kernel.org>
Cc: Hawking Zhang <Hawking.Zhang@amd.com>
Cc: Helge Deller <deller@gmx.de>
Cc: intel-gfx@lists.freedesktop.org
Cc: intel-xe@lists.freedesktop.org
Cc: Jani Nikula <jani.nikula@linux.intel.com>
Cc: Javier Martinez Canillas <javierm@redhat.com>
Cc: Jocelyn Falempe <jfalempe@redhat.com>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: Lijo Lazar <lijo.lazar@amd.com>
Cc: linux-efi@vger.kernel.org
Cc: linux-fbdev@vger.kernel.org
Cc: linux-hyperv@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Cc: Lucas De Marchi <lucas.demarchi@intel.com>
Cc: Lyude Paul <lyude@redhat.com>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: "Mario Limonciello (AMD)" <superm1@kernel.org>
Cc: Mario Limonciello <mario.limonciello@amd.com>
Cc: Maxime Ripard <mripard@kernel.org>
Cc: nouveau@lists.freedesktop.org
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Cc: Simona Vetter <simona@ffwll.ch>
Cc: spice-devel@lists.freedesktop.org
Cc: "Thomas Hellström" <thomas.hellstrom@linux.intel.com>
Cc: Thomas Zimmermann <tzimmermann@suse.de>
Cc: "Timur Kristóf" <timur.kristof@gmail.com>
Cc: Tvrtko Ursulin <tursulin@ursulin.net>
Cc: virtualization@lists.linux.dev
Cc: Vitaly Prosyak <vitaly.prosyak@amd.com>

Zack Rusin (12):
  video/aperture: Add sysfb restore on DRM probe failure
  drm/vmwgfx: Use devm aperture helpers for sysfb restore on probe
    failure
  drm/xe: Use devm aperture helpers for sysfb restore on probe failure
  drm/amdgpu: Use devm aperture helpers for sysfb restore on probe
    failure
  drm/virtio: Add sysfb restore on probe failure
  drm/nouveau: Use devm aperture helpers for sysfb restore on probe
    failure
  drm/qxl: Use devm aperture helpers for sysfb restore on probe failure
  drm/vboxvideo: Use devm aperture helpers for sysfb restore on probe
    failure
  drm/hyperv: Add sysfb restore on probe failure
  drm/ast: Use devm aperture helpers for sysfb restore on probe failure
  drm/radeon: Use devm aperture helpers for sysfb restore on probe
    failure
  drm/i915: Use devm aperture helpers for sysfb restore on probe failure

 drivers/firmware/efi/sysfb_efi.c           |   2 +-
 drivers/firmware/sysfb.c                   | 191 +++++++++++++--------
 drivers/firmware/sysfb_simplefb.c          |  10 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c |   9 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c    |   7 +
 drivers/gpu/drm/ast/ast_drv.c              |  13 +-
 drivers/gpu/drm/hyperv/hyperv_drm_drv.c    |  23 +++
 drivers/gpu/drm/i915/i915_driver.c         |  13 +-
 drivers/gpu/drm/nouveau/nouveau_drm.c      |  16 +-
 drivers/gpu/drm/qxl/qxl_drv.c              |  14 +-
 drivers/gpu/drm/radeon/radeon_drv.c        |  15 +-
 drivers/gpu/drm/vboxvideo/vbox_drv.c       |  13 +-
 drivers/gpu/drm/virtio/virtgpu_drv.c       |  29 ++++
 drivers/gpu/drm/vmwgfx/vmwgfx_drv.c        |  13 +-
 drivers/gpu/drm/xe/xe_device.c             |   7 +-
 drivers/gpu/drm/xe/xe_pci.c                |   7 +
 drivers/video/aperture.c                   |  54 ++++++
 include/linux/aperture.h                   |  14 ++
 include/linux/sysfb.h                      |   6 +
 19 files changed, 368 insertions(+), 88 deletions(-)

-- 
2.48.1


^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox