Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/hpcarm/dev Cleanup:



details:   https://anonhg.NetBSD.org/src/rev/61860db9fb1f
branches:  trunk
changeset: 588813:61860db9fb1f
user:      peter <peter%NetBSD.org@localhost>
date:      Sat Mar 04 16:51:56 2006 +0000

description:
Cleanup:
- Apply static.
- KNF.
- Wrap long lines, unwrap short lines.

No functional changes.

diffstat:

 sys/arch/hpcarm/dev/sed_saip.c |  289 ++++++++++++++++++++--------------------
 1 files changed, 147 insertions(+), 142 deletions(-)

diffs (truncated from 659 to 300 lines):

diff -r fb777a4bf8a6 -r 61860db9fb1f sys/arch/hpcarm/dev/sed_saip.c
--- a/sys/arch/hpcarm/dev/sed_saip.c    Sat Mar 04 15:23:14 2006 +0000
+++ b/sys/arch/hpcarm/dev/sed_saip.c    Sat Mar 04 16:51:56 2006 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sed_saip.c,v 1.17 2006/03/04 15:23:14 peter Exp $      */
+/*     $NetBSD: sed_saip.c,v 1.18 2006/03/04 16:51:56 peter Exp $      */
 
 /*-
  * Copyright (c) 1999-2001
@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sed_saip.c,v 1.17 2006/03/04 15:23:14 peter Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sed_saip.c,v 1.18 2006/03/04 16:51:56 peter Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -44,8 +44,6 @@
 #include <sys/ioctl.h>
 #include <sys/reboot.h>
 
-#include <uvm/uvm_extern.h>
-
 #include <machine/bus.h>
 #include <machine/bootinfo.h>
 #include <machine/config_hook.h>
@@ -61,7 +59,7 @@
 #include <dev/hpc/hpcfbio.h>
 #include <dev/hpc/hpccmapvar.h>
 
-#include <arch/hpcarm/dev/sed1356var.h>
+#include <hpcarm/dev/sed1356var.h>
 
 #ifdef SED_DEBUG
 #define VPRINTF(arg)   do { if (bootverbose) printf arg; } while (0);
@@ -70,24 +68,19 @@
 #endif
 
 /*
- *  function prototypes
+ * Function prototypes.
  */
-int    sed1356match(struct device *, struct cfdata *, void *);
-void   sed1356attach(struct device *, struct device *, void *);
-int    sed1356_ioctl(void *, u_long, caddr_t, int, struct lwp *);
-paddr_t        sed1356_mmap(void *, off_t, int);
+static int     sed1356_match(struct device *, struct cfdata *, void *);
+static void    sed1356_attach(struct device *, struct device *, void *);
+static int     sed1356_ioctl(void *, u_long, caddr_t, int, struct lwp *);
+static paddr_t sed1356_mmap(void *, off_t, int);
 
-extern struct bus_space sa11x0_bs_tag;
-extern int j720lcd_power(void *, int, long, void *);   /* XXX */
-
-static int sed1356_init(struct hpcfb_fbconf *);
-static void sed1356_power(int, void *);
-static void sed1356_update_powerstate(struct sed1356_softc *, int);
-void   sed1356_init_backlight(struct sed1356_softc *, int);
-void   sed1356_init_brightness(struct sed1356_softc *, int);
-void   sed1356_init_contrast(struct sed1356_softc *, int);
-void   sed1356_set_brightness(struct sed1356_softc *, int);
-void   sed1356_set_contrast(struct sed1356_softc *, int);
+static int     sed1356_init(struct hpcfb_fbconf *);
+static void    sed1356_power(int, void *);
+static void    sed1356_update_powerstate(struct sed1356_softc *, int);
+static void    sed1356_init_backlight(struct sed1356_softc *, int);
+static void    sed1356_set_brightness(struct sed1356_softc *, int);
+static void    sed1356_set_contrast(struct sed1356_softc *, int);
 
 #if defined __mips__ || defined __sh__ || defined __arm__
 #define __BTOP(x)              ((paddr_t)(x) >> PGSHIFT)
@@ -97,10 +90,17 @@
 #endif
 
 /*
- *  static variables
+ * External functions/variables.
+ */
+extern struct cfdriver sed_cd;
+extern struct bus_space sa11x0_bs_tag;
+extern int j720lcd_power(void *, int, long, void *);   /* XXX */
+
+/*
+ * Static variables.
  */
 CFATTACH_DECL(sed, sizeof(struct sed1356_softc),
-    sed1356match, sed1356attach, NULL, NULL);
+    sed1356_match, sed1356_attach, NULL, NULL);
 struct hpcfb_accessops sed1356_ha = {
        sed1356_ioctl, sed1356_mmap
 };
