Re: UVM return(val)

2021-03-23 Thread Mike Larkin
On Tue, Mar 23, 2021 at 01:52:20PM +0100, Martin Pieuchot wrote:
> Diff below convert multiple "return(val)" and "return (val)" to
> "return val".  I only changed those that help decrease the size
> of the diff with NetBSD or didn't change anything.
>
> ok?
>

I read through these and agree this should not change any behaviour.

ok mlarkin if this helps you move forward by improving diffability.

> Index: uvm/uvm_amap.c
> ===
> RCS file: /cvs/src/sys/uvm/uvm_amap.c,v
> retrieving revision 1.88
> diff -u -p -r1.88 uvm_amap.c
> --- uvm/uvm_amap.c20 Mar 2021 10:24:21 -  1.88
> +++ uvm/uvm_amap.c23 Mar 2021 12:14:26 -
> @@ -342,7 +342,7 @@ amap_alloc1(int slots, int waitf, int la
>   amap = pool_get(_small_amap_pool[slots - 1],
>   pwaitf | PR_ZERO);
>   if (amap == NULL)
> - return(NULL);
> + return NULL;
>
>   amap->am_lock = NULL;
>   amap->am_ref = 1;
> @@ -355,7 +355,7 @@ amap_alloc1(int slots, int waitf, int la
>
>   if (UVM_AMAP_SMALL(amap)) {
>   amap->am_small.ac_nslot = slots;
> - return (amap);
> + return amap;
>   }
>
>   amap->am_ncused = 0;
> @@ -392,14 +392,14 @@ amap_alloc1(int slots, int waitf, int la
>   }
>   }
>
> - return(amap);
> + return amap;
>
>  fail1:
>   free(amap->am_buckets, M_UVMAMAP, buckets * sizeof(*amap->am_buckets));
>   TAILQ_FOREACH_SAFE(chunk, >am_chunks, ac_list, tmp)
>   pool_put(_amap_chunk_pool, chunk);
>   pool_put(_amap_pool, amap);
> - return (NULL);
> + return NULL;
>  }
>
>  static void
> @@ -423,7 +423,7 @@ amap_alloc(vaddr_t sz, int waitf, int la
>
>   AMAP_B2SLOT(slots, sz); /* load slots */
>   if (slots > INT_MAX)
> - return (NULL);
> + return NULL;
>
>   amap = amap_alloc1(slots, waitf, lazyalloc);
>   if (amap != NULL) {
> @@ -431,7 +431,7 @@ amap_alloc(vaddr_t sz, int waitf, int la
>   amap_list_insert(amap);
>   }
>
> - return(amap);
> + return amap;
>  }
>
>
> Index: uvm/uvm_anon.c
> ===
> RCS file: /cvs/src/sys/uvm/uvm_anon.c,v
> retrieving revision 1.53
> diff -u -p -r1.53 uvm_anon.c
> --- uvm/uvm_anon.c20 Mar 2021 10:24:21 -  1.53
> +++ uvm/uvm_anon.c23 Mar 2021 12:01:03 -
> @@ -67,7 +67,7 @@ uvm_analloc(void)
>   anon->an_page = NULL;
>   anon->an_swslot = 0;
>   }
> - return(anon);
> + return anon;
>  }
>
>  /*
> Index: uvm/uvm_aobj.c
> ===
> RCS file: /cvs/src/sys/uvm/uvm_aobj.c,v
> retrieving revision 1.92
> diff -u -p -r1.92 uvm_aobj.c
> --- uvm/uvm_aobj.c20 Mar 2021 10:24:21 -  1.92
> +++ uvm/uvm_aobj.c23 Mar 2021 12:17:00 -
> @@ -211,7 +211,7 @@ uao_find_swhash_elt(struct uvm_aobj *aob
>*/
>   LIST_FOREACH(elt, swhash, list) {
>   if (elt->tag == page_tag)
> - return(elt);
> + return elt;
>   }
>
>   if (!create)
> @@ -234,7 +234,7 @@ uao_find_swhash_elt(struct uvm_aobj *aob
>   LIST_INSERT_HEAD(swhash, elt, list);
>   elt->tag = page_tag;
>
> - return(elt);
> + return elt;
>  }
>
>  /*
> @@ -248,7 +248,7 @@ uao_find_swslot(struct uvm_aobj *aobj, i
>* if noswap flag is set, then we never return a slot
>*/
>   if (aobj->u_flags & UAO_FLAG_NOSWAP)
> - return(0);
> + return 0;
>
>   /*
>* if hashing, look in hash table.
> @@ -258,15 +258,15 @@ uao_find_swslot(struct uvm_aobj *aobj, i
>   uao_find_swhash_elt(aobj, pageidx, FALSE);
>
>   if (elt)
> - return(UAO_SWHASH_ELT_PAGESLOT(elt, pageidx));
> + return UAO_SWHASH_ELT_PAGESLOT(elt, pageidx);
>   else
> - return(0);
> + return 0;
>   }
>
>   /*
>* otherwise, look in the array
>*/
> - return(aobj->u_swslots[pageidx]);
> + return aobj->u_swslots[pageidx];
>  }
>
>  /*
> @@ -289,7 +289,7 @@ uao_set_swslot(struct uvm_object *uobj,
>*/
>   if (aobj->u_flags & UAO_FLAG_NOSWAP) {
>   if (slot == 0)
> - return(0);  /* a clear is ok */
> + return 0;   /* a clear is ok */
>
>   /* but a set is not */
>   printf("uao_set_swslot: uobj = %p\n", uobj);
> @@ -309,7 +309,7 @@ uao_set_swslot(struct uvm_object *uobj,
>   uao_find_swhash_elt(aobj, pageidx, slot ? TRUE : FALSE);
>   if (elt == NULL) {
>   KASSERT(slot == 0);
> - return (0);
> + return 0;
>   }
>
>   oldslot = 

UVM return(val)

2021-03-23 Thread Martin Pieuchot
Diff below convert multiple "return(val)" and "return (val)" to
"return val".  I only changed those that help decrease the size
of the diff with NetBSD or didn't change anything.

ok?

Index: uvm/uvm_amap.c
===
RCS file: /cvs/src/sys/uvm/uvm_amap.c,v
retrieving revision 1.88
diff -u -p -r1.88 uvm_amap.c
--- uvm/uvm_amap.c  20 Mar 2021 10:24:21 -  1.88
+++ uvm/uvm_amap.c  23 Mar 2021 12:14:26 -
@@ -342,7 +342,7 @@ amap_alloc1(int slots, int waitf, int la
amap = pool_get(_small_amap_pool[slots - 1],
pwaitf | PR_ZERO);
if (amap == NULL)
-   return(NULL);
+   return NULL;
 
amap->am_lock = NULL;
amap->am_ref = 1;
@@ -355,7 +355,7 @@ amap_alloc1(int slots, int waitf, int la
 
if (UVM_AMAP_SMALL(amap)) {
amap->am_small.ac_nslot = slots;
-   return (amap);
+   return amap;
}
 
amap->am_ncused = 0;
@@ -392,14 +392,14 @@ amap_alloc1(int slots, int waitf, int la
}
}
 
-   return(amap);
+   return amap;
 
 fail1:
free(amap->am_buckets, M_UVMAMAP, buckets * sizeof(*amap->am_buckets));
TAILQ_FOREACH_SAFE(chunk, >am_chunks, ac_list, tmp)
pool_put(_amap_chunk_pool, chunk);
pool_put(_amap_pool, amap);
-   return (NULL);
+   return NULL;
 }
 
 static void
@@ -423,7 +423,7 @@ amap_alloc(vaddr_t sz, int waitf, int la
 
AMAP_B2SLOT(slots, sz); /* load slots */
if (slots > INT_MAX)
-   return (NULL);
+   return NULL;
 
amap = amap_alloc1(slots, waitf, lazyalloc);
if (amap != NULL) {
@@ -431,7 +431,7 @@ amap_alloc(vaddr_t sz, int waitf, int la
amap_list_insert(amap);
}
 
-   return(amap);
+   return amap;
 }
 
 
Index: uvm/uvm_anon.c
===
RCS file: /cvs/src/sys/uvm/uvm_anon.c,v
retrieving revision 1.53
diff -u -p -r1.53 uvm_anon.c
--- uvm/uvm_anon.c  20 Mar 2021 10:24:21 -  1.53
+++ uvm/uvm_anon.c  23 Mar 2021 12:01:03 -
@@ -67,7 +67,7 @@ uvm_analloc(void)
anon->an_page = NULL;
anon->an_swslot = 0;
}
-   return(anon);
+   return anon;
 }
 
 /*
Index: uvm/uvm_aobj.c
===
RCS file: /cvs/src/sys/uvm/uvm_aobj.c,v
retrieving revision 1.92
diff -u -p -r1.92 uvm_aobj.c
--- uvm/uvm_aobj.c  20 Mar 2021 10:24:21 -  1.92
+++ uvm/uvm_aobj.c  23 Mar 2021 12:17:00 -
@@ -211,7 +211,7 @@ uao_find_swhash_elt(struct uvm_aobj *aob
 */
LIST_FOREACH(elt, swhash, list) {
if (elt->tag == page_tag)
-   return(elt);
+   return elt;
}
 
if (!create)
@@ -234,7 +234,7 @@ uao_find_swhash_elt(struct uvm_aobj *aob
LIST_INSERT_HEAD(swhash, elt, list);
elt->tag = page_tag;
 
-   return(elt);
+   return elt;
 }
 
 /*
@@ -248,7 +248,7 @@ uao_find_swslot(struct uvm_aobj *aobj, i
 * if noswap flag is set, then we never return a slot
 */
if (aobj->u_flags & UAO_FLAG_NOSWAP)
-   return(0);
+   return 0;
 
/*
 * if hashing, look in hash table.
@@ -258,15 +258,15 @@ uao_find_swslot(struct uvm_aobj *aobj, i
uao_find_swhash_elt(aobj, pageidx, FALSE);
 
if (elt)
-   return(UAO_SWHASH_ELT_PAGESLOT(elt, pageidx));
+   return UAO_SWHASH_ELT_PAGESLOT(elt, pageidx);
else
-   return(0);
+   return 0;
}
 
/*
 * otherwise, look in the array
 */
-   return(aobj->u_swslots[pageidx]);
+   return aobj->u_swslots[pageidx];
 }
 
 /*
@@ -289,7 +289,7 @@ uao_set_swslot(struct uvm_object *uobj, 
 */
if (aobj->u_flags & UAO_FLAG_NOSWAP) {
if (slot == 0)
-   return(0);  /* a clear is ok */
+   return 0;   /* a clear is ok */
 
/* but a set is not */
printf("uao_set_swslot: uobj = %p\n", uobj);
@@ -309,7 +309,7 @@ uao_set_swslot(struct uvm_object *uobj, 
uao_find_swhash_elt(aobj, pageidx, slot ? TRUE : FALSE);
if (elt == NULL) {
KASSERT(slot == 0);
-   return (0);
+   return 0;
}
 
oldslot = UAO_SWHASH_ELT_PAGESLOT(elt, pageidx);
@@ -336,7 +336,7 @@ uao_set_swslot(struct uvm_object *uobj, 
oldslot = aobj->u_swslots[pageidx];
aobj->u_swslots[pageidx] = slot;
}
-   return (oldslot);
+   return oldslot;
 }
 /*
  * end of hash/array