From: Daniel Vetter <daniel.vetter@ffwll.ch>
To: Intel Graphics Development <intel-gfx@lists.freedesktop.org>
Cc: DRI Development <dri-devel@lists.freedesktop.org>,
LKML <linux-kernel@vger.kernel.org>,
Daniel Vetter <daniel.vetter@ffwll.ch>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Jiri Slaby <jslaby@suse.cz>
Subject: [PATCH 2/5] vt: Fix up unregistration of vt drivers
Date: Thu, 5 Jun 2014 16:58:25 +0200 [thread overview]
Message-ID: <1401980308-5116-2-git-send-email-daniel.vetter@ffwll.ch> (raw)
In-Reply-To: <1401980308-5116-1-git-send-email-daniel.vetter@ffwll.ch>
A bunch of issues:
- We should not kick out the default console (which is tracked in
conswitchp), so check for that.
- Add better error codes so callers can differentiate between "something
went wrong" and "your driver isn't registered already". i915 needs
that so it doesn't fall over when reloading the driver and hence
vga_con is already unregistered.
- There's a mess with the driver flags: What we need to check for is
that the driver isn't used any more, i.e. unbound completely (FLAG_INIT).
And not whether it's the boot console or not (which is the only one
which doesn't have FLAG_MODULE). Otherwise there's no way to kick
out the boot console, which i915 wants to do to prevent havoc with
vga_con interferring (which tends to hang machines).
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Jiri Slaby <jslaby@suse.cz>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
---
drivers/tty/vt/vt.c | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c
index ea600f482eeb..5077fe87324d 100644
--- a/drivers/tty/vt/vt.c
+++ b/drivers/tty/vt/vt.c
@@ -3573,17 +3573,20 @@ err:
*/
int do_unregister_con_driver(const struct consw *csw)
{
- int i, retval = -ENODEV;
+ int i;
/* cannot unregister a bound driver */
if (con_is_bound(csw))
- goto err;
+ return -EBUSY;
+
+ if (csw == conswitchp)
+ return -EINVAL;
for (i = 0; i < MAX_NR_CON_DRIVER; i++) {
struct con_driver *con_driver = ®istered_con_driver[i];
if (con_driver->con == csw &&
- con_driver->flag & CON_DRIVER_FLAG_MODULE) {
+ con_driver->flag & CON_DRIVER_FLAG_INIT) {
vtconsole_deinit_device(con_driver);
device_destroy(vtconsole_class,
MKDEV(0, con_driver->node));
@@ -3594,12 +3597,11 @@ int do_unregister_con_driver(const struct consw *csw)
con_driver->flag = 0;
con_driver->first = 0;
con_driver->last = 0;
- retval = 0;
- break;
+ return 0;
}
}
-err:
- return retval;
+
+ return -ENODEV;
}
EXPORT_SYMBOL_GPL(do_unregister_con_driver);
--
1.8.1.4
next prev parent reply other threads:[~2014-06-05 14:59 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-05 14:58 [PATCH 1/5] vt: Fix replacement console check when unbinding Daniel Vetter
2014-06-05 14:58 ` Daniel Vetter [this message]
2014-06-06 7:24 ` [PATCH 2/5] vt: Fix up unregistration of vt drivers David Herrmann
2014-06-06 7:56 ` Daniel Vetter
2014-06-06 8:47 ` David Herrmann
2014-06-06 9:40 ` Daniel Vetter
2014-06-06 15:51 ` Greg Kroah-Hartman
2014-06-06 20:21 ` [Intel-gfx] " Daniel Vetter
2014-06-05 14:58 ` [PATCH 3/5] vt: Don't ignore unbind errors in vt_unbind Daniel Vetter
2014-06-06 7:13 ` David Herrmann
2014-06-05 14:58 ` [PATCH 4/5] drm/i915: Fixup global gtt cleanup Daniel Vetter
2014-06-06 13:22 ` Imre Deak
2014-06-05 14:58 ` [PATCH 5/5] drm/i915: Kick out vga console Daniel Vetter
2014-06-06 7:28 ` David Herrmann
2014-06-06 7:47 ` Daniel Vetter
2014-06-06 15:20 ` Daniel Vetter
2014-06-09 13:22 ` Tomi Valkeinen
[not found] ` <1602327.OGkKxHtt2b@grover>
2014-06-29 3:55 ` Ed Tomlinson
2014-06-30 6:59 ` Chris Wilson
2014-06-30 8:19 ` David Herrmann
2014-07-01 13:51 ` Ed Tomlinson
2014-07-07 8:48 ` [Intel-gfx] " Daniel Vetter
2014-07-07 10:45 ` Ed Tomlinson
2014-07-07 12:26 ` Daniel Vetter
2014-07-08 2:53 ` Ed Tomlinson
2014-07-08 8:10 ` Daniel Vetter
2014-07-07 10:59 ` Ed Tomlinson
2014-06-06 7:16 ` [PATCH 1/5] vt: Fix replacement console check when unbinding David Herrmann
2014-06-06 7:49 ` Daniel Vetter
2014-06-06 9:43 ` [PATCH] " Daniel Vetter
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1401980308-5116-2-git-send-email-daniel.vetter@ffwll.ch \
--to=daniel.vetter@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=gregkh@linuxfoundation.org \
--cc=intel-gfx@lists.freedesktop.org \
--cc=jslaby@suse.cz \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®