Wed Sep 8 11:59:43 2021 UTC ()
Restore braces for if/else statements which have logically single line,
but physically multiple lines.

This is recommended by an example in style:
http://cvsweb.netbsd.org/bsdweb.cgi/src/share/misc/style#rev1.58

Thanks tsutsui@ for pointing it out.


(rin)
diff -r1.92 -r1.93 src/sys/arch/sh3/sh3/pmap.c

cvs diff -r1.92 -r1.93 src/sys/arch/sh3/sh3/pmap.c (expand / switch to unified diff)

--- src/sys/arch/sh3/sh3/pmap.c 2021/09/08 07:25:55 1.92
+++ src/sys/arch/sh3/sh3/pmap.c 2021/09/08 11:59:43 1.93
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: pmap.c,v 1.92 2021/09/08 07:25:55 rin Exp $ */ 1/* $NetBSD: pmap.c,v 1.93 2021/09/08 11:59:43 rin Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2002 The NetBSD Foundation, Inc. 4 * Copyright (c) 2002 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by UCHIYAMA Yasushi. 8 * by UCHIYAMA Yasushi.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -20,27 +20,27 @@ @@ -20,27 +20,27 @@
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE. 29 * POSSIBILITY OF SUCH DAMAGE.
30 */ 30 */
31 31
32#include <sys/cdefs.h> 32#include <sys/cdefs.h>
33__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.92 2021/09/08 07:25:55 rin Exp $"); 33__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.93 2021/09/08 11:59:43 rin Exp $");
34 34
35#include <sys/param.h> 35#include <sys/param.h>
36#include <sys/systm.h> 36#include <sys/systm.h>
37#include <sys/pool.h> 37#include <sys/pool.h>
38#include <sys/msgbuf.h> 38#include <sys/msgbuf.h>
39#include <sys/socketvar.h> /* XXX: for sock_loan_thresh */ 39#include <sys/socketvar.h> /* XXX: for sock_loan_thresh */
40 40
41#include <uvm/uvm.h> 41#include <uvm/uvm.h>
42#include <uvm/uvm_physseg.h> 42#include <uvm/uvm_physseg.h>
43 43
44#include <sh3/mmu.h> 44#include <sh3/mmu.h>
45#include <sh3/cache.h> 45#include <sh3/cache.h>
46 46
@@ -361,34 +361,35 @@ pmap_enter(pmap_t pmap, vaddr_t va, padd @@ -361,34 +361,35 @@ pmap_enter(pmap_t pmap, vaddr_t va, padd
361 } 361 }
362 362
363 /* Check for existing mapping */ 363 /* Check for existing mapping */
364 if (__pmap_map_change(pmap, va, pa, prot, entry)) 364 if (__pmap_map_change(pmap, va, pa, prot, entry))
365 return 0; 365 return 0;
366 366
367 /* Add to physical-virtual map list of this page */ 367 /* Add to physical-virtual map list of this page */
368 if (__pmap_pv_enter(pmap, pg, va)) { 368 if (__pmap_pv_enter(pmap, pg, va)) {
369 if (flags & PMAP_CANFAIL) 369 if (flags & PMAP_CANFAIL)
370 return ENOMEM; 370 return ENOMEM;
371 panic("%s: cannot allocate pv", __func__); 371 panic("%s: cannot allocate pv", __func__);
372 } 372 }
373 } else { /* bus-space (always uncached map) */ 373 } else { /* bus-space (always uncached map) */
374 if (kva) 374 if (kva) {
375 entry |= PG_V | PG_SH | 375 entry |= PG_V | PG_SH |
376 ((prot & VM_PROT_WRITE) ? 376 ((prot & VM_PROT_WRITE) ?
377 (PG_PR_KRW | PG_D) : PG_PR_KRO); 377 (PG_PR_KRW | PG_D) : PG_PR_KRO);
378 else 378 } else {
379 entry |= PG_V | 379 entry |= PG_V |
380 ((prot & VM_PROT_WRITE) ? 380 ((prot & VM_PROT_WRITE) ?
381 (PG_PR_URW | PG_D) : PG_PR_URO); 381 (PG_PR_URW | PG_D) : PG_PR_URO);
 382 }
382 } 383 }
383 384
384 /* Register to page table */ 385 /* Register to page table */
385 if (kva) 386 if (kva)
386 pte = __pmap_kpte_lookup(va); 387 pte = __pmap_kpte_lookup(va);
387 else { 388 else {
388 pte = __pmap_pte_alloc(pmap, va); 389 pte = __pmap_pte_alloc(pmap, va);
389 if (pte == NULL) { 390 if (pte == NULL) {
390 if (flags & PMAP_CANFAIL) { 391 if (flags & PMAP_CANFAIL) {
391 if (pg != NULL) 392 if (pg != NULL)
392 __pmap_pv_remove(pmap, pg, va); 393 __pmap_pv_remove(pmap, pg, va);
393 return ENOMEM; 394 return ENOMEM;
394 } 395 }
@@ -778,29 +779,30 @@ pmap_zero_page(paddr_t phys) @@ -778,29 +779,30 @@ pmap_zero_page(paddr_t phys)
778 } else 779 } else
779 memset((void *)SH3_PHYS_TO_P1SEG(phys), 0, PAGE_SIZE); 780 memset((void *)SH3_PHYS_TO_P1SEG(phys), 0, PAGE_SIZE);
780} 781}
781 782
782void 783void
783pmap_copy_page(paddr_t src, paddr_t dst) 784pmap_copy_page(paddr_t src, paddr_t dst)
784{ 785{
785 786
786 if (SH_HAS_VIRTUAL_ALIAS) { /* don't polute cache */ 787 if (SH_HAS_VIRTUAL_ALIAS) { /* don't polute cache */
787 /* sync cache since we access via P2. */ 788 /* sync cache since we access via P2. */
788 sh_dcache_wbinv_all(); 789 sh_dcache_wbinv_all();
789 memcpy((void *)SH3_PHYS_TO_P2SEG(dst), 790 memcpy((void *)SH3_PHYS_TO_P2SEG(dst),
790 (void *)SH3_PHYS_TO_P2SEG(src), PAGE_SIZE); 791 (void *)SH3_PHYS_TO_P2SEG(src), PAGE_SIZE);
791 } else 792 } else {
792 memcpy((void *)SH3_PHYS_TO_P1SEG(dst), 793 memcpy((void *)SH3_PHYS_TO_P1SEG(dst),
793 (void *)SH3_PHYS_TO_P1SEG(src), PAGE_SIZE); 794 (void *)SH3_PHYS_TO_P1SEG(src), PAGE_SIZE);
 795 }
794} 796}
795 797
796bool 798bool
797pmap_is_referenced(struct vm_page *pg) 799pmap_is_referenced(struct vm_page *pg)
798{ 800{
799 struct vm_page_md *pvh = VM_PAGE_TO_MD(pg); 801 struct vm_page_md *pvh = VM_PAGE_TO_MD(pg);
800 802
801 return (pvh->pvh_flags & PVH_REFERENCED) ? true : false; 803 return (pvh->pvh_flags & PVH_REFERENCED) ? true : false;
802} 804}
803 805
804bool 806bool
805pmap_clear_reference(struct vm_page *pg) 807pmap_clear_reference(struct vm_page *pg)
806{ 808{