@@ -108,25 +108,23 @@
 static int attach_flag = 0;
 
 /*
- *  function bodies
+ * Function bodies.
  */
-int
-sed1356match(struct device *parent, struct cfdata *match, void *aux)
+static int
+sed1356_match(struct device *parent, struct cfdata *match, void *aux)
 {
 
        /* XXX check version register */
        return 1;
 }
 
-void
-sed1356attach(struct device *parent, struct device *self, void *aux)
+static void
+sed1356_attach(struct device *parent, struct device *self, void *aux)
 {
        struct sed1356_softc *sc = (struct sed1356_softc *)self;
        struct hpcfb_attach_args ha;
        int console = (bootinfo->bi_cnuse & BI_CNUSE_SERIAL) ? 0 : 1;
 
-       printf("\n");
-
        if (attach_flag) {
                panic("%s(%d): sed1356 attached twice", __FILE__, __LINE__);
        }
@@ -136,11 +134,12 @@
                /* just return so that hpcfb will not be attached */
                return;
        }
+       printf("\n");
 
        sc->sc_iot = &sa11x0_bs_tag;
        sc->sc_parent = (struct sa11x0_softc *)parent;
        if (bus_space_map(sc->sc_iot, (bus_addr_t)bootinfo->fb_addr & ~0x3fffff,
-                         0x200, 0, &sc->sc_regh)) {
+           0x200, 0, &sc->sc_regh)) {
                printf("%s: unable to map register\n", sc->sc_dev.dv_xname);
                return;
        }
@@ -151,23 +150,23 @@
        }
        printf("\n");
        printf("%s: framebuffer address: 0x%08lx\n", 
-               sc->sc_dev.dv_xname, (u_long)bootinfo->fb_addr);
+           sc->sc_dev.dv_xname, (u_long)bootinfo->fb_addr);
 
        /* Add a suspend hook to power saving */
        sc->sc_powerstate = 0;
        sc->sc_powerhook = powerhook_establish(sed1356_power, sc);
        if (sc->sc_powerhook == NULL)
                printf("%s: WARNING: unable to establish power hook\n",
-                       sc->sc_dev.dv_xname);
+                   sc->sc_dev.dv_xname);
 
-       /* initialize backlight brightness and lcd contrast */
+       /* Initialize backlight brightness and lcd contrast */
        sc->sc_lcd_inited = 0;
        sed1356_init_brightness(sc, 1);
        sed1356_init_contrast(sc, 1);
        sed1356_init_backlight(sc, 1);
 
        if (console && hpcfb_cnattach(&sc->sc_fbconf) != 0)
-               panic("sed1356attach: cannot init fb console");
+               panic("sed1356_attach: cannot init fb console");
 
        ha.ha_console = console;
        ha.ha_accessops = &sed1356_ha;
@@ -201,7 +200,7 @@
            bootinfo->fb_width == 0 ||
            bootinfo->fb_height == 0) {
                printf("no frame buffer information.\n");
-               return (-1);
+               return -1;
        }
 
        /* zero fill */
@@ -220,7 +219,7 @@
                           bootinfo->fb_height * bootinfo->fb_line_bytes,
                           0, &fb->hf_baseaddr)) {
                printf("unable to map framebuffer\n");
-               return (-1);
+               return -1;
        }
        fb->hf_offset           = (u_long)bootinfo->fb_addr -
                                      __PTOB(__BTOP(bootinfo->fb_addr));
@@ -298,11 +297,10 @@
 
        default:
                printf("unsupported type %d.\n", bootinfo->fb_type);
-               return (-1);
-               break;
+               return -1;
        }
 
-       return (0); /* no error */
+       return 0; /* no error */
 }
 
 static void 
