Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/alpha/pci Give tsc(4)/tsp(4) some attention.



details:   https://anonhg.NetBSD.org/src/rev/984b123d0145
branches:  trunk
changeset: 753982:984b123d0145
user:      jakllsch <jakllsch%NetBSD.org@localhost>
date:      Thu Apr 15 03:09:12 2010 +0000

description:
Give tsc(4)/tsp(4) some attention.
 - Convert to CFATTACH_DECL_NEW().
 - Sprinkle static on functions.
 - Improve KNF conformance.
 - Use C99 integer types.
 - Recycle now-empty-and/or-unused softc structures.

diffstat:

 sys/arch/alpha/pci/tsc.c   |  40 +++++++++++++++++++---------------------
 sys/arch/alpha/pci/tsvar.h |  11 +----------
 2 files changed, 20 insertions(+), 31 deletions(-)

diffs (140 lines):

diff -r 0137c49bd267 -r 984b123d0145 sys/arch/alpha/pci/tsc.c
--- a/sys/arch/alpha/pci/tsc.c  Thu Apr 15 00:57:33 2010 +0000
+++ b/sys/arch/alpha/pci/tsc.c  Thu Apr 15 03:09:12 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: tsc.c,v 1.16 2009/03/14 21:04:02 dsl Exp $ */
+/* $NetBSD: tsc.c,v 1.17 2010/04/15 03:09:12 jakllsch Exp $ */
 
 /*-
  * Copyright (c) 1999 by Ross Harvey.  All rights reserved.
@@ -35,7 +35,7 @@
 
 #include <sys/cdefs.h>
 
-__KERNEL_RCSID(0, "$NetBSD: tsc.c,v 1.16 2009/03/14 21:04:02 dsl Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tsc.c,v 1.17 2010/04/15 03:09:12 jakllsch Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -59,11 +59,10 @@
 
 #define tsc() { Generate ctags(1) key. }
 
-int    tscmatch(struct device *, struct cfdata *, void *);
-void   tscattach(struct device *, struct device *, void *);
+static int tscmatch(device_t, cfdata_t, void *);
+static void tscattach(device_t, device_t, void *);
 
-CFATTACH_DECL(tsc, sizeof(struct tsc_softc),
-    tscmatch, tscattach, NULL, NULL);
+CFATTACH_DECL_NEW(tsc, 0, tscmatch, tscattach, NULL, NULL);
 
 extern struct cfdriver tsc_cd;
 
@@ -71,11 +70,10 @@
 
 static int tscprint(void *, const char *pnp);
 
-int    tspmatch(struct device *, struct cfdata *, void *);
-void   tspattach(struct device *, struct device *, void *);
+static int tspmatch(device_t, cfdata_t, void *);
+static void tspattach(device_t, device_t, void *);
 
-CFATTACH_DECL(tsp, sizeof(struct tsp_softc),
-    tspmatch, tspattach, NULL, NULL);
+CFATTACH_DECL_NEW(tsp, 0, tspmatch, tspattach, NULL, NULL);
 
 extern struct cfdriver tsp_cd;
 
@@ -88,8 +86,8 @@
 /* Which hose is the display console connected to? */
 int tsp_console_hose;
 
-int
-tscmatch(struct device *parent, struct cfdata *match, void *aux)
+static int
+tscmatch(device_t parent, cfdata_t match, void *aux)
 {
        struct mainbus_attach_args *ma = aux;
 
@@ -98,13 +96,12 @@
            && !tscfound;
 }
 
-void tscattach(parent, self, aux)
-       struct device *parent, *self;
-       void *aux;
+static void
+tscattach(device_t parent, device_t self, void * aux)
 {
        int i;
        int nbus;
-       u_int64_t csc, aar;
+       uint64_t csc, aar;
        struct tsp_attach_args tsp;
        struct mainbus_attach_args *ma = aux;
 
@@ -148,8 +145,8 @@
 
 #define tsp() { Generate ctags(1) key. }
 
-int
-tspmatch(struct device *parent, struct cfdata *match, void *aux)
+static int
+tspmatch(device_t parent, cfdata_t match, void *aux)
 {
        struct tsp_attach_args *t = aux;
 
@@ -157,8 +154,8 @@
            && strcmp(t->tsp_name, tsp_cd.cd_name) == 0;
 }
 
-void
-tspattach(struct device *parent, struct device *self, void *aux)
+static void
+tspattach(device_t parent, device_t self, void *aux)
 {
        struct pcibus_attach_args pba;
        struct tsp_attach_args *t = aux;
@@ -218,7 +215,8 @@
 }
 
 static int
-tsp_bus_get_window(int type, int window, struct alpha_bus_space_translation *abst)
+tsp_bus_get_window(int type, int window,
+    struct alpha_bus_space_translation *abst)
 {
        struct tsp_config *tsp = &tsp_configuration[tsp_console_hose];
        bus_space_tag_t st;
diff -r 0137c49bd267 -r 984b123d0145 sys/arch/alpha/pci/tsvar.h
--- a/sys/arch/alpha/pci/tsvar.h        Thu Apr 15 00:57:33 2010 +0000
+++ b/sys/arch/alpha/pci/tsvar.h        Thu Apr 15 03:09:12 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: tsvar.h,v 1.7 2009/10/30 18:55:45 mhitch Exp $ */
+/* $NetBSD: tsvar.h,v 1.8 2010/04/15 03:09:12 jakllsch Exp $ */
 
 /*-
  * Copyright (c) 1999 by Ross Harvey.  All rights reserved.
@@ -39,10 +39,6 @@
 
 #define        tsvar() { Generate ctags(1) key. }
 
-struct tsc_softc {
-       struct  device tsc_dev;
-};
-
 struct tsp_config {
        int     pc_pslot;               /* Pchip 0 or 1 */
        int     pc_initted;             /* Initialized */
@@ -66,11 +62,6 @@
        int     pc_mallocsafe;
 };
 
-struct tsp_softc {
-       struct  device sc_dev;
-       struct  tsp_config *sc_ccp;
-};
-
 struct tsp_attach_args {
        const char *tsp_name;
        int     tsp_slot;



Home | Main Index | Thread Index | Old Index