[PATCH 2.3.x] struct consw is always const

From: Geert Uytterhoeven (geert@linux-m68k.org)
Date: Sat Oct 14 2000 - 12:27:04 EDT

  • Next message: Geert Uytterhoeven: "[PATCH 2.3.x] struct display_switch should be const"

    This patch changes all occurrencies of `struct consw' to `const struct consw'.
    It also removes a superfluous forward type declaration and a superfluous
    external function prototype.

    --- linux-const-consw-2.4.0-test10-pre2/include/linux/console.h Mon Jul 17 15:20:14 2000
    +++ geert-const-consw-2.4.0-test10-pre2/include/linux/console.h Sat Oct 14 17:13:06 2000
    @@ -50,16 +50,16 @@
             unsigned long (*con_getxy)(struct vc_data *, unsigned long, int *, int *);
     };
     
    -extern struct consw *conswitchp;
    +extern const struct consw *conswitchp;
     
    -extern struct consw dummy_con; /* dummy console buffer */
    -extern struct consw fb_con; /* frame buffer based console */
    -extern struct consw vga_con; /* VGA text console */
    -extern struct consw newport_con; /* SGI Newport console */
    -extern struct consw prom_con; /* SPARC PROM console */
    +extern const struct consw dummy_con; /* dummy console buffer */
    +extern const struct consw fb_con; /* frame buffer based console */
    +extern const struct consw vga_con; /* VGA text console */
    +extern const struct consw newport_con; /* SGI Newport console */
    +extern const struct consw prom_con; /* SPARC PROM console */
     
    -void take_over_console(struct consw *sw, int first, int last, int deflt);
    -void give_up_console(struct consw *sw);
    +void take_over_console(const struct consw *sw, int first, int last, int deflt);
    +void give_up_console(const struct consw *sw);
     
     /* scroll */
     #define SM_UP (1)
    --- linux-const-consw-2.4.0-test10-pre2/include/linux/console_struct.h Thu Sep 17 18:35:04 1998
    +++ geert-const-consw-2.4.0-test10-pre2/include/linux/console_struct.h Sat Oct 14 17:13:29 2000
    @@ -16,7 +16,7 @@
             unsigned int vc_cols; /* [#] Console size */
             unsigned int vc_rows;
             unsigned int vc_size_row; /* Bytes per row */
    - struct consw *vc_sw;
    + const struct consw *vc_sw;
             unsigned short *vc_screenbuf; /* In-memory character/attribute buffer */
             unsigned int vc_screenbuf_size;
             unsigned char vc_attr; /* Current attributes */
    --- linux-const-consw-2.4.0-test10-pre2/include/linux/vt_kern.h Mon Jul 17 14:33:46 2000
    +++ geert-const-consw-2.4.0-test10-pre2/include/linux/vt_kern.h Sat Oct 14 17:13:57 2000
    @@ -35,7 +35,6 @@
     /* console.c */
     
     struct console_font_op;
    -struct consw;
     
     int vc_allocate(unsigned int console);
     int vc_cons_allocated(unsigned int console);
    --- linux-const-consw-2.4.0-test10-pre2/drivers/char/console.c Fri Aug 11 13:53:24 2000
    +++ geert-const-consw-2.4.0-test10-pre2/drivers/char/console.c Sat Oct 14 17:11:52 2000
    @@ -108,7 +108,7 @@
     #include "console_macros.h"
     
     
    -struct consw *conswitchp = NULL;
    +const struct consw *conswitchp = NULL;
     
     /* A bitmap for codes <32. A bit of 1 indicates that the code
      * corresponding to that bit number invokes some special action
    @@ -136,7 +136,7 @@
     struct vc vc_cons [MAX_NR_CONSOLES];
     
     #ifndef VT_SINGLE_DRIVER
    -static struct consw *con_driver_map[MAX_NR_CONSOLES];
    +static const struct consw *con_driver_map[MAX_NR_CONSOLES];
     #endif
     
     static int con_open(struct tty_struct *, struct file *);
    @@ -2484,7 +2484,7 @@
      * and become default driver for newly opened ones.
      */
     
    -void take_over_console(struct consw *csw, int first, int last, int deflt)
    +void take_over_console(const struct consw *csw, int first, int last, int deflt)
     {
             int i, j = -1;
             const char *desc;
    @@ -2532,7 +2532,7 @@
                     printk("to %s\n", desc);
     }
     
    -void give_up_console(struct consw *csw)
    +void give_up_console(const struct consw *csw)
     {
             int i;
     
    --- linux-const-consw-2.4.0-test10-pre2/drivers/video/dummycon.c Fri Jul 28 21:19:18 2000
    +++ geert-const-consw-2.4.0-test10-pre2/drivers/video/dummycon.c Sat Oct 14 17:12:09 2000
    @@ -53,7 +53,7 @@
      * Most of the operations are dummies.
      */
     
    -struct consw dummy_con = {
    +const struct consw dummy_con = {
         con_startup: dummycon_startup,
         con_init: dummycon_init,
         con_deinit: DUMMY,
    --- linux-const-consw-2.4.0-test10-pre2/drivers/video/fbcon.c Wed Oct 4 19:53:25 2000
    +++ geert-const-consw-2.4.0-test10-pre2/drivers/video/fbcon.c Sat Oct 14 17:12:16 2000
    @@ -2384,7 +2384,7 @@
      * The console `switch' structure for the frame buffer based console
      */
      
    -struct consw fb_con = {
    +const struct consw fb_con = {
         con_startup: fbcon_startup,
         con_init: fbcon_init,
         con_deinit: fbcon_deinit,
    --- linux-const-consw-2.4.0-test10-pre2/drivers/video/mdacon.c Fri Jul 28 21:19:20 2000
    +++ geert-const-consw-2.4.0-test10-pre2/drivers/video/mdacon.c Sat Oct 14 17:12:20 2000
    @@ -585,7 +585,7 @@
      * The console `switch' structure for the MDA based console
      */
     
    -struct consw mda_con = {
    +const struct consw mda_con = {
             con_startup: mdacon_startup,
             con_init: mdacon_init,
             con_deinit: mdacon_deinit,
    --- linux-const-consw-2.4.0-test10-pre2/drivers/video/newport_con.c Fri Jul 28 21:19:20 2000
    +++ geert-const-consw-2.4.0-test10-pre2/drivers/video/newport_con.c Sat Oct 14 17:12:25 2000
    @@ -574,7 +574,7 @@
     
     #define DUMMY (void *) newport_dummy
     
    -struct consw newport_con = {
    +const struct consw newport_con = {
         con_startup: newport_startup,
         con_init: newport_init,
         con_deinit: DUMMY,
    --- linux-const-consw-2.4.0-test10-pre2/drivers/video/promcon.c Fri Jul 28 21:19:20 2000
    +++ geert-const-consw-2.4.0-test10-pre2/drivers/video/promcon.c Sat Oct 14 17:12:37 2000
    @@ -566,7 +566,7 @@
     
     #define DUMMY (void *) promcon_dummy
     
    -struct consw prom_con = {
    +const struct consw prom_con = {
             con_startup: promcon_startup,
             con_init: promcon_init,
             con_deinit: promcon_deinit,
    --- linux-const-consw-2.4.0-test10-pre2/drivers/video/vgacon.c Fri Jul 28 21:19:21 2000
    +++ geert-const-consw-2.4.0-test10-pre2/drivers/video/vgacon.c Sat Oct 14 17:12:47 2000
    @@ -1037,7 +1037,7 @@
     
     #define DUMMY (void *) vgacon_dummy
     
    -struct consw vga_con = {
    +const struct consw vga_con = {
             con_startup: vgacon_startup,
             con_init: vgacon_init,
             con_deinit: vgacon_deinit,
    --- linux-const-consw-2.4.0-test10-pre2/arch/m68k/mac/config.c Mon Jul 17 15:18:42 2000
    +++ geert-const-consw-2.4.0-test10-pre2/arch/m68k/mac/config.c Sat Oct 14 17:09:05 2000
    @@ -127,7 +127,6 @@
     }
     #endif
     
    -extern struct consw fb_con;
     extern struct fb_info *mac_fb_init(long *);
     
     extern void mac_default_handler(int, void *, struct pt_regs *);

    Gr{oetje,eeting}s,

                                                    Geert

    --
    Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
    

    In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds

    - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org Please read the FAQ at http://www.tux.org/lkml/



    This archive was generated by hypermail 2b29 : Sat Oct 14 2000 - 12:52:22 EDT