[Spice-devel,xf86-video-qxl,v2,cleanup,5/6] qxl_ring: remove volatile. doesn't accomplish anything the mem_barrier doesn't also accomplish, and removes warnings when using memcpy

Submitted by Alon Levy on April 24, 2012, 9:21 a.m.

Details

Message ID 1335259287-23125-5-git-send-email-alevy@redhat.com
State New
Headers show

Not browsing as part of any series.

Commit Message

Alon Levy April 24, 2012, 9:21 a.m.
---
 src/qxl_ring.c |   12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

Patch hide | download patch | download mbox

diff --git a/src/qxl_ring.c b/src/qxl_ring.c
index 7a11fbb..d701791 100644
--- a/src/qxl_ring.c
+++ b/src/qxl_ring.c
@@ -42,7 +42,7 @@  struct ring
 
 struct qxl_ring
 {
-    volatile struct ring *ring;
+    struct ring        *ring;
     int			element_size;
     int			n_elements;
     int			io_port_prod_notify;
@@ -62,7 +62,7 @@  qxl_ring_create (struct qxl_ring_header *header,
     if (!ring)
 	return NULL;
 
-    ring->ring = (volatile struct ring *)header;
+    ring->ring = (struct ring *)header;
     ring->element_size = element_size;
     ring->n_elements = n_elements;
     ring->io_port_prod_notify = io_port_prod_notify;
@@ -74,8 +74,8 @@  void
 qxl_ring_push (struct qxl_ring *ring,
 	       const void      *new_elt)
 {
-    volatile struct qxl_ring_header *header = &(ring->ring->header);
-    volatile uint8_t *elt;
+    struct qxl_ring_header *header = &(ring->ring->header);
+    uint8_t *elt;
     int idx;
 
     while (header->prod - header->cons == header->num_items)
@@ -107,8 +107,8 @@  Bool
 qxl_ring_pop (struct qxl_ring *ring,
 	      void            *element)
 {
-    volatile struct qxl_ring_header *header = &(ring->ring->header);
-    volatile uint8_t *ring_elt;
+    struct qxl_ring_header *header = &(ring->ring->header);
+    uint8_t *ring_elt;
     int idx;
 
     if (header->cons == header->prod)

Comments

This one disappears if we use -Wno-cast-qual

Christophe

On Tue, Apr 24, 2012 at 12:21:26PM +0300, Alon Levy wrote:
> ---
>  src/qxl_ring.c |   12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/src/qxl_ring.c b/src/qxl_ring.c
> index 7a11fbb..d701791 100644
> --- a/src/qxl_ring.c
> +++ b/src/qxl_ring.c
> @@ -42,7 +42,7 @@ struct ring
>  
>  struct qxl_ring
>  {
> -    volatile struct ring *ring;
> +    struct ring        *ring;
>      int			element_size;
>      int			n_elements;
>      int			io_port_prod_notify;
> @@ -62,7 +62,7 @@ qxl_ring_create (struct qxl_ring_header *header,
>      if (!ring)
>  	return NULL;
>  
> -    ring->ring = (volatile struct ring *)header;
> +    ring->ring = (struct ring *)header;
>      ring->element_size = element_size;
>      ring->n_elements = n_elements;
>      ring->io_port_prod_notify = io_port_prod_notify;
> @@ -74,8 +74,8 @@ void
>  qxl_ring_push (struct qxl_ring *ring,
>  	       const void      *new_elt)
>  {
> -    volatile struct qxl_ring_header *header = &(ring->ring->header);
> -    volatile uint8_t *elt;
> +    struct qxl_ring_header *header = &(ring->ring->header);
> +    uint8_t *elt;
>      int idx;
>  
>      while (header->prod - header->cons == header->num_items)
> @@ -107,8 +107,8 @@ Bool
>  qxl_ring_pop (struct qxl_ring *ring,
>  	      void            *element)
>  {
> -    volatile struct qxl_ring_header *header = &(ring->ring->header);
> -    volatile uint8_t *ring_elt;
> +    struct qxl_ring_header *header = &(ring->ring->header);
> +    uint8_t *ring_elt;
>      int idx;
>  
>      if (header->cons == header->prod)
> -- 
> 1.7.10
> 
> _______________________________________________
> Spice-devel mailing list
> Spice-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/spice-devel