From b68e31d0ebbcc909d1941f9f230c9d062a3a13d3 Mon Sep 17 00:00:00 2001 From: Jeff Dike Date: Mon, 2 Oct 2006 02:17:18 -0700 Subject: [PATCH] const struct tty_operations As part of an SMP cleanliness pass over UML, I consted a bunch of structures in order to not have to document their locking. One of these structures was a struct tty_operations. In order to const it in UML without introducing compiler complaints, the declaration of tty_set_operations needs to be changed, and then all of its callers need to be fixed. This patch declares all struct tty_operations in the tree as const. In all cases, they are static and used only as input to tty_set_operations. As an extra check, I ran an i386 allyesconfig build which produced no extra warnings. 53 drivers are affected. I checked the history of a bunch of them, and in most cases, there have been only a handful of maintenance changes in the last six months. serial_core.c was the busiest one that I looked at. Signed-off-by: Jeff Dike Acked-by: Alan Cox Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/char/amiserial.c | 2 +- drivers/char/cyclades.c | 2 +- drivers/char/epca.c | 2 +- drivers/char/esp.c | 2 +- drivers/char/hvc_console.c | 2 +- drivers/char/hvcs.c | 2 +- drivers/char/hvsi.c | 2 +- drivers/char/ip2/ip2main.c | 2 +- drivers/char/isicom.c | 2 +- drivers/char/istallion.c | 2 +- drivers/char/moxa.c | 2 +- drivers/char/mxser.c | 2 +- drivers/char/pcmcia/synclink_cs.c | 2 +- drivers/char/pty.c | 2 +- drivers/char/rio/rio_linux.c | 2 +- drivers/char/riscom8.c | 2 +- drivers/char/rocket.c | 2 +- drivers/char/ser_a2232.c | 2 +- drivers/char/serial167.c | 2 +- drivers/char/specialix.c | 2 +- drivers/char/stallion.c | 2 +- drivers/char/sx.c | 2 +- drivers/char/synclink.c | 2 +- drivers/char/synclink_gt.c | 2 +- drivers/char/synclinkmp.c | 2 +- drivers/char/tty_io.c | 3 ++- drivers/char/viocons.c | 2 +- drivers/char/vme_scc.c | 2 +- drivers/char/vt.c | 2 +- 29 files changed, 30 insertions(+), 29 deletions(-) (limited to 'drivers/char') diff --git a/drivers/char/amiserial.c b/drivers/char/amiserial.c index 9d6713a93ed..d0e92ed0a36 100644 --- a/drivers/char/amiserial.c +++ b/drivers/char/amiserial.c @@ -1958,7 +1958,7 @@ static void show_serial_version(void) } -static struct tty_operations serial_ops = { +static const struct tty_operations serial_ops = { .open = rs_open, .close = rs_close, .write = rs_write, diff --git a/drivers/char/cyclades.c b/drivers/char/cyclades.c index c1c67281750..f85b4eb1661 100644 --- a/drivers/char/cyclades.c +++ b/drivers/char/cyclades.c @@ -5205,7 +5205,7 @@ done: extra ports are ignored. */ -static struct tty_operations cy_ops = { +static const struct tty_operations cy_ops = { .open = cy_open, .close = cy_close, .write = cy_write, diff --git a/drivers/char/epca.c b/drivers/char/epca.c index 86d290e9f30..3baa2ab8cbd 100644 --- a/drivers/char/epca.c +++ b/drivers/char/epca.c @@ -1125,7 +1125,7 @@ static void __exit epca_module_exit(void) module_exit(epca_module_exit); -static struct tty_operations pc_ops = { +static const struct tty_operations pc_ops = { .open = pc_open, .close = pc_close, .write = pc_write, diff --git a/drivers/char/esp.c b/drivers/char/esp.c index afcd83d9984..05788c75d7f 100644 --- a/drivers/char/esp.c +++ b/drivers/char/esp.c @@ -2376,7 +2376,7 @@ static inline int autoconfig(struct esp_struct * info) return (port_detected); } -static struct tty_operations esp_ops = { +static const struct tty_operations esp_ops = { .open = esp_open, .close = rs_close, .write = rs_write, diff --git a/drivers/char/hvc_console.c b/drivers/char/hvc_console.c index a76d2c40dd5..4053d1cd393 100644 --- a/drivers/char/hvc_console.c +++ b/drivers/char/hvc_console.c @@ -696,7 +696,7 @@ int khvcd(void *unused) return 0; } -static struct tty_operations hvc_ops = { +static const struct tty_operations hvc_ops = { .open = hvc_open, .close = hvc_close, .write = hvc_write, diff --git a/drivers/char/hvcs.c b/drivers/char/hvcs.c index 4589ff302b0..0b89bcde8c5 100644 --- a/drivers/char/hvcs.c +++ b/drivers/char/hvcs.c @@ -1306,7 +1306,7 @@ static int hvcs_chars_in_buffer(struct tty_struct *tty) return hvcsd->chars_in_buffer; } -static struct tty_operations hvcs_ops = { +static const struct tty_operations hvcs_ops = { .open = hvcs_open, .close = hvcs_close, .hangup = hvcs_hangup, diff --git a/drivers/char/hvsi.c b/drivers/char/hvsi.c index a89a95fb5e4..c07dc58d5c1 100644 --- a/drivers/char/hvsi.c +++ b/drivers/char/hvsi.c @@ -1130,7 +1130,7 @@ static int hvsi_tiocmset(struct tty_struct *tty, struct file *file, } -static struct tty_operations hvsi_ops = { +static const struct tty_operations hvsi_ops = { .open = hvsi_open, .close = hvsi_close, .write = hvsi_write, diff --git a/drivers/char/ip2/ip2main.c b/drivers/char/ip2/ip2main.c index 331f447e622..4828bc914ce 100644 --- a/drivers/char/ip2/ip2main.c +++ b/drivers/char/ip2/ip2main.c @@ -458,7 +458,7 @@ cleanup_module(void) } #endif /* MODULE */ -static struct tty_operations ip2_ops = { +static const struct tty_operations ip2_ops = { .open = ip2_open, .close = ip2_close, .write = ip2_write, diff --git a/drivers/char/isicom.c b/drivers/char/isicom.c index 2e1da632aee..ea2bbf80ad3 100644 --- a/drivers/char/isicom.c +++ b/drivers/char/isicom.c @@ -1550,7 +1550,7 @@ static void isicom_unregister_ioregion(struct pci_dev *pdev) board->base = 0; } -static struct tty_operations isicom_ops = { +static const struct tty_operations isicom_ops = { .open = isicom_open, .close = isicom_close, .write = isicom_write, diff --git a/drivers/char/istallion.c b/drivers/char/istallion.c index 6b4d82a4565..d6e031542c6 100644 --- a/drivers/char/istallion.c +++ b/drivers/char/istallion.c @@ -4636,7 +4636,7 @@ static int stli_memioctl(struct inode *ip, struct file *fp, unsigned int cmd, un return rc; } -static struct tty_operations stli_ops = { +static const struct tty_operations stli_ops = { .open = stli_open, .close = stli_close, .write = stli_write, diff --git a/drivers/char/moxa.c b/drivers/char/moxa.c index c1a6d3c48da..b401383808c 100644 --- a/drivers/char/moxa.c +++ b/drivers/char/moxa.c @@ -281,7 +281,7 @@ static int moxa_get_serial_info(struct moxa_str *, struct serial_struct __user * static int moxa_set_serial_info(struct moxa_str *, struct serial_struct __user *); static void MoxaSetFifo(int port, int enable); -static struct tty_operations moxa_ops = { +static const struct tty_operations moxa_ops = { .open = moxa_open, .close = moxa_close, .write = moxa_write, diff --git a/drivers/char/mxser.c b/drivers/char/mxser.c index 27a65377204..8253fca8efd 100644 --- a/drivers/char/mxser.c +++ b/drivers/char/mxser.c @@ -453,7 +453,7 @@ static int CheckIsMoxaMust(int io) /* above is modified by Victor Yu. 08-15-2002 */ -static struct tty_operations mxser_ops = { +static const struct tty_operations mxser_ops = { .open = mxser_open, .close = mxser_close, .write = mxser_write, diff --git a/drivers/char/pcmcia/synclink_cs.c b/drivers/char/pcmcia/synclink_cs.c index 00f574cbb0d..dd845cbefe9 100644 --- a/drivers/char/pcmcia/synclink_cs.c +++ b/drivers/char/pcmcia/synclink_cs.c @@ -3010,7 +3010,7 @@ static struct pcmcia_driver mgslpc_driver = { .resume = mgslpc_resume, }; -static struct tty_operations mgslpc_ops = { +static const struct tty_operations mgslpc_ops = { .open = mgslpc_open, .close = mgslpc_close, .write = mgslpc_write, diff --git a/drivers/char/pty.c b/drivers/char/pty.c index 34dd4c38110..80d3eedd7f9 100644 --- a/drivers/char/pty.c +++ b/drivers/char/pty.c @@ -224,7 +224,7 @@ static void pty_set_termios(struct tty_struct *tty, struct termios *old_termios) tty->termios->c_cflag |= (CS8 | CREAD); } -static struct tty_operations pty_ops = { +static const struct tty_operations pty_ops = { .open = pty_open, .close = pty_close, .write = pty_write, diff --git a/drivers/char/rio/rio_linux.c b/drivers/char/rio/rio_linux.c index 3fa80aaf452..202a3b0945b 100644 --- a/drivers/char/rio/rio_linux.c +++ b/drivers/char/rio/rio_linux.c @@ -727,7 +727,7 @@ static struct vpd_prom *get_VPD_PROM(struct Host *hp) return &vpdp; } -static struct tty_operations rio_ops = { +static const struct tty_operations rio_ops = { .open = riotopen, .close = gs_close, .write = gs_write, diff --git a/drivers/char/riscom8.c b/drivers/char/riscom8.c index 06b9f78a95d..214d850112f 100644 --- a/drivers/char/riscom8.c +++ b/drivers/char/riscom8.c @@ -1583,7 +1583,7 @@ static void do_softint(void *private_) } } -static struct tty_operations riscom_ops = { +static const struct tty_operations riscom_ops = { .open = rc_open, .close = rc_close, .write = rc_write, diff --git a/drivers/char/rocket.c b/drivers/char/rocket.c index 0ac13188132..bac80056f7e 100644 --- a/drivers/char/rocket.c +++ b/drivers/char/rocket.c @@ -2334,7 +2334,7 @@ static int __init init_ISA(int i) return (1); } -static struct tty_operations rocket_ops = { +static const struct tty_operations rocket_ops = { .open = rp_open, .close = rp_close, .write = rp_write, diff --git a/drivers/char/ser_a2232.c b/drivers/char/ser_a2232.c index 510bd3e0e88..65c751d0d64 100644 --- a/drivers/char/ser_a2232.c +++ b/drivers/char/ser_a2232.c @@ -661,7 +661,7 @@ static void a2232_init_portstructs(void) } } -static struct tty_operations a2232_ops = { +static const struct tty_operations a2232_ops = { .open = a2232_open, .close = gs_close, .write = gs_write, diff --git a/drivers/char/serial167.c b/drivers/char/serial167.c index 21a710cb4bb..b4ea1266b66 100644 --- a/drivers/char/serial167.c +++ b/drivers/char/serial167.c @@ -2158,7 +2158,7 @@ mvme167_serial_console_setup(int cflag) rcor >> 5, rbpr); } /* serial_console_init */ -static struct tty_operations cy_ops = { +static const struct tty_operations cy_ops = { .open = cy_open, .close = cy_close, .write = cy_write, diff --git a/drivers/char/specialix.c b/drivers/char/specialix.c index f52c7c31bad..902c48dca3b 100644 --- a/drivers/char/specialix.c +++ b/drivers/char/specialix.c @@ -2363,7 +2363,7 @@ static void do_softint(void *private_) func_exit(); } -static struct tty_operations sx_ops = { +static const struct tty_operations sx_ops = { .open = sx_open, .close = sx_close, .write = sx_write, diff --git a/drivers/char/stallion.c b/drivers/char/stallion.c index 3beb2203d24..bd711537ec4 100644 --- a/drivers/char/stallion.c +++ b/drivers/char/stallion.c @@ -2993,7 +2993,7 @@ static int stl_memioctl(struct inode *ip, struct file *fp, unsigned int cmd, uns return(rc); } -static struct tty_operations stl_ops = { +static const struct tty_operations stl_ops = { .open = stl_open, .close = stl_close, .write = stl_write, diff --git a/drivers/char/sx.c b/drivers/char/sx.c index e1cd2bc4b1e..57e31e5eaed 100644 --- a/drivers/char/sx.c +++ b/drivers/char/sx.c @@ -2226,7 +2226,7 @@ static int probe_si (struct sx_board *board) return 1; } -static struct tty_operations sx_ops = { +static const struct tty_operations sx_ops = { .break_ctl = sx_break, .open = sx_open, .close = gs_close, diff --git a/drivers/char/synclink.c b/drivers/char/synclink.c index 78b1b1a2732..244dc308c77 100644 --- a/drivers/char/synclink.c +++ b/drivers/char/synclink.c @@ -4360,7 +4360,7 @@ static struct mgsl_struct* mgsl_allocate_device(void) } /* end of mgsl_allocate_device()*/ -static struct tty_operations mgsl_ops = { +static const struct tty_operations mgsl_ops = { .open = mgsl_open, .close = mgsl_close, .write = mgsl_write, diff --git a/drivers/char/synclink_gt.c b/drivers/char/synclink_gt.c index 78bc85180c8..bdc7cb248b8 100644 --- a/drivers/char/synclink_gt.c +++ b/drivers/char/synclink_gt.c @@ -3441,7 +3441,7 @@ static void __devexit remove_one(struct pci_dev *dev) { } -static struct tty_operations ops = { +static const struct tty_operations ops = { .open = open, .close = close, .write = write, diff --git a/drivers/char/synclinkmp.c b/drivers/char/synclinkmp.c index 66f3754fbbd..6eb75dcd796 100644 --- a/drivers/char/synclinkmp.c +++ b/drivers/char/synclinkmp.c @@ -3929,7 +3929,7 @@ void device_init(int adapter_num, struct pci_dev *pdev) } } -static struct tty_operations ops = { +static const struct tty_operations ops = { .open = open, .close = close, .write = write, diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c index 333741770f1..e90ea39c7c4 100644 --- a/drivers/char/tty_io.c +++ b/drivers/char/tty_io.c @@ -3680,7 +3680,8 @@ void put_tty_driver(struct tty_driver *driver) kfree(driver); } -void tty_set_operations(struct tty_driver *driver, struct tty_operations *op) +void tty_set_operations(struct tty_driver *driver, + const struct tty_operations *op) { driver->open = op->open; driver->close = op->close; diff --git a/drivers/char/viocons.c b/drivers/char/viocons.c index f3efeaf2826..a362ee9c92d 100644 --- a/drivers/char/viocons.c +++ b/drivers/char/viocons.c @@ -1047,7 +1047,7 @@ static int send_open(HvLpIndex remoteLp, void *sem) 0, 0, 0, 0); } -static struct tty_operations serial_ops = { +static const struct tty_operations serial_ops = { .open = viotty_open, .close = viotty_close, .write = viotty_write, diff --git a/drivers/char/vme_scc.c b/drivers/char/vme_scc.c index bfe5ea948f6..c2ca31eb850 100644 --- a/drivers/char/vme_scc.c +++ b/drivers/char/vme_scc.c @@ -113,7 +113,7 @@ static struct real_driver scc_real_driver = { }; -static struct tty_operations scc_ops = { +static const struct tty_operations scc_ops = { .open = scc_open, .close = gs_close, .write = gs_write, diff --git a/drivers/char/vt.c b/drivers/char/vt.c index 303956d3456..ec0c070bf15 100644 --- a/drivers/char/vt.c +++ b/drivers/char/vt.c @@ -2675,7 +2675,7 @@ static int __init con_init(void) } console_initcall(con_init); -static struct tty_operations con_ops = { +static const struct tty_operations con_ops = { .open = con_open, .close = con_close, .write = con_write, -- cgit v1.2.3