Re: [PATCH 09/33] fbcon: Remove fbcon_has_exited

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, May 25, 2019 at 05:38:26PM +0200, Sam Ravnborg wrote:
> Hi Daniel.
> 
> One detail I noticed while brosing the changes.
> 
> >  
> > @@ -1064,9 +1062,13 @@ static void fbcon_init(struct vc_data *vc, int init)
> >  	int logo = 1, new_rows, new_cols, rows, cols, charcnt = 256;
> >  	int cap, ret;
> >  
> > -	if (info_idx == -1 || info == NULL)
> > +	if (WARN_ON(info_idx == -1))
> >  	    return;
> >  
> > +	if (con2fb_map[vc->vc_num] == -1)
> > +		con2fb_map[vc->vc_num] = info_idx;
> > +
> > +	info = registered_fb[con2fb_map[vc->vc_num]];
> >  	cap = info->flags;
> 
> When info is defined it is also assigned:
> struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]];
> 
> As the test for info is gone this assignment is no longer
> requrired and can be deleted.

We use it later on, so we definitely still need info. But I indeed forgot
to delete the initial assignment of info at the function start. Is that
what you mean here?
>
> The code now assumes that there is always an fb_info if con2fb_map[]
> is not set to -1. I could not determine if this is OK, but this
> likely boils down to your locking concern of registered_fb.

Yup, see how fb_registered/unregistered manage this. I think that part
actually all works out correctly (as long as everyone is holding
console_lock). But it's a bit unpretty that fbcon digs around in the raw
registered_fb array instead of going through the refcounted helpers, and
having a full refcounted pointer. Much easier to convince yourself of that
than chasing indices assigments all over imo.
-Daniel

> 
> 	Sam
> 
> >  
> >  	if (logo_shown < 0 && console_loglevel <= CONSOLE_LOGLEVEL_QUIET)
> > @@ -3336,14 +3338,6 @@ static int fbcon_event_notify(struct notifier_block *self,
> >  	struct fb_blit_caps *caps;
> >  	int idx, ret = 0;
> >  
> > -	/*
> > -	 * ignore all events except driver registration and deregistration
> > -	 * if fbcon is not active
> > -	 */
> > -	if (fbcon_has_exited && !(action == FB_EVENT_FB_REGISTERED ||
> > -				  action == FB_EVENT_FB_UNREGISTERED))
> > -		goto done;
> > -
> >  	switch(action) {
> >  	case FB_EVENT_SUSPEND:
> >  		fbcon_suspended(info);
> > @@ -3396,7 +3390,6 @@ static int fbcon_event_notify(struct notifier_block *self,
> >  		fbcon_remap_all(idx);
> >  		break;
> >  	}
> > -done:
> >  	return ret;
> >  }
> >  
> > @@ -3443,9 +3436,6 @@ static ssize_t store_rotate(struct device *device,
> >  	int rotate, idx;
> >  	char **last = NULL;
> >  
> > -	if (fbcon_has_exited)
> > -		return count;
> > -
> >  	console_lock();
> >  	idx = con2fb_map[fg_console];
> >  
> > @@ -3468,9 +3458,6 @@ static ssize_t store_rotate_all(struct device *device,
> >  	int rotate, idx;
> >  	char **last = NULL;
> >  
> > -	if (fbcon_has_exited)
> > -		return count;
> > -
> >  	console_lock();
> >  	idx = con2fb_map[fg_console];
> >  
> > @@ -3491,9 +3478,6 @@ static ssize_t show_rotate(struct device *device,
> >  	struct fb_info *info;
> >  	int rotate = 0, idx;
> >  
> > -	if (fbcon_has_exited)
> > -		return 0;
> > -
> >  	console_lock();
> >  	idx = con2fb_map[fg_console];
> >  
> > @@ -3514,9 +3498,6 @@ static ssize_t show_cursor_blink(struct device *device,
> >  	struct fbcon_ops *ops;
> >  	int idx, blink = -1;
> >  
> > -	if (fbcon_has_exited)
> > -		return 0;
> > -
> >  	console_lock();
> >  	idx = con2fb_map[fg_console];
> >  
> > @@ -3543,9 +3524,6 @@ static ssize_t store_cursor_blink(struct device *device,
> >  	int blink, idx;
> >  	char **last = NULL;
> >  
> > -	if (fbcon_has_exited)
> > -		return count;
> > -
> >  	console_lock();
> >  	idx = con2fb_map[fg_console];
> >  
> > @@ -3668,9 +3646,6 @@ static void fbcon_exit(void)
> >  	struct fb_info *info;
> >  	int i, j, mapped;
> >  
> > -	if (fbcon_has_exited)
> > -		return;
> > -
> >  #ifdef CONFIG_FRAMEBUFFER_CONSOLE_DEFERRED_TAKEOVER
> >  	if (deferred_takeover) {
> >  		dummycon_unregister_output_notifier(&fbcon_output_nb);
> > @@ -3695,7 +3670,7 @@ static void fbcon_exit(void)
> >  		for (j = first_fb_vc; j <= last_fb_vc; j++) {
> >  			if (con2fb_map[j] == i) {
> >  				mapped = 1;
> > -				break;
> > +				con2fb_map[j] = -1;
> >  			}
> >  		}
> >  
> > @@ -3718,8 +3693,6 @@ static void fbcon_exit(void)
> >  				info->queue.func = NULL;
> >  		}
> >  	}
> > -
> > -	fbcon_has_exited = 1;
> >  }
> >  
> >  void __init fb_console_init(void)
> > -- 
> > 2.20.1
> > 
> > _______________________________________________
> > dri-devel mailing list
> > dri-devel@xxxxxxxxxxxxxxxxxxxxx
> > https://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux