Module Name: src
Committed By: tsutsui
Date: Tue Feb 15 11:05:51 UTC 2011
Modified Files:
src/sys/dev/hil: hil.c hildevs.h hilid.c hilkbd.c hilkbdmap.c
hilkbdmap.h hilms.c hilvar.h
Log Message:
- make local functions static
- use aprint_normal(9) and variants
- misc KNF
To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/hil/hil.c src/sys/dev/hil/hildevs.h \
src/sys/dev/hil/hilid.c src/sys/dev/hil/hilkbd.c \
src/sys/dev/hil/hilkbdmap.c src/sys/dev/hil/hilkbdmap.h \
src/sys/dev/hil/hilms.c src/sys/dev/hil/hilvar.h
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/dev/hil/hil.c
diff -u src/sys/dev/hil/hil.c:1.1 src/sys/dev/hil/hil.c:1.2
--- src/sys/dev/hil/hil.c:1.1 Sun Feb 6 18:26:54 2011
+++ src/sys/dev/hil/hil.c Tue Feb 15 11:05:51 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: hil.c,v 1.1 2011/02/06 18:26:54 tsutsui Exp $ */
+/* $NetBSD: hil.c,v 1.2 2011/02/15 11:05:51 tsutsui Exp $ */
/* $OpenBSD: hil.c,v 1.24 2010/11/20 16:45:46 miod Exp $ */
/*
* Copyright (c) 2003, 2004, Miodrag Vallat.
@@ -86,15 +86,15 @@
#include "hilkbd.h"
-void hilconfig(struct hil_softc *, u_int);
-void hilempty(struct hil_softc *);
-int hilsubmatch(device_t, cfdata_t, const int *, void *);
-void hil_process_int(struct hil_softc *, u_int8_t, u_int8_t);
-int hil_process_poll(struct hil_softc *, u_int8_t, u_int8_t);
-void hil_thread(void *);
-int send_device_cmd(struct hil_softc *sc, u_int device, u_int cmd);
-void polloff(struct hil_softc *);
-void pollon(struct hil_softc *);
+static void hilconfig(struct hil_softc *, u_int);
+static void hilempty(struct hil_softc *);
+static int hilsubmatch(device_t, cfdata_t, const int *, void *);
+static void hil_process_int(struct hil_softc *, uint8_t, uint8_t);
+static int hil_process_poll(struct hil_softc *, uint8_t, uint8_t);
+static void hil_thread(void *);
+static int send_device_cmd(struct hil_softc *sc, u_int device, u_int cmd);
+static void polloff(struct hil_softc *);
+static void pollon(struct hil_softc *);
static int hilwait(struct hil_softc *);
static int hildatawait(struct hil_softc *);
@@ -113,7 +113,7 @@
break;
}
- return (cnt);
+ return cnt;
}
static __inline int
@@ -128,7 +128,7 @@
break;
}
- return (cnt);
+ return cnt;
}
/*
@@ -138,7 +138,8 @@
void
hil_attach(struct hil_softc *sc, int *hil_is_console)
{
- printf("\n");
+
+ aprint_normal("\n");
/*
* Initialize loop information
@@ -161,15 +162,15 @@
struct hil_attach_args *ha = aux;
if (pnp != NULL) {
- printf("\"%s\" at %s id %x",
+ aprint_normal("\"%s\" at %s id %x",
ha->ha_descr, pnp, ha->ha_id);
}
- printf(" code %d", ha->ha_code);
+ aprint_normal(" code %d", ha->ha_code);
if (pnp == NULL) {
- printf(": %s", ha->ha_descr);
+ aprint_normal(": %s", ha->ha_descr);
}
- return (UNCONF);
+ return UNCONF;
}
int
@@ -179,7 +180,7 @@
if (cf->cf_loc[0] != -1 &&
cf->cf_loc[0] != ha->ha_code)
- return (0);
+ return 0;
return config_match(parent, cf, aux);
}
@@ -189,7 +190,7 @@
{
struct hil_softc *sc = device_private(self);
int tries;
- u_int8_t db;
+ uint8_t db;
sc->sc_status = HIL_STATUS_BUSY;
@@ -224,15 +225,14 @@
}
#ifdef HILDEBUG
- printf("%s: loop not ready, retrying...\n",
- device_xname(sc->sc_dev));
+ aprint_debug(self, "%s: loop not ready, retrying...\n");
#endif
DELAY(1000000);
}
if (tries == 0 || (db & LPS_CONFFAIL)) {
- printf("%s: no devices\n", device_xname(sc->sc_dev));
+ aprint_normal_dev(self, "no devices\n");
sc->sc_pending = 0;
if (tries == 0)
return;
@@ -243,8 +243,7 @@
*/
if (kthread_create(PRI_NONE, 0, NULL, hil_thread, sc, &sc->sc_thread,
"%s", device_xname(sc->sc_dev)) != 0) {
- printf("%s: unable to create event thread\n",
- device_xname(sc->sc_dev));
+ aprint_error_dev(self, "unable to create event thread\n");
return;
}
@@ -268,10 +267,10 @@
hil_intr(void *v)
{
struct hil_softc *sc = v;
- u_int8_t c, stat;
+ uint8_t c, stat;
if (cold)
- return (0);
+ return 0;
stat = bus_space_read_1(sc->sc_bst, sc->sc_bsh, HILP_STAT);
@@ -280,7 +279,7 @@
* loop.
*/
if ((stat & HIL_DATA_RDY) == 0)
- return (0); /* not for us */
+ return 0; /* not for us */
c = bus_space_read_1(sc->sc_bst, sc->sc_bsh,
HILP_DATA); /* clears interrupt */
@@ -291,11 +290,11 @@
if (sc->sc_status != HIL_STATUS_BUSY)
hil_process_pending(sc);
- return (1);
+ return 1;
}
void
-hil_process_int(struct hil_softc *sc, u_int8_t stat, u_int8_t c)
+hil_process_int(struct hil_softc *sc, uint8_t stat, uint8_t c)
{
device_t child;
struct hildev_softc *hdsc;
@@ -362,9 +361,9 @@
* of buffering it.
*/
int
-hil_process_poll(struct hil_softc *sc, u_int8_t stat, u_int8_t c)
+hil_process_poll(struct hil_softc *sc, uint8_t stat, uint8_t c)
{
- u_int8_t db;
+ uint8_t db;
switch ((stat >> HIL_SSHIFT) & HIL_SMASK) {
case HIL_STATUS:
@@ -484,7 +483,7 @@
hilconfig(struct hil_softc *sc, u_int knowndevs)
{
struct hil_attach_args ha;
- u_int8_t db;
+ uint8_t db;
int id, s;
s = splhil();
@@ -513,8 +512,8 @@
const struct hildevice *hd;
if (send_device_cmd(sc, id, HIL_IDENTIFY) != 0) {
- printf("%s: no answer from device %d\n",
- device_xname(sc->sc_dev), id);
+ aprint_normal_dev(sc->sc_dev,
+ "no answer from device %d\n", id);
continue;
}
@@ -578,7 +577,7 @@
void
hilempty(struct hil_softc *sc)
{
- u_int8_t db;
+ uint8_t db;
int id, s;
u_int oldmaxdev;
@@ -639,10 +638,10 @@
* If rdata is non-null, wait for and return a byte of data.
*/
int
-send_hil_cmd(struct hil_softc *sc, u_int cmd, u_int8_t *data, u_int dlen,
- u_int8_t *rdata)
+send_hil_cmd(struct hil_softc *sc, u_int cmd, uint8_t *data, u_int dlen,
+ uint8_t *rdata)
{
- u_int8_t status;
+ uint8_t status;
int s;
s = splhil();
@@ -653,7 +652,7 @@
device_xname(sc->sc_dev));
#endif
splx(s);
- return (EBUSY);
+ return EBUSY;
}
bus_space_write_1(sc->sc_bst, sc->sc_bsh, HILP_CMD, cmd);
@@ -679,7 +678,7 @@
} while (((status >> HIL_SSHIFT) & HIL_SMASK) != HIL_68K);
}
splx(s);
- return (0);
+ return 0;
}
/*
@@ -694,7 +693,7 @@
int
send_device_cmd(struct hil_softc *sc, u_int device, u_int cmd)
{
- u_int8_t status, c;
+ uint8_t status, c;
int rc = 0;
polloff(sc);
@@ -746,12 +745,12 @@
sc->sc_cmddev = 0;
pollon(sc);
- return (rc);
+ return rc;
}
int
send_hildev_cmd(struct hildev_softc *hdsc, u_int cmd,
- u_int8_t *outbuf, u_int *outlen)
+ uint8_t *outbuf, u_int *outlen)
{
struct hil_softc *sc = device_private(device_parent(hdsc->sc_dev));
int s, rc;
@@ -769,7 +768,7 @@
}
splx(s);
- return (rc);
+ return rc;
}
/*
@@ -778,7 +777,7 @@
void
polloff(struct hil_softc *sc)
{
- u_int8_t db;
+ uint8_t db;
if (hilwait(sc) == 0)
return;
@@ -820,7 +819,7 @@
void
pollon(struct hil_softc *sc)
{
- u_int8_t db;
+ uint8_t db;
if (hilwait(sc) == 0)
return;
@@ -859,10 +858,10 @@
}
int
-hil_poll_data(struct hildev_softc *hdsc, u_int8_t *stat, u_int8_t *data)
+hil_poll_data(struct hildev_softc *hdsc, uint8_t *stat, uint8_t *data)
{
struct hil_softc *sc = device_private(device_parent(hdsc->sc_dev));
- u_int8_t s, c;
+ uint8_t s, c;
s = bus_space_read_1(sc->sc_bst, sc->sc_bsh, HILP_STAT);
if ((s & HIL_DATA_RDY) == 0)
Index: src/sys/dev/hil/hildevs.h
diff -u src/sys/dev/hil/hildevs.h:1.1 src/sys/dev/hil/hildevs.h:1.2
--- src/sys/dev/hil/hildevs.h:1.1 Sun Feb 6 18:26:54 2011
+++ src/sys/dev/hil/hildevs.h Tue Feb 15 11:05:51 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: hildevs.h,v 1.1 2011/02/06 18:26:54 tsutsui Exp $ */
+/* $NetBSD: hildevs.h,v 1.2 2011/02/15 11:05:51 tsutsui Exp $ */
/* $OpenBSD: hildevs.h,v 1.4 2005/05/13 14:54:44 miod Exp $ */
/*
* Copyright (c) 2003, Miodrag Vallat.
@@ -41,7 +41,7 @@
int ha_type; /* hil device type */
int ha_console; /* console set to hil */
int ha_infolen; /* identify info length */
- u_int8_t ha_info[HILBUFSIZE]; /* identify info bits */
+ uint8_t ha_info[HILBUFSIZE]; /* identify info bits */
#define ha_id ha_info[0] /* hil probe id */
const char *ha_descr; /* device description */
@@ -61,9 +61,9 @@
int sc_type; /* hil device type */
int sc_infolen; /* identify info length */
- u_int8_t sc_info[HILBUFSIZE]; /* identify info bits */
+ uint8_t sc_info[HILBUFSIZE]; /* identify info bits */
- void (*sc_fn)(struct hildev_softc *, u_int, u_int8_t *);
+ void (*sc_fn)(struct hildev_softc *, u_int, uint8_t *);
};
#define hd_code sc_hildev.sc_code
Index: src/sys/dev/hil/hilid.c
diff -u src/sys/dev/hil/hilid.c:1.1 src/sys/dev/hil/hilid.c:1.2
--- src/sys/dev/hil/hilid.c:1.1 Sun Feb 6 18:26:54 2011
+++ src/sys/dev/hil/hilid.c Tue Feb 15 11:05:51 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: hilid.c,v 1.1 2011/02/06 18:26:54 tsutsui Exp $ */
+/* $NetBSD: hilid.c,v 1.2 2011/02/15 11:05:51 tsutsui Exp $ */
/* $OpenBSD: hilid.c,v 1.4 2005/01/09 23:49:36 miod Exp $ */
/*
* Copyright (c) 2003, Miodrag Vallat.
@@ -43,12 +43,12 @@
struct hilid_softc {
struct hildev_softc sc_hildev;
- u_int8_t sc_id[16];
+ uint8_t sc_id[16];
};
-int hilidprobe(device_t, cfdata_t, void *);
-void hilidattach(device_t, struct device *, void *);
-int hiliddetach(device_t, int);
+static int hilidprobe(device_t, cfdata_t, void *);
+static void hilidattach(device_t, device_t, void *);
+static int hiliddetach(device_t, int);
CFATTACH_DECL_NEW(hilid, sizeof(struct hilid_softc),
hilidprobe, hilidattach, hiliddetach, NULL);
@@ -59,9 +59,9 @@
struct hil_attach_args *ha = aux;
if (ha->ha_type != HIL_DEVICE_IDMODULE)
- return (0);
+ return 0;
- return (1);
+ return 1;
}
void
@@ -79,23 +79,24 @@
memcpy(sc->hd_info, ha->ha_info, ha->ha_infolen);
sc->hd_fn = NULL;
- printf("\n");
+ aprint_normal("\n");
memset(sc->sc_id, 0, sizeof(sc->sc_id));
len = sizeof(sc->sc_id);
- printf("%s: security code", device_xname(self));
+ aprint_normal("%s: security code", device_xname(self));
if (send_hildev_cmd(hdsc,
HIL_SECURITY, sc->sc_id, &len) == 0) {
for (i = 0; i < sizeof(sc->sc_id); i++)
printf(" %02x", sc->sc_id[i]);
- printf("\n");
+ aprint_normal("\n");
} else
- printf(" unavailable\n");
+ aprint_normal(" unavailable\n");
}
int
-hiliddetach(struct device *self, int flags)
+hiliddetach(device_t self, int flags)
{
- return (0);
+
+ return 0;
}
Index: src/sys/dev/hil/hilkbd.c
diff -u src/sys/dev/hil/hilkbd.c:1.1 src/sys/dev/hil/hilkbd.c:1.2
--- src/sys/dev/hil/hilkbd.c:1.1 Sun Feb 6 18:26:54 2011
+++ src/sys/dev/hil/hilkbd.c Tue Feb 15 11:05:51 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: hilkbd.c,v 1.1 2011/02/06 18:26:54 tsutsui Exp $ */
+/* $NetBSD: hilkbd.c,v 1.2 2011/02/15 11:05:51 tsutsui Exp $ */
/* $OpenBSD: hilkbd.c,v 1.14 2009/01/21 21:53:59 grange Exp $ */
/*
* Copyright (c) 2003, Miodrag Vallat.
@@ -72,34 +72,34 @@
#endif
};
-int hilkbdprobe(device_t, cfdata_t, void *);
-void hilkbdattach(device_t, device_t, void *);
-int hilkbddetach(device_t, int);
+static int hilkbdprobe(device_t, cfdata_t, void *);
+static void hilkbdattach(device_t, device_t, void *);
+static int hilkbddetach(device_t, int);
CFATTACH_DECL_NEW(hilkbd, sizeof(struct hilkbd_softc),
hilkbdprobe, hilkbdattach, hilkbddetach, NULL);
-int hilkbd_enable(void *, int);
-void hilkbd_set_leds(void *, int);
-int hilkbd_ioctl(void *, u_long, void *, int, struct lwp *);
+static int hilkbd_enable(void *, int);
+static void hilkbd_set_leds(void *, int);
+static int hilkbd_ioctl(void *, u_long, void *, int, struct lwp *);
-const struct wskbd_accessops hilkbd_accessops = {
+static const struct wskbd_accessops hilkbd_accessops = {
hilkbd_enable,
hilkbd_set_leds,
hilkbd_ioctl,
};
-void hilkbd_cngetc(void *, u_int *, int *);
-void hilkbd_cnpollc(void *, int);
-void hilkbd_cnbell(void *, u_int, u_int, u_int);
+static void hilkbd_cngetc(void *, u_int *, int *);
+static void hilkbd_cnpollc(void *, int);
+static void hilkbd_cnbell(void *, u_int, u_int, u_int);
-const struct wskbd_consops hilkbd_consops = {
+static const struct wskbd_consops hilkbd_consops = {
hilkbd_cngetc,
hilkbd_cnpollc,
hilkbd_cnbell,
};
-struct wskbd_mapdata hilkbd_keymapdata = {
+static struct wskbd_mapdata hilkbd_keymapdata = {
hilkbd_keydesctab,
#ifdef HILKBD_LAYOUT
HILKBD_LAYOUT,
@@ -108,7 +108,7 @@
#endif
};
-struct wskbd_mapdata hilkbd_keymapdata_ps2 = {
+static struct wskbd_mapdata hilkbd_keymapdata_ps2 = {
hilkbd_keydesctab_ps2,
#ifdef HILKBD_LAYOUT
HILKBD_LAYOUT,
@@ -117,13 +117,14 @@
#endif
};
-void hilkbd_bell(struct hil_softc *, u_int, u_int, u_int);
-void hilkbd_callback(struct hildev_softc *, u_int, u_int8_t *);
-void hilkbd_decode(struct hilkbd_softc *, u_int8_t, u_int *, int *, int);
-int hilkbd_is_console(int);
-void hilkbd_rawrepeat(void *);
+static void hilkbd_bell(struct hil_softc *, u_int, u_int, u_int);
+static void hilkbd_callback(struct hildev_softc *, u_int, uint8_t *);
+static void hilkbd_decode(struct hilkbd_softc *, uint8_t, u_int *, int *,
+ int);
+static int hilkbd_is_console(int);
+static void hilkbd_rawrepeat(void *);
-int seen_hilkbd_console;
+static int seen_hilkbd_console;
int
hilkbdprobe(device_t parent, cfdata_t cf, void *aux)
@@ -132,9 +133,9 @@
if (ha->ha_type != HIL_DEVICE_KEYBOARD &&
ha->ha_type != HIL_DEVICE_BUTTONBOX)
- return (0);
+ return 0;
- return (1);
+ return 1;
}
void
@@ -143,7 +144,7 @@
struct hilkbd_softc *sc = device_private(self);
struct hil_attach_args *ha = aux;
struct wskbddev_attach_args a;
- u_int8_t layoutcode;
+ uint8_t layoutcode;
int ps2;
sc->sc_hildev.sc_dev = self;
@@ -167,7 +168,7 @@
hilkbd_layouts[layoutcode];
#endif
- printf(", layout %x", layoutcode);
+ aprint_normal(", layout %x", layoutcode);
}
/*
@@ -177,10 +178,10 @@
/* HILIOB_PROMPT is not always reported... */
sc->sc_numleds = (ha->ha_info[2] & HILIOB_PMASK) >> 4;
if (sc->sc_numleds != 0)
- printf(", %d leds", sc->sc_numleds);
+ aprint_normal(", %d leds", sc->sc_numleds);
}
- printf("\n");
+ aprint_normal("\n");
/*
* Red lettered keyboards come in two flavours, the old one
@@ -227,7 +228,7 @@
}
int
-hilkbddetach(struct device *self, int flags)
+hilkbddetach(device_t self, int flags)
{
struct hilkbd_softc *sc = device_private(self);
@@ -243,7 +244,7 @@
if (sc->sc_wskbddev != NULL)
return config_detach(sc->sc_wskbddev, flags);
- return (0);
+ return 0;
}
int
@@ -253,15 +254,15 @@
if (on) {
if (sc->sc_enabled)
- return (EBUSY);
+ return EBUSY;
} else {
if (sc->sc_console)
- return (EBUSY);
+ return EBUSY;
}
sc->sc_enabled = on;
- return (0);
+ return 0;
}
void
@@ -332,7 +333,7 @@
{
struct hilkbd_softc *sc = v;
struct hildev_softc *hdsc = &sc->sc_hildev;
- u_int8_t c, stat;
+ uint8_t c, stat;
for (;;) {
while (hil_poll_data(hdsc, &stat, &c) != 0)
@@ -369,7 +370,7 @@
void
hilkbd_bell(struct hil_softc *sc, u_int pitch, u_int period, u_int volume)
{
- u_int8_t buf[2];
+ uint8_t buf[2];
/* XXX there could be at least a pitch -> HIL pitch conversion here */
#define BELLDUR 80 /* tone duration in msec (10-2560) */
@@ -380,7 +381,7 @@
}
void
-hilkbd_callback(struct hildev_softc *hdsc, u_int buflen, u_int8_t *buf)
+hilkbd_callback(struct hildev_softc *hdsc, u_int buflen, uint8_t *buf)
{
struct hilkbd_softc *sc = device_private(hdsc->sc_dev);
u_int type;
@@ -405,7 +406,7 @@
#ifdef WSDISPLAY_COMPAT_RAWKBD
if (sc->sc_rawkbd) {
- u_char cbuf[HILBUFSIZE * 2];
+ uint8_t cbuf[HILBUFSIZE * 2];
int c, j, npress;
npress = j = 0;
@@ -452,9 +453,10 @@
}
void
-hilkbd_decode(struct hilkbd_softc *sc, u_int8_t data, u_int *type, int *key,
+hilkbd_decode(struct hilkbd_softc *sc, uint8_t data, u_int *type, int *key,
int kbdtype)
{
+
if (kbdtype == HIL_BUTTONBOX) {
if (data == 0x02) /* repeat arrow */
data = sc->sc_lastarrow;
@@ -469,16 +471,17 @@
int
hilkbd_is_console(int hil_is_console)
{
+
/* if not first hil keyboard, then not the console */
if (seen_hilkbd_console)
- return (0);
+ return 0;
/* if PDC console does not match hil bus path, then not the console */
if (hil_is_console == 0)
- return (0);
+ return 0;
seen_hilkbd_console = 1;
- return (1);
+ return 1;
}
#ifdef WSDISPLAY_COMPAT_RAWKBD
Index: src/sys/dev/hil/hilkbdmap.c
diff -u src/sys/dev/hil/hilkbdmap.c:1.1 src/sys/dev/hil/hilkbdmap.c:1.2
--- src/sys/dev/hil/hilkbdmap.c:1.1 Sun Feb 6 18:26:54 2011
+++ src/sys/dev/hil/hilkbdmap.c Tue Feb 15 11:05:51 2011
@@ -41,7 +41,7 @@
*
* XXX: Needs re-think how we should treat RAWKBD code on NetBSD.
*/
-const u_int8_t hilkbd_raw[0x80] = {
+const uint8_t hilkbd_raw[0x80] = {
0x9d, 0x00, 0xb8, 0x38, 0x36, 0x2a, 0x1d, 0x6a,
0x4b, 0x48, 0x4c, 0x49, 0x4d, 0x47, 0x53, 0x9c,
0x4f, 0xb5, 0x50, 0x4e, 0x51, 0x37, 0x52, 0x4a,
Index: src/sys/dev/hil/hilkbdmap.h
diff -u src/sys/dev/hil/hilkbdmap.h:1.1 src/sys/dev/hil/hilkbdmap.h:1.2
--- src/sys/dev/hil/hilkbdmap.h:1.1 Sun Feb 6 18:26:54 2011
+++ src/sys/dev/hil/hilkbdmap.h Tue Feb 15 11:05:51 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: hilkbdmap.h,v 1.1 2011/02/06 18:26:54 tsutsui Exp $ */
+/* $NetBSD: hilkbdmap.h,v 1.2 2011/02/15 11:05:51 tsutsui Exp $ */
/* $OpenBSD: hilkbdmap.h,v 1.3 2005/05/07 22:42:30 miod Exp $ */
/*
* Copyright (c) 2003, Miodrag Vallat.
@@ -33,4 +33,4 @@
#define MAXHILKBDLAYOUT 0x20
extern const kbd_t hilkbd_layouts[MAXHILKBDLAYOUT];
-extern const u_int8_t hilkbd_raw[0x80];
+extern const uint8_t hilkbd_raw[0x80];
Index: src/sys/dev/hil/hilms.c
diff -u src/sys/dev/hil/hilms.c:1.1 src/sys/dev/hil/hilms.c:1.2
--- src/sys/dev/hil/hilms.c:1.1 Sun Feb 6 18:26:54 2011
+++ src/sys/dev/hil/hilms.c Tue Feb 15 11:05:51 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: hilms.c,v 1.1 2011/02/06 18:26:54 tsutsui Exp $ */
+/* $NetBSD: hilms.c,v 1.2 2011/02/15 11:05:51 tsutsui Exp $ */
/* $OpenBSD: hilms.c,v 1.5 2007/04/10 22:37:17 miod Exp $ */
/*
* Copyright (c) 2003, Miodrag Vallat.
@@ -55,24 +55,24 @@
device_t sc_wsmousedev;
};
-int hilmsprobe(device_t, cfdata_t, void *);
-void hilmsattach(device_t, device_t, void *);
-int hilmsdetach(device_t, int);
+static int hilmsprobe(device_t, cfdata_t, void *);
+static void hilmsattach(device_t, device_t, void *);
+static int hilmsdetach(device_t, int);
CFATTACH_DECL_NEW(hilms, sizeof(struct hilms_softc),
hilmsprobe, hilmsattach, hilmsdetach, NULL);
-int hilms_enable(void *);
-int hilms_ioctl(void *, u_long, void *, int, struct lwp *);
-void hilms_disable(void *);
+static int hilms_enable(void *);
+static int hilms_ioctl(void *, u_long, void *, int, struct lwp *);
+static void hilms_disable(void *);
-const struct wsmouse_accessops hilms_accessops = {
+static const struct wsmouse_accessops hilms_accessops = {
hilms_enable,
hilms_ioctl,
hilms_disable,
};
-void hilms_callback(struct hildev_softc *, u_int, u_int8_t *);
+static void hilms_callback(struct hildev_softc *, u_int, uint8_t *);
int
hilmsprobe(device_t parent, cfdata_t cf, void *aux)
@@ -80,16 +80,16 @@
struct hil_attach_args *ha = aux;
if (ha->ha_type != HIL_DEVICE_MOUSE)
- return (0);
+ return 0;
/*
* Reject anything that has only buttons - they are handled as
* keyboards, really.
*/
if (ha->ha_infolen > 1 && (ha->ha_info[1] & HIL_AXMASK) == 0)
- return (0);
+ return 0;
- return (1);
+ return 1;
}
void
@@ -137,23 +137,24 @@
}
}
- printf(", %d axes", sc->sc_axes);
+ aprint_normal(", %d axes", sc->sc_axes);
if (sc->sc_buttons == 1)
- printf(", 1 button");
+ aprint_normal(", 1 button");
else if (sc->sc_buttons > 1)
- printf(", %d buttons", sc->sc_buttons);
+ aprint_normal(", %d buttons", sc->sc_buttons);
if (sc->sc_features & HILIOB_PIO)
- printf(", pressure sensor");
+ aprint_normal(", pressure sensor");
if (sc->sc_features & HIL_ABSOLUTE) {
- printf ("\n%s: %d", device_xname(self), rx);
+ aprint_normal("\n");
+ aprint_normal_dev(self, "%d", rx);
if (ry != 0)
- printf("x%d", ry);
+ aprint_normal("x%d", ry);
else
- printf(" linear");
- printf(" fixed area");
+ aprint_normal(" linear");
+ aprint_normal(" fixed area");
}
- printf("\n");
+ aprint_normal("\n");
sc->sc_enabled = 0;
@@ -171,7 +172,7 @@
if (sc->sc_wsmousedev != NULL)
return config_detach(sc->sc_wsmousedev, flags);
- return (0);
+ return 0;
}
int
@@ -185,7 +186,7 @@
sc->sc_enabled = 1;
sc->sc_buttonstate = 0;
- return (0);
+ return 0;
}
void
@@ -213,7 +214,7 @@
}
void
-hilms_callback(struct hildev_softc *hdsc, u_int buflen, u_int8_t *buf)
+hilms_callback(struct hildev_softc *hdsc, u_int buflen, uint8_t *buf)
{
struct hilms_softc *sc = device_private(hdsc->sc_dev);
int type, flags;
Index: src/sys/dev/hil/hilvar.h
diff -u src/sys/dev/hil/hilvar.h:1.1 src/sys/dev/hil/hilvar.h:1.2
--- src/sys/dev/hil/hilvar.h:1.1 Sun Feb 6 18:26:54 2011
+++ src/sys/dev/hil/hilvar.h Tue Feb 15 11:05:51 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: hilvar.h,v 1.1 2011/02/06 18:26:54 tsutsui Exp $ */
+/* $NetBSD: hilvar.h,v 1.2 2011/02/15 11:05:51 tsutsui Exp $ */
/* $OpenBSD: hilvar.h,v 1.10 2006/11/05 14:39:32 miod Exp $ */
/*
* Copyright (c) 2003, Miodrag Vallat.
@@ -81,10 +81,10 @@
int sc_cmdending;
u_int sc_actdev; /* current input device */
u_int sc_cmddev; /* device to perform command on */
- u_int8_t sc_pollbuf[HILBUFSIZE]; /* interrupt time input buf */
- u_int8_t sc_cmdbuf[HILBUFSIZE];
- u_int8_t *sc_pollbp; /* pointer into sc_pollbuf */
- u_int8_t *sc_cmdbp; /* pointer into sc_cmdbuf */
+ uint8_t sc_pollbuf[HILBUFSIZE]; /* interrupt time input buf */
+ uint8_t sc_cmdbuf[HILBUFSIZE];
+ uint8_t *sc_pollbp; /* pointer into sc_pollbuf */
+ uint8_t *sc_cmdbp; /* pointer into sc_cmdbuf */
int sc_status; /* initialization status */
#define HIL_STATUS_BUSY 0x00
@@ -98,10 +98,10 @@
#ifdef _KERNEL
-int send_hil_cmd(struct hil_softc *, u_int, u_int8_t *, u_int, u_int8_t *);
-int send_hildev_cmd(struct hildev_softc *, u_int, u_int8_t *, u_int *);
+int send_hil_cmd(struct hil_softc *, u_int, uint8_t *, u_int, uint8_t *);
+int send_hildev_cmd(struct hildev_softc *, u_int, uint8_t *, u_int *);
void hil_set_poll(struct hil_softc *, int);
-int hil_poll_data(struct hildev_softc *, u_int8_t *, u_int8_t *);
+int hil_poll_data(struct hildev_softc *, uint8_t *, uint8_t *);
void hil_attach(struct hil_softc *, int *);
void hil_attach_deferred(device_t);