diff options
author | Rusty Russell <rusty@rustcorp.com.au> | 2010-01-17 22:44:57 -0500 |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2010-02-03 01:39:49 -0500 |
commit | b51130685817d8c1b56386f9957405b5be2cdfe0 (patch) | |
tree | 539572b81d26a5eff70e75ad6d1fffb2f443cfc0 /drivers/char | |
parent | 7b62922a071aea362e879252d7482e448bd63d9c (diff) |
hvc_console: Make the ops pointer const.
This is nicer for modern R/O protection. And noone needs it non-const, so
constify the callers as well.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Amit Shah <amit.shah@redhat.com>
To: Christian Borntraeger <borntraeger@de.ibm.com>
Cc: linuxppc-dev@ozlabs.org
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'drivers/char')
-rw-r--r-- | drivers/char/hvc_beat.c | 2 | ||||
-rw-r--r-- | drivers/char/hvc_console.c | 7 | ||||
-rw-r--r-- | drivers/char/hvc_console.h | 7 | ||||
-rw-r--r-- | drivers/char/hvc_iseries.c | 2 | ||||
-rw-r--r-- | drivers/char/hvc_iucv.c | 2 | ||||
-rw-r--r-- | drivers/char/hvc_rtas.c | 2 | ||||
-rw-r--r-- | drivers/char/hvc_udbg.c | 2 | ||||
-rw-r--r-- | drivers/char/hvc_vio.c | 2 | ||||
-rw-r--r-- | drivers/char/hvc_xen.c | 2 |
9 files changed, 15 insertions, 13 deletions
diff --git a/drivers/char/hvc_beat.c b/drivers/char/hvc_beat.c index 0afc8b82212e..6913fc33270c 100644 --- a/drivers/char/hvc_beat.c +++ b/drivers/char/hvc_beat.c | |||
@@ -84,7 +84,7 @@ static int hvc_beat_put_chars(uint32_t vtermno, const char *buf, int cnt) | |||
84 | return cnt; | 84 | return cnt; |
85 | } | 85 | } |
86 | 86 | ||
87 | static struct hv_ops hvc_beat_get_put_ops = { | 87 | static const struct hv_ops hvc_beat_get_put_ops = { |
88 | .get_chars = hvc_beat_get_chars, | 88 | .get_chars = hvc_beat_get_chars, |
89 | .put_chars = hvc_beat_put_chars, | 89 | .put_chars = hvc_beat_put_chars, |
90 | }; | 90 | }; |
diff --git a/drivers/char/hvc_console.c b/drivers/char/hvc_console.c index 416d3423150d..d8dac5820f0e 100644 --- a/drivers/char/hvc_console.c +++ b/drivers/char/hvc_console.c | |||
@@ -125,7 +125,7 @@ static struct hvc_struct *hvc_get_by_index(int index) | |||
125 | * console interfaces but can still be used as a tty device. This has to be | 125 | * console interfaces but can still be used as a tty device. This has to be |
126 | * static because kmalloc will not work during early console init. | 126 | * static because kmalloc will not work during early console init. |
127 | */ | 127 | */ |
128 | static struct hv_ops *cons_ops[MAX_NR_HVC_CONSOLES]; | 128 | static const struct hv_ops *cons_ops[MAX_NR_HVC_CONSOLES]; |
129 | static uint32_t vtermnos[MAX_NR_HVC_CONSOLES] = | 129 | static uint32_t vtermnos[MAX_NR_HVC_CONSOLES] = |
130 | {[0 ... MAX_NR_HVC_CONSOLES - 1] = -1}; | 130 | {[0 ... MAX_NR_HVC_CONSOLES - 1] = -1}; |
131 | 131 | ||
@@ -247,7 +247,7 @@ static void destroy_hvc_struct(struct kref *kref) | |||
247 | * vty adapters do NOT get an hvc_instantiate() callback since they | 247 | * vty adapters do NOT get an hvc_instantiate() callback since they |
248 | * appear after early console init. | 248 | * appear after early console init. |
249 | */ | 249 | */ |
250 | int hvc_instantiate(uint32_t vtermno, int index, struct hv_ops *ops) | 250 | int hvc_instantiate(uint32_t vtermno, int index, const struct hv_ops *ops) |
251 | { | 251 | { |
252 | struct hvc_struct *hp; | 252 | struct hvc_struct *hp; |
253 | 253 | ||
@@ -749,7 +749,8 @@ static const struct tty_operations hvc_ops = { | |||
749 | }; | 749 | }; |
750 | 750 | ||
751 | struct hvc_struct __devinit *hvc_alloc(uint32_t vtermno, int data, | 751 | struct hvc_struct __devinit *hvc_alloc(uint32_t vtermno, int data, |
752 | struct hv_ops *ops, int outbuf_size) | 752 | const struct hv_ops *ops, |
753 | int outbuf_size) | ||
753 | { | 754 | { |
754 | struct hvc_struct *hp; | 755 | struct hvc_struct *hp; |
755 | int i; | 756 | int i; |
diff --git a/drivers/char/hvc_console.h b/drivers/char/hvc_console.h index 10950ca706d8..52ddf4d3716c 100644 --- a/drivers/char/hvc_console.h +++ b/drivers/char/hvc_console.h | |||
@@ -55,7 +55,7 @@ struct hvc_struct { | |||
55 | int outbuf_size; | 55 | int outbuf_size; |
56 | int n_outbuf; | 56 | int n_outbuf; |
57 | uint32_t vtermno; | 57 | uint32_t vtermno; |
58 | struct hv_ops *ops; | 58 | const struct hv_ops *ops; |
59 | int irq_requested; | 59 | int irq_requested; |
60 | int data; | 60 | int data; |
61 | struct winsize ws; | 61 | struct winsize ws; |
@@ -76,11 +76,12 @@ struct hv_ops { | |||
76 | }; | 76 | }; |
77 | 77 | ||
78 | /* Register a vterm and a slot index for use as a console (console_init) */ | 78 | /* Register a vterm and a slot index for use as a console (console_init) */ |
79 | extern int hvc_instantiate(uint32_t vtermno, int index, struct hv_ops *ops); | 79 | extern int hvc_instantiate(uint32_t vtermno, int index, |
80 | const struct hv_ops *ops); | ||
80 | 81 | ||
81 | /* register a vterm for hvc tty operation (module_init or hotplug add) */ | 82 | /* register a vterm for hvc tty operation (module_init or hotplug add) */ |
82 | extern struct hvc_struct * __devinit hvc_alloc(uint32_t vtermno, int data, | 83 | extern struct hvc_struct * __devinit hvc_alloc(uint32_t vtermno, int data, |
83 | struct hv_ops *ops, int outbuf_size); | 84 | const struct hv_ops *ops, int outbuf_size); |
84 | /* remove a vterm from hvc tty operation (module_exit or hotplug remove) */ | 85 | /* remove a vterm from hvc tty operation (module_exit or hotplug remove) */ |
85 | extern int hvc_remove(struct hvc_struct *hp); | 86 | extern int hvc_remove(struct hvc_struct *hp); |
86 | 87 | ||
diff --git a/drivers/char/hvc_iseries.c b/drivers/char/hvc_iseries.c index 936d05bf37fa..fd0242676a2a 100644 --- a/drivers/char/hvc_iseries.c +++ b/drivers/char/hvc_iseries.c | |||
@@ -197,7 +197,7 @@ done: | |||
197 | return sent; | 197 | return sent; |
198 | } | 198 | } |
199 | 199 | ||
200 | static struct hv_ops hvc_get_put_ops = { | 200 | static const struct hv_ops hvc_get_put_ops = { |
201 | .get_chars = get_chars, | 201 | .get_chars = get_chars, |
202 | .put_chars = put_chars, | 202 | .put_chars = put_chars, |
203 | .notifier_add = notifier_add_irq, | 203 | .notifier_add = notifier_add_irq, |
diff --git a/drivers/char/hvc_iucv.c b/drivers/char/hvc_iucv.c index fe62bd0e17b7..21681a81cc35 100644 --- a/drivers/char/hvc_iucv.c +++ b/drivers/char/hvc_iucv.c | |||
@@ -922,7 +922,7 @@ static int hvc_iucv_pm_restore_thaw(struct device *dev) | |||
922 | 922 | ||
923 | 923 | ||
924 | /* HVC operations */ | 924 | /* HVC operations */ |
925 | static struct hv_ops hvc_iucv_ops = { | 925 | static const struct hv_ops hvc_iucv_ops = { |
926 | .get_chars = hvc_iucv_get_chars, | 926 | .get_chars = hvc_iucv_get_chars, |
927 | .put_chars = hvc_iucv_put_chars, | 927 | .put_chars = hvc_iucv_put_chars, |
928 | .notifier_add = hvc_iucv_notifier_add, | 928 | .notifier_add = hvc_iucv_notifier_add, |
diff --git a/drivers/char/hvc_rtas.c b/drivers/char/hvc_rtas.c index 88590d040046..61c4a61558d9 100644 --- a/drivers/char/hvc_rtas.c +++ b/drivers/char/hvc_rtas.c | |||
@@ -71,7 +71,7 @@ static int hvc_rtas_read_console(uint32_t vtermno, char *buf, int count) | |||
71 | return i; | 71 | return i; |
72 | } | 72 | } |
73 | 73 | ||
74 | static struct hv_ops hvc_rtas_get_put_ops = { | 74 | static const struct hv_ops hvc_rtas_get_put_ops = { |
75 | .get_chars = hvc_rtas_read_console, | 75 | .get_chars = hvc_rtas_read_console, |
76 | .put_chars = hvc_rtas_write_console, | 76 | .put_chars = hvc_rtas_write_console, |
77 | }; | 77 | }; |
diff --git a/drivers/char/hvc_udbg.c b/drivers/char/hvc_udbg.c index bd63ba878a56..b0957e61a7be 100644 --- a/drivers/char/hvc_udbg.c +++ b/drivers/char/hvc_udbg.c | |||
@@ -58,7 +58,7 @@ static int hvc_udbg_get(uint32_t vtermno, char *buf, int count) | |||
58 | return i; | 58 | return i; |
59 | } | 59 | } |
60 | 60 | ||
61 | static struct hv_ops hvc_udbg_ops = { | 61 | static const struct hv_ops hvc_udbg_ops = { |
62 | .get_chars = hvc_udbg_get, | 62 | .get_chars = hvc_udbg_get, |
63 | .put_chars = hvc_udbg_put, | 63 | .put_chars = hvc_udbg_put, |
64 | }; | 64 | }; |
diff --git a/drivers/char/hvc_vio.c b/drivers/char/hvc_vio.c index 10be343d6ae7..27370e99c66f 100644 --- a/drivers/char/hvc_vio.c +++ b/drivers/char/hvc_vio.c | |||
@@ -77,7 +77,7 @@ static int filtered_get_chars(uint32_t vtermno, char *buf, int count) | |||
77 | return got; | 77 | return got; |
78 | } | 78 | } |
79 | 79 | ||
80 | static struct hv_ops hvc_get_put_ops = { | 80 | static const struct hv_ops hvc_get_put_ops = { |
81 | .get_chars = filtered_get_chars, | 81 | .get_chars = filtered_get_chars, |
82 | .put_chars = hvc_put_chars, | 82 | .put_chars = hvc_put_chars, |
83 | .notifier_add = notifier_add_irq, | 83 | .notifier_add = notifier_add_irq, |
diff --git a/drivers/char/hvc_xen.c b/drivers/char/hvc_xen.c index b1a71638c772..60446f82a3fc 100644 --- a/drivers/char/hvc_xen.c +++ b/drivers/char/hvc_xen.c | |||
@@ -122,7 +122,7 @@ static int read_console(uint32_t vtermno, char *buf, int len) | |||
122 | return recv; | 122 | return recv; |
123 | } | 123 | } |
124 | 124 | ||
125 | static struct hv_ops hvc_ops = { | 125 | static const struct hv_ops hvc_ops = { |
126 | .get_chars = read_console, | 126 | .get_chars = read_console, |
127 | .put_chars = write_console, | 127 | .put_chars = write_console, |
128 | .notifier_add = notifier_add_irq, | 128 | .notifier_add = notifier_add_irq, |