Skip to content

Commit

Permalink
Merge tag 'fbdev-for-6.7-rc1' 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 and cleanups from Helge Deller:

 - fix double free and resource leaks in imsttfb

 - lots of remove callback cleanups and section mismatch fixes in
   omapfb, amifb and atmel_lcdfb

 - error code fix and memparse simplification in omapfb

* tag 'fbdev-for-6.7-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/linux-fbdev: (31 commits)
  fbdev: fsl-diu-fb: mark wr_reg_wa() static
  fbdev: amifb: Convert to platform remove callback returning void
  fbdev: amifb: Mark driver struct with __refdata to prevent section mismatch warning
  fbdev: hyperv_fb: fix uninitialized local variable use
  fbdev: omapfb/tpd12s015: Convert to platform remove callback returning void
  fbdev: omapfb/tfp410: Convert to platform remove callback returning void
  fbdev: omapfb/sharp-ls037v7dw01: Convert to platform remove callback returning void
  fbdev: omapfb/opa362: Convert to platform remove callback returning void
  fbdev: omapfb/hdmi: Convert to platform remove callback returning void
  fbdev: omapfb/dvi: Convert to platform remove callback returning void
  fbdev: omapfb/dsi-cm: Convert to platform remove callback returning void
  fbdev: omapfb/dpi: Convert to platform remove callback returning void
  fbdev: omapfb/analog-tv: Convert to platform remove callback returning void
  fbdev: atmel_lcdfb: Convert to platform remove callback returning void
  fbdev: omapfb/tpd12s015: Don't put .remove() in .exit.text and drop suppress_bind_attrs
  fbdev: omapfb/tfp410: Don't put .remove() in .exit.text and drop suppress_bind_attrs
  fbdev: omapfb/sharp-ls037v7dw01: Don't put .remove() in .exit.text and drop suppress_bind_attrs
  fbdev: omapfb/opa362: Don't put .remove() in .exit.text and drop suppress_bind_attrs
  fbdev: omapfb/hdmi: Don't put .remove() in .exit.text and drop suppress_bind_attrs
  fbdev: omapfb/dvi: Don't put .remove() in .exit.text and drop suppress_bind_attrs
  ...
  • Loading branch information
torvalds committed Nov 10, 2023
2 parents c0d12d7 + a5035c8 commit 1855350
Show file tree
Hide file tree
Showing 18 changed files with 70 additions and 110 deletions.
13 changes: 9 additions & 4 deletions drivers/video/fbdev/amifb.c
Original file line number Diff line number Diff line change
Expand Up @@ -3752,7 +3752,7 @@ static int __init amifb_probe(struct platform_device *pdev)
}


static int __exit amifb_remove(struct platform_device *pdev)
static void __exit amifb_remove(struct platform_device *pdev)
{
struct fb_info *info = platform_get_drvdata(pdev);

Expand All @@ -3765,11 +3765,16 @@ static int __exit amifb_remove(struct platform_device *pdev)
chipfree();
framebuffer_release(info);
amifb_video_off();
return 0;
}

static struct platform_driver amifb_driver = {
.remove = __exit_p(amifb_remove),
/*
* amifb_remove() lives in .exit.text. For drivers registered via
* module_platform_driver_probe() this ok because they cannot get unboud at
* runtime. The driver needs to be marked with __refdata, otherwise modpost
* triggers a section mismatch warning.
*/
static struct platform_driver amifb_driver __refdata = {
.remove_new = __exit_p(amifb_remove),
.driver = {
.name = "amiga-video",
},
Expand Down
18 changes: 8 additions & 10 deletions drivers/video/fbdev/atmel_lcdfb.c
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ static inline void atmel_lcdfb_power_control(struct atmel_lcdfb_info *sinfo, int
}
}

static const struct fb_fix_screeninfo atmel_lcdfb_fix __initconst = {
static const struct fb_fix_screeninfo atmel_lcdfb_fix = {
.type = FB_TYPE_PACKED_PIXELS,
.visual = FB_VISUAL_TRUECOLOR,
.xpanstep = 0,
Expand Down Expand Up @@ -841,7 +841,7 @@ static void atmel_lcdfb_task(struct work_struct *work)
atmel_lcdfb_reset(sinfo);
}

static int __init atmel_lcdfb_init_fbinfo(struct atmel_lcdfb_info *sinfo)
static int atmel_lcdfb_init_fbinfo(struct atmel_lcdfb_info *sinfo)
{
struct fb_info *info = sinfo->info;
int ret = 0;
Expand Down Expand Up @@ -1017,7 +1017,7 @@ static int atmel_lcdfb_of_init(struct atmel_lcdfb_info *sinfo)
return ret;
}

static int __init atmel_lcdfb_probe(struct platform_device *pdev)
static int atmel_lcdfb_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
struct fb_info *info;
Expand Down Expand Up @@ -1223,14 +1223,14 @@ static int __init atmel_lcdfb_probe(struct platform_device *pdev)
return ret;
}

static int __exit atmel_lcdfb_remove(struct platform_device *pdev)
static void atmel_lcdfb_remove(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
struct fb_info *info = dev_get_drvdata(dev);
struct atmel_lcdfb_info *sinfo;

if (!info || !info->par)
return 0;
return;
sinfo = info->par;

cancel_work_sync(&sinfo->task);
Expand All @@ -1252,8 +1252,6 @@ static int __exit atmel_lcdfb_remove(struct platform_device *pdev)
}

framebuffer_release(info);

return 0;
}

