Commit f4960b00 authored by Linus Torvalds's avatar Linus Torvalds

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
parents eec91e22 de5e89b6
......@@ -544,6 +544,36 @@ unregister_framebuffer(struct fb_info *fb_info)
}
EXPORT_SYMBOL(unregister_framebuffer);
static void devm_unregister_framebuffer(void *data)
{
struct fb_info *info = data;
unregister_framebuffer(info);
}
/**
* devm_register_framebuffer - resource-managed frame buffer device registration
* @dev: device the framebuffer belongs to
* @fb_info: frame buffer info structure
*
* Registers a frame buffer device @fb_info to device @dev.
*
* Returns negative errno on error, or zero for success.
*
*/
int
devm_register_framebuffer(struct device *dev, struct fb_info *fb_info)
{
int ret;
ret = register_framebuffer(fb_info);
if (ret)
return ret;
return devm_add_action_or_reset(dev, devm_unregister_framebuffer, fb_info);
}
EXPORT_SYMBOL(devm_register_framebuffer);
/**
* fb_set_suspend - low level driver signals suspend
* @info: framebuffer affected
......
......@@ -322,7 +322,7 @@ static ssize_t name##_show(struct device *dev, \
struct device_attribute *attr, \
char *buf) \
{ \
struct screen_info *si = dev_get_platdata(dev); \
struct screen_info *si = dev_get_drvdata(dev); \
if (!si) \
return -ENODEV; \
return sprintf(buf, fmt "\n", (si->lfb_##name)); \
......@@ -369,6 +369,8 @@ static int efifb_probe(struct platform_device *dev)
if (!si)
return -ENOMEM;
dev_set_drvdata(&dev->dev, si);
if (si->orig_video_isVGA != VIDEO_TYPE_EFI)
return -ENODEV;
......@@ -449,7 +451,6 @@ static int efifb_probe(struct platform_device *dev)
err = -ENOMEM;
goto err_release_mem;
}
platform_set_drvdata(dev, info);
par = info->par;
info->pseudo_palette = par->pseudo_palette;
......@@ -561,15 +562,10 @@ static int efifb_probe(struct platform_device *dev)
break;
}
err = sysfs_create_groups(&dev->dev.kobj, efifb_groups);
if (err) {
pr_err("efifb: cannot add sysfs attrs\n");
goto err_unmap;
}
err = fb_alloc_cmap(&info->cmap, 256, 0);
if (err < 0) {
pr_err("efifb: cannot allocate colormap\n");
goto err_groups;
goto err_unmap;
}
err = devm_aperture_acquire_for_platform_device(dev, par->base, par->size);
......@@ -577,7 +573,7 @@ static int efifb_probe(struct platform_device *dev)
pr_err("efifb: cannot acquire aperture\n");
goto err_fb_dealloc_cmap;
}
err = register_framebuffer(info);
err = devm_register_framebuffer(&dev->dev, info);
if (err < 0) {
pr_err("efifb: cannot register framebuffer\n");
goto err_fb_dealloc_cmap;
......@@ -587,8 +583,6 @@ static int efifb_probe(struct platform_device *dev)
err_fb_dealloc_cmap:
fb_dealloc_cmap(&info->cmap);
err_groups:
sysfs_remove_groups(&dev->dev.kobj, efifb_groups);
err_unmap:
if (mem_flags & (EFI_MEMORY_UC | EFI_MEMORY_WC))
iounmap(info->screen_base);
......@@ -602,21 +596,12 @@ static int efifb_probe(struct platform_device *dev)
return err;
}
static void efifb_remove(struct platform_device *pdev)
{
struct fb_info *info = platform_get_drvdata(pdev);
/* efifb_destroy takes care of info cleanup */
unregister_framebuffer(info);
sysfs_remove_groups(&pdev->dev.kobj, efifb_groups);
}
static struct platform_driver efifb_driver = {
.driver = {
.name = "efi-framebuffer",
.dev_groups = efifb_groups,
},
.probe = efifb_probe,
.remove_new = efifb_remove,
};
builtin_platform_driver(efifb_driver);
......@@ -345,6 +345,7 @@ static int hpfb_dio_probe(struct dio_dev *d, const struct dio_device_id *ent)
if (hpfb_init_one(paddr, vaddr)) {
if (d->scode >= DIOII_SCBASE)
iounmap((void *)vaddr);
release_mem_region(d->resource.start, resource_size(&d->resource));
return -ENOMEM;
}
return 0;
......
......@@ -1189,7 +1189,7 @@ static int hvfb_probe(struct hv_device *hdev,
* which is almost at the end of list, with priority = INT_MIN + 1.
*/
par->hvfb_panic_nb.notifier_call = hvfb_on_panic;
par->hvfb_panic_nb.priority = INT_MIN + 10,
par->hvfb_panic_nb.priority = INT_MIN + 10;
atomic_notifier_chain_register(&panic_notifier_list,
&par->hvfb_panic_nb);
......
......@@ -995,7 +995,7 @@ imsttfb_fillrect(struct fb_info *info, const struct fb_fillrect *rect)
bgc |= (bgc << 8);
bgc |= (bgc << 16);
Bpp = info->var.bits_per_pixel >> 3,
Bpp = info->var.bits_per_pixel >> 3;
line_pitch = info->fix.line_length;
dy = rect->dy * line_pitch;
......@@ -1036,7 +1036,7 @@ imsttfb_copyarea(struct fb_info *info, const struct fb_copyarea *area)
__u32 Bpp, line_pitch, fb_offset_old, fb_offset_new, sp, dp_octl;
__u32 cnt, bltctl, sx, sy, dx, dy, height, width;
Bpp = info->var.bits_per_pixel >> 3,
Bpp = info->var.bits_per_pixel >> 3;
sx = area->sx * Bpp;
sy = area->sy;
......
......@@ -512,16 +512,13 @@ static int mmphw_probe(struct platform_device *pdev)
}
/* get clock */
ctrl->clk = devm_clk_get(ctrl->dev, mi->clk_name);
ctrl->clk = devm_clk_get_enabled(ctrl->dev, mi->clk_name);
if (IS_ERR(ctrl->clk)) {
ret = PTR_ERR(ctrl->clk);
dev_err_probe(ctrl->dev, ret,
"unable to get clk %s\n", mi->clk_name);
goto failed;
}
ret = clk_prepare_enable(ctrl->clk);
if (ret)
goto failed;
/* init global regs */
ctrl_set_default(ctrl);
......@@ -556,7 +553,6 @@ static int mmphw_probe(struct platform_device *pdev)
path_deinit(path_plat);
}
clk_disable_unprepare(ctrl->clk);
failed:
dev_err(&pdev->dev, "device init failed\n");
......
......@@ -1241,14 +1241,13 @@ static ssize_t omapfb_show_caps_num(struct device *dev,
{
struct omapfb_device *fbdev = dev_get_drvdata(dev);
int plane;
size_t size;
size_t size = 0;
struct omapfb_caps caps;
plane = 0;
size = 0;
while (size < PAGE_SIZE && plane < OMAPFB_PLANE_NUM) {
while (plane < OMAPFB_PLANE_NUM) {
omapfb_get_caps(fbdev, plane, &caps);
size += scnprintf(&buf[size], PAGE_SIZE - size,
size += sysfs_emit_at(buf, size,
"plane#%d %#010x %#010x %#010x\n",
plane, caps.ctrl, caps.plane_color, caps.wnd_color);
plane++;
......@@ -1263,34 +1262,27 @@ static ssize_t omapfb_show_caps_text(struct device *dev,
int i;
struct omapfb_caps caps;
int plane;
size_t size;
size_t size = 0;
plane = 0;
size = 0;
while (size < PAGE_SIZE && plane < OMAPFB_PLANE_NUM) {
while (plane < OMAPFB_PLANE_NUM) {
omapfb_get_caps(fbdev, plane, &caps);
size += scnprintf(&buf[size], PAGE_SIZE - size,
"plane#%d:\n", plane);
for (i = 0; i < ARRAY_SIZE(ctrl_caps) &&
size < PAGE_SIZE; i++) {
size += sysfs_emit_at(buf, size, "plane#%d:\n", plane);
for (i = 0; i < ARRAY_SIZE(ctrl_caps); i++) {
if (ctrl_caps[i].flag & caps.ctrl)
size += scnprintf(&buf[size], PAGE_SIZE - size,
size += sysfs_emit_at(buf, size,
" %s\n", ctrl_caps[i].name);
}
size += scnprintf(&buf[size], PAGE_SIZE - size,
" plane colors:\n");
for (i = 0; i < ARRAY_SIZE(color_caps) &&
size < PAGE_SIZE; i++) {
size += sysfs_emit_at(buf, size, " plane colors:\n");
for (i = 0; i < ARRAY_SIZE(color_caps); i++) {
if (color_caps[i].flag & caps.plane_color)
size += scnprintf(&buf[size], PAGE_SIZE - size,
size += sysfs_emit_at(buf, size,
" %s\n", color_caps[i].name);
}
size += scnprintf(&buf[size], PAGE_SIZE - size,
" window colors:\n");
for (i = 0; i < ARRAY_SIZE(color_caps) &&
size < PAGE_SIZE; i++) {
size += sysfs_emit_at(buf, size, " window colors:\n");
for (i = 0; i < ARRAY_SIZE(color_caps); i++) {
if (color_caps[i].flag & caps.wnd_color)
size += scnprintf(&buf[size], PAGE_SIZE - size,
size += sysfs_emit_at(buf, size,
" %s\n", color_caps[i].name);
}
......
......@@ -466,19 +466,20 @@ static ssize_t show_cabc_available_modes(struct device *dev,
char *buf)
{
struct panel_drv_data *ddata = dev_get_drvdata(dev);
int len;
int len = 0;
int i;
if (!ddata->has_cabc)
return sysfs_emit(buf, "%s\n", cabc_modes[0]);
for (i = 0, len = 0;
len < PAGE_SIZE && i < ARRAY_SIZE(cabc_modes); i++)
len += snprintf(&buf[len], PAGE_SIZE - len, "%s%s%s",
i ? " " : "", cabc_modes[i],
i == ARRAY_SIZE(cabc_modes) - 1 ? "\n" : "");
for (i = 0; i < ARRAY_SIZE(cabc_modes); i++)
len += sysfs_emit_at(buf, len, "%s ", cabc_modes[i]);
/* Remove the trailing space */
if (len)
buf[len - 1] = '\n';
return len < PAGE_SIZE ? len : PAGE_SIZE - 1;
return len;
}
static DEVICE_ATTR(cabc_mode, S_IRUGO | S_IWUSR,
......
......@@ -351,7 +351,7 @@ struct omap_hdmi {
bool audio_configured;
struct omap_dss_audio audio_config;
/* This lock should be taken when booleans bellow are touched. */
/* This lock should be taken when booleans below are touched. */
spinlock_t audio_playing_lock;
bool audio_playing;
bool display_enabled;
......
......@@ -594,8 +594,8 @@ static int pxa3xx_gcu_probe(struct platform_device *pdev)
* container_of(). This isn't really necessary as we have a fixed minor
* number anyway, but this is to avoid statics. */
priv->misc_dev.minor = PXA3XX_GCU_MINOR,
priv->misc_dev.name = DRV_NAME,
priv->misc_dev.minor = PXA3XX_GCU_MINOR;
priv->misc_dev.name = DRV_NAME;
priv->misc_dev.fops = &pxa3xx_gcu_miscdev_fops;
/* handle IO resources */
......
......@@ -2403,6 +2403,7 @@ static void pxafb_remove(struct platform_device *dev)
info = &fbi->fb;
pxafb_overlay_exit(fbi);
cancel_work_sync(&fbi->task);
unregister_framebuffer(info);
pxafb_disable_controller(fbi);
......
......@@ -407,6 +407,7 @@ static int xenfb_probe(struct xenbus_device *dev,
/* complete the abuse: */
fb_info->pseudo_palette = fb_info->par;
fb_info->par = info;
fb_info->device = &dev->dev;
fb_info->screen_buffer = info->fb;
......
......@@ -601,6 +601,7 @@ extern ssize_t fb_sys_write(struct fb_info *info, const char __user *buf,
/* fbmem.c */
extern int register_framebuffer(struct fb_info *fb_info);
extern void unregister_framebuffer(struct fb_info *fb_info);
extern int devm_register_framebuffer(struct device *dev, struct fb_info *fb_info);
extern char* fb_get_buffer_offset(struct fb_info *info, struct fb_pixmap *buf, u32 size);
extern void fb_pad_unaligned_buffer(u8 *dst, u32 d_pitch, u8 *src, u32 idx,
u32 height, u32 shift_high, u32 shift_low, u32 mod);
......
......@@ -197,9 +197,26 @@ struct vgastate {
extern int save_vga(struct vgastate *state);
extern int restore_vga(struct vgastate *state);
static inline unsigned char vga_mm_r (void __iomem *regbase, unsigned short port)
{
return readb (regbase + port);
}
static inline void vga_mm_w (void __iomem *regbase, unsigned short port, unsigned char val)
{
writeb (val, regbase + port);
}
static inline void vga_mm_w_fast (void __iomem *regbase, unsigned short port,
unsigned char reg, unsigned char val)
{
writew (VGA_OUT16VAL (val, reg), regbase + port);
}
/*
* generic VGA port read/write
*/
#ifdef CONFIG_HAS_IOPORT
static inline unsigned char vga_io_r (unsigned short port)
{
......@@ -217,22 +234,6 @@ static inline void vga_io_w_fast (unsigned short port, unsigned char reg,
outw(VGA_OUT16VAL (val, reg), port);
}
static inline unsigned char vga_mm_r (void __iomem *regbase, unsigned short port)
{
return readb (regbase + port);
}
static inline void vga_mm_w (void __iomem *regbase, unsigned short port, unsigned char val)
{
writeb (val, regbase + port);
}
static inline void vga_mm_w_fast (void __iomem *regbase, unsigned short port,
unsigned char reg, unsigned char val)
{
writew (VGA_OUT16VAL (val, reg), regbase + port);
}
static inline unsigned char vga_r (void __iomem *regbase, unsigned short port)
{
if (regbase)
......@@ -258,8 +259,25 @@ static inline void vga_w_fast (void __iomem *regbase, unsigned short port,
else
vga_io_w_fast (port, reg, val);
}
#else /* CONFIG_HAS_IOPORT */
static inline unsigned char vga_r (void __iomem *regbase, unsigned short port)
{
return vga_mm_r (regbase, port);
}
static inline void vga_w (void __iomem *regbase, unsigned short port, unsigned char val)
{
vga_mm_w (regbase, port, val);
}
static inline void vga_w_fast (void __iomem *regbase, unsigned short port,
unsigned char reg, unsigned char val)
{
vga_mm_w_fast (regbase, port, reg, val);
}
#endif /* CONFIG_HAS_IOPORT */
/*
* VGA CRTC register read/write
*/
......@@ -280,6 +298,7 @@ static inline void vga_wcrt (void __iomem *regbase, unsigned char reg, unsigned
#endif /* VGA_OUTW_WRITE */
}
#ifdef CONFIG_HAS_IOPORT
static inline unsigned char vga_io_rcrt (unsigned char reg)
{
vga_io_w (VGA_CRT_IC, reg);
......@@ -295,6 +314,7 @@ static inline void vga_io_wcrt (unsigned char reg, unsigned char val)
vga_io_w (VGA_CRT_DC, val);
#endif /* VGA_OUTW_WRITE */
}
#endif /* CONFIG_HAS_IOPORT */
static inline unsigned char vga_mm_rcrt (void __iomem *regbase, unsigned char reg)
{
......@@ -333,6 +353,7 @@ static inline void vga_wseq (void __iomem *regbase, unsigned char reg, unsigned
#endif /* VGA_OUTW_WRITE */
}
#ifdef CONFIG_HAS_IOPORT
static inline unsigned char vga_io_rseq (unsigned char reg)
{
vga_io_w (VGA_SEQ_I, reg);
......@@ -348,6 +369,7 @@ static inline void vga_io_wseq (unsigned char reg, unsigned char val)
vga_io_w (VGA_SEQ_D, val);
#endif /* VGA_OUTW_WRITE */
}
#endif /* CONFIG_HAS_IOPORT */
static inline unsigned char vga_mm_rseq (void __iomem *regbase, unsigned char reg)
{
......@@ -385,6 +407,7 @@ static inline void vga_wgfx (void __iomem *regbase, unsigned char reg, unsigned
#endif /* VGA_OUTW_WRITE */
}
#ifdef CONFIG_HAS_IOPORT
static inline unsigned char vga_io_rgfx (unsigned char reg)
{
vga_io_w (VGA_GFX_I, reg);
......@@ -400,6 +423,7 @@ static inline void vga_io_wgfx (unsigned char reg, unsigned char val)
vga_io_w (VGA_GFX_D, val);
#endif /* VGA_OUTW_WRITE */
}
#endif /* CONFIG_HAS_IOPORT */
static inline unsigned char vga_mm_rgfx (void __iomem *regbase, unsigned char reg)
{
......@@ -434,6 +458,7 @@ static inline void vga_wattr (void __iomem *regbase, unsigned char reg, unsigned
vga_w (regbase, VGA_ATT_W, val);
}
#ifdef CONFIG_HAS_IOPORT
static inline unsigned char vga_io_rattr (unsigned char reg)
{
vga_io_w (VGA_ATT_IW, reg);
......@@ -445,6 +470,7 @@ static inline void vga_io_wattr (unsigned char reg, unsigned char val)
vga_io_w (VGA_ATT_IW, reg);
vga_io_w (VGA_ATT_W, val);
}
#endif /* CONFIG_HAS_IOPORT */
static inline unsigned char vga_mm_rattr (void __iomem *regbase, unsigned char reg)
{
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment