Use config's conditional compilation rather than using #ifdefs that make

modular compilation harder.  I'm doing this because people seem to like
cut/pasting examples of bad practices in existing code.
This commit is contained in:
Peter Wemm 2000-01-29 15:08:56 +00:00
parent 08922a1c23
commit 8f8e587948
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=56836
29 changed files with 10 additions and 166 deletions

View File

@ -26,12 +26,9 @@
* $FreeBSD$
*/
#include "atkbd.h"
#include "opt_kbd.h"
#include "opt_atkbd.h"
#if NATKBD > 0
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/kernel.h>
@ -1393,5 +1390,3 @@ typematic(int delay, int rate)
value |= i;
return value;
}
#endif /* NATKBD > 0 */

View File

@ -26,11 +26,8 @@
* $FreeBSD$
*/
#include "atkbd.h"
#include "opt_kbd.h"
#if NATKBD > 0
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/kernel.h>
@ -124,5 +121,3 @@ atkbd_isa_intr(void *arg)
}
DRIVER_MODULE(atkbd, atkbdc, atkbd_driver, atkbd_devclass, 0, 0);
#endif /* NATKBD > 0 */

View File

@ -26,11 +26,8 @@
* $FreeBSD$
*/
#include "atkbd.h"
#include "opt_kbd.h"
#if NATKBD > 0
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/kernel.h>
@ -124,5 +121,3 @@ atkbd_isa_intr(void *arg)
}
DRIVER_MODULE(atkbd, atkbdc, atkbd_driver, atkbd_devclass, 0, 0);
#endif /* NATKBD > 0 */

View File

@ -48,7 +48,7 @@
/* constants */
#define MAXKBDC MAX(NATKBDC, 1)
#define MAXKBDC MAX(NATKBDC, 1) /* XXX */
/* macros */
@ -90,8 +90,6 @@ static int wait_for_kbd_ack(atkbdc_softc_t *kbdc);
static int wait_for_aux_data(atkbdc_softc_t *kbdc);
static int wait_for_aux_ack(atkbdc_softc_t *kbdc);
#if NATKBDC > 0
atkbdc_softc_t
*atkbdc_get_softc(int unit)
{
@ -125,8 +123,6 @@ atkbdc_attach_unit(int unit, atkbdc_softc_t *sc, int port)
return atkbdc_setup(sc, port);
}
#endif /* NATKBDC > 0 */
/* the backdoor to the keyboard controller! XXX */
int
atkbdc_configure(void)

View File

@ -26,11 +26,8 @@
* $FreeBSD$
*/
#include "atkbdc.h"
#include "opt_kbd.h"
#if NATKBDC > 0
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/kernel.h>
@ -265,5 +262,3 @@ atkbdc_write_ivar(device_t bus, device_t dev, int index, u_long val)
}
DRIVER_MODULE(atkbdc, isa, atkbdc_driver, atkbdc_devclass, 0, 0);
#endif /* NATKBDC > 0 */

View File

@ -26,11 +26,8 @@
* $FreeBSD$
*/
#include "atkbdc.h"
#include "opt_kbd.h"
#if NATKBDC > 0
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/kernel.h>
@ -265,5 +262,3 @@ atkbdc_write_ivar(device_t bus, device_t dev, int index, u_long val)
}
DRIVER_MODULE(atkbdc, isa, atkbdc_driver, atkbdc_devclass, 0, 0);
#endif /* NATKBDC > 0 */

View File

@ -61,11 +61,8 @@
* Vendor specific support routines.
*/
#include "psm.h"
#include "opt_psm.h"
#if NPSM > 0
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/kernel.h>
@ -1108,10 +1105,6 @@ psmopen(dev_t dev, int flag, int fmt, struct proc *p)
int err;
int s;
/* Validate unit number */
if (unit >= NPSM)
return (ENXIO);
/* Get device data */
sc = PSM_SOFTC(unit);
if ((sc == NULL) || (sc->state & PSM_VALID) == 0)
@ -2450,5 +2443,3 @@ psmresume(device_t dev)
}
DRIVER_MODULE(psm, atkbdc, psm_driver, psm_devclass, 0, 0);
#endif /* NPSM > 0 */

View File

@ -26,12 +26,9 @@
* $FreeBSD$
*/
#include "atkbd.h"
#include "opt_kbd.h"
#include "opt_atkbd.h"
#if NATKBD > 0
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/kernel.h>
@ -1393,5 +1390,3 @@ typematic(int delay, int rate)
value |= i;
return value;
}
#endif /* NATKBD > 0 */

View File

@ -48,7 +48,7 @@
/* constants */
#define MAXKBDC MAX(NATKBDC, 1)
#define MAXKBDC MAX(NATKBDC, 1) /* XXX */
/* macros */
@ -90,8 +90,6 @@ static int wait_for_kbd_ack(atkbdc_softc_t *kbdc);
static int wait_for_aux_data(atkbdc_softc_t *kbdc);
static int wait_for_aux_ack(atkbdc_softc_t *kbdc);
#if NATKBDC > 0
atkbdc_softc_t
*atkbdc_get_softc(int unit)
{
@ -125,8 +123,6 @@ atkbdc_attach_unit(int unit, atkbdc_softc_t *sc, int port)
return atkbdc_setup(sc, port);
}
#endif /* NATKBDC > 0 */
/* the backdoor to the keyboard controller! XXX */
int
atkbdc_configure(void)

View File

@ -26,7 +26,6 @@
* $FreeBSD$
*/
#include "kbd.h"
#include "opt_kbd.h"
#include <sys/param.h>

View File

@ -26,13 +26,9 @@
* $FreeBSD$
*/
#include "sc.h"
#include "vga.h"
#include "opt_syscons.h"
#include "opt_vga.h"
#if NSC > 0 && NVGA > 0
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/kernel.h>
@ -826,5 +822,3 @@ vga_grborder(scr_stat *scp, int color)
}
#endif
#endif /* NSC > 0 && NVGA > 0 */

View File

@ -32,8 +32,6 @@
#include "sc.h"
#include "opt_syscons.h"
#if NSC > 0
#ifndef SC_NO_HISTORY
#include <sys/param.h>
@ -307,5 +305,3 @@ sc_hist_ioctl(struct tty *tp, u_long cmd, caddr_t data, int flag,
}
#endif /* SC_NO_HISTORY */
#endif /* NSC */

View File

@ -26,11 +26,8 @@
* $FreeBSD$
*/
#include "sc.h"
#include "opt_syscons.h"
#if NSC > 0
#include <limits.h>
#include <sys/param.h>
#include <sys/systm.h>
@ -902,5 +899,3 @@ sc_mouse_ioctl(struct tty *tp, u_long cmd, caddr_t data, int flag,
}
#endif /* SC_NO_SYSMOUSE */
#endif /* NSC */

View File

@ -26,11 +26,8 @@
* $FreeBSD$
*/
#include "sc.h"
#include "opt_syscons.h"
#if NSC > 0
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/kernel.h>
@ -152,5 +149,3 @@ dumb_nop(void)
}
#endif /* SC_DUMB_TERMINAL */
#endif /* NSC > 1 */

View File

@ -27,11 +27,8 @@
* $FreeBSD$
*/
#include "sc.h"
#include "opt_syscons.h"
#if NSC > 0
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/kernel.h>
@ -725,5 +722,3 @@ mask2attr(term_stat *tcp)
}
#endif /* SC_DUMB_TERMINAL */
#endif /* NSC > 0 */

View File

@ -26,11 +26,8 @@
* $FreeBSD$
*/
#include "sc.h"
#include "opt_syscons.h"
#if NSC > 0
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/kernel.h>
@ -124,5 +121,3 @@ sc_term_sw_t
return NULL;
}
#endif /* NSC > 0 */

View File

@ -26,17 +26,9 @@
* $FreeBSD$
*/
#include "sc.h"
#include "vga.h"
#include "opt_syscons.h"
#include "opt_vga.h"
#include "opt_vesa.h"
#ifdef VGA_NO_MODE_CHANGE
#undef VESA
#endif
#if (NSC > 0 && NVGA > 0 && defined(VESA)) || defined(KLD_MODULE)
#ifndef VGA_NO_MODE_CHANGE
#include <sys/param.h>
#include <sys/systm.h>
@ -138,4 +130,4 @@ vesa_unload_ioctl(void)
return 0;
}
#endif /* (NSC > 0 && NVGA > 0 && VESA) || KLD_MODULE */
#endif /* SC_NO_MODE_CHANGE */

View File

@ -26,13 +26,9 @@
* $FreeBSD$
*/
#include "sc.h"
#include "vga.h"
#include "opt_syscons.h"
#include "opt_vga.h"
#if NSC > 0 && NVGA > 0
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/kernel.h>
@ -826,5 +822,3 @@ vga_grborder(scr_stat *scp, int color)
}
#endif
#endif /* NSC > 0 && NVGA > 0 */

View File

@ -26,11 +26,8 @@
* $FreeBSD$
*/
#include "sc.h"
#include "opt_syscons.h"
#if NSC > 0
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/conf.h>
@ -814,5 +811,3 @@ sc_rndr_sw_t
return NULL;
}
#endif /* NSC > 0 */

View File

@ -26,11 +26,8 @@
* $FreeBSD$
*/
#include "sc.h"
#include "opt_syscons.h"
#if NSC > 0
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/malloc.h>
@ -296,5 +293,3 @@ sc_vtb_ins(sc_vtb_t *vtb, int at, int count, int c, int attr)
else
fillw(attr | c, (void *)sc_vtb_pointer(vtb, at), count);
}
#endif /* NSC */

View File

@ -28,7 +28,6 @@
* $FreeBSD$
*/
#include "sc.h"
#include "splash.h"
#include "opt_syscons.h"
#include "opt_ddb.h"
@ -36,7 +35,6 @@
#include "apm.h"
#endif
#if NSC > 0
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/eventhandler.h>
@ -3406,5 +3404,3 @@ blink_screen(void *arg)
timeout(blink_screen, scp, hz / 10);
}
}
#endif /* NSC */

View File

@ -26,11 +26,8 @@
* $FreeBSD$
*/
#include "sc.h"
#include "opt_syscons.h"
#if NSC > 0
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/conf.h>
@ -340,5 +337,3 @@ sysmouse_event(mouse_info_t *info)
}
#endif /* !SC_NO_SYSMOUSE */
#endif /* NSC */

View File

@ -26,16 +26,9 @@
* $FreeBSD$
*/
#include "vga.h"
#include "opt_vga.h"
#include "opt_vesa.h"
#include "opt_fb.h"
#ifdef VGA_NO_MODE_CHANGE
#undef VESA
#endif
#if (NVGA > 0 && defined(VESA)) || defined(KLD_MODULE)
#ifndef VGA_NO_MODE_CHANGE
#include <sys/param.h>
#include <sys/systm.h>
@ -1642,4 +1635,4 @@ static moduledata_t vesa_mod = {
DECLARE_MODULE(vesa, vesa_mod, SI_SUB_DRIVERS, SI_ORDER_MIDDLE);
#endif /* (NVGA > 0 && VESA) || KLD_MODULE */
#endif /* VGA_NO_MODE_CHANGE */

View File

@ -26,11 +26,8 @@
* $FreeBSD$
*/
#include "atkbd.h"
#include "opt_kbd.h"
#if NATKBD > 0
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/kernel.h>
@ -124,5 +121,3 @@ atkbd_isa_intr(void *arg)
}
DRIVER_MODULE(atkbd, atkbdc, atkbd_driver, atkbd_devclass, 0, 0);
#endif /* NATKBD > 0 */

View File

@ -26,11 +26,8 @@
* $FreeBSD$
*/
#include "atkbdc.h"
#include "opt_kbd.h"
#if NATKBDC > 0
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/kernel.h>
@ -265,5 +262,3 @@ atkbdc_write_ivar(device_t bus, device_t dev, int index, u_long val)
}
DRIVER_MODULE(atkbdc, isa, atkbdc_driver, atkbdc_devclass, 0, 0);
#endif /* NATKBDC > 0 */

View File

@ -61,11 +61,8 @@
* Vendor specific support routines.
*/
#include "psm.h"
#include "opt_psm.h"
#if NPSM > 0
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/kernel.h>
@ -1108,10 +1105,6 @@ psmopen(dev_t dev, int flag, int fmt, struct proc *p)
int err;
int s;
/* Validate unit number */
if (unit >= NPSM)
return (ENXIO);
/* Get device data */
sc = PSM_SOFTC(unit);
if ((sc == NULL) || (sc->state & PSM_VALID) == 0)
@ -2450,5 +2443,3 @@ psmresume(device_t dev)
}
DRIVER_MODULE(psm, atkbdc, psm_driver, psm_devclass, 0, 0);
#endif /* NPSM > 0 */

View File

@ -26,11 +26,8 @@
* $FreeBSD$
*/
#include "sc.h"
#include "opt_syscons.h"
#if NSC > 0
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/kernel.h>
@ -118,13 +115,15 @@ sc_softc_t
{
sc_softc_t *sc;
if ((unit < 0) || (unit >= NSC))
if (unit < 0)
return NULL;
if (flags & SC_KERNEL_CONSOLE) {
/* FIXME: clear if it is wired to another unit! */
sc = &main_softc;
} else {
sc = (sc_softc_t *)device_get_softc(devclass_get_device(sc_devclass, unit));
if (sc == NULL)
return NULL;
}
sc->unit = unit;
if (!(sc->flags & SC_INIT_DONE)) {
@ -242,5 +241,3 @@ sc_tone(int herz)
}
DRIVER_MODULE(sc, isa, sc_driver, sc_devclass, 0, 0);
#endif /* NSC > 0 */

View File

@ -26,13 +26,10 @@
* $FreeBSD$
*/
#include "vga.h"
#include "opt_vga.h"
#include "opt_fb.h"
#include "opt_syscons.h" /* should be removed in the future, XXX */
#if NVGA > 0
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/kernel.h>
@ -219,5 +216,3 @@ isavga_mmap(dev_t dev, vm_offset_t offset, int prot)
}
#endif /* FB_INSTALL_CDEV */
#endif /* NVGA > 0 */

View File

@ -2,18 +2,7 @@
.PATH: ${.CURDIR}/../../dev/syscons ${.CURDIR}/../../i386/isa
KMOD = vesa
SRCS = vesa.c scvesactl.c sc.h vga.h opt_syscons.h opt_vga.h \
opt_vesa.h opt_fb.h
SRCS = vesa.c scvesactl.c opt_vga.h
NOMAN =
CLEANFILES = sc.h vga.h
sc.h:
echo "#define NSC 1" > sc.h
vga.h:
echo "#define NVGA 1" > vga.h
opt_vesa.h:
echo "#define VESA 1" > opt_vesa.h
.include <bsd.kmod.mk>