#ifdef CONFIG_PM
Expand Down Expand Up @@ -1301,16 +1299,16 @@ static int atmel_lcdfb_resume(struct platform_device *pdev)
#endif

static struct platform_driver atmel_lcdfb_driver = {
.remove = __exit_p(atmel_lcdfb_remove),
.probe = atmel_lcdfb_probe,
.remove_new = atmel_lcdfb_remove,
.suspend = atmel_lcdfb_suspend,
.resume = atmel_lcdfb_resume,
.driver = {
.name = "atmel_lcdfb",
.of_match_table = atmel_lcdfb_dt_ids,
},
};

module_platform_driver_probe(atmel_lcdfb_driver, atmel_lcdfb_probe);
module_platform_driver(atmel_lcdfb_driver);

MODULE_DESCRIPTION("AT91 LCD Controller framebuffer driver");
MODULE_AUTHOR("Nicolas Ferre <[email protected]>");
Expand Down
2 changes: 1 addition & 1 deletion drivers/video/fbdev/fsl-diu-fb.c
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ static enum fsl_diu_monitor_port fsl_diu_name_to_port(const char *s)
* Workaround for failed writing desc register of planes.
* Needed with MPC5121 DIU rev 2.0 silicon.
*/
void wr_reg_wa(u32 *reg, u32 val)
static void wr_reg_wa(u32 *reg, u32 val)
{
do {
out_be32(reg, val);
Expand Down
2 changes: 2 additions & 0 deletions drivers/video/fbdev/hyperv_fb.c
Original file line number Diff line number Diff line change
Expand Up @@ -1013,6 +1013,8 @@ static int hvfb_getmem(struct hv_device *hdev, struct fb_info *info)
} else if (IS_ENABLED(CONFIG_SYSFB)) {
base = screen_info.lfb_base;
size = screen_info.lfb_size;
} else {
goto err1;
}

/*
Expand Down
35 changes: 17 additions & 18 deletions drivers/video/fbdev/imsttfb.c
Original file line number Diff line number Diff line change
Expand Up @@ -1421,7 +1421,6 @@ static int init_imstt(struct fb_info *info)
if ((info->var.xres * info->var.yres) * (info->var.bits_per_pixel >> 3) > info->fix.smem_len
|| !(compute_imstt_regvals(par, info->var.xres, info->var.yres))) {
printk("imsttfb: %ux%ux%u not supported\n", info->var.xres, info->var.yres, info->var.bits_per_pixel);
framebuffer_release(info);
return -ENODEV;
}

Expand Down Expand Up @@ -1453,14 +1452,11 @@ static int init_imstt(struct fb_info *info)
FBINFO_HWACCEL_FILLRECT |
FBINFO_HWACCEL_YPAN;

if (fb_alloc_cmap(&info->cmap, 0, 0)) {
framebuffer_release(info);
if (fb_alloc_cmap(&info->cmap, 0, 0))
return -ENODEV;
}

if (register_framebuffer(info) < 0) {
fb_dealloc_cmap(&info->cmap);
framebuffer_release(info);
return -ENODEV;
}

Expand Down Expand Up @@ -1500,8 +1496,8 @@ static int imsttfb_probe(struct pci_dev *pdev, const struct pci_device_id *ent)

if (!request_mem_region(addr, size, "imsttfb")) {
printk(KERN_ERR "imsttfb: Can't reserve memory region\n");
framebuffer_release(info);
return -ENODEV;
ret = -ENODEV;
goto release_info;
}

switch (pdev->device) {
Expand All @@ -1518,36 +1514,39 @@ static int imsttfb_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
printk(KERN_INFO "imsttfb: Device 0x%x unknown, "
"contact maintainer.\n", pdev->device);
ret = -ENODEV;
goto error;
goto release_mem_region;
}

info->fix.smem_start = addr;
info->screen_base = (__u8 *)ioremap(addr, par->ramdac == IBM ?
0x400000 : 0x800000);
if (!info->screen_base)
goto error;
goto release_mem_region;
info->fix.mmio_start = addr + 0x800000;
par->dc_regs = ioremap(addr + 0x800000, 0x1000);
if (!par->dc_regs)
goto error;
goto unmap_screen_base;
par->cmap_regs_phys = addr + 0x840000;
par->cmap_regs = (__u8 *)ioremap(addr + 0x840000, 0x1000);
if (!par->cmap_regs)
goto error;
goto unmap_dc_regs;
info->pseudo_palette = par->palette;
ret = init_imstt(info);
if (ret)
goto error;
goto unmap_cmap_regs;

pci_set_drvdata(pdev, info);
return ret;
return 0;

error:
if (par->dc_regs)
iounmap(par->dc_regs);
if (info->screen_base)
iounmap(info->screen_base);
unmap_cmap_regs:
iounmap(par->cmap_regs);
unmap_dc_regs:
iounmap(par->dc_regs);
unmap_screen_base:
iounmap(info->screen_base);
release_mem_region:
release_mem_region(addr, size);
release_info:
framebuffer_release(info);
return ret;
}
Expand Down
8 changes: 3 additions & 5 deletions drivers/video/fbdev/offb.c
Original file line number Diff line number Diff line change
Expand Up @@ -423,11 +423,9 @@ static void offb_init_fb(struct platform_device *parent, const char *name,
fix = &info->fix;
var = &info->var;

if (name) {
strcpy(fix->id, "OFfb ");
strncat(fix->id, name, sizeof(fix->id) - sizeof("OFfb "));
fix->id[sizeof(fix->id) - 1] = '\0';
} else
if (name)
snprintf(fix->id, sizeof(fix->id), "OFfb %s", name);
else
snprintf(fix->id, sizeof(fix->id), "OFfb %pOFn", dp);


Expand Down
28 changes: 10 additions & 18 deletions drivers/video/fbdev/omap/omapfb_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1643,17 +1643,16 @@ static int omapfb_do_probe(struct platform_device *pdev,
r = -ENOMEM;
goto cleanup;
}
fbdev->int_irq = platform_get_irq(pdev, 0);
if (fbdev->int_irq < 0) {
r = -ENXIO;

r = platform_get_irq(pdev, 0);
if (r < 0)
goto cleanup;
}
fbdev->int_irq = r;

fbdev->ext_irq = platform_get_irq(pdev, 1);
if (fbdev->ext_irq < 0) {
r = -ENXIO;
r = platform_get_irq(pdev, 1);
if (r < 0)
goto cleanup;
}
fbdev->ext_irq = r;

init_state++;

Expand Down Expand Up @@ -1857,20 +1856,13 @@ static int __init omapfb_setup(char *options)
if (!strncmp(this_opt, "accel", 5))
def_accel = 1;
else if (!strncmp(this_opt, "vram:", 5)) {
unsigned long long vram;
char *suffix;
unsigned long vram;
vram = (simple_strtoul(this_opt + 5, &suffix, 0));

vram = memparse(this_opt + 5, &suffix);
switch (suffix[0]) {
case '\0':
break;
case 'm':
case 'M':
vram *= 1024;
fallthrough;
case 'k':
case 'K':
vram *= 1024;
break;
default:
pr_debug("omapfb: invalid vram suffix %c\n",
suffix[0]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ static int tvc_probe(struct platform_device *pdev)
return r;
}

static int __exit tvc_remove(struct platform_device *pdev)
static void tvc_remove(struct platform_device *pdev)
{
struct panel_drv_data *ddata = platform_get_drvdata(pdev);
struct omap_dss_device *dssdev = &ddata->dssdev;
Expand All @@ -233,8 +233,6 @@ static int __exit tvc_remove(struct platform_device *pdev)
tvc_disconnect(dssdev);

omap_dss_put_device(in);

return 0;
}

static const struct of_device_id tvc_of_match[] = {
Expand All @@ -247,11 +245,10 @@ MODULE_DEVICE_TABLE(of, tvc_of_match);

static struct platform_driver tvc_connector_driver = {
.probe = tvc_probe,
.remove = __exit_p(tvc_remove),
.remove_new = tvc_remove,
.driver = {
.name = "connector-analog-tv",
.of_match_table = tvc_of_match,
.suppress_bind_attrs = true,
},
};

Expand Down
7 changes: 2 additions & 5 deletions drivers/video/fbdev/omap2/omapfb/displays/connector-dvi.c
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ static int dvic_probe(struct platform_device *pdev)
return r;
}

static int __exit dvic_remove(struct platform_device *pdev)
static void dvic_remove(struct platform_device *pdev)
{
struct panel_drv_data *ddata = platform_get_drvdata(pdev);
struct omap_dss_device *dssdev = &ddata->dssdev;
Expand All @@ -317,8 +317,6 @@ static int __exit dvic_remove(struct platform_device *pdev)
omap_dss_put_device(in);

i2c_put_adapter(ddata->i2c_adapter);

return 0;
}

static const struct of_device_id dvic_of_match[] = {
Expand All @@ -330,11 +328,10 @@ MODULE_DEVICE_TABLE(of, dvic_of_match);

static struct platform_driver dvi_connector_driver = {
.probe = dvic_probe,
.remove = __exit_p(dvic_remove),
.remove_new = dvic_remove,
.driver = {
.name = "connector-dvi",
.of_match_table = dvic_of_match,
.suppress_bind_attrs = true,
},
};

Expand Down
7 changes: 2 additions & 5 deletions drivers/video/fbdev/omap2/omapfb/displays/connector-hdmi.c
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ static int hdmic_probe(struct platform_device *pdev)
return r;
}

static int __exit hdmic_remove(struct platform_device *pdev)
static void hdmic_remove(struct platform_device *pdev)
{
struct panel_drv_data *ddata = platform_get_drvdata(pdev);
struct omap_dss_device *dssdev = &ddata->dssdev;
Expand All @@ -261,8 +261,6 @@ static int __exit hdmic_remove(struct platform_device *pdev)
hdmic_disconnect(dssdev);

omap_dss_put_device(in);

return 0;
}

static const struct of_device_id hdmic_of_match[] = {
Expand All @@ -274,11 +272,10 @@ MODULE_DEVICE_TABLE(of, hdmic_of_match);

static struct platform_driver hdmi_connector_driver = {
.probe = hdmic_probe,
.remove = __exit_p(hdmic_remove),
.remove_new = hdmic_remove,
.driver = {
.name = "connector-hdmi",
.of_match_table = hdmic_of_match,
.suppress_bind_attrs = true,
},
};

Expand Down
7 changes: 2 additions & 5 deletions drivers/video/fbdev/omap2/omapfb/displays/encoder-opa362.c
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ static int opa362_probe(struct platform_device *pdev)
return r;
}

static int __exit opa362_remove(struct platform_device *pdev)
static void opa362_remove(struct platform_device *pdev)
{
struct panel_drv_data *ddata = platform_get_drvdata(pdev);
struct omap_dss_device *dssdev = &ddata->dssdev;
Expand All @@ -248,8 +248,6 @@ static int __exit opa362_remove(struct platform_device *pdev)
opa362_disconnect(dssdev, dssdev->dst);

omap_dss_put_device(in);

return 0;
}

static const struct of_device_id opa362_of_match[] = {
Expand All @@ -260,11 +258,10 @@ MODULE_DEVICE_TABLE(of, opa362_of_match);

static struct platform_driver opa362_driver = {
.probe = opa362_probe,
.remove = __exit_p(opa362_remove),
.remove_new = opa362_remove,
.driver = {
.name = "amplifier-opa362",
.of_match_table = opa362_of_match,
.suppress_bind_attrs = true,
},
};

Expand Down
Loading

0 comments on commit 1855350

Please sign in to comment.