Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/emips/ebus - ANSIfy, KNF, remove __P()



details:   https://anonhg.NetBSD.org/src/rev/0e6d80f5f139
branches:  trunk
changeset: 765959:0e6d80f5f139
user:      tsutsui <tsutsui%NetBSD.org@localhost>
date:      Sun Jun 12 03:52:13 2011 +0000

description:
- ANSIfy, KNF, remove __P()
- use device_t and cfdata_t

diffstat:

 sys/arch/emips/ebus/ebus.c       |  61 ++++++++++++++++++---------------------
 sys/arch/emips/ebus/ebus_emips.c |  43 ++++++++++++++-------------
 2 files changed, 50 insertions(+), 54 deletions(-)

diffs (211 lines):

diff -r c47b2698fd81 -r 0e6d80f5f139 sys/arch/emips/ebus/ebus.c
--- a/sys/arch/emips/ebus/ebus.c        Sun Jun 12 03:50:42 2011 +0000
+++ b/sys/arch/emips/ebus/ebus.c        Sun Jun 12 03:52:13 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ebus.c,v 1.1 2011/01/26 01:18:50 pooka Exp $   */
+/*     $NetBSD: ebus.c,v 1.2 2011/06/12 03:52:13 tsutsui Exp $ */
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>                 /* RCS ID & Copyright macro defns */
-__KERNEL_RCSID(0, "$NetBSD: ebus.c,v 1.1 2011/01/26 01:18:50 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ebus.c,v 1.2 2011/06/12 03:52:13 tsutsui Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -44,13 +44,11 @@
 #include "locators.h"
 
 void
-ebusattach(parent, self, aux)
-       struct device *parent, *self;
-       void *aux;
+ebusattach(device_t parent, device_t self, void *aux)
 {
        struct ebus_dev_attach_args *ida = aux;
        struct ebus_attach_args *ia;
-    void *addr;
+       void *addr;
        int i;
        int locs[EBUSCF_NLOCS];
 
@@ -65,38 +63,38 @@
                ia = &ida->ida_devs[i];
 
 #if 0 // DEBUG
-        printf("PROBING %s %d@%x i=%d\n", ia->ia_name, ia->ia_basz, ia->ia_paddr, ia->ia_cookie);
+               printf("PROBING %s %d@%x i=%d\n",
+                   ia->ia_name, ia->ia_basz, ia->ia_paddr, ia->ia_cookie);
 #endif
                if (ia->ia_basz != 0) {
-            addr = (void *) mips_map_physmem(ia->ia_paddr, ia->ia_basz);
-            if (addr == NULL){
-                printf("Failed to map %s: phys %x size %d\n",
-                       ia->ia_name, ia->ia_paddr, ia->ia_basz);
-                continue;
-            }
-            ia->ia_vaddr = addr;
+                       addr = (void *)mips_map_physmem(ia->ia_paddr,
+                           ia->ia_basz);
+                       if (addr == NULL) {
+                               printf("Failed to map %s: phys %x size %d\n",
+                                   ia->ia_name, ia->ia_paddr, ia->ia_basz);
+                               continue;
+                       }
+                       ia->ia_vaddr = addr;
 #if 0 // DEBUG
-            printf("MAPPED at %p\n", ia->ia_vaddr);
+                       printf("MAPPED at %p\n", ia->ia_vaddr);
 #endif
-        }
-
+               }
 
                locs[EBUSCF_ADDR] = ia->ia_paddr;
 
                if (NULL == config_found_sm_loc(self, "ebus", locs, ia,
-                                        ebusprint, config_stdsubmatch)) {
-            /* do we need to say anything? */
-            if (ia->ia_basz != 0) {
-                mips_unmap_physmem((vaddr_t)ia->ia_vaddr, ia->ia_basz);
-            }            
-        }
+                   ebusprint, config_stdsubmatch)) {
+                       /* do we need to say anything? */
+                       if (ia->ia_basz != 0) {
+                               mips_unmap_physmem((vaddr_t)ia->ia_vaddr,
+                                   ia->ia_basz);
+                       }
+               }
        }
 }
 
 int
-ebusprint(aux, pnp)
-       void *aux;
-       const char *pnp;
+ebusprint(void *aux, const char *pnp)
 {
        struct ebus_attach_args *ia = aux;
 
@@ -105,16 +103,13 @@
 
        aprint_normal(" addr 0x%x", ia->ia_paddr);
 
-       return (UNCONF);
+       return UNCONF;
 }
 
 void
-ebus_intr_establish(dev, cookie, level, handler, arg)
-       struct device *dev;
-       void *cookie;
-       int level;
-       int (*handler) (void *, void *);
-       void *arg;
+ebus_intr_establish(device_t dev, void *cookie, int level,
+    int (*handler)(void *, void *), void *arg)
 {
+
        (*platform.intr_establish)(dev, cookie, level, handler, arg);
 }
diff -r c47b2698fd81 -r 0e6d80f5f139 sys/arch/emips/ebus/ebus_emips.c
--- a/sys/arch/emips/ebus/ebus_emips.c  Sun Jun 12 03:50:42 2011 +0000
+++ b/sys/arch/emips/ebus/ebus_emips.c  Sun Jun 12 03:52:13 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ebus_emips.c,v 1.1 2011/01/26 01:18:50 pooka Exp $     */
+/*     $NetBSD: ebus_emips.c,v 1.2 2011/06/12 03:52:13 tsutsui Exp $   */
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>                 /* RCS ID & Copyright macro defns */
-__KERNEL_RCSID(0, "$NetBSD: ebus_emips.c,v 1.1 2011/01/26 01:18:50 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ebus_emips.c,v 1.2 2011/06/12 03:52:13 tsutsui Exp $");
 
 #include "opt_xilinx_ml40x.h"
 #include "opt_xs_bee3.h"
