Commit 1dff399616a79b8ef5d61ad68f2ef1e1f590b465

Authored by Rusty Russell
1 parent 971f339000

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

Showing 10 changed files with 16 additions and 14 deletions Side-by-side Diff

drivers/char/hvc_beat.c
... ... @@ -84,7 +84,7 @@
84 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 88 .get_chars = hvc_beat_get_chars,
89 89 .put_chars = hvc_beat_put_chars,
90 90 };
drivers/char/hvc_console.c
... ... @@ -125,7 +125,7 @@
125 125 * console interfaces but can still be used as a tty device. This has to be
126 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 129 static uint32_t vtermnos[MAX_NR_HVC_CONSOLES] =
130 130 {[0 ... MAX_NR_HVC_CONSOLES - 1] = -1};
131 131  
... ... @@ -247,7 +247,7 @@
247 247 * vty adapters do NOT get an hvc_instantiate() callback since they
248 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 252 struct hvc_struct *hp;
253 253  
... ... @@ -749,7 +749,8 @@
749 749 };
750 750  
751 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 755 struct hvc_struct *hp;
755 756 int i;
drivers/char/hvc_console.h
... ... @@ -55,7 +55,7 @@
55 55 int outbuf_size;
56 56 int n_outbuf;
57 57 uint32_t vtermno;
58   - struct hv_ops *ops;
  58 + const struct hv_ops *ops;
59 59 int irq_requested;
60 60 int data;
61 61 struct winsize ws;
62 62  
... ... @@ -76,11 +76,12 @@
76 76 };
77 77  
78 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 82 /* register a vterm for hvc tty operation (module_init or hotplug add) */
82 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 85 /* remove a vterm from hvc tty operation (module_exit or hotplug remove) */
85 86 extern int hvc_remove(struct hvc_struct *hp);
86 87  
drivers/char/hvc_iseries.c
... ... @@ -197,7 +197,7 @@
197 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 201 .get_chars = get_chars,
202 202 .put_chars = put_chars,
203 203 .notifier_add = notifier_add_irq,
drivers/char/hvc_iucv.c
... ... @@ -922,7 +922,7 @@
922 922  
923 923  
924 924 /* HVC operations */
925   -static struct hv_ops hvc_iucv_ops = {
  925 +static const struct hv_ops hvc_iucv_ops = {
926 926 .get_chars = hvc_iucv_get_chars,
927 927 .put_chars = hvc_iucv_put_chars,
928 928 .notifier_add = hvc_iucv_notifier_add,
drivers/char/hvc_rtas.c
... ... @@ -71,7 +71,7 @@
71 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 75 .get_chars = hvc_rtas_read_console,
76 76 .put_chars = hvc_rtas_write_console,
77 77 };
drivers/char/hvc_udbg.c
... ... @@ -58,7 +58,7 @@
58 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 62 .get_chars = hvc_udbg_get,
63 63 .put_chars = hvc_udbg_put,
64 64 };
drivers/char/hvc_vio.c
... ... @@ -77,7 +77,7 @@
77 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 81 .get_chars = filtered_get_chars,
82 82 .put_chars = hvc_put_chars,
83 83 .notifier_add = notifier_add_irq,
drivers/char/hvc_xen.c
... ... @@ -122,7 +122,7 @@
122 122 return recv;
123 123 }
124 124  
125   -static struct hv_ops hvc_ops = {
  125 +static const struct hv_ops hvc_ops = {
126 126 .get_chars = read_console,
127 127 .put_chars = write_console,
128 128 .notifier_add = notifier_add_irq,
drivers/char/virtio_console.c
... ... @@ -163,7 +163,7 @@
163 163 }
164 164  
165 165 /* The operations for the console. */
166   -static struct hv_ops hv_ops = {
  166 +static const struct hv_ops hv_ops = {
167 167 .get_chars = get_chars,
168 168 .put_chars = put_chars,
169 169 .notifier_add = notifier_add_vio,