Commit b68e31d0 authored by Jeff Dike's avatar Jeff Dike Committed by Linus Torvalds
Browse files

[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: default avatarJeff Dike <jdike@addtoit.com>
Acked-by: default avatarAlan Cox <alan@redhat.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent ed97bd37
......@@ -229,7 +229,7 @@ srmcons_close(struct tty_struct *tty, struct file *filp)
static struct tty_driver *srmcons_driver;
static struct tty_operations srmcons_ops = {
static const struct tty_operations srmcons_ops = {
.open = srmcons_open,
.close = srmcons_close,
.write = srmcons_write,
......
......@@ -940,7 +940,7 @@ static inline void show_serial_version(void)
printk(KERN_INFO " no serial options enabled\n");
}
static struct tty_operations hp_ops = {
static const struct tty_operations hp_ops = {
.open = rs_open,
.close = rs_close,
.write = rs_write,
......
......@@ -1720,7 +1720,7 @@ static int siccuart_open(struct tty_struct *tty, struct file *filp)
return 0;
}
static struct tty_operations sicc_ops = {
static const struct tty_operations sicc_ops = {
.open = siccuart_open,
.close = siccuart_close,
.write = siccuart_write,
......
......@@ -642,9 +642,9 @@ int line_remove(struct line *lines, unsigned int num, int n)
}
struct tty_driver *line_register_devfs(struct lines *set,
struct line_driver *line_driver,
struct tty_operations *ops, struct line *lines,
int nlines)
struct line_driver *line_driver,
const struct tty_operations *ops,
struct line *lines, int nlines)
{
int i;
struct tty_driver *driver = alloc_tty_driver(nlines);
......
......@@ -91,10 +91,9 @@ extern int line_setup_irq(int fd, int input, int output, struct line *line,
void *data);
extern void line_close_chan(struct line *line);
extern struct tty_driver * line_register_devfs(struct lines *set,
struct line_driver *line_driver,
struct tty_operations *driver,
struct line *lines,
int nlines);
struct line_driver *line_driver,
const struct tty_operations *driver,
struct line *lines, int nlines);
extern void lines_init(struct line *lines, int nlines, struct chan_opts *opts);
extern void close_lines(struct line *lines, int nlines);
......
......@@ -104,7 +104,7 @@ int memcons_tty_chars_in_buffer (struct tty_struct *tty)
return 0;
}
static struct tty_operations ops = {
static const struct tty_operations ops = {
.open = memcons_tty_open,
.write = memcons_tty_write,
.write_room = memcons_tty_write_room,
......
......@@ -77,7 +77,7 @@ int simcons_tty_chars_in_buffer (struct tty_struct *tty)
return 0;
}
static struct tty_operations ops = {
static const struct tty_operations ops = {
.open = simcons_tty_open,
.write = simcons_tty_write,
.write_room = simcons_tty_write_room,
......
......@@ -191,7 +191,7 @@ static int rs_read_proc(char *page, char **start, off_t off, int count,
}
static struct tty_operations serial_ops = {
static const struct tty_operations serial_ops = {
.open = rs_open,
.close = rs_close,
.write = rs_write,
......
......@@ -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,
......
......@@ -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,
......
......@@ -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,
......
......@@ -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,
......
......@@ -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,
......
......@@ -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,
......
......@@ -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,
......
......@@ -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,
......
......@@ -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,
......
......@@ -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,
......
......@@ -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,
......
......@@ -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,
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment