Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/pci Apply const and static where appropriate.



details:   https://anonhg.NetBSD.org/src/rev/f5b1ad00202e
branches:  trunk
changeset: 582837:f5b1ad00202e
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Thu Jul 07 18:43:47 2005 +0000

description:
Apply const and static where appropriate.

diffstat:

 sys/dev/pci/machfb.c |  246 ++++++++++++++++++++++++++------------------------
 1 files changed, 129 insertions(+), 117 deletions(-)

diffs (truncated from 646 to 300 lines):

diff -r e933acbc51cf -r f5b1ad00202e sys/dev/pci/machfb.c
--- a/sys/dev/pci/machfb.c      Thu Jul 07 17:51:31 2005 +0000
+++ b/sys/dev/pci/machfb.c      Thu Jul 07 18:43:47 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: machfb.c,v 1.29 2005/05/31 21:17:03 christos Exp $     */
+/*     $NetBSD: machfb.c,v 1.30 2005/07/07 18:43:47 thorpej Exp $      */
 
 /*
  * Copyright (c) 2002 Bang Jun-Young
@@ -33,7 +33,7 @@
 
 #include <sys/cdefs.h>
 __KERNEL_RCSID(0, 
-       "$NetBSD: machfb.c,v 1.29 2005/05/31 21:17:03 christos Exp $");
+       "$NetBSD: machfb.c,v 1.30 2005/07/07 18:43:47 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -171,7 +171,7 @@
 struct {
        u_int16_t chip_id;
        u_int32_t ramdac_freq;
-} mach64_info[] = {
+} static const mach64_info[] = {
        { PCI_PRODUCT_ATI_MACH64_CT, 135000 },
        { PCI_PRODUCT_ATI_RAGE_PRO_AGP, 230000 },
        { PCI_PRODUCT_ATI_RAGE_PRO_AGP1X, 230000 },
@@ -206,7 +206,7 @@
        "(unknown type)"
 };
 
-struct videomode mach64_modes[] = {
+static struct videomode mach64_modes[] = {
        /* 640x400 @ 70 Hz, 31.5 kHz */
        { 25175, 640, 664, 760, 800, 400, 409, 411, 450, 0 },
        /* 640x480 @ 72 Hz, 36.5 kHz */
@@ -226,65 +226,74 @@
 
 extern const u_char rasops_cmap[768];
 
-int    mach64_match(struct device *, struct cfdata *, void *);
-void   mach64_attach(struct device *, struct device *, void *);
+static int     mach64_match(struct device *, struct cfdata *, void *);
+static void    mach64_attach(struct device *, struct device *, void *);
 
 CFATTACH_DECL(machfb, sizeof(struct mach64_softc), mach64_match, mach64_attach,
     NULL, NULL);
 
-void   mach64_init(struct mach64_softc *);
-int    mach64_get_memsize(struct mach64_softc *);
-int    mach64_get_max_ramdac(struct mach64_softc *);
-void   mach64_get_mode(struct mach64_softc *, struct videomode *);
-int    mach64_calc_crtcregs(struct mach64_softc *, struct mach64_crtcregs *,
-    struct videomode *);
-void   mach64_set_crtcregs(struct mach64_softc *, struct mach64_crtcregs *);
-int    mach64_modeswitch(struct mach64_softc *, struct videomode *);
-void   mach64_set_dsp(struct mach64_softc *);
-void   mach64_set_pll(struct mach64_softc *, int);
-void   mach64_reset_engine(struct mach64_softc *);
-void   mach64_init_engine(struct mach64_softc *);
-void   mach64_adjust_frame(struct mach64_softc *, int, int);
-void   mach64_init_lut(struct mach64_softc *);
-void   mach64_switch_screen(struct mach64_softc *);
-void   mach64_init_screen(struct mach64_softc *, struct mach64screen *,
-    const struct wsscreen_descr *, int, long *, int);
-void   mach64_restore_screen(struct mach64screen *,
-    const struct wsscreen_descr *, u_int *);
-int    mach64_set_screentype(struct mach64_softc *,
-    const struct wsscreen_descr *);
-int    mach64_is_console(struct pci_attach_args *);
+static void    mach64_init(struct mach64_softc *);
+static int     mach64_get_memsize(struct mach64_softc *);
+static int     mach64_get_max_ramdac(struct mach64_softc *);
+static void    mach64_get_mode(struct mach64_softc *, struct videomode *);
+static int     mach64_calc_crtcregs(struct mach64_softc *,
+                                    struct mach64_crtcregs *,
+                                    struct videomode *);
+static void    mach64_set_crtcregs(struct mach64_softc *,
+                                   struct mach64_crtcregs *);
+#if 0
+static int     mach64_modeswitch(struct mach64_softc *, struct videomode *);
+#endif
+static void    mach64_set_dsp(struct mach64_softc *);
+static void    mach64_set_pll(struct mach64_softc *, int);
+static void    mach64_reset_engine(struct mach64_softc *);
+static void    mach64_init_engine(struct mach64_softc *);
+#if 0
+static void    mach64_adjust_frame(struct mach64_softc *, int, int);
+#endif
+static void    mach64_init_lut(struct mach64_softc *);
+static void    mach64_switch_screen(struct mach64_softc *);
+static void    mach64_init_screen(struct mach64_softc *, struct mach64screen *,
+                                  const struct wsscreen_descr *, int, long *,
+                                  int);
+static void    mach64_restore_screen(struct mach64screen *,
+                                     const struct wsscreen_descr *, u_int *);
+static int     mach64_set_screentype(struct mach64_softc *,
+                                     const struct wsscreen_descr *);
+static int     mach64_is_console(struct pci_attach_args *);
 
-void   mach64_cursor(void *, int, int, int);
-int    mach64_mapchar(void *, int, u_int *);
-void   mach64_putchar(void *, int, int, u_int, long);
-void   mach64_copycols(void *, int, int, int, int);
-void   mach64_erasecols(void *, int, int, int, long);
-void   mach64_copyrows(void *, int, int, int);
-void   mach64_eraserows(void *, int, int, long);
-int    mach64_allocattr(void *, int, int, int, long *);
-void   mach64_clearscreen(struct mach64_softc *);
-
-void   mach64_scroll(void *, void *, int);
+static void    mach64_cursor(void *, int, int, int);
+#if 0
+static int     mach64_mapchar(void *, int, u_int *);
+#endif
+static void    mach64_putchar(void *, int, int, u_int, long);
+static void    mach64_copycols(void *, int, int, int, int);
+static void    mach64_erasecols(void *, int, int, int, long);
+static void    mach64_copyrows(void *, int, int, int);
+static void    mach64_eraserows(void *, int, int, long);
+static int     mach64_allocattr(void *, int, int, int, long *);
+static void    mach64_clearscreen(struct mach64_softc *);
 
-int    mach64_putcmap(struct mach64_softc *, struct wsdisplay_cmap *);
-int    mach64_getcmap(struct mach64_softc *, struct wsdisplay_cmap *);
-int    mach64_putpalreg(struct mach64_softc *, uint8_t, uint8_t, uint8_t,
-                        uint8_t);
-void   mach64_bitblt(struct mach64_softc *, int, int, int, int, int, int, int,
-                     int) ;
-void   mach64_rectfill(struct mach64_softc *, int, int, int, int, int);
-void   mach64_setup_mono(struct mach64_softc *, int, int, int, int, uint32_t,
-                         uint32_t);
-void   mach64_feed_bytes(struct mach64_softc *, int, uint8_t *);
-void   mach64_showpal(struct mach64_softc *);
-int    mach64_getwschar(void *, struct wsdisplay_char *);
-int    mach64_putwschar(void *, struct wsdisplay_char *);
+static int     mach64_putcmap(struct mach64_softc *, struct wsdisplay_cmap *);
+static int     mach64_getcmap(struct mach64_softc *, struct wsdisplay_cmap *);
+static int     mach64_putpalreg(struct mach64_softc *, uint8_t, uint8_t,
+                                uint8_t, uint8_t);
+static void    mach64_bitblt(struct mach64_softc *, int, int, int, int, int,
+                             int, int, int) ;
+static void    mach64_rectfill(struct mach64_softc *, int, int, int, int, int);
+static void    mach64_setup_mono(struct mach64_softc *, int, int, int, int,
+                                 uint32_t, uint32_t);
+static void    mach64_feed_bytes(struct mach64_softc *, int, uint8_t *);
+#if 0
+static void    mach64_showpal(struct mach64_softc *);
+#endif
+static int     mach64_getwschar(void *, struct wsdisplay_char *);
+static int     mach64_putwschar(void *, struct wsdisplay_char *);
 
-void   set_address(struct rasops_info *, bus_addr_t);
+static void    set_address(struct rasops_info *, bus_addr_t);
 
 #if 0
-const struct wsdisplay_emulops mach64_emulops = {
+static const struct wsdisplay_emulops mach64_emulops = {
        mach64_cursor,
        mach64_mapchar,
        mach64_putchar,
@@ -296,7 +305,7 @@
 };
 #endif
 
-struct wsscreen_descr mach64_defaultscreen = {
+static struct wsscreen_descr mach64_defaultscreen = {
        "default",
        0, 0,
        &mach64_console_screen.ri.ri_ops,
@@ -353,7 +362,7 @@
        &mach64_modes[5]
 };
 
-const struct wsscreen_descr *_mach64_scrlist[] = {
+static const struct wsscreen_descr *_mach64_scrlist[] = {
        &mach64_defaultscreen,
        &mach64_80x25_screen,
        &mach64_80x30_screen,
@@ -365,21 +374,23 @@
        &mach64_160x64_screen
 };
 
-struct wsscreen_list mach64_screenlist = {
+static struct wsscreen_list mach64_screenlist = {
        sizeof(_mach64_scrlist) / sizeof(struct wsscreen_descr *),
        _mach64_scrlist
 };
 
-int    mach64_ioctl(void *, u_long, caddr_t, int, struct proc *);
-paddr_t        mach64_mmap(void *, off_t, int);
-int    mach64_alloc_screen(void *, const struct wsscreen_descr *, void **,
-    int *, int *, long *);
-void   mach64_free_screen(void *, void *);
-int    mach64_show_screen(void *, void *, int, void (*)(void *, int, int),
-    void *);
-int    mach64_load_font(void *, void *, struct wsdisplay_font *);
+static int     mach64_ioctl(void *, u_long, caddr_t, int, struct proc *);
+static paddr_t mach64_mmap(void *, off_t, int);
+static int     mach64_alloc_screen(void *, const struct wsscreen_descr *,
+                                   void **, int *, int *, long *);
+static void    mach64_free_screen(void *, void *);
+static int     mach64_show_screen(void *, void *, int,
+                                  void (*)(void *, int, int), void *);
+#if 0
+static int     mach64_load_font(void *, void *, struct wsdisplay_font *);
+#endif
 
-struct wsdisplay_accessops mach64_accessops = {
+static struct wsdisplay_accessops mach64_accessops = {
        mach64_ioctl,
        mach64_mmap,
        mach64_alloc_screen,
@@ -397,11 +408,6 @@
 /*
  * Inline functions for getting access to register aperture.
  */
-static inline u_int32_t regr(struct mach64_softc *, u_int32_t);
-static inline u_int8_t regrb(struct mach64_softc *, u_int32_t);
-static inline void regw(struct mach64_softc *, u_int32_t, u_int32_t);
-static inline void regwb(struct mach64_softc *, u_int32_t, u_int8_t);
-static inline void regwb_pll(struct mach64_softc *, u_int32_t, u_int8_t);
 
 static inline u_int32_t
 regr(struct mach64_softc *sc, u_int32_t index)
@@ -454,7 +460,7 @@
                continue;
 }
 
-int
+static int
 mach64_match(struct device *parent, struct cfdata *match, void *aux)
 {
        struct pci_attach_args *pa = (struct pci_attach_args *)aux;
@@ -474,7 +480,7 @@
        return 0;
 }
 
-void
+static void
 mach64_attach(struct device *parent, struct device *self, void *aux)
 {
        struct mach64_softc *sc = (void *)self;
@@ -667,7 +673,7 @@
        config_found(self, &aa, wsemuldisplaydevprint);
 }
 
-void
+static void
 mach64_init_screen(struct mach64_softc *sc, struct mach64screen *scr,
     const struct wsscreen_descr *type, int existing, long *attrp, int setmode)
 {
@@ -711,7 +717,7 @@
        LIST_INSERT_HEAD(&sc->screens, scr, next);
 }
 
-void
+static void
 mach64_init(struct mach64_softc *sc)
 {
        u_int32_t *p32, saved_value;
@@ -752,7 +758,7 @@
        callout_init(&sc->switch_callout);
 }
 
-int
+static int
 mach64_get_memsize(struct mach64_softc *sc)
 {
        int tmp, memsize;
@@ -777,7 +783,7 @@
        return memsize;
 }
 
-int
+static int
 mach64_get_max_ramdac(struct mach64_softc *sc)
 {
        int i;
@@ -797,7 +803,7 @@
                return 80000;
 }
 
-void
+static void
 mach64_get_mode(struct mach64_softc *sc, struct videomode *mode)
 {
        struct mach64_crtcregs crtc;
@@ -824,7 +830,7 @@
 #endif
 }
 
-int
+static int
 mach64_calc_crtcregs(struct mach64_softc *sc, struct mach64_crtcregs *crtc,
     struct videomode *mode)
 {
@@ -871,7 +877,7 @@
        return 0;
 }



Home | Main Index | Thread Index | Old Index