Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/atari/atari ANSIfy, some KNF.



details:   https://anonhg.NetBSD.org/src/rev/115e7060f7af
branches:  trunk
changeset: 753513:115e7060f7af
user:      tsutsui <tsutsui%NetBSD.org@localhost>
date:      Wed Mar 31 13:15:52 2010 +0000

description:
ANSIfy, some KNF.

diffstat:

 sys/arch/atari/atari/be_bus.c |    6 +-
 sys/arch/atari/atari/bus.c    |  141 ++++++++++++++++++++++-------------------
 2 files changed, 79 insertions(+), 68 deletions(-)

diffs (truncated from 467 to 300 lines):

diff -r c1f3b25628f4 -r 115e7060f7af sys/arch/atari/atari/be_bus.c
--- a/sys/arch/atari/atari/be_bus.c     Wed Mar 31 13:10:10 2010 +0000
+++ b/sys/arch/atari/atari/be_bus.c     Wed Mar 31 13:15:52 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: be_bus.c,v 1.13 2009/03/18 16:00:10 cegger Exp $       */
+/*     $NetBSD: be_bus.c,v 1.14 2010/03/31 13:15:52 tsutsui Exp $      */
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: be_bus.c,v 1.13 2009/03/18 16:00:10 cegger Exp $");
+__KERNEL_RCSID(0, "$NetBSD: be_bus.c,v 1.14 2010/03/31 13:15:52 tsutsui Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -184,7 +184,7 @@
                beb_t = storage;
        else {
            if ((beb_t = malloc(sizeof(*beb_t), M_TEMP, M_NOWAIT)) == NULL)
-               return(NULL);
+               return NULL;
        }
        memset(beb_t, 0, sizeof(*beb_t));
        
diff -r c1f3b25628f4 -r 115e7060f7af sys/arch/atari/atari/bus.c
--- a/sys/arch/atari/atari/bus.c        Wed Mar 31 13:10:10 2010 +0000
+++ b/sys/arch/atari/atari/bus.c        Wed Mar 31 13:15:52 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bus.c,v 1.51 2009/03/18 16:00:10 cegger Exp $  */
+/*     $NetBSD: bus.c,v 1.52 2010/03/31 13:15:52 tsutsui Exp $ */
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: bus.c,v 1.51 2009/03/18 16:00:10 cegger Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bus.c,v 1.52 2010/03/31 13:15:52 tsutsui Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -128,6 +128,7 @@
 int
 bootm_free(vaddr_t va, u_long size)
 {
+
        if ((va < bootm_ex->ex_start) || ((va + size) > bootm_ex->ex_end))
                return 0; /* Not for us! */
        extent_free(bootm_ex, va, size, EX_NOWAIT);
@@ -135,7 +136,8 @@
 }
 
 int
-bus_space_map(bus_space_tag_t t, bus_addr_t bpa, bus_size_t size, int flags, bus_space_handle_t *mhp)
+bus_space_map(bus_space_tag_t t, bus_addr_t bpa, bus_size_t size, int flags,
+    bus_space_handle_t *mhp)
 {
        int     error;
 
@@ -147,21 +149,24 @@
                        EX_NOWAIT | (iomem_malloc_safe ? EX_MALLOCOK : 0));
 
        if (error)
-               return (error);
+               return error;
 
        error = bus_mem_add_mapping(t, bpa, size, flags, mhp);
        if (error) {
                if (extent_free(iomem_ex, bpa + t->base, size, EX_NOWAIT |
-                               (iomem_malloc_safe ? EX_MALLOCOK : 0))) {
-                   printf("bus_space_map: pa 0x%lx, size 0x%lx\n", bpa, size);
-                   printf("bus_space_map: can't free region\n");
+                   (iomem_malloc_safe ? EX_MALLOCOK : 0))) {
+                       printf("bus_space_map: pa 0x%lx, size 0x%lx\n",
+                           bpa, size);
+                       printf("bus_space_map: can't free region\n");
                }
        }
-       return (error);
+       return error;
 }
 
 int
