Skip to content

Commit b68e31d

Browse files
cfd-36Linus Torvalds
authored andcommitted
[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 <jdike@addtoit.com> Acked-by: Alan Cox <alan@redhat.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
1 parent ed97bd3 commit b68e31d

57 files changed

Lines changed: 63 additions & 62 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎arch/alpha/kernel/srmcons.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ srmcons_close(struct tty_struct *tty, struct file *filp)
229229

230230
static struct tty_driver *srmcons_driver;
231231

232-
static struct tty_operations srmcons_ops = {
232+
static const struct tty_operations srmcons_ops = {
233233
.open = srmcons_open,
234234
.close = srmcons_close,
235235
.write = srmcons_write,

‎arch/ia64/hp/sim/simserial.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -940,7 +940,7 @@ static inline void show_serial_version(void)
940940
printk(KERN_INFO " no serial options enabled\n");
941941
}
942942

943-
static struct tty_operations hp_ops = {
943+
static const struct tty_operations hp_ops = {
944944
.open = rs_open,
945945
.close = rs_close,
946946
.write = rs_write,

‎arch/ppc/4xx_io/serial_sicc.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1720,7 +1720,7 @@ static int siccuart_open(struct tty_struct *tty, struct file *filp)
17201720
return 0;
17211721
}
17221722

1723-
static struct tty_operations sicc_ops = {
1723+
static const struct tty_operations sicc_ops = {
17241724
.open = siccuart_open,
17251725
.close = siccuart_close,
17261726
.write = siccuart_write,

‎arch/um/drivers/line.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -642,9 +642,9 @@ int line_remove(struct line *lines, unsigned int num, int n)
642642
}
643643

644644
struct tty_driver *line_register_devfs(struct lines *set,
645-
struct line_driver *line_driver,
646-
struct tty_operations *ops, struct line *lines,
647-
int nlines)
645+
struct line_driver *line_driver,
646+
const struct tty_operations *ops,
647+
struct line *lines, int nlines)
648648
{
649649
int i;
650650
struct tty_driver *driver = alloc_tty_driver(nlines);

‎arch/um/include/line.h‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,9 @@ extern int line_setup_irq(int fd, int input, int output, struct line *line,
9191
void *data);
9292
extern void line_close_chan(struct line *line);
9393
extern struct tty_driver * line_register_devfs(struct lines *set,
94-
struct line_driver *line_driver,
95-
struct tty_operations *driver,
96-
struct line *lines,
97-
int nlines);
94+
struct line_driver *line_driver,
95+
const struct tty_operations *driver,
96+
struct line *lines, int nlines);
9897
extern void lines_init(struct line *lines, int nlines, struct chan_opts *opts);
9998
extern void close_lines(struct line *lines, int nlines);
10099

‎arch/v850/kernel/memcons.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ int memcons_tty_chars_in_buffer (struct tty_struct *tty)
104104
return 0;
105105
}
106106

107-
static struct tty_operations ops = {
107+
static const struct tty_operations ops = {
108108
.open = memcons_tty_open,
109109
.write = memcons_tty_write,
110110
.write_room = memcons_tty_write_room,

‎arch/v850/kernel/simcons.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ int simcons_tty_chars_in_buffer (struct tty_struct *tty)
7777
return 0;
7878
}
7979

80-
static struct tty_operations ops = {
80+
static const struct tty_operations ops = {
8181
.open = simcons_tty_open,
8282
.write = simcons_tty_write,
8383
.write_room = simcons_tty_write_room,

‎arch/xtensa/platform-iss/console.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ static int rs_read_proc(char *page, char **start, off_t off, int count,
191191
}
192192

193193

194-
static struct tty_operations serial_ops = {
194+
static const struct tty_operations serial_ops = {
195195
.open = rs_open,
196196
.close = rs_close,
197197
.write = rs_write,

‎drivers/char/amiserial.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1958,7 +1958,7 @@ static void show_serial_version(void)
19581958
}
19591959

19601960

1961-
static struct tty_operations serial_ops = {
1961+
static const struct tty_operations serial_ops = {
19621962
.open = rs_open,
19631963
.close = rs_close,
19641964
.write = rs_write,

‎drivers/char/cyclades.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5205,7 +5205,7 @@ cyclades_get_proc_info(char *buf, char **start, off_t offset, int length,
52055205
extra ports are ignored.
52065206
*/
52075207

5208-
static struct tty_operations cy_ops = {
5208+
static const struct tty_operations cy_ops = {
52095209
.open = cy_open,
52105210
.close = cy_close,
52115211
.write = cy_write,

0 commit comments

Comments
 (0)