Skip to content

Commit

Permalink
Merge tag 'fbdev-for-6.3-rc3' of git://git.kernel.org/pub/scm/linux/k…
Browse files Browse the repository at this point in the history
…ernel/git/deller/linux-fbdev

Pull fbdev fixes from Helge Deller:
 "The majority of lines changed is due to a code style cleanup in the
  pnmtologo helper program.

  Arnd removed the omap1 osk driver and the SIS fb driver is now
  orphaned.

  Other than that it's the usual bunch of small fixes and cleanups, e.g.
  prevent possible divide-by-zero in various fb drivers if the pixclock
  is zero and various conversions to devm_platform*() and of_property*()
  functions:

   - Drop omap1 osk driver

   - Various potential divide by zero pixclock fixes

   - Add pixelclock and fb_check_var() to stifb

   - Code style cleanups and indenting fixes"

* tag 'fbdev-for-6.3-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/linux-fbdev:
  fbdev: Use of_property_present() for testing DT property presence
  fbdev: au1200fb: Fix potential divide by zero
  fbdev: lxfb: Fix potential divide by zero
  fbdev: intelfb: Fix potential divide by zero
  fbdev: nvidia: Fix potential divide by zero
  fbdev: stifb: Provide valid pixelclock and add fb_check_var() checks
  fbdev: omapfb: remove omap1 osk driver
  fbdev: xilinxfb: Use devm_platform_get_and_ioremap_resource()
  fbdev: wm8505fb: Use devm_platform_ioremap_resource()
  fbdev: pxa3xx-gcu: Use devm_platform_get_and_ioremap_resource()
  fbdev: Use of_property_read_bool() for boolean properties
  fbdev: clps711x-fb: Use devm_platform_get_and_ioremap_resource()
  fbdev: tgafb: Fix potential divide by zero
  MAINTAINERS: orphan SIS FRAMEBUFFER DRIVER
  fbdev: omapfb: cleanup inconsistent indentation
  drivers: video: logo: add SPDX comment, remove GPL notice in pnmtologo.c
  drivers: video: logo: fix code style issues in pnmtologo.c
  • Loading branch information
Linus Torvalds committed Mar 18, 2023
2 parents 5342933 + 29413f0 commit a3671bd
Show file tree
Hide file tree
Showing 22 changed files with 409 additions and 462 deletions.
4 changes: 1 addition & 3 deletions MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -19150,9 +19150,7 @@ W: http://www.brownhat.org/sis900.html
F: drivers/net/ethernet/sis/sis900.*

