drivers/video/fbdev/mb862xx/mb862xxfbdrv.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
This patch wraps the relevant code blocks with `IS_ENABLED(ifdef CONFIG_FB_DEVICE)`,
allowing the driver to be built and used even if CONFIG_FB_DEVICE is not selected.
The sysfs only give access to show some controller and cursor registers so
it's not needed to allow driver works correctly.
This align with Documentation/drm/todo.rst
"Remove driver dependencies on FB_DEVICE"
Signed-off-by: Javier Garcia <rampxxxx@gmail.com>
---
v1 -> v2:
* Fix error and improvement , thanks Uwe Kleine-Koenig.
* v1 https://lore.kernel.org/lkml/20251005173812.1169436-1-rampxxxx@gmail.com
drivers/video/fbdev/mb862xx/mb862xxfbdrv.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/drivers/video/fbdev/mb862xx/mb862xxfbdrv.c b/drivers/video/fbdev/mb862xx/mb862xxfbdrv.c
index ade88e7bc760..dc99b8c9ff0f 100644
--- a/drivers/video/fbdev/mb862xx/mb862xxfbdrv.c
+++ b/drivers/video/fbdev/mb862xx/mb862xxfbdrv.c
@@ -17,6 +17,7 @@
#include <linux/module.h>
#include <linux/init.h>
#include <linux/interrupt.h>
+#include "linux/kconfig.h"
#include <linux/pci.h>
#include <linux/of.h>
#include <linux/of_address.h>
@@ -759,7 +760,7 @@ static int of_platform_mb862xx_probe(struct platform_device *ofdev)
dev_set_drvdata(dev, info);
- if (device_create_file(dev, &dev_attr_dispregs))
+ if (IS_ENABLED(CONFIG_FB_DEVICE) && device_create_file(dev, &dev_attr_dispregs))
dev_err(dev, "Can't create sysfs regdump file\n");
return 0;
@@ -801,7 +802,8 @@ static void of_platform_mb862xx_remove(struct platform_device *ofdev)
free_irq(par->irq, (void *)par);
irq_dispose_mapping(par->irq);
- device_remove_file(&ofdev->dev, &dev_attr_dispregs);
+ if(IS_ENABLED(CONFIG_FB_DEVICE))
+ device_remove_file(&ofdev->dev, &dev_attr_dispregs);
unregister_framebuffer(fbi);
fb_dealloc_cmap(&fbi->cmap);
@@ -1101,7 +1103,7 @@ static int mb862xx_pci_probe(struct pci_dev *pdev,
pci_set_drvdata(pdev, info);
- if (device_create_file(dev, &dev_attr_dispregs))
+ if (IS_ENABLED(CONFIG_FB_DEVICE) && device_create_file(dev, &dev_attr_dispregs))
dev_err(dev, "Can't create sysfs regdump file\n");
if (par->type == BT_CARMINE)
@@ -1151,7 +1153,8 @@ static void mb862xx_pci_remove(struct pci_dev *pdev)
mb862xx_i2c_exit(par);
- device_remove_file(&pdev->dev, &dev_attr_dispregs);
+ if(IS_ENABLED(CONFIG_FB_DEVICE))
+ device_remove_file(&pdev->dev, &dev_attr_dispregs);
unregister_framebuffer(fbi);
fb_dealloc_cmap(&fbi->cmap);
--
2.50.1
On Mon, Oct 06, 2025 at 06:41:43PM +0200, Javier Garcia wrote: > This patch wraps the relevant code blocks with `IS_ENABLED(ifdef CONFIG_FB_DEVICE)`, stray "ifdef " > allowing the driver to be built and used even if CONFIG_FB_DEVICE is not selected. The driver built fine without FB_DEVICE already before, doesn't it? > The sysfs only give access to show some controller and cursor registers so > it's not needed to allow driver works correctly. > > This align with Documentation/drm/todo.rst > "Remove driver dependencies on FB_DEVICE" Given the above, I still don't understand that. (But maybe this can be fixed by Helge's request to improve the commit message.) > Signed-off-by: Javier Garcia <rampxxxx@gmail.com> > --- > v1 -> v2: > * Fix error and improvement , thanks Uwe Kleine-Koenig. > * v1 https://lore.kernel.org/lkml/20251005173812.1169436-1-rampxxxx@gmail.com > > > drivers/video/fbdev/mb862xx/mb862xxfbdrv.c | 11 +++++++---- > 1 file changed, 7 insertions(+), 4 deletions(-) > > diff --git a/drivers/video/fbdev/mb862xx/mb862xxfbdrv.c b/drivers/video/fbdev/mb862xx/mb862xxfbdrv.c > index ade88e7bc760..dc99b8c9ff0f 100644 > --- a/drivers/video/fbdev/mb862xx/mb862xxfbdrv.c > +++ b/drivers/video/fbdev/mb862xx/mb862xxfbdrv.c > @@ -17,6 +17,7 @@ > #include <linux/module.h> > #include <linux/init.h> > #include <linux/interrupt.h> > +#include "linux/kconfig.h" I didn't need that during my build tests, also don't use "" here, but <>. > #include <linux/pci.h> > #include <linux/of.h> > #include <linux/of_address.h> > [...] Best regards Uwe
Hi Javier, thanks for the updated patch! Some notes: On 10/6/25 18:41, Javier Garcia wrote: > This patch wraps the relevant code blocks with `IS_ENABLED(ifdef CONFIG_FB_DEVICE)`, > allowing the driver to be built and used even if CONFIG_FB_DEVICE is not selected. > > The sysfs only give access to show some controller and cursor registers so > it's not needed to allow driver works correctly. > > This align with Documentation/drm/todo.rst > "Remove driver dependencies on FB_DEVICE" Can you make this commit message more crisp? E.g. what is the benefit? Something new possible or fixed? Also, the driver can be built without CONFIG_FB_DEVICE, but it will then probably not work. Do you have that card and tested it? Maybe something like: Allow the driver to be used for framebuffer text console, even if support for the /dev/fb device isn't compiled-in (CONFIG_FB_DEVICE=n). > Signed-off-by: Javier Garcia <rampxxxx@gmail.com> > --- > v1 -> v2: > * Fix error and improvement , thanks Uwe Kleine-Koenig. > * v1 https://lore.kernel.org/lkml/20251005173812.1169436-1-rampxxxx@gmail.com > > > drivers/video/fbdev/mb862xx/mb862xxfbdrv.c | 11 +++++++---- > 1 file changed, 7 insertions(+), 4 deletions(-) > > diff --git a/drivers/video/fbdev/mb862xx/mb862xxfbdrv.c b/drivers/video/fbdev/mb862xx/mb862xxfbdrv.c > index ade88e7bc760..dc99b8c9ff0f 100644 > --- a/drivers/video/fbdev/mb862xx/mb862xxfbdrv.c > +++ b/drivers/video/fbdev/mb862xx/mb862xxfbdrv.c > @@ -17,6 +17,7 @@ > #include <linux/module.h> > #include <linux/init.h> > #include <linux/interrupt.h> > +#include "linux/kconfig.h" > #include <linux/pci.h> > #include <linux/of.h> > #include <linux/of_address.h> > @@ -759,7 +760,7 @@ static int of_platform_mb862xx_probe(struct platform_device *ofdev) > > dev_set_drvdata(dev, info); > > - if (device_create_file(dev, &dev_attr_dispregs)) > + if (IS_ENABLED(CONFIG_FB_DEVICE) && device_create_file(dev, &dev_attr_dispregs)) > dev_err(dev, "Can't create sysfs regdump file\n"); > return 0; > > @@ -801,7 +802,8 @@ static void of_platform_mb862xx_remove(struct platform_device *ofdev) > free_irq(par->irq, (void *)par); > irq_dispose_mapping(par->irq); > > - device_remove_file(&ofdev->dev, &dev_attr_dispregs); > + if(IS_ENABLED(CONFIG_FB_DEVICE)) > + device_remove_file(&ofdev->dev, &dev_attr_dispregs); > > unregister_framebuffer(fbi); > fb_dealloc_cmap(&fbi->cmap); > @@ -1101,7 +1103,7 @@ static int mb862xx_pci_probe(struct pci_dev *pdev, > > pci_set_drvdata(pdev, info); > > - if (device_create_file(dev, &dev_attr_dispregs)) > + if (IS_ENABLED(CONFIG_FB_DEVICE) && device_create_file(dev, &dev_attr_dispregs)) > dev_err(dev, "Can't create sysfs regdump file\n"); > > if (par->type == BT_CARMINE) > @@ -1151,7 +1153,8 @@ static void mb862xx_pci_remove(struct pci_dev *pdev) > > mb862xx_i2c_exit(par); > > - device_remove_file(&pdev->dev, &dev_attr_dispregs); > + if(IS_ENABLED(CONFIG_FB_DEVICE)) a space is missign after "if". Helge
This patch wraps the relevant code blocks with `IS_ENABLED(CONFIG_FB_DEVICE)`.
Allows the driver to be used for framebuffer text console, even if
support for the /dev/fb device isn't compiled-in (CONFIG_FB_DEVICE=n).
This align with Documentation/drm/todo.rst
"Remove driver dependencies on FB_DEVICE"
I've not the card so I was not able to test it.
Signed-off-by: Javier Garcia <rampxxxx@gmail.com>
---
v2 -> v3:
* Change commit msg , thanks Helge Deller.
* Delete not used include , thanks Uwe Kleine-Koenig.
* v1 https://lore.kernel.org/lkml/20251006164143.1187434-1-rampxxxx@gmail.com/
v1 -> v2:
* Fix error and improvement , thanks Uwe Kleine-Koenig.
* v1 https://lore.kernel.org/lkml/20251005173812.1169436-1-rampxxxx@gmail.com
drivers/video/fbdev/mb862xx/mb862xxfbdrv.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/drivers/video/fbdev/mb862xx/mb862xxfbdrv.c b/drivers/video/fbdev/mb862xx/mb862xxfbdrv.c
index ade88e7bc760..3f79dfc27a53 100644
--- a/drivers/video/fbdev/mb862xx/mb862xxfbdrv.c
+++ b/drivers/video/fbdev/mb862xx/mb862xxfbdrv.c
@@ -759,7 +759,7 @@ static int of_platform_mb862xx_probe(struct platform_device *ofdev)
dev_set_drvdata(dev, info);
- if (device_create_file(dev, &dev_attr_dispregs))
+ if (IS_ENABLED(CONFIG_FB_DEVICE) && device_create_file(dev, &dev_attr_dispregs))
dev_err(dev, "Can't create sysfs regdump file\n");
return 0;
@@ -801,7 +801,8 @@ static void of_platform_mb862xx_remove(struct platform_device *ofdev)
free_irq(par->irq, (void *)par);
irq_dispose_mapping(par->irq);
- device_remove_file(&ofdev->dev, &dev_attr_dispregs);
+ if (IS_ENABLED(CONFIG_FB_DEVICE))
+ device_remove_file(&ofdev->dev, &dev_attr_dispregs);
unregister_framebuffer(fbi);
fb_dealloc_cmap(&fbi->cmap);
@@ -1101,7 +1102,7 @@ static int mb862xx_pci_probe(struct pci_dev *pdev,
pci_set_drvdata(pdev, info);
- if (device_create_file(dev, &dev_attr_dispregs))
+ if (IS_ENABLED(CONFIG_FB_DEVICE) && device_create_file(dev, &dev_attr_dispregs))
dev_err(dev, "Can't create sysfs regdump file\n");
if (par->type == BT_CARMINE)
@@ -1151,7 +1152,8 @@ static void mb862xx_pci_remove(struct pci_dev *pdev)
mb862xx_i2c_exit(par);
- device_remove_file(&pdev->dev, &dev_attr_dispregs);
+ if (IS_ENABLED(CONFIG_FB_DEVICE))
+ device_remove_file(&pdev->dev, &dev_attr_dispregs);
unregister_framebuffer(fbi);
fb_dealloc_cmap(&fbi->cmap);
--
2.50.1
Hello Javier, On Wed, Oct 08, 2025 at 08:36:27PM +0200, Javier Garcia wrote: > This patch wraps the relevant code blocks with `IS_ENABLED(CONFIG_FB_DEVICE)`. > > Allows the driver to be used for framebuffer text console, even if > support for the /dev/fb device isn't compiled-in (CONFIG_FB_DEVICE=n). > > This align with Documentation/drm/todo.rst > "Remove driver dependencies on FB_DEVICE" > > I've not the card so I was not able to test it. I still don't understand why the creation of the dispregs sysfs file should be conditional on FB_DEVICE. Either they have nothing to do with each other, or I'm missing something. The former makes this patch wrong, the latter would be an indication that the commit log is still non-optimal. Best regards Uwe
On 10/9/25 10:50, Uwe Kleine-König wrote: > Hello Javier, > > On Wed, Oct 08, 2025 at 08:36:27PM +0200, Javier Garcia wrote: >> This patch wraps the relevant code blocks with `IS_ENABLED(CONFIG_FB_DEVICE)`. >> >> Allows the driver to be used for framebuffer text console, even if >> support for the /dev/fb device isn't compiled-in (CONFIG_FB_DEVICE=n). >> >> This align with Documentation/drm/todo.rst This seems to be Documentation/gpu/todo.rst now... >> "Remove driver dependencies on FB_DEVICE">>> I've not the card so I was not able to test it. > > I still don't understand why the creation of the dispregs sysfs file > should be conditional on FB_DEVICE. I think this is because people simply believe it, as it's documented like this in the todo file. I think this is wrong. I think the problem was, that device_create_file() has a "struct device *" pointer as first parameter. Some device drivers probably referenced the "struct device" pointer of the "/dev/fb" device, which does not exist when FB_DEVICE isn't enabled. As such, the device_create_file() would fail during initialization (since the devide ptr is NULL) of the driver and prevent the driver from working. That's not the case for this driver here, and probably not for the other remaining drivers. > Either they have nothing to do with each other, or I'm missing > something. Right now you are right... it has nothing to do with each other. > The former makes this patch wrong, the latter would be an > indication that the commit log is still non-optimal. Either way, I've dropped the patch from the git repo for now. I don't think the patch is wrong, but it's not deemed necessary either. If someone has that device I'd happy to apply it after some feedback. In addition, maybe the section from the todo file should be dropped? Helge
On 10/8/25 20:36, Javier Garcia wrote: > This patch wraps the relevant code blocks with `IS_ENABLED(CONFIG_FB_DEVICE)`. > > Allows the driver to be used for framebuffer text console, even if > support for the /dev/fb device isn't compiled-in (CONFIG_FB_DEVICE=n). > > This align with Documentation/drm/todo.rst > "Remove driver dependencies on FB_DEVICE" > > I've not the card so I was not able to test it. > > Signed-off-by: Javier Garcia <rampxxxx@gmail.com> applied (with minor changes to the commit message). Thanks! Helge
© 2016 - 2025 Red Hat, Inc.