diff mbox

[v2,3/3] xenfb: remove out_cons in xenfb_handle_events

Message ID 1460457796-1779-4-git-send-email-wei.liu2@citrix.com
State New
Headers show

Commit Message

Wei Liu April 12, 2016, 10:43 a.m. UTC
The variable out_cons was only used to temporarily hold the consumer
index. Use cons directly to simplify code a bit.

No functional change introduced.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
---
Cc: Stefano Stabellini <sstabellini@kernel.org>
Cc: Anthony Perard <anthony.perard@citrix.com>
---
 hw/display/xenfb.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Stefano Stabellini April 12, 2016, 5:33 p.m. UTC | #1
On Tue, 12 Apr 2016, Wei Liu wrote:
> The variable out_cons was only used to temporarily hold the consumer
> index. Use cons directly to simplify code a bit.
> 
> No functional change introduced.
> 
> Signed-off-by: Wei Liu <wei.liu2@citrix.com>

Except for the fact that it is based on patch #2, which is wrong, this
looks OK.

Acked-by: Stefano Stabellini <sstabellini@kernel.org>


> Cc: Stefano Stabellini <sstabellini@kernel.org>
> Cc: Anthony Perard <anthony.perard@citrix.com>
> ---
>  hw/display/xenfb.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/hw/display/xenfb.c b/hw/display/xenfb.c
> index 7f4fad7..7d50efb 100644
> --- a/hw/display/xenfb.c
> +++ b/hw/display/xenfb.c
> @@ -770,16 +770,16 @@ static void xenfb_invalidate(void *opaque)
>  
>  static void xenfb_handle_events(struct XenFB *xenfb)
>  {
> -    uint32_t prod, cons, out_cons;
> +    uint32_t prod, cons;
>      struct xenfb_page *page = xenfb->c.page;
>  
>      prod = page->out_prod;
> -    out_cons = page->out_cons;
> +    cons = page->out_cons;
>      xen_rmb();
> -    if (prod - out_cons > XENFB_OUT_RING_LEN) {
> +    if (prod - cons > XENFB_OUT_RING_LEN) {
>          return;
>      }
> -    for (cons = out_cons; cons != prod; cons++) {
> +    for ( ; cons != prod; cons++) {
>  	union xenfb_out_event *event = &XENFB_OUT_RING_REF(page, cons);
>          uint8_t type = event->type;
>  	int x, y, w, h;
> -- 
> 2.1.4
>
diff mbox

Patch

diff --git a/hw/display/xenfb.c b/hw/display/xenfb.c
index 7f4fad7..7d50efb 100644
--- a/hw/display/xenfb.c
+++ b/hw/display/xenfb.c
@@ -770,16 +770,16 @@  static void xenfb_invalidate(void *opaque)
 
 static void xenfb_handle_events(struct XenFB *xenfb)
 {
-    uint32_t prod, cons, out_cons;
+    uint32_t prod, cons;
     struct xenfb_page *page = xenfb->c.page;
 
     prod = page->out_prod;
-    out_cons = page->out_cons;
+    cons = page->out_cons;
     xen_rmb();
-    if (prod - out_cons > XENFB_OUT_RING_LEN) {
+    if (prod - cons > XENFB_OUT_RING_LEN) {
         return;
     }
-    for (cons = out_cons; cons != prod; cons++) {
+    for ( ; cons != prod; cons++) {
 	union xenfb_out_event *event = &XENFB_OUT_RING_REF(page, cons);
         uint8_t type = event->type;
 	int x, y, w, h;