Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b5113068 authored by Rusty Russell's avatar Rusty Russell Committed by Benjamin Herrenschmidt
Browse files

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: default avatarRusty Russell <rusty@rustcorp.com.au>
Signed-off-by: default avatarAmit Shah <amit.shah@redhat.com>
To: Christian Borntraeger <borntraeger@de.ibm.com>
Cc: linuxppc-dev@ozlabs.org
Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
parent 7b62922a
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -84,7 +84,7 @@ static int hvc_beat_put_chars(uint32_t vtermno, const char *buf, int cnt)
	return cnt;
}

static struct hv_ops hvc_beat_get_put_ops = {
static const struct hv_ops hvc_beat_get_put_ops = {
	.get_chars = hvc_beat_get_chars,
	.put_chars = hvc_beat_put_chars,
};
+4 −3
Original line number Diff line number Diff line
@@ -125,7 +125,7 @@ static struct hvc_struct *hvc_get_by_index(int index)
 * console interfaces but can still be used as a tty device.  This has to be
 * static because kmalloc will not work during early console init.
 */
static struct hv_ops *cons_ops[MAX_NR_HVC_CONSOLES];
static const struct hv_ops *cons_ops[MAX_NR_HVC_CONSOLES];
static uint32_t vtermnos[MAX_NR_HVC_CONSOLES] =
	{[0 ... MAX_NR_HVC_CONSOLES - 1] = -1};

@@ -247,7 +247,7 @@ static void destroy_hvc_struct(struct kref *kref)
 * vty adapters do NOT get an hvc_instantiate() callback since they
 * appear after early console init.
 */
int hvc_instantiate(uint32_t vtermno, int index, struct hv_ops *ops)
int hvc_instantiate(uint32_t vtermno, int index, const struct hv_ops *ops)
{
	struct hvc_struct *hp;

@@ -749,7 +749,8 @@ static const struct tty_operations hvc_ops = {
};

struct hvc_struct __devinit *hvc_alloc(uint32_t vtermno, int data,
					struct hv_ops *ops, int outbuf_size)
				       const struct hv_ops *ops,
				       int outbuf_size)
{
	struct hvc_struct *hp;
	int i;
+4 −3
Original line number Diff line number Diff line
@@ -55,7 +55,7 @@ struct hvc_struct {
	int outbuf_size;
	int n_outbuf;
	uint32_t vtermno;
	struct hv_ops *ops;
	const struct hv_ops *ops;
	int irq_requested;
	int data;
	struct winsize ws;
@@ -76,11 +76,12 @@ struct hv_ops {
};

/* Register a vterm and a slot index for use as a console (console_init) */
extern int hvc_instantiate(uint32_t vtermno, int index, struct hv_ops *ops);
extern int hvc_instantiate(uint32_t vtermno, int index,
			   const struct hv_ops *ops);

/* register a vterm for hvc tty operation (module_init or hotplug add) */
extern struct hvc_struct * __devinit hvc_alloc(uint32_t vtermno, int data,
				struct hv_ops *ops, int outbuf_size);
				const struct hv_ops *ops, int outbuf_size);
/* remove a vterm from hvc tty operation (module_exit or hotplug remove) */
extern int hvc_remove(struct hvc_struct *hp);

+1 −1
Original line number Diff line number Diff line
@@ -197,7 +197,7 @@ static int put_chars(uint32_t vtermno, const char *buf, int count)
	return sent;
}

static struct hv_ops hvc_get_put_ops = {
static const struct hv_ops hvc_get_put_ops = {
	.get_chars = get_chars,
	.put_chars = put_chars,
	.notifier_add = notifier_add_irq,
+1 −1
Original line number Diff line number Diff line
@@ -922,7 +922,7 @@ static int hvc_iucv_pm_restore_thaw(struct device *dev)


/* HVC operations */
static struct hv_ops hvc_iucv_ops = {
static const struct hv_ops hvc_iucv_ops = {
	.get_chars = hvc_iucv_get_chars,
	.put_chars = hvc_iucv_put_chars,
	.notifier_add = hvc_iucv_notifier_add,
Loading