-bus_space_alloc(bus_space_tag_t t, bus_addr_t rstart, bus_addr_t rend, bus_size_t size, bus_size_t alignment, bus_size_t boundary, int flags, bus_addr_t *bpap, bus_space_handle_t *bshp)
+bus_space_alloc(bus_space_tag_t t, bus_addr_t rstart, bus_addr_t rend,
+    bus_size_t size, bus_size_t alignment, bus_size_t boundary, int flags,
+    bus_addr_t *bpap, bus_space_handle_t *bshp)
 {
        u_long bpa;
        int error;
@@ -172,8 +177,8 @@
         * XXX: Since we manage the whole of memory in a single map,
         *      this is nonsense for now! Brace it DIAGNOSTIC....
         */
-       if ((rstart + t->base) < iomem_ex->ex_start
-                               || (rend + t->base) > iomem_ex->ex_end)
+       if ((rstart + t->base) < iomem_ex->ex_start ||
+           (rend + t->base) > iomem_ex->ex_end)
                panic("bus_space_alloc: bad region start/end");
 #endif /* DIAGNOSTIC */
 
@@ -186,7 +191,7 @@
            &bpa);
 
        if (error)
-               return (error);
+               return error;
 
        /*
         * Map the bus physical address to a kernel virtual address.
@@ -203,11 +208,12 @@
 
        *bpap = bpa;
 
-       return (error);
+       return error;
 }
 
 static int
-bus_mem_add_mapping(bus_space_tag_t t, bus_addr_t bpa, bus_size_t size, int flags, bus_space_handle_t *bshp)
+bus_mem_add_mapping(bus_space_tag_t t, bus_addr_t bpa, bus_size_t size,
+    int flags, bus_space_handle_t *bshp)
 {
        vaddr_t va;
        paddr_t pa, endpa;
@@ -227,15 +233,15 @@
                 */
                va = bootm_alloc(pa, endpa - pa, flags);
                if (va == 0)
-                       return (ENOMEM);
+                       return ENOMEM;
                *bshp = va + (bpa & PGOFSET);
-               return (0);
+               return 0;
        }
 
        va = uvm_km_alloc(kernel_map, endpa - pa, 0,
            UVM_KMF_VAONLY | UVM_KMF_NOWAIT);
        if (va == 0)
-               return (ENOMEM);
+               return ENOMEM;
 
        *bshp = va + (bpa & PGOFSET);
 
@@ -243,12 +249,12 @@
                u_int   *ptep, npte;
 
                pmap_enter(pmap_kernel(), (vaddr_t)va, pa,
-                               VM_PROT_READ|VM_PROT_WRITE, PMAP_WIRED);
+                   VM_PROT_READ|VM_PROT_WRITE, PMAP_WIRED);
 
                ptep = kvtopte(va);
                npte = *ptep & ~PG_CMASK;
 
-               if (!(flags & BUS_SPACE_MAP_CACHEABLE))
+               if ((flags & BUS_SPACE_MAP_CACHEABLE) == 0)
                        npte |= PG_CI;
                else if (mmutype == MMU_68040)
                        npte |= PG_CCB;
@@ -257,7 +263,7 @@
        }
        pmap_update(pmap_kernel());
        TBIAS();
-       return (0);
+       return 0;
 }
 
 void
@@ -273,7 +279,7 @@
                panic("unmap_iospace: overflow");
 #endif
 
-       (void) pmap_extract(pmap_kernel(), va, &bpa);
+       (void)pmap_extract(pmap_kernel(), va, &bpa);
        bpa += ((u_long)bsh & PGOFSET);
 
        /*
@@ -289,7 +295,7 @@
         * Mark as free in the extent map.
         */
        if (extent_free(iomem_ex, bpa, size,
-                       EX_NOWAIT | (iomem_malloc_safe ? EX_MALLOCOK : 0))) {
+           EX_NOWAIT | (iomem_malloc_safe ? EX_MALLOCOK : 0))) {
                printf("bus_space_unmap: pa 0x%lx, size 0x%lx\n", bpa, size);
                printf("bus_space_unmap: can't free region\n");
        }