@@ -329,18 +327,18 @@
        if (updates & PWRSTAT_LCD)
                config_hook_call(CONFIG_HOOK_POWERCONTROL,
                    CONFIG_HOOK_POWERCONTROL_LCD,
-                   (void*)!(sc->sc_powerstate & 
+                   (void *)!(sc->sc_powerstate & 
                                (PWRSTAT_VIDEOOFF|PWRSTAT_SUSPEND)));
 
        if (updates & PWRSTAT_BACKLIGHT)
                config_hook_call(CONFIG_HOOK_POWERCONTROL,
                    CONFIG_HOOK_POWERCONTROL_LCDLIGHT,
-                   (void*)(!(sc->sc_powerstate & 
+                   (void *)(!(sc->sc_powerstate & 
                                (PWRSTAT_VIDEOOFF|PWRSTAT_SUSPEND)) &&
                             (sc->sc_powerstate & PWRSTAT_BACKLIGHT)));
 }
 
-int
+static int
 sed1356_ioctl(void *v, u_long cmd, caddr_t data, int flag, struct lwp *l)
 {
        struct sed1356_softc *sc = (struct sed1356_softc *)v;
@@ -354,7 +352,7 @@
                /*
                 * XXX should be able to handle color map in 4/8 bpp mode.
                 */
-               return (EINVAL);
+               return EINVAL;
        
        case WSDISPLAYIO_SVIDEO:
                if (*(int *)data == WSDISPLAYIO_VIDEO_OFF)
@@ -365,32 +363,33 @@
                return 0;
 
        case WSDISPLAYIO_GVIDEO:
-               *(int *)data = (sc->sc_powerstate&PWRSTAT_VIDEOOFF) ? 
-                               WSDISPLAYIO_VIDEO_OFF:WSDISPLAYIO_VIDEO_ON;
+               *(int *)data = (sc->sc_powerstate & PWRSTAT_VIDEOOFF) ? 
+                               WSDISPLAYIO_VIDEO_OFF : WSDISPLAYIO_VIDEO_ON;
                return 0;
 
-
        case WSDISPLAYIO_GETPARAM:
-               dispparam = (struct wsdisplay_param*)data;
+               dispparam = (struct wsdisplay_param *)data;
                switch (dispparam->param) {
                case WSDISPLAYIO_PARAM_BACKLIGHT:
                        VPRINTF(("sed1356_ioctl: GET:BACKLIGHT\n"));
                        sed1356_init_brightness(sc, 0);
                        sed1356_init_backlight(sc, 0);
                        VPRINTF(("sed1356_ioctl: GET:(real)BACKLIGHT %d\n",
-                                (sc->sc_powerstate&PWRSTAT_BACKLIGHT)? 1: 0));
+                           (sc->sc_powerstate & PWRSTAT_BACKLIGHT) ? 1: 0));
                        dispparam->min = 0;
                        dispparam->max = 1;
                        if (sc->sc_max_brightness > 0)
-                               dispparam->curval = sc->sc_brightness > 0? 1: 0;
+                               dispparam->curval = (sc->sc_brightness > 0) ?
+                                   1 : 0;
                        else
                                dispparam->curval =
-                                   (sc->sc_powerstate&PWRSTAT_BACKLIGHT) ? 1: 0;
+                                   (sc->sc_powerstate & PWRSTAT_BACKLIGHT) ?
+                                   1 : 0;
                        VPRINTF(("sed1356_ioctl: GET:BACKLIGHT:%d(%s)\n",
-                               dispparam->curval,
-                               sc->sc_max_brightness > 0? "brightness": "light"));
+                           dispparam->curval, (sc->sc_max_brightness > 0) ?
+                           "brightness": "light"));
                        return 0;
-                       break;
+
                case WSDISPLAYIO_PARAM_CONTRAST:
                        VPRINTF(("sed1356_ioctl: GET:CONTRAST\n"));
                        sed1356_init_contrast(sc, 0);
@@ -398,13 +397,14 @@
                                dispparam->min = 0;
                                dispparam->max = sc->sc_max_contrast;
                                dispparam->curval = sc->sc_contrast;
-                               VPRINTF(("sed1356_ioctl: GET:CONTRAST max=%d, current=%d\n", sc->sc_max_contrast, sc->sc_contrast));
+                               VPRINTF(("sed1356_ioctl: GET:CONTRAST max=%d,"
+                                   " current=%d\n", sc->sc_max_contrast,
+                                   sc->sc_contrast));
                                return 0;
-                       } else {
-                               VPRINTF(("sed1356_ioctl: GET:CONTRAST EINVAL\n"));
-                               return (EINVAL);
                        }
-                       break;  
+                       VPRINTF(("sed1356_ioctl: GET:CONTRAST EINVAL\n"));
+                       return EINVAL;
+
                case WSDISPLAYIO_PARAM_BRIGHTNESS:
                        VPRINTF(("sed1356_ioctl: GET:BRIGHTNESS\n"));
                        sed1356_init_brightness(sc, 0);
@@ -412,168 +412,174 @@
                                dispparam->min = 0;
                                dispparam->max = sc->sc_max_brightness;
                                dispparam->curval = sc->sc_brightness;
-                               VPRINTF(("sed1356_ioctl: GET:BRIGHTNESS max=%d, current=%d\n", sc->sc_max_brightness, sc->sc_brightness));
+                               VPRINTF(("sed1356_ioctl: GET:BRIGHTNESS max=%d,"
+                                   " current=%d\n", sc->sc_max_brightness,
+                                   sc->sc_brightness));



Home | Main Index | Thread Index | Old Index