From: Nikita Danilov <Nikita@Namesys.COM>
To: Linux Kernel Mailing List <Linux-Kernel@Vger.Kernel.ORG>
Cc: Oleg Drokin <Green@Namesys.COM>, Jeff Dike <jdike@karaya.com>
Subject: [PATCH]: fix kobject initialization in drivers/char/tty_io.c
Date: Fri, 6 Jun 2003 21:07:35 +0400 [thread overview]
Message-ID: <16096.51799.485147.930465@laputa.namesys.com> (raw)
Hello,
in 2.5.70, UML fails to boot with
Initializing stdio console driver
Badness in kobject_get at lib/kobject.c:351
it seems that problem is that drivers/char/tty_io.c:tty_init() is now
called after arch/um/stdio_console.c:stdio_init(), and when the latter
calls tty_register_driver(), neither tty_kobj, nor tty_cdev are yet
initialized. Below is a work around.
Nikita.
===== drivers/char/tty_io.c 1.105 vs edited =====
--- 1.105/drivers/char/tty_io.c Fri Jun 6 02:19:36 2003
+++ edited/drivers/char/tty_io.c Fri Jun 6 20:27:05 2003
@@ -2233,6 +2233,19 @@
EXPORT_SYMBOL(tty_unregister_device);
static struct kobject tty_kobj = {.name = "tty"};
+static struct cdev tty_cdev, console_cdev;
+static int kobj_bootstraped = 0;
+static void kobj_bootstrap(void)
+{
+ if (!kobj_bootstraped) {
+ kobj_bootstraped = 1;
+ strcpy(tty_cdev.kobj.name, "dev.tty");
+ cdev_init(&tty_cdev, &tty_fops);
+ tty_kobj.kset = tty_cdev.kobj.kset;
+ kobject_register(&tty_kobj);
+ }
+}
+
/*
* Called by a tty driver to register itself.
*/
@@ -2261,6 +2274,8 @@
if (error < 0)
return error;
+ kobj_bootstrap();
+
driver->cdev.kobj.parent = &tty_kobj;
strcpy(driver->cdev.kobj.name, driver->name);
for (s = strchr(driver->cdev.kobj.name, '/'); s; s = strchr(s, '/'))
@@ -2372,7 +2387,6 @@
postcore_initcall(tty_class_init);
-static struct cdev tty_cdev, console_cdev;
#ifdef CONFIG_UNIX98_PTYS
static struct cdev ptmx_cdev;
#endif
@@ -2386,8 +2400,7 @@
*/
void __init tty_init(void)
{
- strcpy(tty_cdev.kobj.name, "dev.tty");
- cdev_init(&tty_cdev, &tty_fops);
+ kobj_bootstrap();
if (cdev_add(&tty_cdev, MKDEV(TTYAUX_MAJOR, 0), 1) ||
register_chrdev_region(MKDEV(TTYAUX_MAJOR, 0), 1, "/dev/tty") < 0)
panic("Couldn't register /dev/tty driver\n");
@@ -2401,9 +2414,6 @@
panic("Couldn't register /dev/console driver\n");
devfs_mk_cdev(MKDEV(TTYAUX_MAJOR, 1), S_IFCHR|S_IRUSR|S_IWUSR, "console");
tty_add_class_device ("console", MKDEV(TTYAUX_MAJOR, 1), NULL);
-
- tty_kobj.kset = tty_cdev.kobj.kset;
- kobject_register(&tty_kobj);
#ifdef CONFIG_UNIX98_PTYS
strcpy(ptmx_cdev.kobj.name, "dev.ptmx");
next reply other threads:[~2003-06-06 16:54 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-06-06 17:07 Nikita Danilov [this message]
2003-08-15 19:44 ` Jeff Dike
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=16096.51799.485147.930465@laputa.namesys.com \
--to=nikita@namesys.com \
--cc=Green@Namesys.COM \
--cc=Linux-Kernel@Vger.Kernel.ORG \
--cc=jdike@karaya.com \
/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®