From: Thomas Zimmermann <tzimmermann@suse.de> Date: 2023-06-13 11:21:29
Add the new config option FB_DEVICE. If enabled, fbdev provides
traditional userspace interfaces in devfs, sysfs and procfs, such
as /dev/fb0 or /proc/fb.
Modern Linux distrobutions have adopted DRM drivers for graphics
output and use fbdev only for the kernel's framebuffer console.
Userspace has also moved on, with no new fbdev code being written
and existing support being removed.
OTOH, fbdev provides userspace a way of accessing kernel or I/O
memory, which might compromise the system's security. See the recent
commit c8687694bb1f ("drm/fbdev-generic: prohibit potential
out-of-bounds access") for an example. Disabling fbdev userspace
interfaces is therefore a useful feature to limit unnecessary
exposure of fbdev code to processes of low privilegues.
Patches 1 to 31 fix various bugs and issues in fbdev-related code.
In most cases the code uses the fbdev device where it should use
the Linux hardware device or something else. Most of these patches
fix existing problems and should therefore be considered in any case.
Patches 32 to 37 refactor the fbdev core code. The patches move
support for backlights, sysfs, procfs and devfs into separate files
and hide it behind simple interfaces. These changes will allow to
easily build the userspace support conditionally.
Patch 38 introduces the config option FB_DEVICE and adapts the fbdev
core to support it. The field struct fb_info.dev is now optional,
hence the name of the config option.
Tested on simpledrm and i915, including the device handover.
Future directions: With the support for disabling fbdev userspace
interfaces in place, it will be possible to make most fbdev drivers'
file-I/O code in struct fb_ops optional as well.
v3:
* add missing file fb_chrdev.c
* fix typo in Kconfig help (Daniel)
v2:
* fix fsl-diu-fb and sh7760fb
* split backlight patches
* set 'default y' for FB_CONFIG
* minor fixes and corrections
Thomas Zimmermann (38):
backlight/bd6107: Compare against struct fb_info.device
backlight/bd6107: Rename struct bd6107_platform_data.fbdev to 'dev'
backlight/gpio_backlight: Compare against struct fb_info.device
backlight/gpio_backlight: Rename field 'fbdev' to 'dev'
backlight/lv5207lp: Compare against struct fb_info.device
backlight/lv5207lp: Rename struct lv5207lp_platform_data.fbdev to
'dev'
fbdev/atyfb: Reorder backlight and framebuffer init/cleanup
fbdev/atyfb: Use hardware device as backlight parent
fbdev/aty128fb: Reorder backlight and framebuffer init/cleanup
fbdev/aty128fb: Use hardware device as backlight parent
fbdev/broadsheetfb: Call device_remove_file() with hardware device
fbdev/ep93xx-fb: Alloc DMA memory from hardware device
fbdev/ep93xx-fb: Output messages with fb_info() and fb_err()
fbdev/ep93xx-fb: Do not assign to struct fb_info.dev
fbdev/fsl-diu-fb: Output messages with fb_*() helpers
fbdev/mb862xxfb: Output messages with fb_dbg()
fbdev/metronomefb: Use hardware device for dev_err()
fbdev/nvidiafb: Reorder backlight and framebuffer init/cleanup
fbdev/nvidiafb: Use hardware device as backlight parent
fbdev/pxa168fb: Do not assign to struct fb_info.dev
fbdev/radeonfb: Reorder backlight and framebuffer cleanup
fbdev/radeonfb: Use hardware device as backlight parent
fbdev/rivafb: Reorder backlight and framebuffer init/cleanup
fbdev/rivafb: Use hardware device as backlight parent
fbdev/sh7760fb: Use fb_dbg() in sh7760fb_get_color_info()
fbdev/sh7760fb: Output messages with fb_dbg()
fbdev/sh7760fb: Alloc DMA memory from hardware device
fbdev/sh7760fb: Use hardware device with dev_() output during probe
fbdev/sm501fb: Output message with fb_err()
fbdev/smscufx: Detect registered fb_info from refcount
fbdev/tdfxfb: Set i2c adapter parent to hardware device
fbdev/core: Pass Linux device to pm_vt_switch_*() functions
fbdev/core: Move framebuffer and backlight helpers into separate files
fbdev/core: Add fb_device_{create,destroy}()
fbdev/core: Move procfs code to separate file
fbdev/core: Move file-I/O code into separate file
fbdev/core: Rework fb init code
fbdev: Make support for userspace interfaces configurable
Documentation/gpu/todo.rst | 13 +
arch/sh/boards/mach-ecovec24/setup.c | 2 +-
arch/sh/boards/mach-kfr2r09/setup.c | 2 +-
drivers/staging/fbtft/Kconfig | 1 +
drivers/video/backlight/bd6107.c | 2 +-
drivers/video/backlight/gpio_backlight.c | 6 +-
drivers/video/backlight/lv5207lp.c | 2 +-
drivers/video/fbdev/Kconfig | 13 +
drivers/video/fbdev/aty/aty128fb.c | 12 +-
drivers/video/fbdev/aty/atyfb_base.c | 18 +-
drivers/video/fbdev/aty/radeon_backlight.c | 2 +-
drivers/video/fbdev/aty/radeon_base.c | 3 +-
drivers/video/fbdev/broadsheetfb.c | 2 +-
drivers/video/fbdev/core/Makefile | 7 +-
drivers/video/fbdev/core/fb_backlight.c | 33 ++
drivers/video/fbdev/core/fb_chrdev.c | 485 +++++++++++++++
drivers/video/fbdev/core/fb_info.c | 78 +++
drivers/video/fbdev/core/fb_internal.h | 67 +++
drivers/video/fbdev/core/fb_procfs.c | 62 ++
drivers/video/fbdev/core/fbcon.c | 1 +
drivers/video/fbdev/core/fbmem.c | 592 +------------------
drivers/video/fbdev/core/fbsysfs.c | 134 +----
drivers/video/fbdev/ep93xx-fb.c | 21 +-
drivers/video/fbdev/fsl-diu-fb.c | 26 +-
drivers/video/fbdev/mb862xx/mb862xxfbdrv.c | 9 +-
drivers/video/fbdev/metronomefb.c | 2 +-
drivers/video/fbdev/nvidia/nv_backlight.c | 2 +-
drivers/video/fbdev/nvidia/nvidia.c | 8 +-
drivers/video/fbdev/omap2/omapfb/Kconfig | 2 +-
drivers/video/fbdev/pxa168fb.c | 2 +-
drivers/video/fbdev/riva/fbdev.c | 10 +-
drivers/video/fbdev/sh7760fb.c | 50 +-
drivers/video/fbdev/sm501fb.c | 2 +-
drivers/video/fbdev/smscufx.c | 4 +-
drivers/video/fbdev/tdfxfb.c | 4 +-
include/linux/fb.h | 6 +-
include/linux/platform_data/bd6107.h | 2 +-
include/linux/platform_data/gpio_backlight.h | 2 +-
include/linux/platform_data/lv5207lp.h | 2 +-
39 files changed, 922 insertions(+), 769 deletions(-)
create mode 100644 drivers/video/fbdev/core/fb_backlight.c
create mode 100644 drivers/video/fbdev/core/fb_chrdev.c
create mode 100644 drivers/video/fbdev/core/fb_info.c
create mode 100644 drivers/video/fbdev/core/fb_internal.h
create mode 100644 drivers/video/fbdev/core/fb_procfs.c
base-commit: 63a468ec7c7652afa80e3fa6ad203f9e64d04e83
prerequisite-patch-id: 0aa359f6144c4015c140c8a6750be19099c676fb
prerequisite-patch-id: c67e5d886a47b7d0266d81100837557fda34cb24
prerequisite-patch-id: cbc453ee02fae02af22fbfdce56ab732c7a88c36
prerequisite-patch-id: 7c401614cf55c033f742bced317575b9f5b77bb1
prerequisite-patch-id: d3145eae4b35a1290199af6ff6cd5abfebc82033
prerequisite-patch-id: 242b6bc45675f1f1a62572542d75c89d4864f15a
--
2.41.0
From: Thomas Zimmermann <tzimmermann@suse.de> Date: 2023-06-13 11:10:28
Use the hardware device in struct fb_info.device as parent of the
backlight device. Aligns the driver with the rest of the codebase
and prepares fbdev for making struct fb_info.dev optional.
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Reviewed-by: Sam Ravnborg <redacted>
---
drivers/video/fbdev/aty/atyfb_base.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
From: Thomas Zimmermann <tzimmermann@suse.de> Date: 2023-06-13 11:10:36
The driver's backlight code requires the framebuffer to be
registered. Therefore reorder the init and cleanup calls for
both data structures.
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Reviewed-by: Sam Ravnborg <redacted>
---
drivers/video/fbdev/aty/atyfb_base.c | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
From: Thomas Zimmermann <tzimmermann@suse.de> Date: 2023-06-13 11:10:40
Rename struct lv5207lp_platform_data.fbdev to 'dev', as it stores a
pointer to the Linux platform device; not the fbdev device. Makes
the code easier to understand.
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
Cc: Rich Felker <dalias@libc.org>
Cc: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
Cc: Lee Jones <lee@kernel.org>
Cc: Daniel Thompson <redacted>
Cc: Jingoo Han <jingoohan1@gmail.com>
Cc: linux-sh@vger.kernel.org
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Reviewed-by: Sam Ravnborg <redacted>
Reviewed-by: Daniel Thompson <redacted>
---
arch/sh/boards/mach-kfr2r09/setup.c | 2 +-
drivers/video/backlight/lv5207lp.c | 2 +-
include/linux/platform_data/lv5207lp.h | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
From: Thomas Zimmermann <tzimmermann@suse.de> Date: 2023-06-13 11:10:46
Call device_remove_file() with the same device that has been used
for device_create_file(), which is the hardware device stored in
struct fb_info.device. Prepares fbdev for making struct fb_info.dev
optional.
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Reviewed-by: Sam Ravnborg <redacted>
---
drivers/video/fbdev/broadsheetfb.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
From: Thomas Zimmermann <tzimmermann@suse.de> Date: 2023-06-13 11:10:50
Use the hardware device in struct fb_info.device as parent of the
backlight device. Aligns the driver with the rest of the codebase
and prepares fbdev for making struct fb_info.dev optional.
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Reviewed-by: Sam Ravnborg <redacted>
---
drivers/video/fbdev/aty/aty128fb.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
From: Thomas Zimmermann <tzimmermann@suse.de> Date: 2023-06-13 11:10:55
The driver's backlight code requires the framebuffer to be
registered. Therefore reorder the init and cleanup calls for
both data structures.
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Reviewed-by: Sam Ravnborg <redacted>
---
drivers/video/fbdev/aty/aty128fb.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
From: Thomas Zimmermann <tzimmermann@suse.de> Date: 2023-06-13 11:10:59
Fix cases were output helpers are called with struct fb_info.dev.
Use fb_*() helpers instead. Prepares fbdev for making struct
fb_info.dev optional.
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Cc: Timur Tabi <timur@kernel.org>
Reviewed-by: Sam Ravnborg <redacted>
---
drivers/video/fbdev/fsl-diu-fb.c | 26 +++++++++++++-------------
1 file changed, 13 insertions(+), 13 deletions(-)
@@ -872,7 +872,7 @@ static int map_video_memory(struct fb_info *info)p=alloc_pages_exact(smem_len,GFP_DMA|__GFP_ZERO);if(!p){-dev_err(info->dev,"unable to allocate fb memory\n");+fb_err(info,"unable to allocate fb memory\n");return-ENOMEM;}mutex_lock(&info->mm_lock);
@@ -1145,7 +1145,7 @@ static int fsl_diu_set_par(struct fb_info *info)/* Memory allocation for framebuffer */if(map_video_memory(info)){-dev_err(info->dev,"unable to allocate fb memory 1\n");+fb_err(info,"unable to allocate fb memory 1\n");return-ENOMEM;}}
@@ -1277,16 +1277,16 @@ static int fsl_diu_ioctl(struct fb_info *info, unsigned int cmd,if(!arg)return-EINVAL;-dev_dbg(info->dev,"ioctl %08x (dir=%s%s type=%u nr=%u size=%u)\n",cmd,+fb_dbg(info,"ioctl %08x (dir=%s%s type=%u nr=%u size=%u)\n",cmd,_IOC_DIR(cmd)&_IOC_READ?"R":"",_IOC_DIR(cmd)&_IOC_WRITE?"W":"",_IOC_TYPE(cmd),_IOC_NR(cmd),_IOC_SIZE(cmd));switch(cmd){caseMFB_SET_PIXFMT_OLD:-dev_warn(info->dev,-"MFB_SET_PIXFMT value of 0x%08x is deprecated.\n",-MFB_SET_PIXFMT_OLD);+fb_warn(info,+"MFB_SET_PIXFMT value of 0x%08x is deprecated.\n",+MFB_SET_PIXFMT_OLD);fallthrough;caseMFB_SET_PIXFMT:if(copy_from_user(&pix_fmt,buf,sizeof(pix_fmt)))
@@ -1294,9 +1294,9 @@ static int fsl_diu_ioctl(struct fb_info *info, unsigned int cmd,ad->pix_fmt=pix_fmt;break;caseMFB_GET_PIXFMT_OLD:-dev_warn(info->dev,-"MFB_GET_PIXFMT value of 0x%08x is deprecated.\n",-MFB_GET_PIXFMT_OLD);+fb_warn(info,+"MFB_GET_PIXFMT value of 0x%08x is deprecated.\n",+MFB_GET_PIXFMT_OLD);fallthrough;caseMFB_GET_PIXFMT:pix_fmt=ad->pix_fmt;
@@ -1375,7 +1375,7 @@ static int fsl_diu_ioctl(struct fb_info *info, unsigned int cmd,}#endifdefault:-dev_err(info->dev,"unknown ioctl command (0x%08X)\n",cmd);+fb_err(info,"unknown ioctl command (0x%08X)\n",cmd);return-ENOIOCTLCMD;}
From: Thomas Zimmermann <tzimmermann@suse.de> Date: 2023-06-13 11:11:03
Do not assing the Linux device to struct fb_info.dev. The call to
register_framebuffer() initializes the field to the fbdev device.
Drivers should not override its value.
Fixes a bug where the driver incorrectly decreases the hardware
device's reference counter and leaks the fbdev device.
v2:
* add Fixes tag (Dan)
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Fixes: 88017bda96a5 ("ep93xx video driver")
Cc: <redacted> # v2.6.32+
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Reviewed-by: Sam Ravnborg <redacted>
---
drivers/video/fbdev/ep93xx-fb.c | 1 -
1 file changed, 1 deletion(-)
From: Thomas Zimmermann <tzimmermann@suse.de> Date: 2023-06-13 11:11:09
Pass the hardware device to the DMA helpers dma_alloc_wc(), dma_mmap_wc()
and dma_free_coherent(). The fbdev device that is currently being used is
a software device and does not provide DMA memory.
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
---
drivers/video/fbdev/ep93xx-fb.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
@@ -423,7 +423,7 @@ static int ep93xxfb_alloc_videomem(struct fb_info *info)/* Maximum 16bpp -> used memory is maximum x*y*2 bytes */fb_size=EP93XXFB_MAX_XRES*EP93XXFB_MAX_YRES*2;-virt_addr=dma_alloc_wc(info->dev,fb_size,&phys_addr,GFP_KERNEL);+virt_addr=dma_alloc_wc(info->device,fb_size,&phys_addr,GFP_KERNEL);if(!virt_addr)return-ENOMEM;
@@ -440,7 +440,7 @@ static int ep93xxfb_alloc_videomem(struct fb_info *info)"has bit 27 set: cannot init framebuffer\n",phys_addr);-dma_free_coherent(info->dev,fb_size,virt_addr,phys_addr);+dma_free_coherent(info->device,fb_size,virt_addr,phys_addr);return-ENOMEM;}
@@ -454,7 +454,7 @@ static int ep93xxfb_alloc_videomem(struct fb_info *info)staticvoidep93xxfb_dealloc_videomem(structfb_info*info){if(info->screen_base)-dma_free_coherent(info->dev,info->fix.smem_len,+dma_free_coherent(info->device,info->fix.smem_len,info->screen_base,info->fix.smem_start);}
From: Thomas Zimmermann <tzimmermann@suse.de> Date: 2023-06-13 11:11:12
Fix cases were output helpers are called with struct fb_info.dev.
Use fb_info() and fb_err() instead.
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Reviewed-by: Sam Ravnborg <redacted>
---
drivers/video/fbdev/ep93xx-fb.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
From: Thomas Zimmermann <tzimmermann@suse.de> Date: 2023-06-13 11:11:15
The driver's backlight code requires the framebuffer to be
registered. Therefore reorder the init and cleanup calls for
both data structures.
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Cc: Antonino Daplas <adaplas@gmail.com>
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Reviewed-by: Sam Ravnborg <redacted>
---
drivers/video/fbdev/nvidia/nvidia.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
From: Thomas Zimmermann <tzimmermann@suse.de> Date: 2023-06-13 11:11:20
Replace the use of the fbdev software device, stored in struct
fb_info.dev, with the hardware device from struct fb_info.device
in load_waveform(). The device is only used for printing errors
with dev_err().
This change aligns load_waveform() with the rest of the driver and
prepares fbdev for making struct fb_info.dev optional.
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Reviewed-by: Sam Ravnborg <redacted>
---
drivers/video/fbdev/metronomefb.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
@@ -181,7 +181,7 @@ static int load_waveform(u8 *mem, size_t size, int m, int t,intmem_idx=0;structwaveform_hdr*wfm_hdr;u8*metromem=par->metromem_wfm;-structdevice*dev=par->info->dev;+structdevice*dev=par->info->device;if(user_wfm_size)epd_frame_table[par->dt].wfm_size=user_wfm_size;
From: Thomas Zimmermann <tzimmermann@suse.de> Date: 2023-06-13 11:11:23
Fix cases were output helpers are called with struct fb_info.dev.
Use fb_dbg() instead. Prepares fbdev for making struct fb_info.dev
optional.
v2:
* fix another reference to struct fb_info.dev (kernel test reobot)
* remove fb_err() from commit message
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Reviewed-by: Sam Ravnborg <redacted>
---
drivers/video/fbdev/mb862xx/mb862xxfbdrv.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
@@ -112,8 +112,7 @@ static int mb862xxfb_check_var(struct fb_var_screeninfo *var,{unsignedlongtmp;-if(fbi->dev)-dev_dbg(fbi->dev,"%s\n",__func__);+fb_dbg(fbi,"%s\n",__func__);/* check if these values fit into the registers */if(var->hsync_len>255||var->vsync_len>255)
From: Thomas Zimmermann <tzimmermann@suse.de> Date: 2023-06-13 11:11:29
Use the hardware device in struct fb_info.device as parent of the
backlight device. Aligns the driver with the rest of the codebase
and prepares fbdev for making struct fb_info.dev optional.
v2:
* add Cc: tag (Dan)
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Reviewed-by: Sam Ravnborg <redacted>
---
drivers/video/fbdev/aty/radeon_backlight.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
From: Thomas Zimmermann <tzimmermann@suse.de> Date: 2023-06-13 11:11:35
Do not assign the hardware device to struct fb_info.dev. The
field references the fbdev software device, which is unrelated.
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Reviewed-by: Sam Ravnborg <redacted>
---
drivers/video/fbdev/pxa168fb.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
From: Thomas Zimmermann <tzimmermann@suse.de> Date: 2023-06-13 11:11:39
The driver's backlight code requires the framebuffer to be
registered. Therefore reorder the cleanup calls for both data
structures. The init calls are already in the correct order.
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Reviewed-by: Sam Ravnborg <redacted>
---
drivers/video/fbdev/aty/radeon_base.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
From: Thomas Zimmermann <tzimmermann@suse.de> Date: 2023-06-13 11:11:46
Use the hardware device in struct fb_info.device as parent of the
backlight device. Aligns the driver with the rest of the codebase
and prepares fbdev for making struct fb_info.dev optional.
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Cc: Antonino Daplas <adaplas@gmail.com>
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Reviewed-by: Sam Ravnborg <redacted>
---
drivers/video/fbdev/nvidia/nv_backlight.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
From: Thomas Zimmermann <tzimmermann@suse.de> Date: 2023-06-13 11:11:50
Give struct fb_info to sh7760fb_get_color_info() and use it in
call to fb_dbg(). Prepares fbdev for making struct fb_info.dev
optional.
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Sam Ravnborg <redacted>
---
drivers/video/fbdev/sh7760fb.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
@@ -118,7 +118,7 @@ static int sh7760_setcolreg (u_int regno,return0;}-staticintsh7760fb_get_color_info(structdevice*dev,+staticintsh7760fb_get_color_info(structfb_info*info,u16lddfr,int*bpp,int*gray){intlbpp,lgray;
@@ -150,7 +150,7 @@ static int sh7760fb_get_color_info(struct device *dev,lgray=0;break;default:-dev_dbg(dev,"unsupported LDDFR bit depth.\n");+fb_dbg(info,"unsupported LDDFR bit depth.\n");return-EINVAL;}
@@ -170,7 +170,7 @@ static int sh7760fb_check_var(struct fb_var_screeninfo *var,intret,bpp;/* get color info from register value */-ret=sh7760fb_get_color_info(info->dev,par->pd->lddfr,&bpp,NULL);+ret=sh7760fb_get_color_info(info,par->pd->lddfr,&bpp,NULL);if(ret)returnret;
@@ -222,7 +222,7 @@ static int sh7760fb_set_par(struct fb_info *info)vdln=vm->yres;/* get color info from register value */-ret=sh7760fb_get_color_info(info->dev,par->pd->lddfr,&bpp,&gray);+ret=sh7760fb_get_color_info(info,par->pd->lddfr,&bpp,&gray);if(ret)returnret;
@@ -381,7 +381,7 @@ static int sh7760fb_alloc_mem(struct fb_info *info)return0;/* get color info from register value */-ret=sh7760fb_get_color_info(info->dev,par->pd->lddfr,&bpp,NULL);+ret=sh7760fb_get_color_info(info,par->pd->lddfr,&bpp,NULL);if(ret){printk(KERN_ERR"colinfo\n");returnret;
From: Thomas Zimmermann <tzimmermann@suse.de> Date: 2023-06-13 11:11:54
The driver's backlight code requires the framebuffer to be
registered. Therefore reorder the init and cleanup calls for
both data structures.
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Cc: Antonino Daplas <adaplas@gmail.com>
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Reviewed-by: Sam Ravnborg <redacted>
---
drivers/video/fbdev/riva/fbdev.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
From: Thomas Zimmermann <tzimmermann@suse.de> Date: 2023-06-13 11:11:59
Use the hardware device in struct fb_info.device as parent of the
backlight device. Aligns the driver with the rest of the codebase
and prepares fbdev for making struct fb_info.dev optional.
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Cc: Antonino Daplas <adaplas@gmail.com>
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Reviewed-by: Sam Ravnborg <redacted>
---
drivers/video/fbdev/riva/fbdev.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
From: Thomas Zimmermann <tzimmermann@suse.de> Date: 2023-06-13 11:12:01
Pass the hardware device to the DMA helpers dma_alloc_coherent() and
dma_free_coherent(). The fbdev device that is currently being used is
a software device and does not provide DMA memory. Also update the
related dev_*() output statements similarly.
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
drivers/video/fbdev/sh7760fb.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
@@ -408,14 +408,14 @@ static int sh7760fb_alloc_mem(struct fb_info *info)if(vram<PAGE_SIZE)vram=PAGE_SIZE;-fbmem=dma_alloc_coherent(info->dev,vram,&par->fbdma,GFP_KERNEL);+fbmem=dma_alloc_coherent(info->device,vram,&par->fbdma,GFP_KERNEL);if(!fbmem)return-ENOMEM;if((par->fbdma&SH7760FB_DMA_MASK)!=SH7760FB_DMA_MASK){sh7760fb_free_mem(info);-dev_err(info->dev,"kernel gave me memory at 0x%08lx, which is"+dev_err(info->device,"kernel gave me memory at 0x%08lx, which is""unusable for the LCDC\n",(unsignedlong)par->fbdma);return-ENOMEM;}
From: Javier Martinez Canillas <javierm@redhat.com> Date: 2023-06-26 12:29:10
Thomas Zimmermann [off-list ref] writes:
Pass the hardware device to the DMA helpers dma_alloc_coherent() and
dma_free_coherent(). The fbdev device that is currently being used is
a software device and does not provide DMA memory. Also update the
related dev_*() output statements similarly.
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
--
Best regards,
Javier Martinez Canillas
Core Platforms
Red Hat
From: Thomas Zimmermann <tzimmermann@suse.de> Date: 2023-06-13 11:12:06
Fix cases were output helpers are called with struct fb_info.dev.
Use fb_dbg() instead. Prepares fbdev for making struct fb_info.dev
optional.
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Sam Ravnborg <redacted>
---
drivers/video/fbdev/sh7760fb.c | 26 +++++++++++++-------------
1 file changed, 13 insertions(+), 13 deletions(-)
@@ -207,7 +207,7 @@ static int sh7760fb_set_par(struct fb_info *info)/* rotate only works with xres <= 320 */if(par->rot&&(vm->xres>320)){-dev_dbg(info->dev,"rotation disabled due to display size\n");+fb_dbg(info,"rotation disabled due to display size\n");par->rot=0;}
From: Thomas Zimmermann <tzimmermann@suse.de> Date: 2023-06-13 11:12:08
Fix case were dev_err() is being called with struct fb_info.dev.
Use fb_err() instead.
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Reviewed-by: Sam Ravnborg <redacted>
---
drivers/video/fbdev/sm501fb.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
From: Thomas Zimmermann <tzimmermann@suse.de> Date: 2023-06-13 11:12:13
Call output helpers in the probe function with the hardware device.
The virtual fbdev device has not been initialized at that point. Also
prepares fbdev for making struct fb_info.dev optional.
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Sam Ravnborg <redacted>
---
drivers/video/fbdev/sh7760fb.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
From: Thomas Zimmermann <tzimmermann@suse.de> Date: 2023-06-13 11:12:19
Pass the Linux device to pm_vt_switch_*() instead of the virtual
fbdev device. Prepares fbdev for making struct fb_info.dev optional.
The type of device that is passed to the PM functions does not matter
much. It is only a token within the internal list of known devices.
The PM functions do not refer to any of the device's properties or its
type.
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Cc: "Rafael J. Wysocki" <rafael@kernel.org>
Cc: Pavel Machek <redacted>
Cc: linux-pm@vger.kernel.org
Reviewed-by: Sam Ravnborg <redacted>
---
drivers/video/fbdev/core/fbmem.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
From: Thomas Zimmermann <tzimmermann@suse.de> Date: 2023-06-13 11:12:23
Use the 3dfx hardware device from the Linux device hierarchy as
parent device of the i2c adapter. Aligns the driver with the rest
of the codebase and prepares fbdev for making struct fb_info.dev
optional.
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Reviewed-by: Sam Ravnborg <redacted>
---
drivers/video/fbdev/tdfxfb.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
From: Thomas Zimmermann <tzimmermann@suse.de> Date: 2023-06-13 11:12:28
Detect registered instances of fb_info by reading the reference
counter from struct fb_info.read. Avoids looking at the dev field
and prepares fbdev for making struct fb_info.dev optional.
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Cc: Steve Glendinning <steve.glendinning@shawell.net>
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
---
drivers/video/fbdev/smscufx.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
@@ -1496,7 +1496,7 @@ static int ufx_setup_modes(struct ufx_data *dev, struct fb_info *info,u8*edid;inti,result=0,tries=3;-if(info->dev)/* only use mutex if info has been registered */+if(refcount_read(&info->count))/* only use mutex if info has been registered */mutex_lock(&info->lock);edid=kmalloc(EDID_LENGTH,GFP_KERNEL);
From: Thomas Zimmermann <tzimmermann@suse.de> Date: 2023-06-13 11:12:38
Init the class "graphics" before the rest of fbdev. Later steps, such
as the sysfs code, depend on the class. Also arrange the module's exit
code in reverse order.
Unexport the global variable fb_class, which is only shared internally
within the fbdev core module.
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Sam Ravnborg <redacted>
---
drivers/video/fbdev/core/fb_internal.h | 1 +
drivers/video/fbdev/core/fbcon.c | 1 +
drivers/video/fbdev/core/fbmem.c | 52 ++++++++++----------------
include/linux/fb.h | 1 -
4 files changed, 22 insertions(+), 33 deletions(-)
From: Thomas Zimmermann <tzimmermann@suse.de> Date: 2023-06-13 11:12:38
Move fbdev's procfs code into a separate file and contain it in
init and cleanup helpers. For the cleanup, replace remove_proc_entry()
with proc_remove(). It is equivalent in functionality, but looks
more like an inverse of proc_create_seq().
v2:
* document proc_remove() usage (Sam)
* revert unrelated removal of for_each_registered_fb()
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Sam Ravnborg <redacted>
---
drivers/video/fbdev/core/Makefile | 1 +
drivers/video/fbdev/core/fb_internal.h | 12 ++++-
drivers/video/fbdev/core/fb_procfs.c | 62 ++++++++++++++++++++++++++
drivers/video/fbdev/core/fbmem.c | 48 +++-----------------
4 files changed, 80 insertions(+), 43 deletions(-)
create mode 100644 drivers/video/fbdev/core/fb_procfs.c
From: Thomas Zimmermann <tzimmermann@suse.de> Date: 2023-06-13 11:12:43
Move framebuffer and backlight helpers into separate files. Leave
fbsysfs.c to sysfs-related code. No functional changes.
The framebuffer helpers are not in fbmem.c because they are under
GPL-2.0-or-later copyright, while fbmem.c is GPL-2.0.
v2:
* include <linux/mutex.h> (Sam)
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Sam Ravnborg <redacted>
---
drivers/video/fbdev/core/Makefile | 4 +-
drivers/video/fbdev/core/fb_backlight.c | 33 +++++++
drivers/video/fbdev/core/fb_info.c | 78 +++++++++++++++++
drivers/video/fbdev/core/fbsysfs.c | 110 +-----------------------
4 files changed, 115 insertions(+), 110 deletions(-)
create mode 100644 drivers/video/fbdev/core/fb_backlight.c
create mode 100644 drivers/video/fbdev/core/fb_info.c
@@ -551,30 +470,3 @@ void fb_cleanup_device(struct fb_info *fb_info)fb_info->class_flag&=~FB_SYSFS_FLAG_ATTR;}}--#if IS_ENABLED(CONFIG_FB_BACKLIGHT)-/* This function generates a linear backlight curve-*-*0:off-*1-7:min-*8-127:linearfrommintomax-*/-voidfb_bl_default_curve(structfb_info*fb_info,u8off,u8min,u8max)-{-unsignedinti,flat,count,range=(max-min);--mutex_lock(&fb_info->bl_curve_mutex);--fb_info->bl_curve[0]=off;--for(flat=1;flat<(FB_BACKLIGHT_LEVELS/16);++flat)-fb_info->bl_curve[flat]=min;--count=FB_BACKLIGHT_LEVELS*15/16;-for(i=0;i<count;++i)-fb_info->bl_curve[flat+i]=min+(range*(i+1)/count);--mutex_unlock(&fb_info->bl_curve_mutex);-}-EXPORT_SYMBOL_GPL(fb_bl_default_curve);-#endif
From: Thomas Zimmermann <tzimmermann@suse.de> Date: 2023-06-13 11:12:50
Move the logic to create and destroy fbdev devices into the new
helpers fb_device_create() and fb_device_destroy().
There was a call to fb_cleanup_device() in do_unregister_framebuffer()
that was too late. The device had already been removed at this point.
Move the call into fb_device_destroy().
Declare the helpers in the new internal header file fb_internal.h, as
they are only used within the fbdev core module.
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Sam Ravnborg <redacted>
---
drivers/video/fbdev/core/fb_internal.h | 12 ++++++++
drivers/video/fbdev/core/fbmem.c | 21 +++-----------
drivers/video/fbdev/core/fbsysfs.c | 38 ++++++++++++++++++++++++--
include/linux/fb.h | 3 --
4 files changed, 52 insertions(+), 22 deletions(-)
create mode 100644 drivers/video/fbdev/core/fb_internal.h
From: Thomas Zimmermann <tzimmermann@suse.de> Date: 2023-06-13 11:12:54
Add Kconfig option CONFIG_FB_DEVICE and make the virtual fbdev
device optional. If the new option has not been selected, fbdev
does not create files in devfs, sysfs or procfs.
Most modern Linux systems run a DRM-based graphics stack that uses
the kernel's framebuffer console, but has otherwise deprecated fbdev
support. Yet fbdev userspace interfaces are still present.
The option makes it possible to use the fbdev subsystem as console
implementation without support for userspace. This closes potential
entry points to manipulate kernel or I/O memory via framebuffers. It
also prevents the execution of driver code via ioctl or sysfs, both
of which might allow malicious software to exploit bugs in the fbdev
code.
A small number of fbdev drivers require struct fbinfo.dev to be
initialized, usually for the support of sysfs interface. Make these
drivers depend on FB_DEVICE. They can later be fixed if necessary.
v3:
* effect -> affect in Kconfig help (Daniel)
v2:
* set FB_DEVICE default to y (Geert)
* comment on {get,put}_device() (Sam)
* Kconfig fixes (Sam)
* add TODO item about FB_DEVICE dependencies (Sam)
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Reviewed-by: Sam Ravnborg <redacted>
---
Documentation/gpu/todo.rst | 13 ++++++++
drivers/staging/fbtft/Kconfig | 1 +
drivers/video/fbdev/Kconfig | 13 ++++++++
drivers/video/fbdev/core/Makefile | 7 +++--
drivers/video/fbdev/core/fb_internal.h | 38 ++++++++++++++++++++++++
drivers/video/fbdev/omap2/omapfb/Kconfig | 2 +-
include/linux/fb.h | 2 ++
7 files changed, 72 insertions(+), 4 deletions(-)
@@ -452,6 +452,19 @@ Contact: Thomas Zimmermann <tzimmermann@suse.de> Level: Starter+Remove driver dependencies on FB_DEVICE+---------------------------------------++A number of fbdev drivers provide attributes via sysfs and therefore depend+on CONFIG_FB_DEVICE to be selected. Review each driver and attempt to make+any dependencies on CONFIG_FB_DEVICE optional. At the minimum, the respective+code in the driver could be conditionalized via ifdef CONFIG_FB_DEVICE. Not+all drivers might be able to drop CONFIG_FB_DEVICE.++Contact: Thomas Zimmermann <tzimmermann@suse.de>++Level: Starter+ Core refactorings =================
@@ -481,7 +481,9 @@ struct fb_info {conststructfb_ops*fbops;structdevice*device;/* This is the parent */+#if defined(CONFIG_FB_DEVICE)structdevice*dev;/* This is this fb device */+#endifintclass_flag;/* private sysfs flags */#ifdef CONFIG_FB_TILEBLITTINGstructfb_tile_ops*tileops;/* Tile Blitting */
@@ -1591,11 +1126,9 @@ fbmem_init(void)if(ret)returnret;-ret=register_chrdev(FB_MAJOR,"fb",&fb_fops);-if(ret){-printk("unable to get major %d for fb devs\n",FB_MAJOR);+ret=fb_register_chrdev();+if(ret)gotoerr_chrdev;-}fb_class=class_create("graphics");if(IS_ERR(fb_class)){
From: Thomas Zimmermann <tzimmermann@suse.de> Date: 2023-06-13 11:21:25
Rename struct bd6107_platform_data.fbdev to 'dev', as it stores a
pointer to the Linux platform device; not the fbdev device. Makes
the code easier to understand.
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Cc: Lee Jones <lee@kernel.org>
Cc: Daniel Thompson <redacted>
Cc: Jingoo Han <jingoohan1@gmail.com>
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Reviewed-by: Sam Ravnborg <redacted>
Reviewed-by: Daniel Thompson <redacted>
---
drivers/video/backlight/bd6107.c | 2 +-
include/linux/platform_data/bd6107.h | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
From: Thomas Zimmermann <tzimmermann@suse.de> Date: 2023-06-13 11:21:33
Struct bd6107_platform_data refers to a platform device within
the Linux device hierarchy. The test in bd6107_backlight_check_fb()
compares it against the fbdev device in struct fb_info.dev, which
is different. Fix the test by comparing to struct fb_info.device.
Fixes a bug in the backlight driver and prepares fbdev for making
struct fb_info.dev optional.
v2:
* move renames into separate patch (Javier, Sam, Michael)
Fixes: 67b43e590415 ("backlight: Add ROHM BD6107 backlight driver")
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Cc: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Cc: Lee Jones <lee@kernel.org>
Cc: Daniel Thompson <redacted>
Cc: Jingoo Han <jingoohan1@gmail.com>
Cc: dri-devel@lists.freedesktop.org
Cc: <redacted> # v3.12+
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Reviewed-by: Sam Ravnborg <redacted>
Reviewed-by: Daniel Thompson <redacted>
---
drivers/video/backlight/bd6107.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
From: Lee Jones <lee@kernel.org> Date: 2023-06-14 13:52:20
On Tue, 13 Jun 2023, Thomas Zimmermann wrote:
Struct bd6107_platform_data refers to a platform device within
the Linux device hierarchy. The test in bd6107_backlight_check_fb()
compares it against the fbdev device in struct fb_info.dev, which
is different. Fix the test by comparing to struct fb_info.device.
Fixes a bug in the backlight driver and prepares fbdev for making
struct fb_info.dev optional.
v2:
* move renames into separate patch (Javier, Sam, Michael)
Fixes: 67b43e590415 ("backlight: Add ROHM BD6107 backlight driver")
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Cc: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Cc: Lee Jones <lee@kernel.org>
Cc: Daniel Thompson <redacted>
Cc: Jingoo Han <jingoohan1@gmail.com>
Cc: dri-devel@lists.freedesktop.org
Cc: <redacted> # v3.12+
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Reviewed-by: Sam Ravnborg <redacted>
Reviewed-by: Daniel Thompson <redacted>
---
drivers/video/backlight/bd6107.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Can the Backlight patches be applied without the others and visa versa?
--
Lee Jones [李琼斯]
From: Thomas Zimmermann <tzimmermann@suse.de> Date: 2023-06-14 14:13:18
Hi
Am 14.06.23 um 15:51 schrieb Lee Jones:
On Tue, 13 Jun 2023, Thomas Zimmermann wrote:
quoted
Struct bd6107_platform_data refers to a platform device within
the Linux device hierarchy. The test in bd6107_backlight_check_fb()
compares it against the fbdev device in struct fb_info.dev, which
is different. Fix the test by comparing to struct fb_info.device.
Fixes a bug in the backlight driver and prepares fbdev for making
struct fb_info.dev optional.
v2:
* move renames into separate patch (Javier, Sam, Michael)
Fixes: 67b43e590415 ("backlight: Add ROHM BD6107 backlight driver")
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Cc: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Cc: Lee Jones <lee@kernel.org>
Cc: Daniel Thompson <redacted>
Cc: Jingoo Han <jingoohan1@gmail.com>
Cc: dri-devel@lists.freedesktop.org
Cc: <redacted> # v3.12+
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Reviewed-by: Sam Ravnborg <redacted>
Reviewed-by: Daniel Thompson <redacted>
---
drivers/video/backlight/bd6107.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Can the Backlight patches be applied without the others and visa versa?
Unfortunately not. The rest of the series requires the backlight patches.
Best regards
Thomas
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstrasse 146, 90461 Nuernberg, Germany
GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman
HRB 36809 (AG Nuernberg)
From: Thomas Zimmermann <tzimmermann@suse.de> Date: 2023-06-13 11:21:37
Rename the field 'fbdev' in struct gpio_backlight_platform_data and
struct gpio_backlight to 'dev', as they store pointers to the Linux
platform device; not the fbdev device. Makes the code easier to
understand.
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Cc: Rich Felker <dalias@libc.org>
Cc: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
Cc: Lee Jones <lee@kernel.org>
Cc: Daniel Thompson <redacted>
Cc: Jingoo Han <jingoohan1@gmail.com>
Cc: linux-sh@vger.kernel.org
Reviewed-by: Sam Ravnborg <redacted>
Reviewed-by: Daniel Thompson <redacted>
---
arch/sh/boards/mach-ecovec24/setup.c | 2 +-
drivers/video/backlight/gpio_backlight.c | 6 +++---
include/linux/platform_data/gpio_backlight.h | 2 +-
3 files changed, 5 insertions(+), 5 deletions(-)
From: Thomas Zimmermann <tzimmermann@suse.de> Date: 2023-06-13 11:21:40
Struct gpio_backlight_platform_data refers to a platform device within
the Linux device hierarchy. The test in gpio_backlight_check_fb()
compares it against the fbdev device in struct fb_info.dev, which
is different. Fix the test by comparing to struct fb_info.device.
Fixes a bug in the backlight driver and prepares fbdev for making
struct fb_info.dev optional.
v2:
* move renames into separate patch (Javier, Sam, Michael)
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Fixes: 8b770e3c9824 ("backlight: Add GPIO-based backlight driver")
Cc: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Cc: Rich Felker <dalias@libc.org>
Cc: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
Cc: Lee Jones <lee@kernel.org>
Cc: Daniel Thompson <redacted>
Cc: Jingoo Han <jingoohan1@gmail.com>
Cc: linux-sh@vger.kernel.org
Cc: dri-devel@lists.freedesktop.org
Cc: <redacted> # v3.12+
Reviewed-by: Sam Ravnborg <redacted>
Reviewed-by: Daniel Thompson <redacted>
---
drivers/video/backlight/gpio_backlight.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
From: Thomas Zimmermann <tzimmermann@suse.de> Date: 2023-06-13 11:21:45
Struct lv5207lp_platform_data refers to a platform device within
the Linux device hierarchy. The test in lv5207lp_backlight_check_fb()
compares it against the fbdev device in struct fb_info.dev, which
is different. Fix the test by comparing to struct fb_info.device.
Fixes a bug in the backlight driver and prepares fbdev for making
struct fb_info.dev optional.
v2:
* move renames into separate patch (Javier, Sam, Michael)
Fixes: 82e5c40d88f9 ("backlight: Add Sanyo LV5207LP backlight driver")
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Cc: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
Cc: Rich Felker <dalias@libc.org>
Cc: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
Cc: Lee Jones <lee@kernel.org>
Cc: Daniel Thompson <redacted>
Cc: Jingoo Han <jingoohan1@gmail.com>
Cc: linux-sh@vger.kernel.org
Cc: dri-devel@lists.freedesktop.org
Cc: <redacted> # v3.12+
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Reviewed-by: Sam Ravnborg <redacted>
Reviewed-by: Daniel Thompson <redacted>
---
drivers/video/backlight/lv5207lp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
From: Lee Jones <lee@kernel.org> Date: 2023-06-19 08:32:30
On Tue, 13 Jun 2023, Thomas Zimmermann wrote:
Add the new config option FB_DEVICE. If enabled, fbdev provides
traditional userspace interfaces in devfs, sysfs and procfs, such
as /dev/fb0 or /proc/fb.
Modern Linux distrobutions have adopted DRM drivers for graphics
output and use fbdev only for the kernel's framebuffer console.
Userspace has also moved on, with no new fbdev code being written
and existing support being removed.
OTOH, fbdev provides userspace a way of accessing kernel or I/O
memory, which might compromise the system's security. See the recent
commit c8687694bb1f ("drm/fbdev-generic: prohibit potential
out-of-bounds access") for an example. Disabling fbdev userspace
interfaces is therefore a useful feature to limit unnecessary
exposure of fbdev code to processes of low privilegues.
Patches 1 to 31 fix various bugs and issues in fbdev-related code.
In most cases the code uses the fbdev device where it should use
the Linux hardware device or something else. Most of these patches
fix existing problems and should therefore be considered in any case.
Patches 32 to 37 refactor the fbdev core code. The patches move
support for backlights, sysfs, procfs and devfs into separate files
and hide it behind simple interfaces. These changes will allow to
easily build the userspace support conditionally.
Patch 38 introduces the config option FB_DEVICE and adapts the fbdev
core to support it. The field struct fb_info.dev is now optional,
hence the name of the config option.
Tested on simpledrm and i915, including the device handover.
Future directions: With the support for disabling fbdev userspace
interfaces in place, it will be possible to make most fbdev drivers'
file-I/O code in struct fb_ops optional as well.
v3:
* add missing file fb_chrdev.c
* fix typo in Kconfig help (Daniel)
v2:
* fix fsl-diu-fb and sh7760fb
* split backlight patches
* set 'default y' for FB_CONFIG
* minor fixes and corrections
Thomas Zimmermann (38):
backlight/bd6107: Compare against struct fb_info.device
backlight/bd6107: Rename struct bd6107_platform_data.fbdev to 'dev'
backlight/gpio_backlight: Compare against struct fb_info.device
backlight/gpio_backlight: Rename field 'fbdev' to 'dev'
backlight/lv5207lp: Compare against struct fb_info.device
backlight/lv5207lp: Rename struct lv5207lp_platform_data.fbdev to
'dev'
fbdev/atyfb: Reorder backlight and framebuffer init/cleanup
fbdev/atyfb: Use hardware device as backlight parent
fbdev/aty128fb: Reorder backlight and framebuffer init/cleanup
fbdev/aty128fb: Use hardware device as backlight parent
fbdev/broadsheetfb: Call device_remove_file() with hardware device
fbdev/ep93xx-fb: Alloc DMA memory from hardware device
fbdev/ep93xx-fb: Output messages with fb_info() and fb_err()
fbdev/ep93xx-fb: Do not assign to struct fb_info.dev
fbdev/fsl-diu-fb: Output messages with fb_*() helpers
fbdev/mb862xxfb: Output messages with fb_dbg()
fbdev/metronomefb: Use hardware device for dev_err()
fbdev/nvidiafb: Reorder backlight and framebuffer init/cleanup
fbdev/nvidiafb: Use hardware device as backlight parent
fbdev/pxa168fb: Do not assign to struct fb_info.dev
fbdev/radeonfb: Reorder backlight and framebuffer cleanup
fbdev/radeonfb: Use hardware device as backlight parent
fbdev/rivafb: Reorder backlight and framebuffer init/cleanup
fbdev/rivafb: Use hardware device as backlight parent
fbdev/sh7760fb: Use fb_dbg() in sh7760fb_get_color_info()
fbdev/sh7760fb: Output messages with fb_dbg()
fbdev/sh7760fb: Alloc DMA memory from hardware device
fbdev/sh7760fb: Use hardware device with dev_() output during probe
fbdev/sm501fb: Output message with fb_err()
fbdev/smscufx: Detect registered fb_info from refcount
fbdev/tdfxfb: Set i2c adapter parent to hardware device
fbdev/core: Pass Linux device to pm_vt_switch_*() functions
fbdev/core: Move framebuffer and backlight helpers into separate files
fbdev/core: Add fb_device_{create,destroy}()
fbdev/core: Move procfs code to separate file
fbdev/core: Move file-I/O code into separate file
fbdev/core: Rework fb init code
fbdev: Make support for userspace interfaces configurable
Documentation/gpu/todo.rst | 13 +
arch/sh/boards/mach-ecovec24/setup.c | 2 +-
arch/sh/boards/mach-kfr2r09/setup.c | 2 +-
drivers/staging/fbtft/Kconfig | 1 +