@@ -48,8 +48,8 @@
 #include <machine/emipsreg.h>
 #include <emips/emips/emipstype.h>
 
-static int     ebus_emips_match __P((struct device *, struct cfdata *, void *));
-static void    ebus_emips_attach __P((struct device *, struct device *, void *));
+static int     ebus_emips_match(device_t, cfdata_t, void *);
+static void    ebus_emips_attach(device_t, device_t, void *);
 
 CFATTACH_DECL(ebus_emips, sizeof(struct ebus_softc),
     ebus_emips_match, ebus_emips_attach, NULL, NULL);
@@ -57,18 +57,18 @@
 #if defined(XILINX_ML40x) || defined(XS_BEE3)
 struct ebus_attach_args ebus_emips_devs[] = {
    /* NAME     INTERRUPT        PHYS                      VIRT  PHYS_SIZE */
-   { "eclock", AIC_TIMER,      TIMER_DEFAULT_ADDRESS,    NULL, sizeof(struct _Tc) },
-   { "dz",     AIC_USART,          USART_DEFAULT_ADDRESS,    NULL, sizeof(struct _Usart)},
+   { "eclock", AIC_TIMER,       TIMER_DEFAULT_ADDRESS,    NULL, sizeof(struct _Tc) },
+   { "dz",     AIC_USART,       USART_DEFAULT_ADDRESS,    NULL, sizeof(struct _Usart)},
    { "ace",    AIC_SYSTEM_ACE,  IDE_DEFAULT_ADDRESS,      NULL, sizeof(struct _Sac) },
    { "ace",    AIC_SYSTEM_ACE2, IDE_DEFAULT_ADDRESS+256,  NULL, sizeof(struct _Sac) },
-   { "enic",   AIC_ETHERNET,   ETHERNET_DEFAULT_ADDRESS, NULL, sizeof(struct _Enic) },
-   { "icap",   AIC_ICAP,               ICAP_DEFAULT_ADDRESS,     NULL, sizeof(struct _Icap) },
-   { "gpio",   AIC_GPIO,               GPIO_DEFAULT_ADDRESS,     NULL, sizeof(struct _Pio) },
-   { "flash",  0,                              FLASH_0_DEFAULT_ADDRESS,  NULL, sizeof(struct _Flash) },
-   { "lcd",    0,                              LCD_DEFAULT_ADDRESS,      NULL, sizeof(struct _Lcd) },
-   { "evga",   AIC_VGA,                        VGA_DEFAULT_ADDRESS,      NULL, sizeof(struct _Evga) },
-   { "ps2",    AIC_PS2,                        PS2_DEFAULT_ADDRESS,      NULL, sizeof(struct _Cpbdi) },
-   { "ac97",   AIC_AC97,               AC97_DEFAULT_ADDRESS,     NULL, sizeof(struct _Cpbdi) },
+   { "enic",   AIC_ETHERNET,    ETHERNET_DEFAULT_ADDRESS, NULL, sizeof(struct _Enic) },
+   { "icap",   AIC_ICAP,        ICAP_DEFAULT_ADDRESS,     NULL, sizeof(struct _Icap) },
+   { "gpio",   AIC_GPIO,        GPIO_DEFAULT_ADDRESS,     NULL, sizeof(struct _Pio) },
+   { "flash",  0,               FLASH_0_DEFAULT_ADDRESS,  NULL, sizeof(struct _Flash) },
+   { "lcd",    0,               LCD_DEFAULT_ADDRESS,      NULL, sizeof(struct _Lcd) },
+   { "evga",   AIC_VGA,         VGA_DEFAULT_ADDRESS,      NULL, sizeof(struct _Evga) },
+   { "ps2",    AIC_PS2,         PS2_DEFAULT_ADDRESS,      NULL, sizeof(struct _Cpbdi) },
+   { "ac97",   AIC_AC97,        AC97_DEFAULT_ADDRESS,     NULL, sizeof(struct _Cpbdi) },
 };
 static const int ebus_emips_ndevs =
        sizeof(ebus_emips_devs)/sizeof(ebus_emips_devs[0]);
@@ -77,22 +77,22 @@
 static int ebus_attached;
 
 static int
-ebus_emips_match(struct device *parent, struct cfdata *cfdata, void *aux)
+ebus_emips_match(device_t parent, cfdata_t cf, void *aux)
 {
        struct mainbus_attach_args *ma = aux;
 
        if (ebus_attached)
-               return (0);
+               return 0;
        if (systype != XS_ML40x && systype != XS_BE3 && systype != XS_ML50x)
-               return (0);
+               return 0;
        if (strcmp(ma->ma_name, "baseboard") != 0)
-               return (0);
+               return 0;
 
-       return (1);
+       return 1;
 }
 
 static void
-ebus_emips_attach(struct device *parent, struct device *self, void *aux)
+ebus_emips_attach(device_t parent, device_t self, void *aux)
 {
        struct ebus_dev_attach_args ida;
 
@@ -109,7 +109,8 @@
                break;
 #endif
        default:
-               panic("ebus_emips_attach: no ebus configured for systype = %d", systype);
+               panic("ebus_emips_attach: no ebus configured for systype = %d",
+                   systype);
        }
 
        ebusattach(parent, self, &ida);



Home | Main Index | Thread Index | Old Index