All of lore.kernel.org
 help / color / mirror / Atom feed
From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: Amit Shah <amit.shah@redhat.com>
Cc: linuxppc-dev@ozlabs.org, rusty@rustcorp.com.au,
	virtualization@lists.linux-foundation.org
Subject: Re: [PATCH 03/31] hvc_console: make the ops pointer const.
Date: Tue, 12 Jan 2010 13:21:46 +1100	[thread overview]
Message-ID: <1263262906.724.175.camel@pasglop> (raw)
In-Reply-To: <1261492481-19817-4-git-send-email-amit.shah@redhat.com>

On Tue, 2009-12-22 at 20:04 +0530, Amit Shah wrote:
> From: Rusty Russell <rusty@rustcorp.com.au>
> 
> This is nicer for modern R/O protection.  And noone needs it non-const, so
> constify the callers as well.

Rusty, do you want me to take these via powerpc ?

Cheers,
Ben.

> 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
> ---
>  drivers/char/hvc_beat.c       |    2 +-
>  drivers/char/hvc_console.c    |    7 ++++---
>  drivers/char/hvc_console.h    |    7 ++++---
>  drivers/char/hvc_iseries.c    |    2 +-
>  drivers/char/hvc_iucv.c       |    2 +-
>  drivers/char/hvc_rtas.c       |    2 +-
>  drivers/char/hvc_udbg.c       |    2 +-
>  drivers/char/hvc_vio.c        |    2 +-
>  drivers/char/hvc_xen.c        |    2 +-
>  drivers/char/virtio_console.c |    2 +-
>  10 files changed, 16 insertions(+), 14 deletions(-)
> 
> diff --git a/drivers/char/hvc_beat.c b/drivers/char/hvc_beat.c
> index 0afc8b8..6913fc3 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)
>  	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,
>  };
> diff --git a/drivers/char/hvc_console.c b/drivers/char/hvc_console.c
> index 416d342..d8dac58 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)
>   * 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;
> diff --git a/drivers/char/hvc_console.h b/drivers/char/hvc_console.h
> index 10950ca..52ddf4d 100644
> --- a/drivers/char/hvc_console.h
> +++ b/drivers/char/hvc_console.h
> @@ -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);
>  
> diff --git a/drivers/char/hvc_iseries.c b/drivers/char/hvc_iseries.c
> index 936d05b..fd02426 100644
> --- a/drivers/char/hvc_iseries.c
> +++ b/drivers/char/hvc_iseries.c
> @@ -197,7 +197,7 @@ done:
>  	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,
> diff --git a/drivers/char/hvc_iucv.c b/drivers/char/hvc_iucv.c
> index fe62bd0..21681a8 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)
>  
> 
>  /* 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,
> diff --git a/drivers/char/hvc_rtas.c b/drivers/char/hvc_rtas.c
> index 88590d0..61c4a61 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)
>  	return i;
>  }
>  
> -static struct hv_ops hvc_rtas_get_put_ops = {
> +static const struct hv_ops hvc_rtas_get_put_ops = {
>  	.get_chars = hvc_rtas_read_console,
>  	.put_chars = hvc_rtas_write_console,
>  };
> diff --git a/drivers/char/hvc_udbg.c b/drivers/char/hvc_udbg.c
> index bd63ba8..b0957e6 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)
>  	return i;
>  }
>  
> -static struct hv_ops hvc_udbg_ops = {
> +static const struct hv_ops hvc_udbg_ops = {
>  	.get_chars = hvc_udbg_get,
>  	.put_chars = hvc_udbg_put,
>  };
> diff --git a/drivers/char/hvc_vio.c b/drivers/char/hvc_vio.c
> index 10be343..27370e9 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)
>  	return got;
>  }
>  
> -static struct hv_ops hvc_get_put_ops = {
> +static const struct hv_ops hvc_get_put_ops = {
>  	.get_chars = filtered_get_chars,
>  	.put_chars = hvc_put_chars,
>  	.notifier_add = notifier_add_irq,
> diff --git a/drivers/char/hvc_xen.c b/drivers/char/hvc_xen.c
> index b1a7163..60446f8 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)
>  	return recv;
>  }
>  
> -static struct hv_ops hvc_ops = {
> +static const struct hv_ops hvc_ops = {
>  	.get_chars = read_console,
>  	.put_chars = write_console,
>  	.notifier_add = notifier_add_irq,
> diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c
> index 1d844a4..791be4e 100644
> --- a/drivers/char/virtio_console.c
> +++ b/drivers/char/virtio_console.c
> @@ -163,7 +163,7 @@ static void hvc_handle_input(struct virtqueue *vq)
>  }
>  
>  /* The operations for the console. */
> -static struct hv_ops hv_ops = {
> +static const struct hv_ops hv_ops = {
>  	.get_chars = get_chars,
>  	.put_chars = put_chars,
>  	.notifier_add = notifier_add_vio,

  parent reply	other threads:[~2010-01-12  2:21 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-22 14:34 [PATCH 00/31] virtio: console: Fixes, multiple devices and generic ports Amit Shah
2009-12-22 14:34 ` [PATCH 01/31] virtio: console: comment cleanup Amit Shah
2009-12-22 14:34   ` [PATCH 02/31] virtio: console: statically initialize virtio_cons Amit Shah
2009-12-22 14:34     ` [PATCH 03/31] hvc_console: make the ops pointer const Amit Shah
2009-12-22 14:34       ` [PATCH 04/31] hvc_console: Remove __devinit annotation from hvc_alloc Amit Shah
2009-12-22 14:34         ` [PATCH 05/31] virtio: console: We support only one device at a time Amit Shah
2009-12-22 14:34           ` [PATCH 06/31] virtio: console: port encapsulation Amit Shah
2009-12-22 14:34             ` [PATCH 07/31] virtio: console: encapsulate buffer information in a struct Amit Shah
2009-12-22 14:34               ` [PATCH 08/31] virtio: console: ensure add_inbuf can work for multiple ports as well Amit Shah
2009-12-22 14:34                 ` [PATCH 09/31] virtio: console: introduce a get_inbuf helper to fetch bufs from in_vq Amit Shah
2009-12-22 14:34                   ` [PATCH 10/31] virtio: console: use vdev->priv to avoid accessing global var Amit Shah
2009-12-22 14:34                     ` [PATCH 11/31] virtio: console: don't assume a single console port Amit Shah
2009-12-22 14:34                       ` [PATCH 12/31] virtio: console: remove global var Amit Shah
2009-12-22 14:34                         ` [PATCH 13/31] virtio: console: struct ports for multiple ports per device Amit Shah
2009-12-22 14:34                           ` [PATCH 14/31] virtio: console: ensure console size is updated on hvc open Amit Shah
2009-12-22 14:34                             ` [PATCH 15/31] virtio: console: Separate out console-specific data into a separate struct Amit Shah
2009-12-22 14:34                               ` [PATCH 16/31] virtio: console: Separate out console init into a new function Amit Shah
2009-12-22 14:34                                 ` [PATCH 17/31] virtio: console: Separate out find_vqs operation into a different function Amit Shah
2009-12-22 14:34                                   ` [PATCH 18/31] virtio: console: Buffer data that comes from the host Amit Shah
2009-12-22 14:34                                     ` [PATCH 19/31] virtio: console: Introduce a send_buf function for a common path for sending data to host Amit Shah
2009-12-22 14:34                                       ` [PATCH 20/31] virtio: console: Introduce a 'header' for each buffer towards supporting multiport Amit Shah
2009-12-22 14:34                                         ` [PATCH 21/31] virtio: console: Add a new MULTIPORT feature, support for generic ports Amit Shah
2009-12-22 14:34                                           ` [PATCH 22/31] virtio: console: Prepare for writing to / reading from userspace buffers Amit Shah
2009-12-22 14:34                                             ` [PATCH 23/31] virtio: console: Associate each port with a char device Amit Shah
2009-12-22 14:34                                               ` [PATCH 24/31] virtio: console: Add file operations to ports for open/read/write/poll Amit Shah
2009-12-22 14:34                                                 ` [PATCH 25/31] virtio: console: Ensure only one process can have a port open at a time Amit Shah
2009-12-22 14:34                                                   ` [PATCH 26/31] virtio: console: Register with sysfs and create a 'name' attribute for ports Amit Shah
2009-12-22 14:34                                                     ` [PATCH 27/31] virtio: console: Add throttling support to prevent flooding ports Amit Shah
2009-12-22 14:34                                                       ` [PATCH 28/31] virtio: console: Add option to remove cached buffers on port close Amit Shah
2009-12-22 14:34                                                         ` [PATCH 29/31] virtio: console: Handle port hot-plug Amit Shah
2009-12-22 14:34                                                           ` [PATCH 30/31] virtio: console: Add ability to hot-unplug ports Amit Shah
2009-12-22 14:34                                                             ` [PATCH 31/31] virtio: console: Add debugfs files for each port to expose debug info Amit Shah
2010-01-04  9:15                                     ` [PATCH 18/31] virtio: console: Buffer data that comes from the host Rusty Russell
2010-01-04  9:47                                       ` Amit Shah
2010-01-13  6:11                                         ` Amit Shah
2010-01-13 11:13                                           ` Rusty Russell
2010-01-13 11:24                                             ` Amit Shah
2010-01-13 23:15                                               ` Rusty Russell
2010-01-14  3:17                                                 ` Amit Shah
2010-01-16 22:16                                                   ` Rusty Russell
2009-12-22 14:34       ` [PATCH 04/31] hvc_console: Remove __devinit annotation from hvc_alloc Amit Shah
2010-01-12  2:21       ` Benjamin Herrenschmidt [this message]
2010-01-12 11:36         ` [PATCH 03/31] hvc_console: make the ops pointer const Rusty Russell
2010-01-12 11:36         ` Rusty Russell
2010-01-12  2:21       ` Benjamin Herrenschmidt
2009-12-22 14:34     ` Amit Shah
2009-12-23  6:39 ` [PATCH 00/31] virtio: console: Fixes, multiple devices and generic ports Rusty Russell
2009-12-23  6:44   ` Amit Shah

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1263262906.724.175.camel@pasglop \
    --to=benh@kernel.crashing.org \
    --cc=amit.shah@redhat.com \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=rusty@rustcorp.com.au \
    --cc=virtualization@lists.linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.