@@ -298,18 +304,18 @@
 /*
  * Get a new handle for a subregion of an already-mapped area of bus space.
  */
-int bus_space_subregion(t, memh, off, sz, mhp)
-bus_space_tag_t                t;
-bus_space_handle_t     memh;
-bus_size_t             off, sz;
-bus_space_handle_t     *mhp;
+int
+bus_space_subregion(bus_space_tag_t t, bus_space_handle_t memh,
+    bus_size_t off, bus_size_t sz, bus_space_handle_t *mhp)
 {
+
        *mhp = memh + off;
        return 0;
 }
 
 paddr_t
-bus_space_mmap(bus_space_tag_t t, bus_addr_t addr, off_t off, int prot, int flags)
+bus_space_mmap(bus_space_tag_t t, bus_addr_t addr, off_t off, int prot,
+    int flags)
 {
 
        /*
@@ -319,7 +325,7 @@
         * Note we are called for each "page" in the device that
         * the upper layers want to map.
         */
-       return (m68k_btop(addr + off));
+       return m68k_btop(addr + off);
 }
 
 /*
@@ -327,7 +333,8 @@
  * DMA map creation functions.
  */
 int
-_bus_dmamap_create(bus_dma_tag_t t, bus_size_t size, int nsegments, bus_size_t maxsegsz, bus_size_t boundary, int flags, bus_dmamap_t *dmamp)
+_bus_dmamap_create(bus_dma_tag_t t, bus_size_t size, int nsegments,
+    bus_size_t maxsegsz, bus_size_t boundary, int flags, bus_dmamap_t *dmamp)
 {
        struct atari_bus_dmamap *map;
        void *mapstore;
@@ -349,7 +356,7 @@
            (sizeof(bus_dma_segment_t) * (nsegments - 1));
        if ((mapstore = malloc(mapsize, M_DMAMAP,
            (flags & BUS_DMA_NOWAIT) ? M_NOWAIT : M_WAITOK)) == NULL)
-               return (ENOMEM);
+               return ENOMEM;
 
        memset(mapstore, 0, mapsize);
        map = (struct atari_bus_dmamap *)mapstore;
@@ -363,7 +370,7 @@
        map->dm_nsegs = 0;
 
        *dmamp = map;
-       return (0);
+       return 0;
 }
 
 /*
@@ -382,7 +389,8 @@
  * be called by bus-specific DMA map load functions.
  */
 int
-_bus_dmamap_load(bus_dma_tag_t t, bus_dmamap_t map, void *buf, bus_size_t buflen, struct proc *p, int flags)
+_bus_dmamap_load(bus_dma_tag_t t, bus_dmamap_t map, void *buf,
+    bus_size_t buflen, struct proc *p, int flags)
 {
        paddr_t lastaddr;
        int seg, error;
@@ -396,7 +404,7 @@
        KASSERT(map->dm_maxsegsz <= map->_dm_maxmaxsegsz);
 
        if (buflen > map->_dm_size)
-               return (EINVAL);
+               return EINVAL;
 
        if (p != NULL) {
                vm = p->p_vmspace;
@@ -411,14 +419,15 @@
                map->dm_mapsize = buflen;
                map->dm_nsegs = seg + 1;
        }
-       return (error);
+       return error;
 }
 
 /*
  * Like _bus_dmamap_load(), but for mbufs.
  */
 int
-_bus_dmamap_load_mbuf(bus_dma_tag_t t, bus_dmamap_t map, struct mbuf *m0, int flags)
+_bus_dmamap_load_mbuf(bus_dma_tag_t t, bus_dmamap_t map, struct mbuf *m0,
+    int flags)
 {
        paddr_t lastaddr;
        int seg, error, first;
@@ -437,7 +446,7 @@
 #endif
 
        if (m0->m_pkthdr.len > map->_dm_size)
-               return (EINVAL);
+               return EINVAL;
 
        first = 1;
        seg = 0;
@@ -453,14 +462,15 @@
                map->dm_mapsize = m0->m_pkthdr.len;



Home | Main Index | Thread Index | Old Index