Skip to content

Commit f4960b0

Browse files
committed
Merge tag 'fbdev-for-6.12-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/linux-fbdev
Pull fbdev updates from Helge Deller: - video: Reduce code when CONFIG_HAS_IOPORT=n - xenfb: Fix crash by assigning fb_info->device - pxafb: Fix possible use after free in pxafb_task() - efifb: Introduce and use new devm_register_framebuffer() function - mmpfb: Utilize devm_clk_get_enabled() helpers - various typo fixes and code cleanups * tag 'fbdev-for-6.12-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/linux-fbdev: fbdev: omapfb: Fix typo in comment fbdev: pxafb: Fix possible use after free in pxafb_task() fbdev: xen-fbfront: Assign fb_info->device fbdev: hyperv_fb: Convert comma to semicolon fbdev: imsttfb: convert comma to semicolon fbdev: pxa3xx-gcu: Convert comma to semicolon fbdev: efifb: Use driver-private screen_info for sysfs fbdev: efifb: Use devm_register_framebuffer() fbdev: efifb: Register sysfs groups through driver core fbdev: Introduce devm_register_framebuffer() fbdev: omapfb: Use sysfs_emit_at() to simplify code fbdev: omapfb: panel-sony-acx565akm: Simplify show_cabc_available_modes() fbdev: mmp: Use devm_clk_get_enabled() helpers fbdev: hpfb: Fix an error handling path in hpfb_dio_probe() video: Handle HAS_IOPORT dependencies
2 parents eec91e2 + de5e89b commit f4960b0

File tree

14 files changed

+111
-77
lines changed

14 files changed

+111
-77
lines changed

drivers/video/fbdev/core/fbmem.c

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -544,6 +544,36 @@ unregister_framebuffer(struct fb_info *fb_info)
544544
}
545545
EXPORT_SYMBOL(unregister_framebuffer);
546546

