[Xen-devel,1/7] xen/arm: domain_build: Clean-up insert_11_bank

Message ID 20171004181526.9405-2-julien.grall@linaro.org
State New
Headers show
Series
  • xen: Convert __page_to_mfn and __mfn_to_page to use typesafe MFN
Related show

Commit Message

Julien Grall Oct. 4, 2017, 6:15 p.m.
- Remove spurious ()
    - Add missing spaces
    - Turn 1 << to 1UL <<

Signed-off-by: Julien Grall <julien.grall@linaro.org>

---

Cc: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/arch/arm/domain_build.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

Comments

Andrew Cooper Oct. 4, 2017, 10:39 p.m. | #1
On 04/10/2017 19:15, Julien Grall wrote:
> diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
> index 3723dc3f78..093ebf1a8e 100644
> --- a/xen/arch/arm/domain_build.c
> +++ b/xen/arch/arm/domain_build.c
> @@ -109,11 +109,11 @@ static bool insert_11_bank(struct domain *d,
>  
>      spfn = page_to_mfn(pg);
>      start = pfn_to_paddr(spfn);
> -    size = pfn_to_paddr((1 << order));
> +    size = pfn_to_paddr(1UL << order);
>  
>      D11PRINT("Allocated %#"PRIpaddr"-%#"PRIpaddr" (%ldMB/%ldMB, order %d)\n",
>               start, start + size,
> -             1UL << (order+PAGE_SHIFT-20),
> +             1UL << (order + PAGE_SHIFT -  20),

If you are looking to be picky, you've got a double space between the
minus and the 20.  I'm sure this would be trivial to fix on commit.

~Andrew
Julien Grall Oct. 5, 2017, 11:08 a.m. | #2
Hi Andrew,

On 04/10/17 23:39, Andrew Cooper wrote:
> On 04/10/2017 19:15, Julien Grall wrote:
>> diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
>> index 3723dc3f78..093ebf1a8e 100644
>> --- a/xen/arch/arm/domain_build.c
>> +++ b/xen/arch/arm/domain_build.c
>> @@ -109,11 +109,11 @@ static bool insert_11_bank(struct domain *d,
>>   
>>       spfn = page_to_mfn(pg);
>>       start = pfn_to_paddr(spfn);
>> -    size = pfn_to_paddr((1 << order));
>> +    size = pfn_to_paddr(1UL << order);
>>   
>>       D11PRINT("Allocated %#"PRIpaddr"-%#"PRIpaddr" (%ldMB/%ldMB, order %d)\n",
>>                start, start + size,
>> -             1UL << (order+PAGE_SHIFT-20),
>> +             1UL << (order + PAGE_SHIFT -  20),
> 
> If you are looking to be picky, you've got a double space between the
> minus and the 20.  I'm sure this would be trivial to fix on commit.

Argh, on my original patch I had 2 spaces before the minus. Dropped one 
before sending on xen-devel and didn't spot the one after the minus.

I will resend the series with your comments addressed.

Cheers,

Patch

diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
index 3723dc3f78..093ebf1a8e 100644
--- a/xen/arch/arm/domain_build.c
+++ b/xen/arch/arm/domain_build.c
@@ -109,11 +109,11 @@  static bool insert_11_bank(struct domain *d,
 
     spfn = page_to_mfn(pg);
     start = pfn_to_paddr(spfn);
-    size = pfn_to_paddr((1 << order));
+    size = pfn_to_paddr(1UL << order);
 
     D11PRINT("Allocated %#"PRIpaddr"-%#"PRIpaddr" (%ldMB/%ldMB, order %d)\n",
              start, start + size,
-             1UL << (order+PAGE_SHIFT-20),
+             1UL << (order + PAGE_SHIFT -  20),
              /* Don't want format this as PRIpaddr (16 digit hex) */
              (unsigned long)(kinfo->unassigned_mem >> 20),
              order);
@@ -167,7 +167,8 @@  static bool insert_11_bank(struct domain *d,
          */
         if ( start + size < bank->start && kinfo->mem.nr_banks < NR_MEM_BANKS )
         {
-            memmove(bank + 1, bank, sizeof(*bank)*(kinfo->mem.nr_banks - i));
+            memmove(bank + 1, bank,
+                    sizeof(*bank) * (kinfo->mem.nr_banks - i));
             kinfo->mem.nr_banks++;
             bank->start = start;
             bank->size = size;