Skip to content

Commit 5e7672e

Browse files
cfd-36Linus Torvalds
authored andcommitted
[PATCH] uml: const more data
Make lots of structures const in order to make it obvious that they need no locking. Signed-off-by: Jeff Dike <jdike@addtoit.com> Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
1 parent 48af05e commit 5e7672e

40 files changed

Lines changed: 65 additions & 65 deletions

‎arch/um/drivers/chan_kern.c‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ static void not_configged_free(void *data)
110110
"UML\n");
111111
}
112112

113-
static struct chan_ops not_configged_ops = {
113+
static const struct chan_ops not_configged_ops = {
114114
.init = not_configged_init,
115115
.open = not_configged_open,
116116
.close = not_configged_close,
@@ -373,7 +373,7 @@ int console_write_chan(struct list_head *chans, const char *buf, int len)
373373
}
374374

375375
int console_open_chan(struct line *line, struct console *co,
376-
struct chan_opts *opts)
376+
const struct chan_opts *opts)
377377
{
378378
int err;
379379

@@ -494,10 +494,10 @@ int chan_config_string(struct list_head *chans, char *str, int size,
494494

495495
struct chan_type {
496496
char *key;
497-
struct chan_ops *ops;
497+
const struct chan_ops *ops;
498498
};
499499

500-
static struct chan_type chan_table[] = {
500+
static const struct chan_type chan_table[] = {
501501
{ "fd", &fd_ops },
502502

503503
#ifdef CONFIG_NULL_CHAN
@@ -534,10 +534,10 @@ static struct chan_type chan_table[] = {
534534
};
535535

536536
static struct chan *parse_chan(struct line *line, char *str, int device,
537-
struct chan_opts *opts)
537+
const struct chan_opts *opts)
538538
{
539-
struct chan_type *entry;
540-
struct chan_ops *ops;
539+
const struct chan_type *entry;
540+
const struct chan_ops *ops;
541541
struct chan *chan;
542542
void *data;
543543
int i;
@@ -582,7 +582,7 @@ static struct chan *parse_chan(struct line *line, char *str, int device,
582582
}
583583

584584
int parse_chan_pair(char *str, struct line *line, int device,
585-
struct chan_opts *opts)
585+
const struct chan_opts *opts)
586586
{
587587
struct list_head *chans = &line->chan_list;
588588
struct chan *new, *chan;

‎arch/um/drivers/daemon.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ struct daemon_data {
1818
void *dev;
1919
};
2020

21-
extern struct net_user_info daemon_user_info;
21+
extern const struct net_user_info daemon_user_info;
2222

2323
extern int daemon_user_write(int fd, void *buf, int len,
2424
struct daemon_data *pri);

‎arch/um/drivers/daemon_kern.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ static int daemon_write(int fd, struct sk_buff **skb,
5757
(struct daemon_data *) &lp->user));
5858
}
5959

60-
static struct net_kern_info daemon_kern_info = {
60+
static const struct net_kern_info daemon_kern_info = {
6161
.init = daemon_init,
6262
.protocol = eth_protocol,
6363
.read = daemon_read,

‎arch/um/drivers/daemon_user.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ static int daemon_set_mtu(int mtu, void *data)
182182
return(mtu);
183183
}
184184

185-
struct net_user_info daemon_user_info = {
185+
const struct net_user_info daemon_user_info = {
186186
.init = daemon_user_init,
187187
.open = daemon_open,
188188
.close = NULL,

‎arch/um/drivers/fd.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ struct fd_chan {
2020
char str[sizeof("1234567890\0")];
2121
};
2222

23-
static void *fd_init(char *str, int device, struct chan_opts *opts)
23+
static void *fd_init(char *str, int device, const struct chan_opts *opts)
2424
{
2525
struct fd_chan *data;
2626
char *end;
@@ -77,7 +77,7 @@ static void fd_close(int fd, void *d)
7777
}
7878
}
7979

80-
struct chan_ops fd_ops = {
80+
const struct chan_ops fd_ops = {
8181
.type = "fd",
8282
.init = fd_init,
8383
.open = fd_open,

‎arch/um/drivers/hostaudio_kern.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ static int hostmixer_release(struct inode *inode, struct file *file)
280280

281281
/* kernel module operations */
282282

283-
static struct file_operations hostaudio_fops = {
283+
static const struct file_operations hostaudio_fops = {
284284
.owner = THIS_MODULE,
285285
.llseek = no_llseek,
286286
.read = hostaudio_read,
@@ -292,7 +292,7 @@ static struct file_operations hostaudio_fops = {
292292
.release = hostaudio_release,
293293
};
294294

295-
static struct file_operations hostmixer_fops = {
295+
static const struct file_operations hostmixer_fops = {
296296
.owner = THIS_MODULE,
297297
.llseek = no_llseek,
298298
.ioctl = hostmixer_ioctl_mixdev,

‎arch/um/drivers/line.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ void line_set_termios(struct tty_struct *tty, struct termios * old)
251251
/* nothing */
252252
}
253253

254-
static struct {
254+
static const struct {
255255
int cmd;
256256
char *level;
257257
char *name;
@@ -405,7 +405,7 @@ static irqreturn_t line_write_interrupt(int irq, void *data,
405405

406406
int line_setup_irq(int fd, int input, int output, struct line *line, void *data)
407407
{
408-
struct line_driver *driver = line->driver;
408+
const struct line_driver *driver = line->driver;
409409
int err = 0, flags = IRQF_DISABLED | IRQF_SHARED | IRQF_SAMPLE_RANDOM;
410410

411411
if (input)
@@ -558,7 +558,7 @@ int line_setup(struct line *lines, unsigned int num, char *init)
558558
}
559559

560560
int line_config(struct line *lines, unsigned int num, char *str,
561-
struct chan_opts *opts)
561+
const struct chan_opts *opts)
562562
{
563563
struct line *line;
564564
char *new;

‎arch/um/drivers/mcast.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ struct mcast_data {
1313
void *dev;
1414
};
1515

16-
extern struct net_user_info mcast_user_info;
16+
extern const struct net_user_info mcast_user_info;
1717

1818
extern int mcast_user_write(int fd, void *buf, int len,
1919
struct mcast_data *pri);

‎arch/um/drivers/mcast_kern.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ static int mcast_write(int fd, struct sk_buff **skb,
6161
(struct mcast_data *) &lp->user);
6262
}
6363

64-
static struct net_kern_info mcast_kern_info = {
64+
static const struct net_kern_info mcast_kern_info = {
6565
.init = mcast_init,
6666
.protocol = eth_protocol,
6767
.read = mcast_read,

‎arch/um/drivers/mcast_user.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ static int mcast_set_mtu(int mtu, void *data)
152152
return(mtu);
153153
}
154154

155-
struct net_user_info mcast_user_info = {
155+
const struct net_user_info mcast_user_info = {
156156
.init = mcast_user_init,
157157
.open = mcast_open,
158158
.close = mcast_close,

0 commit comments

Comments
 (0)