547+
static void devm_unregister_framebuffer(void *data)
548+
{
549+
struct fb_info *info = data;
550+
551+
unregister_framebuffer(info);
552+
}
553+
554+
/**
555+
* devm_register_framebuffer - resource-managed frame buffer device registration
556+
* @dev: device the framebuffer belongs to
557+
* @fb_info: frame buffer info structure
558+
*
559+
* Registers a frame buffer device @fb_info to device @dev.
560+
*
561+
* Returns negative errno on error, or zero for success.
562+
*
563+
*/
564+
int
565+
devm_register_framebuffer(struct device *dev, struct fb_info *fb_info)
566+
{
567+
int ret;
568+
569+
ret = register_framebuffer(fb_info);
570+
if (ret)
571+
return ret;
572+
573+
return devm_add_action_or_reset(dev, devm_unregister_framebuffer, fb_info);
574+
}
575+
EXPORT_SYMBOL(devm_register_framebuffer);
576+
547577
/**
548578
* fb_set_suspend - low level driver signals suspend
549579
* @info: framebuffer affected

drivers/video/fbdev/efifb.c

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ static ssize_t name##_show(struct device *dev, \
322322
struct device_attribute *attr, \
323323
char *buf) \
324324
{ \
325-
struct screen_info *si = dev_get_platdata(dev); \
325+
struct screen_info *si = dev_get_drvdata(dev); \
326326
if (!si) \
327327
return -ENODEV; \
328328
return sprintf(buf, fmt "\n", (si->lfb_##name)); \
@@ -369,6 +369,8 @@ static int efifb_probe(struct platform_device *dev)
369369
if (!si)
370370
return -ENOMEM;
371371

372+
dev_set_drvdata(&dev->dev, si);
373+
372374
if (si->orig_video_isVGA != VIDEO_TYPE_EFI)
373375
return -ENODEV;
374376

@@ -449,7 +451,6 @@ static int efifb_probe(struct platform_device *dev)
449451
err = -ENOMEM;
450452
goto err_release_mem;
451453
}
452-
platform_set_drvdata(dev, info);
453454
par = info->par;
454455
info->pseudo_palette = par->pseudo_palette;
455456

@@ -561,23 +562,18 @@ static int efifb_probe(struct platform_device *dev)
561562
break;
562563
}
563564

564-
err = sysfs_create_groups(&dev->dev.kobj, efifb_groups);
565-
if (err) {
566-
pr_err("efifb: cannot add sysfs attrs\n");
567-
goto err_unmap;
568-
}
569565
err = fb_alloc_cmap(&info->cmap, 256, 0);
570566
if (err < 0) {
571567
pr_err("efifb: cannot allocate colormap\n");
572-
goto err_groups;
568+
goto err_unmap;
573569
}
574570

575571
err = devm_aperture_acquire_for_platform_device(dev, par->base, par->size);
576572
if (err) {
577573
pr_err("efifb: cannot acquire aperture\n");
578574
goto err_fb_dealloc_cmap;
579575
}
580-
err = register_framebuffer(info);
576+
err = devm_register_framebuffer(&dev->dev, info);
581577
if (err < 0) {
582578
pr_err("efifb: cannot register framebuffer\n");
583579
goto err_fb_dealloc_cmap;
@@ -587,8 +583,6 @@ static int efifb_probe(struct platform_device *dev)
587583

588584
err_fb_dealloc_cmap:
589585
fb_dealloc_cmap(&info->cmap);
590-
err_groups:
591-
sysfs_remove_groups(&dev->dev.kobj, efifb_groups);
592586
err_unmap:
593587
if (mem_flags & (EFI_MEMORY_UC | EFI_MEMORY_WC))
594588
iounmap(info->screen_base);
@@ -602,21 +596,12 @@ static int efifb_probe(struct platform_device *dev)
602596
return err;
603597
}
604598

605-
static void efifb_remove(struct platform_device *pdev)
606-
{
607-
struct fb_info *info = platform_get_drvdata(pdev);
608-
609-
/* efifb_destroy takes care of info cleanup */
610-
unregister_framebuffer(info);
611-
sysfs_remove_groups(&pdev->dev.kobj, efifb_groups);
612-
}
613-
614599
static struct platform_driver efifb_driver = {
615600
.driver = {
616601
.name = "efi-framebuffer",
602+
.dev_groups = efifb_groups,
617603
},
618604
.probe = efifb_probe,
619-
.remove_new = efifb_remove,
620605
};
621606

622607
builtin_platform_driver(efifb_driver);

drivers/video/fbdev/hpfb.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,7 @@ static int hpfb_dio_probe(struct dio_dev *d, const struct dio_device_id *ent)
345345
if (hpfb_init_one(paddr, vaddr)) {
346346
if (d->scode >= DIOII_SCBASE)
347347
iounmap((void *)vaddr);
348+
release_mem_region(d->resource.start, resource_size(&d->resource));
348349
return -ENOMEM;
349350
}
350351
return 0;

drivers/video/fbdev/hyperv_fb.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1189,7 +1189,7 @@ static int hvfb_probe(struct hv_device *hdev,
11891189
* which is almost at the end of list, with priority = INT_MIN + 1.
11901190
*/
11911191
par->hvfb_panic_nb.notifier_call = hvfb_on_panic;
1192-
par->hvfb_panic_nb.priority = INT_MIN + 10,
1192+
par->hvfb_panic_nb.priority = INT_MIN + 10;
11931193
atomic_notifier_chain_register(&panic_notifier_list,
11941194
&par->hvfb_panic_nb);
11951195

drivers/video/fbdev/imsttfb.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -995,7 +995,7 @@ imsttfb_fillrect(struct fb_info *info, const struct fb_fillrect *rect)
995995
bgc |= (bgc << 8);
996996
bgc |= (bgc << 16);
997997

998-
Bpp = info->var.bits_per_pixel >> 3,
998+
Bpp = info->var.bits_per_pixel >> 3;
999999
line_pitch = info->fix.line_length;
10001000

10011001
dy = rect->dy * line_pitch;
@@ -1036,7 +1036,7 @@ imsttfb_copyarea(struct fb_info *info, const struct fb_copyarea *area)
10361036
__u32 Bpp, line_pitch, fb_offset_old, fb_offset_new, sp, dp_octl;
10371037
__u32 cnt, bltctl, sx, sy, dx, dy, height, width;
10381038

1039-
Bpp = info->var.bits_per_pixel >> 3,
1039+
Bpp = info->var.bits_per_pixel >> 3;
10401040

10411041
sx = area->sx * Bpp;
10421042
sy = area->sy;

drivers/video/fbdev/mmp/hw/mmp_ctrl.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -512,16 +512,13 @@ static int mmphw_probe(struct platform_device *pdev)
512512
}
513513