SIS FRAMEBUFFER DRIVER
M: Thomas Winischhofer <thomas@winischhofer.net>
S: Maintained
W: http://www.winischhofer.net/linuxsisvga.shtml
S: Orphan
F: Documentation/fb/sisfb.rst
F: drivers/video/fbdev/sis/
F: include/video/sisfb.h
Expand Down
2 changes: 1 addition & 1 deletion drivers/video/fbdev/amba-clcd.c
Original file line number Diff line number Diff line change
Expand Up @@ -854,7 +854,7 @@ static struct clcd_board *clcdfb_of_get_board(struct amba_device *dev)
board->caps = CLCD_CAP_ALL;
board->check = clcdfb_check;
board->decode = clcdfb_decode;
if (of_find_property(node, "memory-region", NULL)) {
if (of_property_present(node, "memory-region")) {
board->setup = clcdfb_of_vram_setup;
board->mmap = clcdfb_of_vram_mmap;
board->remove = clcdfb_of_vram_remove;
Expand Down
3 changes: 3 additions & 0 deletions drivers/video/fbdev/au1200fb.c
Original file line number Diff line number Diff line change
Expand Up @@ -1040,6 +1040,9 @@ static int au1200fb_fb_check_var(struct fb_var_screeninfo *var,
u32 pixclock;
int screen_size, plane;

if (!var->pixclock)
return -EINVAL;

plane = fbdev->plane;

/* Make sure that the mode respect all LCD controller and
Expand Down
2 changes: 1 addition & 1 deletion drivers/video/fbdev/bw2.c
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ static int bw2_probe(struct platform_device *op)
if (!par->regs)
goto out_release_fb;

if (!of_find_property(dp, "width", NULL)) {
if (!of_property_present(dp, "width")) {
err = bw2_do_default_mode(par, info, &linebytes);
if (err)
goto out_unmap_regs;
Expand Down
2 changes: 1 addition & 1 deletion drivers/video/fbdev/cg3.c
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ static int cg3_probe(struct platform_device *op)

cg3_blank(FB_BLANK_UNBLANK, info);

if (!of_find_property(dp, "width", NULL)) {
if (!of_property_present(dp, "width")) {
err = cg3_do_default_mode(par);
if (err)
goto out_unmap_screen;
Expand Down
3 changes: 1 addition & 2 deletions drivers/video/fbdev/clps711x-fb.c
Original file line number Diff line number Diff line change
Expand Up @@ -238,8 +238,7 @@ static int clps711x_fb_probe(struct platform_device *pdev)
info->fix.mmio_start = res->start;
info->fix.mmio_len = resource_size(res);

res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
info->screen_base = devm_ioremap_resource(dev, res);
info->screen_base = devm_platform_get_and_ioremap_resource(pdev, 1, &res);
if (IS_ERR(info->screen_base)) {
ret = PTR_ERR(info->screen_base);
goto out_fb_release;
Expand Down
3 changes: 3 additions & 0 deletions drivers/video/fbdev/geode/lxfb_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,9 @@ static void get_modedb(struct fb_videomode **modedb, unsigned int *size)

static int lxfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
{
if (!var->pixclock)
return -EINVAL;

if (var->xres > 1920 || var->yres > 1440)
return -EINVAL;

Expand Down
3 changes: 3 additions & 0 deletions drivers/video/fbdev/intelfb/intelfbdrv.c
Original file line number Diff line number Diff line change
Expand Up @@ -1222,6 +1222,9 @@ static int intelfb_check_var(struct fb_var_screeninfo *var,

dinfo = GET_DINFO(info);

if (!var->pixclock)
return -EINVAL;

/* update the pitch */
if (intelfbhw_validate_mode(dinfo, var) != 0)
return -EINVAL;
Expand Down
2 changes: 2 additions & 0 deletions drivers/video/fbdev/nvidia/nvidia.c
Original file line number Diff line number Diff line change
Expand Up @@ -764,6 +764,8 @@ static int nvidiafb_check_var(struct fb_var_screeninfo *var,
int pitch, err = 0;

NVTRACE_ENTER();
if (!var->pixclock)
return -EINVAL;

var->transp.offset = 0;
var->transp.length = 0;
Expand Down
4 changes: 2 additions & 2 deletions drivers/video/fbdev/offb.c
Original file line number Diff line number Diff line change
Expand Up @@ -549,10 +549,10 @@ static void offb_init_nodriver(struct platform_device *parent, struct device_nod
int foreign_endian = 0;

#ifdef __BIG_ENDIAN
if (of_get_property(dp, "little-endian", NULL))
if (of_property_read_bool(dp, "little-endian"))
foreign_endian = FBINFO_FOREIGN_ENDIAN;
#else
if (of_get_property(dp, "big-endian", NULL))
if (of_property_read_bool(dp, "big-endian"))
foreign_endian = FBINFO_FOREIGN_ENDIAN;
#endif

Expand Down
1 change: 0 additions & 1 deletion drivers/video/fbdev/omap/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ objs-y$(CONFIG_FB_OMAP_LCDC_HWA742) += hwa742.o

lcds-y$(CONFIG_MACH_AMS_DELTA) += lcd_ams_delta.o
lcds-y$(CONFIG_MACH_OMAP_PALMTE) += lcd_palmte.o
lcds-y$(CONFIG_MACH_OMAP_OSK) += lcd_osk.o

lcds-y$(CONFIG_FB_OMAP_LCD_MIPID) += lcd_mipid.o

Expand Down
86 changes: 0 additions & 86 deletions drivers/video/fbdev/omap/lcd_osk.c

This file was deleted.

30 changes: 18 additions & 12 deletions drivers/video/fbdev/omap/omapfb_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -544,19 +544,25 @@ static int set_fb_var(struct fb_info *fbi,
var->yoffset = var->yres_virtual - var->yres;

if (plane->color_mode == OMAPFB_COLOR_RGB444) {
var->red.offset = 8; var->red.length = 4;
var->red.msb_right = 0;
var->green.offset = 4; var->green.length = 4;
var->green.msb_right = 0;
var->blue.offset = 0; var->blue.length = 4;
var->blue.msb_right = 0;
var->red.offset = 8;
var->red.length = 4;
var->red.msb_right = 0;
var->green.offset = 4;
var->green.length = 4;
var->green.msb_right = 0;
var->blue.offset = 0;
var->blue.length = 4;
var->blue.msb_right = 0;
} else {
var->red.offset = 11; var->red.length = 5;
var->red.msb_right = 0;
var->green.offset = 5; var->green.length = 6;
var->green.msb_right = 0;
var->blue.offset = 0; var->blue.length = 5;
var->blue.msb_right = 0;
var->red.offset = 11;
var->red.length = 5;
var->red.msb_right = 0;
var->green.offset = 5;
var->green.length = 6;
var->green.msb_right = 0;
var->blue.offset = 0;
var->blue.length = 5;
var->blue.msb_right = 0;
}

var->height = -1;
Expand Down
2 changes: 1 addition & 1 deletion drivers/video/fbdev/omap2/omapfb/dss/omapdss-boot-init.c
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ static int __init omapdss_boot_init(void)
omapdss_walk_device(dss, true);

for_each_available_child_of_node(dss, child) {
if (!of_find_property(child, "compatible", NULL))
if (!of_property_present(child, "compatible"))
continue;

omapdss_walk_device(child, true);
Expand Down
3 changes: 1 addition & 2 deletions drivers/video/fbdev/pxa3xx-gcu.c
Original file line number Diff line number Diff line change
Expand Up @@ -599,8 +599,7 @@ static int pxa3xx_gcu_probe(struct platform_device *pdev)
priv->misc_dev.fops = &pxa3xx_gcu_miscdev_fops;

/* handle IO resources */
r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
priv->mmio_base = devm_ioremap_resource(dev, r);
priv->mmio_base = devm_platform_get_and_ioremap_resource(pdev, 0, &r);
if (IS_ERR(priv->mmio_base))
return PTR_ERR(priv->mmio_base);

Expand Down
4 changes: 2 additions & 2 deletions drivers/video/fbdev/sm501fb.c
Original file line number Diff line number Diff line change
Expand Up @@ -1737,10 +1737,10 @@ static int sm501fb_init_fb(struct fb_info *fb, enum sm501_controller head,

#if defined(CONFIG_OF)
#ifdef __BIG_ENDIAN
if (of_get_property(info->dev->parent->of_node, "little-endian", NULL))
if (of_property_read_bool(info->dev->parent->of_node, "little-endian"))
fb->flags |= FBINFO_FOREIGN_ENDIAN;
#else
if (of_get_property(info->dev->parent->of_node, "big-endian", NULL))
if (of_property_read_bool(info->dev->parent->of_node, "big-endian"))
fb->flags |= FBINFO_FOREIGN_ENDIAN;
#endif
#endif
Expand Down
27 changes: 27 additions & 0 deletions drivers/video/fbdev/stifb.c
Original file line number Diff line number Diff line change
Expand Up @@ -921,6 +921,28 @@ SETUP_HCRX(struct stifb_info *fb)

/* ------------------- driver specific functions --------------------------- */

static int
stifb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
{
struct stifb_info *fb = container_of(info, struct stifb_info, info);

if (var->xres != fb->info.var.xres ||
var->yres != fb->info.var.yres ||
var->bits_per_pixel != fb->info.var.bits_per_pixel)
return -EINVAL;

var->xres_virtual = var->xres;
var->yres_virtual = var->yres;
var->xoffset = 0;
var->yoffset = 0;
var->grayscale = fb->info.var.grayscale;
var->red.length = fb->info.var.red.length;
var->green.length = fb->info.var.green.length;
var->blue.length = fb->info.var.blue.length;

return 0;
}

static int
stifb_setcolreg(u_int regno, u_int red, u_int green,
u_int blue, u_int transp, struct fb_info *info)
Expand Down Expand Up @@ -1145,6 +1167,7 @@ stifb_init_display(struct stifb_info *fb)

static const struct fb_ops stifb_ops = {
.owner = THIS_MODULE,
.fb_check_var = stifb_check_var,
.fb_setcolreg = stifb_setcolreg,
.fb_blank = stifb_blank,
.fb_fillrect = stifb_fillrect,
Expand All @@ -1164,6 +1187,7 @@ static int __init stifb_init_fb(struct sti_struct *sti, int bpp_pref)
struct stifb_info *fb;
struct fb_info *info;
unsigned long sti_rom_address;
char modestr[32];
char *dev_name;
int bpp, xres, yres;

Expand Down Expand Up @@ -1342,6 +1366,9 @@ static int __init stifb_init_fb(struct sti_struct *sti, int bpp_pref)
info->flags = FBINFO_HWACCEL_COPYAREA | FBINFO_HWACCEL_FILLRECT;
info->pseudo_palette = &fb->pseudo_palette;

scnprintf(modestr, sizeof(modestr), "%dx%d-%d", xres, yres, bpp);
fb_find_mode(&info->var, info, modestr, NULL, 0, NULL, bpp);

/* This has to be done !!! */
if (fb_alloc_cmap(&info->cmap, NR_PALETTE, 0))
goto out_err1;
Expand Down
3 changes: 1 addition & 2 deletions drivers/video/fbdev/tcx.c
Original file line number Diff line number Diff line change
Expand Up @@ -379,8 +379,7 @@ static int tcx_probe(struct platform_device *op)

spin_lock_init(&par->lock);

par->lowdepth =
(of_find_property(dp, "tcx-8-bit", NULL) != NULL);
par->lowdepth = of_property_read_bool(dp, "tcx-8-bit");

sbusfb_fill_var(&info->var, dp, 8);
info->var.red.length = 8;
Expand Down
3 changes: 3 additions & 0 deletions drivers/video/fbdev/tgafb.c
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,9 @@ tgafb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
{
struct tga_par *par = (struct tga_par *)info->par;

if (!var->pixclock)
return -EINVAL;

if (par->tga_type == TGA_TYPE_8PLANE) {
if (var->bits_per_pixel != 8)
return -EINVAL;
Expand Down
4 changes: 1 addition & 3 deletions drivers/video/fbdev/wm8505fb.c
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,6 @@ static const struct fb_ops wm8505fb_ops = {
static int wm8505fb_probe(struct platform_device *pdev)
{
struct wm8505fb_info *fbi;
struct resource *res;
struct display_timings *disp_timing;
void *addr;
int ret;
Expand Down Expand Up @@ -299,8 +298,7 @@ static int wm8505fb_probe(struct platform_device *pdev)
addr = addr + sizeof(struct wm8505fb_info);
fbi->fb.pseudo_palette = addr;

res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
fbi->regbase = devm_ioremap_resource(&pdev->dev, res);
fbi->regbase = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(fbi->regbase))
return PTR_ERR(fbi->regbase);

Expand Down
6 changes: 2 additions & 4 deletions drivers/video/fbdev/xilinxfb.c
Original file line number Diff line number Diff line change
Expand Up @@ -273,8 +273,7 @@ static int xilinxfb_assign(struct platform_device *pdev,
if (drvdata->flags & BUS_ACCESS_FLAG) {
struct resource *res;

res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
drvdata->regs = devm_ioremap_resource(&pdev->dev, res);
drvdata->regs = devm_platform_get_and_ioremap_resource(pdev, 0, &res);
if (IS_ERR(drvdata->regs))
return PTR_ERR(drvdata->regs);

Expand Down Expand Up @@ -469,8 +468,7 @@ static int xilinxfb_of_probe(struct platform_device *pdev)
pdata.yvirt = prop[1];
}

if (of_find_property(pdev->dev.of_node, "rotate-display", NULL))
pdata.rotate_screen = 1;
pdata.rotate_screen = of_property_read_bool(pdev->dev.of_node, "rotate-display");

platform_set_drvdata(pdev, drvdata);
return xilinxfb_assign(pdev, drvdata, &pdata);
Expand Down
Loading

0 comments on commit a3671bd

Please sign in to comment.