* [PATCH]: fix kobject initialization in drivers/char/tty_io.c
@ 2003-06-06 17:07 Nikita Danilov
2003-08-15 19:44 ` Jeff Dike
0 siblings, 1 reply; 2+ messages in thread
From: Nikita Danilov @ 2003-06-06 17:07 UTC (permalink / raw)
To: Linux Kernel Mailing List; +Cc: Oleg Drokin, Jeff Dike
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");
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH]: fix kobject initialization in drivers/char/tty_io.c
2003-06-06 17:07 [PATCH]: fix kobject initialization in drivers/char/tty_io.c Nikita Danilov
@ 2003-08-15 19:44 ` Jeff Dike
0 siblings, 0 replies; 2+ messages in thread
From: Jeff Dike @ 2003-08-15 19:44 UTC (permalink / raw)
To: Nikita Danilov; +Cc: Linux Kernel Mailing List, Oleg Drokin
Nikita@Namesys.COM said:
> in 2.5.70, UML fails to boot with
> Initializing stdio console driver Badness in kobject_get at lib/
> kobject.c:351
I haven't seen this lately, so I'm guessing the ordering problem was fixed
when the console initcall stuff was added.
Jeff
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2003-08-15 19:39 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-06-06 17:07 [PATCH]: fix kobject initialization in drivers/char/tty_io.c Nikita Danilov
2003-08-15 19:44 ` Jeff Dike
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).