All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Xen-devel <xen-devel@lists.xen.org>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>,
	Wei Liu <wei.liu2@citrix.com>, Jan Beulich <JBeulich@suse.com>
Subject: [PATCH v2 for-next] x86/mm: Fix the odd indentation of the pin_page block of do_mmuext_op()
Date: Fri, 5 May 2017 17:32:43 +0100	[thread overview]
Message-ID: <1494001963-30732-1-git-send-email-andrew.cooper3@citrix.com> (raw)
In-Reply-To: <590CC03A0200007800157588@prv-mh.provo.novell.com>

The pin_page block is missing one level of indentation, which makes the
MMUEXT_UNPIN_TABLE case label appear to be outside of the switch statement.

However, the block isn't needed at all if page is declared with switch level
scope.  This allows for the removal of the identical local declarations for
MMUEXT_UNPIN_TABLE, MMUEXT_NEW_USER_BASEPTR and MMUEXT_CLEAR_PAGE.

While making this adjustment, delete one other piece of trailing whitespace.

No functional change.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
CC: Jan Beulich <JBeulich@suse.com>

v2:
 * Rearange, for far less code churn.
---
 xen/arch/x86/mm.c | 23 +++++++----------------
 1 file changed, 7 insertions(+), 16 deletions(-)

diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
index 411eed0..2914d1d 100644
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -3232,6 +3232,8 @@ long do_mmuext_op(
 
         switch ( op.cmd )
         {
+            struct page_info *page;
+
         case MMUEXT_PIN_L1_TABLE:
             type = PGT_l1_page_table;
             goto pin_page;
@@ -3249,9 +3251,7 @@ long do_mmuext_op(
                 break;
             type = PGT_l4_page_table;
 
-        pin_page: {
-            struct page_info *page;
-
+        pin_page:
             /* Ignore pinning of invalid paging levels. */
             if ( (op.cmd - MMUEXT_PIN_L1_TABLE) > (CONFIG_PAGING_LEVELS - 1) )
                 break;
@@ -3313,13 +3313,9 @@ long do_mmuext_op(
                         curr->arch.old_guest_table = page;
                 }
             }
-
             break;
-        }
-
-        case MMUEXT_UNPIN_TABLE: {
-            struct page_info *page;
 
+        case MMUEXT_UNPIN_TABLE:
             if ( paging_mode_refcounts(pg_owner) )
                 break;
 
@@ -3357,9 +3353,7 @@ long do_mmuext_op(
 
             /* A page is dirtied when its pin status is cleared. */
             paging_mark_dirty(pg_owner, _mfn(page_to_mfn(page)));
-
             break;
-        }
 
         case MMUEXT_NEW_BASEPTR:
             if ( unlikely(d != pg_owner) )
@@ -3414,7 +3408,7 @@ long do_mmuext_op(
 
             if ( old_mfn != 0 )
             {
-                struct page_info *page = mfn_to_page(old_mfn);
+                page = mfn_to_page(old_mfn);
 
                 if ( paging_mode_refcounts(d) )
                     put_page(page);
@@ -3478,7 +3472,7 @@ long do_mmuext_op(
             else
                 rc = -EPERM;
             break;
-    
+
         case MMUEXT_INVLPG_ALL:
             if ( unlikely(d != pg_owner) )
                 rc = -EPERM;
@@ -3542,9 +3536,7 @@ long do_mmuext_op(
             break;
         }
 
-        case MMUEXT_CLEAR_PAGE: {
-            struct page_info *page;
-
+        case MMUEXT_CLEAR_PAGE:
             page = get_page_from_gfn(pg_owner, op.arg1.mfn, NULL, P2M_ALLOC);
             if ( !page || !get_page_type(page, PGT_writable_page) )
             {
@@ -3563,7 +3555,6 @@ long do_mmuext_op(
 
             put_page_and_type(page);
             break;
-        }
 
         case MMUEXT_COPY_PAGE:
         {
-- 
2.1.4


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

  reply	other threads:[~2017-05-05 16:32 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-05 15:51 [PATCH for-next] x86/mm: Correctly indent the pin_page block of do_mmuext_op() Andrew Cooper
2017-05-05 16:11 ` Jan Beulich
2017-05-05 16:32   ` Andrew Cooper [this message]
2017-05-05 16:35     ` [PATCH v2 for-next] x86/mm: Fix the odd indentation of " Wei Liu
2017-05-08  7:20     ` Jan Beulich

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=1494001963-30732-1-git-send-email-andrew.cooper3@citrix.com \
    --to=andrew.cooper3@citrix.com \
    --cc=JBeulich@suse.com \
    --cc=wei.liu2@citrix.com \
    --cc=xen-devel@lists.xen.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.