[Intel-gfx] [PATCH 3/5] tty/vt: add con_bind and con_unbind functions

Ville Syrjälä ville.syrjala at linux.intel.com
Tue Oct 1 15:50:56 CEST 2013


On Thu, Sep 26, 2013 at 08:06:00PM -0300, Paulo Zanoni wrote:
> From: Paulo Zanoni <paulo.r.zanoni at intel.com>
> 
> The consoles who need to do something when unbinding or binding can
> optionally implement these functions.
> 
> The current problem I'm trying to solve is that when i915+fbcon is
> loaded on Haswell, if we disable the power well (to save power) the
> VGA interface gets completely disabled, so when we unbind fbcon we
> need to restore the VGA interface to allow vgacon to work.

We don't need to make it work. No one else does, and in the general case
it's even impossible since on some hardware that would definitely
corrupt the state that the real driver is attempting to use. The only
case where it might be nice to restore vgacon is on i915 unload, but no
one else does that either AFAIK, so I would not waste any cycles on
attempting that.

> 
> Signed-off-by: Paulo Zanoni <paulo.r.zanoni at intel.com>
> ---
>  drivers/tty/vt/vt.c     | 6 ++++++
>  include/linux/console.h | 2 ++
>  2 files changed, 8 insertions(+)
> 
> diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c
> index 9a8e8c5..beb5986 100644
> --- a/drivers/tty/vt/vt.c
> +++ b/drivers/tty/vt/vt.c
> @@ -3014,6 +3014,9 @@ static int do_bind_con_driver(const struct consw *csw, int first, int last,
>  	if (retval)
>  		goto err;
>  
> +	if (csw->con_bind)
> +		csw->con_bind();
> +
>  	if (!(con_driver->flag & CON_DRIVER_FLAG_INIT)) {
>  		csw->con_startup();
>  		con_driver->flag |= CON_DRIVER_FLAG_INIT;
> @@ -3152,6 +3155,9 @@ int do_unbind_con_driver(const struct consw *csw, int first, int last, int deflt
>  	if (!con_is_bound(csw))
>  		goto err;
>  
> +	if (csw->con_unbind)
> +		csw->con_unbind();
> +
>  	first = max(first, con_driver->first);
>  	last = min(last, con_driver->last);
>  
> diff --git a/include/linux/console.h b/include/linux/console.h
> index 7571a16..5cd2c35 100644
> --- a/include/linux/console.h
> +++ b/include/linux/console.h
> @@ -65,6 +65,8 @@ struct consw {
>  	 * Restore the console to its pre-debug state as closely as possible.
>  	 */
>  	int	(*con_debug_leave)(struct vc_data *);
> +	void	(*con_bind)(void);
> +	void	(*con_unbind)(void);
>  };
>  
>  extern const struct consw *conswitchp;
> -- 
> 1.8.3.1
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Ville Syrjälä
Intel OTC



More information about the Intel-gfx mailing list