514514
/* get clock */
515-
ctrl->clk = devm_clk_get(ctrl->dev, mi->clk_name);
515+
ctrl->clk = devm_clk_get_enabled(ctrl->dev, mi->clk_name);
516516
if (IS_ERR(ctrl->clk)) {
517517
ret = PTR_ERR(ctrl->clk);
518518
dev_err_probe(ctrl->dev, ret,
519519
"unable to get clk %s\n", mi->clk_name);
520520
goto failed;
521521
}
522-
ret = clk_prepare_enable(ctrl->clk);
523-
if (ret)
524-
goto failed;
525522

526523
/* init global regs */
527524
ctrl_set_default(ctrl);
@@ -556,7 +553,6 @@ static int mmphw_probe(struct platform_device *pdev)
556553
path_deinit(path_plat);
557554
}
558555

559-
clk_disable_unprepare(ctrl->clk);
560556
failed:
561557
dev_err(&pdev->dev, "device init failed\n");
562558

drivers/video/fbdev/omap/omapfb_main.c

Lines changed: 14 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1241,14 +1241,13 @@ static ssize_t omapfb_show_caps_num(struct device *dev,
12411241
{
12421242
struct omapfb_device *fbdev = dev_get_drvdata(dev);
12431243
int plane;
1244-
size_t size;
1244+
size_t size = 0;
12451245
struct omapfb_caps caps;
12461246

12471247
plane = 0;
1248-
size = 0;
1249-
while (size < PAGE_SIZE && plane < OMAPFB_PLANE_NUM) {
1248+
while (plane < OMAPFB_PLANE_NUM) {
12501249
omapfb_get_caps(fbdev, plane, &caps);
1251-
size += scnprintf(&buf[size], PAGE_SIZE - size,
1250+
size += sysfs_emit_at(buf, size,
12521251
"plane#%d %#010x %#010x %#010x\n",
12531252
plane, caps.ctrl, caps.plane_color, caps.wnd_color);
12541253
plane++;
@@ -1263,34 +1262,27 @@ static ssize_t omapfb_show_caps_text(struct device *dev,
12631262
int i;
12641263
struct omapfb_caps caps;
12651264
int plane;
1266-
size_t size;
1265+
size_t size = 0;
12671266

12681267
plane = 0;
1269-
size = 0;
1270-
while (size < PAGE_SIZE && plane < OMAPFB_PLANE_NUM) {
1268+
while (plane < OMAPFB_PLANE_NUM) {
12711269
omapfb_get_caps(fbdev, plane, &caps);
1272-
size += scnprintf(&buf[size], PAGE_SIZE - size,
1273-
"plane#%d:\n", plane);
1274-
for (i = 0; i < ARRAY_SIZE(ctrl_caps) &&
1275-
size < PAGE_SIZE; i++) {
1270+
size += sysfs_emit_at(buf, size, "plane#%d:\n", plane);
1271+
for (i = 0; i < ARRAY_SIZE(ctrl_caps); i++) {
12761272
if (ctrl_caps[i].flag & caps.ctrl)
1277-
size += scnprintf(&buf[size], PAGE_SIZE - size,
1273+
size += sysfs_emit_at(buf, size,
12781274
" %s\n", ctrl_caps[i].name);
12791275
}
1280-
size += scnprintf(&buf[size], PAGE_SIZE - size,
1281-
" plane colors:\n");
1282-
for (i = 0; i < ARRAY_SIZE(color_caps) &&
1283-
size < PAGE_SIZE; i++) {
1276+
size += sysfs_emit_at(buf, size, " plane colors:\n");
1277+
for (i = 0; i < ARRAY_SIZE(color_caps); i++) {
12841278
if (color_caps[i].flag & caps.plane_color)
1285-
size += scnprintf(&buf[size], PAGE_SIZE - size,
1279+
size += sysfs_emit_at(buf, size,
12861280
" %s\n", color_caps[i].name);
12871281
}
1288-
size += scnprintf(&buf[size], PAGE_SIZE - size,
1289-
" window colors:\n");
1290-
for (i = 0; i < ARRAY_SIZE(color_caps) &&
1291-
size < PAGE_SIZE; i++) {
1282+
size += sysfs_emit_at(buf, size, " window colors:\n");
1283+
for (i = 0; i < ARRAY_SIZE(color_caps); i++) {
12921284
if (color_caps[i].flag & caps.wnd_color)
1293-
size += scnprintf(&buf[size], PAGE_SIZE - size,
1285+
size += sysfs_emit_at(buf, size,
12941286
" %s\n", color_caps[i].name);
12951287
}
12961288

drivers/video/fbdev/omap2/omapfb/displays/panel-sony-acx565akm.c

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -466,19 +466,20 @@ static ssize_t show_cabc_available_modes(struct device *dev,
466466
char *buf)
467467
{
468468
struct panel_drv_data *ddata = dev_get_drvdata(dev);
469-
int len;
469+
int len = 0;
470470
int i;
471471

472472
if (!ddata->has_cabc)
473473
return sysfs_emit(buf, "%s\n", cabc_modes[0]);
474474

475-
for (i = 0, len = 0;
476-
len < PAGE_SIZE && i < ARRAY_SIZE(cabc_modes); i++)
477-
len += snprintf(&buf[len], PAGE_SIZE - len, "%s%s%s",
478-
i ? " " : "", cabc_modes[i],
479-
i == ARRAY_SIZE(cabc_modes) - 1 ? "\n" : "");
475+
for (i = 0; i < ARRAY_SIZE(cabc_modes); i++)
476+
len += sysfs_emit_at(buf, len, "%s ", cabc_modes[i]);
477+
478+
/* Remove the trailing space */
479+
if (len)
480+
buf[len - 1] = '\n';
480481

481-
return len < PAGE_SIZE ? len : PAGE_SIZE - 1;
482+
return len;
482483
}
483484

484485
static DEVICE_ATTR(cabc_mode, S_IRUGO | S_IWUSR,

drivers/video/fbdev/omap2/omapfb/dss/hdmi.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ struct omap_hdmi {
351351
bool audio_configured;
352352
struct omap_dss_audio audio_config;
353353

354-
/* This lock should be taken when booleans bellow are touched. */
354+
/* This lock should be taken when booleans below are touched. */
355355
spinlock_t audio_playing_lock;
356356
bool audio_playing;
357357
bool display_enabled;

drivers/video/fbdev/pxa3xx-gcu.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -594,8 +594,8 @@ static int pxa3xx_gcu_probe(struct platform_device *pdev)
594594
* container_of(). This isn't really necessary as we have a fixed minor
595595
* number anyway, but this is to avoid statics. */
596596

597-
priv->misc_dev.minor = PXA3XX_GCU_MINOR,
598-
priv->misc_dev.name = DRV_NAME,
597+
priv->misc_dev.minor = PXA3XX_GCU_MINOR;
598+
priv->misc_dev.name = DRV_NAME;
599599
priv->misc_dev.fops = &pxa3xx_gcu_miscdev_fops;
600600

601601
/* handle IO resources */

0 commit comments

Comments
 (0)