Skip to content

Commit

Permalink
Merge branch 'topic/remove-fbcon-notifiers' into drm-misc-next
Browse files Browse the repository at this point in the history
topic/remove-fbcon-notifiers:
- remove fbdev notifier usage for fbcon, as prep work to clean up the fbcon locking
- assorted locking checks in vt/console code
- assorted notifier and cleanups in fbdev and backlight code

This is the pull request that was sent out, plus the compile fix for
sh4 reported by kbuild.

Acked-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
  • Loading branch information
Maarten Lankhorst committed Jun 19, 2019
2 parents bcb7416 + 2443091 commit d609f60
Show file tree
Hide file tree
Showing 27 changed files with 397 additions and 782 deletions.
13 changes: 11 additions & 2 deletions arch/arm/mach-pxa/am200epd.c
Original file line number Diff line number Diff line change
Expand Up @@ -347,8 +347,17 @@ int __init am200_init(void)
{
int ret;

/* before anything else, we request notification for any fb
* creation events */
/*
* Before anything else, we request notification for any fb
* creation events.
*
* FIXME: This is terrible and needs to be nuked. The notifier is used
* to get at the fb base address from the boot splash fb driver, which
* is then passed to metronomefb. Instaed of metronomfb or this board
* support file here figuring this out on their own.
*
* See also the #ifdef in fbmem.c.
*/
fb_register_client(&am200_fb_notif);

pxa2xx_mfp_config(ARRAY_AND_SIZE(am200_pin_config));
Expand Down
11 changes: 3 additions & 8 deletions drivers/gpu/vga/vga_switcheroo.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
#include <linux/debugfs.h>
#include <linux/fb.h>
#include <linux/fs.h>
#include <linux/fbcon.h>
#include <linux/module.h>
#include <linux/pci.h>
#include <linux/pm_domain.h>
Expand Down Expand Up @@ -734,14 +735,8 @@ static int vga_switchto_stage2(struct vga_switcheroo_client *new_client)
if (!active->driver_power_control)
set_audio_state(active->id, VGA_SWITCHEROO_OFF);

if (new_client->fb_info) {
struct fb_event event;

console_lock();
event.info = new_client->fb_info;
fb_notifier_call_chain(FB_EVENT_REMAP_ALL_CONSOLE, &event);
console_unlock();
}
if (new_client->fb_info)
fbcon_remap_all(new_client->fb_info);

mutex_lock(&vgasr_priv.mux_hw_lock);
ret = vgasr_priv.handler->switchto(new_client->id);
Expand Down
6 changes: 1 addition & 5 deletions drivers/media/pci/ivtv/ivtvfb.c
Original file line number Diff line number Diff line change
Expand Up @@ -1246,11 +1246,7 @@ static int ivtvfb_callback_cleanup(struct device *dev, void *p)
struct osd_info *oi = itv->osd_info;

if (itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT) {
if (unregister_framebuffer(&itv->osd_info->ivtvfb_info)) {
IVTVFB_WARN("Framebuffer %d is in use, cannot unload\n",
itv->instance);
return 0;
}
unregister_framebuffer(&itv->osd_info->ivtvfb_info);
IVTVFB_INFO("Unregister framebuffer %d\n", itv->instance);
itv->ivtvfb_restore = NULL;
ivtvfb_blank(FB_BLANK_VSYNC_SUSPEND, &oi->ivtvfb_info);
Expand Down
4 changes: 3 additions & 1 deletion drivers/staging/fbtft/fbtft-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -891,7 +891,9 @@ int fbtft_unregister_framebuffer(struct fb_info *fb_info)
if (par->fbtftops.unregister_backlight)
par->fbtftops.unregister_backlight(par);
fbtft_sysfs_exit(par);
return unregister_framebuffer(fb_info);
unregister_framebuffer(fb_info);

return 0;
}
EXPORT_SYMBOL(fbtft_unregister_framebuffer);

Expand Down
7 changes: 7 additions & 0 deletions drivers/staging/olpc_dcon/TODO
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
TODO:
- complete rewrite:
1. The underlying fbdev drivers need to be converted into drm kernel
modesetting drivers.
2. The dcon low-power display mode can then be integrated using the
drm damage tracking and self-refresh helpers.
This bolted-on self-refresh support that digs around in fbdev
internals, but isn't properly integrated, is not the correct solution.
- see if vx855 gpio API can be made similar enough to cs5535 so we can
share more code
- convert all uses of the old GPIO API from <linux/gpio.h> to the
Expand Down
6 changes: 1 addition & 5 deletions drivers/staging/olpc_dcon/olpc_dcon.c
Original file line number Diff line number Diff line change
Expand Up @@ -250,11 +250,7 @@ static bool dcon_blank_fb(struct dcon_priv *dcon, bool blank)
int err;

console_lock();
if (!lock_fb_info(dcon->fbinfo)) {
console_unlock();
dev_err(&dcon->client->dev, "unable to lock framebuffer\n");
return false;
}
lock_fb_info(dcon->fbinfo);

dcon->ignore_fb_events = true;
err = fb_blank(dcon->fbinfo,
Expand Down
18 changes: 18 additions & 0 deletions drivers/tty/vt/vt.c
Original file line number Diff line number Diff line change
Expand Up @@ -3822,6 +3822,8 @@ int con_is_bound(const struct consw *csw)
{
int i, bound = 0;

WARN_CONSOLE_UNLOCKED();

for (i = 0; i < MAX_NR_CONSOLES; i++) {
if (con_driver_map[i] == csw) {
bound = 1;
Expand All @@ -3833,6 +3835,20 @@ int con_is_bound(const struct consw *csw)
}
EXPORT_SYMBOL(con_is_bound);

/**
* con_is_visible - checks whether the current console is visible
* @vc: virtual console
*
* RETURNS: zero if not visible, nonzero if visible
*/
bool con_is_visible(const struct vc_data *vc)
{
WARN_CONSOLE_UNLOCKED();

return *vc->vc_display_fg == vc;
}
EXPORT_SYMBOL(con_is_visible);

/**
* con_debug_enter - prepare the console for the kernel debugger
* @sw: console driver
Expand Down Expand Up @@ -4166,6 +4182,8 @@ void do_blank_screen(int entering_gfx)
struct vc_data *vc = vc_cons[fg_console].d;
int i;

might_sleep();

WARN_CONSOLE_UNLOCKED();

if (console_blanked) {
Expand Down
2 changes: 1 addition & 1 deletion drivers/video/backlight/backlight.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ static int fb_notifier_callback(struct notifier_block *self,
int fb_blank = 0;

/* If we aren't interested in this event, skip it immediately ... */
if (event != FB_EVENT_BLANK && event != FB_EVENT_CONBLANK)
if (event != FB_EVENT_BLANK)
return 0;

bd = container_of(self, struct backlight_device, fb_notif);
Expand Down
12 changes: 0 additions & 12 deletions drivers/video/backlight/lcd.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,6 @@ static int fb_notifier_callback(struct notifier_block *self,
struct lcd_device *ld;
struct fb_event *evdata = data;

/* If we aren't interested in this event, skip it immediately ... */
switch (event) {
case FB_EVENT_BLANK:
case FB_EVENT_MODE_CHANGE:
case FB_EVENT_MODE_CHANGE_ALL:
case FB_EARLY_EVENT_BLANK:
case FB_R_EARLY_EVENT_BLANK:
break;
default:
return 0;
}

ld = container_of(self, struct lcd_device, fb_notif);
if (!ld->ops)
return 0;
Expand Down
6 changes: 6 additions & 0 deletions drivers/video/console/dummycon.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ static bool dummycon_putc_called;

void dummycon_register_output_notifier(struct notifier_block *nb)
{
WARN_CONSOLE_UNLOCKED();

raw_notifier_chain_register(&dummycon_output_nh, nb);

if (dummycon_putc_called)
Expand All @@ -42,11 +44,15 @@ void dummycon_register_output_notifier(struct notifier_block *nb)

void dummycon_unregister_output_notifier(struct notifier_block *nb)
{
WARN_CONSOLE_UNLOCKED();

raw_notifier_chain_unregister(&dummycon_output_nh, nb);
}

static void dummycon_putc(struct vc_data *vc, int c, int ypos, int xpos)
{
WARN_CONSOLE_UNLOCKED();

dummycon_putc_called = true;
raw_notifier_call_chain(&dummycon_output_nh, 0, NULL);
}
Expand Down
64 changes: 0 additions & 64 deletions drivers/video/fbdev/aty/aty128fb.c
Original file line number Diff line number Diff line change
Expand Up @@ -2350,70 +2350,6 @@ static int aty128fb_ioctl(struct fb_info *info, u_int cmd, u_long arg)
return -EINVAL;
}

#if 0
/*
* Accelerated functions
*/

static inline void aty128_rectcopy(int srcx, int srcy, int dstx, int dsty,
u_int width, u_int height,
struct fb_info_aty128 *par)
{
u32 save_dp_datatype, save_dp_cntl, dstval;

if (!width || !height)
return;

dstval = depth_to_dst(par->current_par.crtc.depth);
if (dstval == DST_24BPP) {
srcx *= 3;
dstx *= 3;
width *= 3;
} else if (dstval == -EINVAL) {
printk("aty128fb: invalid depth or RGBA\n");
return;
}

wait_for_fifo(2, par);
save_dp_datatype = aty_ld_le32(DP_DATATYPE);
save_dp_cntl = aty_ld_le32(DP_CNTL);

wait_for_fifo(6, par);
aty_st_le32(SRC_Y_X, (srcy << 16) | srcx);
aty_st_le32(DP_MIX, ROP3_SRCCOPY | DP_SRC_RECT);
aty_st_le32(DP_CNTL, DST_X_LEFT_TO_RIGHT | DST_Y_TOP_TO_BOTTOM);
aty_st_le32(DP_DATATYPE, save_dp_datatype | dstval | SRC_DSTCOLOR);

aty_st_le32(DST_Y_X, (dsty << 16) | dstx);
aty_st_le32(DST_HEIGHT_WIDTH, (height << 16) | width);

par->blitter_may_be_busy = 1;

wait_for_fifo(2, par);
aty_st_le32(DP_DATATYPE, save_dp_datatype);
aty_st_le32(DP_CNTL, save_dp_cntl);
}


/*
* Text mode accelerated functions
*/

static void fbcon_aty128_bmove(struct display *p, int sy, int sx, int dy,
int dx, int height, int width)
{
sx *= fontwidth(p);
sy *= fontheight(p);
dx *= fontwidth(p);
dy *= fontheight(p);
width *= fontwidth(p);
height *= fontheight(p);

aty128_rectcopy(sx, sy, dx, dy, width, height,
(struct fb_info_aty128 *)p->fb_info);
}
#endif /* 0 */

static void aty128_set_suspend(struct aty128fb_par *par, int suspend)
{
u32 pmgt;
Expand Down
3 changes: 1 addition & 2 deletions drivers/video/fbdev/aty/atyfb_base.c
Original file line number Diff line number Diff line change
Expand Up @@ -3916,8 +3916,7 @@ static int atyfb_reboot_notify(struct notifier_block *nb,
if (!reboot_info)
goto out;

if (!lock_fb_info(reboot_info))
goto out;
lock_fb_info(reboot_info);

par = reboot_info->par;

Expand Down
6 changes: 1 addition & 5 deletions drivers/video/fbdev/core/fbcmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -285,11 +285,7 @@ int fb_set_user_cmap(struct fb_cmap_user *cmap, struct fb_info *info)
goto out;
}
umap.start = cmap->start;
if (!lock_fb_info(info)) {
rc = -ENODEV;
goto out;
}

lock_fb_info(info);
rc = fb_set_cmap(&umap, info);
unlock_fb_info(info);
out:
Expand Down
Loading

0 comments on commit d609f60

Please sign in to comment.