Date: Wed, 27 Nov 1996 22:32:32 +0100 From: Poul-Henning Kamp <phk@critter.tfs.com> To: sos@freebsd.org Cc: current@freebsd.org Subject: psm.c patch Message-ID: <2884.849130352@critter.tfs.com>
next in thread | raw e-mail | index | archive | help
Please test. This cuts 4k out of the kernel on machines without a psm. Will be committed if no protests. Poul-Henning Index: psm.c =================================================================== RCS file: /home/ncvs/src/sys/i386/isa/psm.c,v retrieving revision 1.25.2.1 diff -u -r1.25.2.1 psm.c --- psm.c 1996/11/19 17:25:29 1.25.2.1 +++ psm.c 1996/11/27 21:29:50 @@ -68,6 +68,7 @@ #include <sys/proc.h> #include <sys/conf.h> #include <sys/syslog.h> +#include <sys/malloc.h> #ifdef DEVFS #include <sys/devfsext.h> #endif @@ -157,7 +158,7 @@ void *devfs_token; void *n_devfs_token; #endif -} psm_softc[NPSM]; +} *psm_softc[NPSM]; /* driver state flags (state) */ #define PSM_VALID 0x80 @@ -432,7 +433,7 @@ if (unit >= NPSM) return (0); - sc = &psm_softc[unit]; + sc = psm_softc[unit]; sc->addr = ioport; if (bootverbose) ++verbose; @@ -619,7 +620,10 @@ psmattach(struct isa_device *dvp) { int unit = dvp->id_unit; - struct psm_softc *sc = &psm_softc[unit]; + struct psm_softc *sc = psm_softc[unit] = + malloc(sizeof *sc, M_DEVBUF, M_NOWAIT); + + bzero(sc, sizeof *sc); /* initial operation mode */ sc->mode.accelfactor = PSM_ACCEL; @@ -661,7 +665,7 @@ return (ENXIO); /* Get device data */ - sc = &psm_softc[unit]; + sc = psm_softc[unit]; if ((sc->state & PSM_VALID) == 0) return (ENXIO); ioport = sc->addr; @@ -716,7 +720,7 @@ static int psmclose(dev_t dev, int flag, int fmt, struct proc *p) { - struct psm_softc *sc = &psm_softc[PSM_UNIT(dev)]; + struct psm_softc *sc = psm_softc[PSM_UNIT(dev)]; int ioport = sc->addr; /* disable the aux interrupt */ @@ -881,7 +885,7 @@ static int psmread(dev_t dev, struct uio *uio, int flag) { - register struct psm_softc *sc = &psm_softc[PSM_UNIT(dev)]; + register struct psm_softc *sc = psm_softc[PSM_UNIT(dev)]; unsigned int length; int error; int s; @@ -938,7 +942,7 @@ static int psmioctl(dev_t dev, int cmd, caddr_t addr, int flag, struct proc *p) { - struct psm_softc *sc = &psm_softc[PSM_UNIT(dev)]; + struct psm_softc *sc = psm_softc[PSM_UNIT(dev)]; mouseinfo_t info; mousestatus_t *ms; packetfunc_t func; @@ -1075,7 +1079,7 @@ BUT2STAT, BUT1STAT | BUT2STAT, BUT2STAT | BUT3STAT, BUT1STAT | BUT2STAT | BUT3STAT }; - register struct psm_softc *sc = &psm_softc[unit]; + register struct psm_softc *sc = psm_softc[unit]; int ioport = sc->addr; mousestatus_t *ms; unsigned char c; @@ -1171,7 +1175,7 @@ static int psmselect(dev_t dev, int rw, struct proc *p) { - struct psm_softc *sc = &psm_softc[PSM_UNIT(dev)]; + struct psm_softc *sc = psm_softc[PSM_UNIT(dev)]; int s, ret; /* Silly to select for output */ -- Poul-Henning Kamp | phk@FreeBSD.ORG FreeBSD Core-team. http://www.freebsd.org/~phk | phk@login.dknet.dk Private mailbox. whois: [PHK] | phk@ref.tfs.com TRW Financial Systems, Inc. Future will arrive by its own means, progress not so.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?2884.849130352>