From: Aivils S. <ai...@us...> - 2004-02-12 06:37:45
|
Update of /cvsroot/linuxconsole/ruby/ruby-2.6/drivers/char In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12910/ruby-2.6/drivers/char Modified Files: vt.c vt_proc.c vt_sysfs.c Log Message: vt is a class. fbdev and fbcon load in any order. Index: vt.c =================================================================== RCS file: /cvsroot/linuxconsole/ruby/ruby-2.6/drivers/char/vt.c,v retrieving revision 1.15 retrieving revision 1.16 diff -u -d -r1.15 -r1.16 --- vt.c 9 Feb 2004 07:33:28 -0000 1.15 +++ vt.c 12 Feb 2004 06:33:04 -0000 1.16 @@ -907,7 +907,7 @@ */ static void visual_init(struct vc_data *vc, int init) { - struct vc_data *default_mode = vc->display_fg->default_mode; + /*struct vc_data *default_mode = vc->display_fg->default_mode;*/ /* ++Geert: sw->con_startup determines console size */ vc->vc_uni_pagedir_loc = &vc->vc_uni_pagedir; @@ -1772,6 +1772,12 @@ update_screen(vt->fg_console); current_vc += vc_count; current_vt += 1; + if (vt->vt_kmalloced) { + vt_create_sysfs_dev_files(vt); +#ifdef CONFIG_PROC_FS + vt_proc_attach(vt); +#endif + } return display_desc; } @@ -1839,6 +1845,10 @@ if (tty_register_driver(console_driver)) panic("Couldn't register console driver\n"); + vt_sysfs_init(); +#ifdef CONFIG_PROC_FS + vt_proc_init(); +#endif #if defined (CONFIG_PROM_CONSOLE) prom_con_init(); #endif @@ -1848,10 +1858,6 @@ kbd_init(); console_map_init(); vcs_init(); -#ifdef CONFIG_PROC_FS - vt_proc_init(); -#endif - vt_sysfs_init(); return 0; } Index: vt_proc.c =================================================================== RCS file: /cvsroot/linuxconsole/ruby/ruby-2.6/drivers/char/vt_proc.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- vt_proc.c 9 Feb 2004 07:31:07 -0000 1.4 +++ vt_proc.c 12 Feb 2004 06:33:04 -0000 1.5 @@ -193,17 +193,11 @@ int __init vt_proc_init(void) { - struct vt_struct *vt; - - if (list_empty(&vt_list)) - return 0; - - proc_bus_console_dir = proc_mkdir(VT_PROC_DIR, proc_bus); - list_for_each_entry (vt, &vt_list, node) { - vt_proc_attach(vt); - } + /* we have only one boot time console - admin_vt*/ + proc_bus_console_dir = proc_mkdir(VT_PROC_DIR, proc_bus); + vt_proc_attach(admin_vt); - return 0; + return 0; } #endif /* CONFIG_PROC_FS */ Index: vt_sysfs.c =================================================================== RCS file: /cvsroot/linuxconsole/ruby/ruby-2.6/drivers/char/vt_sysfs.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- vt_sysfs.c 9 Feb 2004 07:33:28 -0000 1.1 +++ vt_sysfs.c 12 Feb 2004 06:33:04 -0000 1.2 @@ -13,16 +13,18 @@ /* show configuration fields */ #define vt_config_attr(field, format_string) \ static ssize_t \ -vt_show_##field (struct device *dev, char *buf) \ +vt_show_##field (struct class_device *dev, char *buf) \ { \ struct vt_struct *vt; \ \ vt = to_vt_struct (dev); \ return sprintf (buf, format_string, vt->field); \ } \ -static DEVICE_ATTR(field, S_IRUGO, vt_show_##field, NULL); +static CLASS_DEVICE_ATTR(field, S_IRUGO, vt_show_##field, NULL); -struct device vt_parent_dev; +struct class vt_class = { + .name = "vt", +}; vt_config_attr(display_desc, "%s\n"); vt_config_attr(first_vc, "%d\n"); @@ -30,7 +32,7 @@ static ssize_t -vt_show_keyboard (struct device *dev, char *buf) +vt_show_keyboard (struct class_device *dev, char *buf) { struct vt_struct *vt; struct input_handle *handle; @@ -41,84 +43,28 @@ return sprintf (buf, "%s\n", handle->dev->phys); return sprintf (buf, "%s\n", ""); } -static DEVICE_ATTR(keyboard, S_IRUGO, vt_show_keyboard, NULL); - -/** - * vt_dev_get - increments the reference count of the pci device structure - * @vt: the device being referenced - * - * Each live reference to a device should be refcounted. - * - * Drivers for VT devices should normally record such references in - * their probe() methods, when they bind to a device, and release - * them by calling vt_dev_put(), in their disconnect() methods. - * - * A pointer to the device with the incremented reference counter is returned. - */ -struct vt_struct *vt_dev_get(struct vt_struct *vt) -{ - struct device *tmp; - - if (!vt) - return NULL; - - tmp = get_device(&vt->dev); - if (tmp) - return to_vt_struct(tmp); - else - return NULL; -} - -/** - * vt_dev_put - release a use of the pci device structure - * @vt: device that's been disconnected - * - * Must be called when a user of a device is finished with it. When the last - * user of the device calls this function, the memory of the device is freed. - */ -void vt_dev_put(struct vt_struct *vt) -{ - if (vt) - put_device(&vt->dev); -} - -struct bus_type vt_bus_type = { - .name = "vt", -}; - +static CLASS_DEVICE_ATTR(keyboard, S_IRUGO, vt_show_keyboard, NULL); int __init vt_create_sysfs_dev_files (struct vt_struct *vt) { - struct device *dev = &vt->dev; + struct class_device *dev = &vt->dev; - bus_register(&vt_bus_type); - dev->parent = &vt_parent_dev; - dev->bus = &vt_bus_type; - device_initialize(dev); - dev->release = NULL; /* release_vt */ - vt_dev_get(vt); - sprintf (dev->bus_id, "%02x", vt->vt_num); - device_add(dev); + dev->class = &vt_class; + sprintf (dev->class_id, "%02x", vt->vt_num); + class_device_register(dev); /* current configuration's attributes */ - device_create_file (dev, &dev_attr_display_desc); - device_create_file (dev, &dev_attr_first_vc); - device_create_file (dev, &dev_attr_vc_count); - device_create_file (dev, &dev_attr_keyboard); + class_device_create_file (dev, &class_device_attr_display_desc); + class_device_create_file (dev, &class_device_attr_first_vc); + class_device_create_file (dev, &class_device_attr_vc_count); + class_device_create_file (dev, &class_device_attr_keyboard); return 0; } void __init vt_sysfs_init(void) { - struct device *dev=&vt_parent_dev; - struct vt_struct *vt; - - memset(dev, 0, sizeof(*dev)); - dev->parent = NULL; - sprintf(dev->bus_id, "wagadubu"); - device_register(dev); - list_for_each_entry (vt, &vt_list, node) { - vt_create_sysfs_dev_files(vt); - } + /* we have only one boot time console - admin_vt*/ + class_register(&vt_class); + vt_create_sysfs_dev_files(admin_vt); } |