From ec76bb9b04b851f403fac72fddaa8613025c7da4 Mon Sep 17 00:00:00 2001 From: Guillem Jover Date: Fri, 9 Sep 2011 03:40:24 +0200 Subject: Remove unused [!MACH_KERNEL] driver code MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use «unifdef -DMACK_KERNEL=1» as a starting point, but only remove the code not exposed on public headers, the rest is needed to build properly from userland. * device/cons.c [!MACH_KERNEL]: Remove includes. [!MACH_KERNEL] (constty): Remove variable. (cninit, cnmaygetc) [MACH_KERNEL]: Remove preprocessor conditionals. [!MACH_KERNEL] (cnopen, cnclose, cnread, cnwrite, cnioctl, cnselect) (cncontrol): Remove functions. * device/cons.h (struct consdev) [MACH_KERNEL]: Remove preprocessor conditional. * device/kmsg.h [MACH_KERNEL]: Likewise. * i386/i386at/autoconf.c [!MACH_KERNEL]: Remove includes. * i386/i386at/kd_event.c [!MACH_KERNEL]: Likewise. [!MACH_KERNEL] (kbd_sel, kbdpgrp, kbdflag): Remove variables. [!MACH_KERNEL] (KBD_COLL, KBD_ASYNC, KBD_NBIO): Remove macros. (kbdopen, kbdclose, kbd_enqueue) [!MACH_KERNEL]: Remove code. [!MACH_KERNEL] (kbdioctl, kbdselect, kbdread): Remove functions. [!MACH_KERNEL] (X_kdb_enter_init, X_kdb_exit_init: Likewise. * i386/i386at/kd_mouse.c [!MACH_KERNEL]: Remove includes. [!MACH_KERNEL] (mouse_sel, mousepgrp, mouseflag): Remove variables. [!MACH_KERNEL] (MOUSE_COLL, MOUSE_ASYNC, MOUSE_NBIO): Remove macros. (mouseopen, mouseclose, kd_mouse_read, mouse_enqueue) [!MACH_KERNEL]: Remove code. [!MACH_KERNEL] (mouseioctl, mouseselect, mouseread): Remove functions. * i386/i386at/lpr.c [!MACH_KERNEL]: Remove includes. (lpropen) [MACH_KERNEL]: Remove preprocessor conditionals. (lpropen, lprclose, lprstart) [!MACH_KERNEL]: Remove code. [!MACH_KERNEL] (lprwrite, lprioctl, lprstop): Remove functions. * i386/i386at/rtc.c (readtodc, writetodc) [!MACH_KERNEL]: Remove code. * kern/mach_factor.c [MACH_KERNEL]: Remove preprocessor conditional. * xen/time.c (readtodc) [!MACH_KERNEL]: Remove code. --- i386/i386at/lpr.c | 110 ------------------------------------------------------ 1 file changed, 110 deletions(-) (limited to 'i386/i386at/lpr.c') diff --git a/i386/i386at/lpr.c b/i386/i386at/lpr.c index cf76da2..468608c 100644 --- a/i386/i386at/lpr.c +++ b/i386/i386at/lpr.c @@ -30,7 +30,6 @@ #if NLPR > 0 -#ifdef MACH_KERNEL #include #include #include @@ -40,18 +39,6 @@ #include #include #include -#else /* MACH_KERNEL */ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#endif /* MACH_KERNEL */ #include #include @@ -68,9 +55,7 @@ int lprprobe(); void lprstop(); void lprintr(), lprstart(); void lprattach(struct bus_device *); -#ifdef MACH_KERNEL int lprgetstat(), lprsetstat(); -#endif /* MACH_KERNEL */ void lprpr_addr(); struct bus_device *lprinfo[NLPR]; /* ??? */ @@ -130,9 +115,7 @@ int lpropen(dev, flag, ior) int dev; int flag; -#ifdef MACH_KERNEL io_req_t ior; -#endif /* MACH_KERNEL */ { int unit = minor(dev); struct bus_device *isai; @@ -142,20 +125,14 @@ u_short addr; if (unit >= NLPR || (isai = lprinfo[unit]) == 0 || isai->alive == 0) return (D_NO_SUCH_DEVICE); tp = &lpr_tty[unit]; -#ifndef MACH_KERNEL - if (tp->t_state & TS_XCLUDE && u.u_uid != 0) - return (D_ALREADY_OPEN); -#endif /* MACH_KERNEL */ addr = (u_short) isai->address; tp->t_dev = dev; tp->t_addr = *(caddr_t *)&addr; tp->t_oproc = lprstart; tp->t_state |= TS_WOPEN; -#ifdef MACH_KERNEL tp->t_stop = lprstop; tp->t_getstat = lprgetstat; tp->t_setstat = lprsetstat; -#endif /* MACH_KERNEL */ if ((tp->t_state & TS_ISOPEN) == 0) ttychars(tp); outb(INTR_ENAB(addr), inb(INTR_ENAB(addr)) | 0x10); @@ -172,9 +149,6 @@ int unit = minor(dev); struct tty *tp = &lpr_tty[unit]; u_short addr = (u_short) lprinfo[unit]->address; -#ifndef MACH_KERNEL - (*linesw[tp->t_line].l_close)(tp); -#endif /* MACH_KERNEL */ ttyclose(tp); if (tp->t_state&TS_HUPCLS || (tp->t_state&TS_ISOPEN)==0) { outb(INTR_ENAB(addr), inb(INTR_ENAB(addr)) & 0x0f); @@ -182,7 +156,6 @@ u_short addr = (u_short) lprinfo[unit]->address; } } -#ifdef MACH_KERNEL int lprread(dev, ior) int dev; @@ -244,43 +217,6 @@ unsigned int count; } return (D_SUCCESS); } -#else /* MACH_KERNEL */ -int lprwrite(dev, uio) - int dev; - struct uio *uio; -{ - struct tty *tp= &lpr_tty[minor(dev)]; - - return ((*linesw[tp->t_line].l_write)(tp, uio)); -} - -int lprioctl(dev, cmd, addr, mode) - int dev; - int cmd; - caddr_t addr; - int mode; -{ - int error; - spl_t s; - int unit = minor(dev); - struct tty *tp = &lpr_tty[unit]; - - error = (*linesw[tp->t_line].l_ioctl)(tp, cmd, addr,mode); - if (error >= 0) - return(error); - error = ttioctl(tp, cmd, addr,mode); - if (error >= 0) - return (error); - s = spltty(); - switch (cmd) { - default: - splx(s); - return(ENOTTY); - } - splx(s); - return(0); -} -#endif /* MACH_KERNEL */ void lprintr(unit) int unit; @@ -317,25 +253,12 @@ struct tty *tp; } if (tp->t_outq.c_cc <= TTLOWAT(tp)) { -#ifdef MACH_KERNEL tt_write_wakeup(tp); -#else /* MACH_KERNEL */ - if (tp->t_state & TS_ASLEEP) { - tp->t_state &= ~TS_ASLEEP; - wakeup ((caddr_t)&tp->t_outq); - } - if (tp->t_wsel) { - selwakeup(tp->t_wsel, tp->t_state & TS_WCOLL); - tp->t_wsel = 0; - tp->t_state &= ~TS_WCOLL; - } -#endif /* MACH_KERNEL */ } if (tp->t_outq.c_cc == 0) { splx(s); return; } -#ifdef MACH_KERNEL nch = getc(&tp->t_outq); if ((tp->t_flags & LITOUT) == 0 && (nch & 0200)) { timeout((timer_func_t *)ttrstrt, (char *)tp, (nch & 0x7f) + 6); @@ -346,32 +269,10 @@ struct tty *tp; outb(INTR_ENAB(addr),inb(INTR_ENAB(addr)) | 0x01); outb(INTR_ENAB(addr),inb(INTR_ENAB(addr)) & 0x1e); tp->t_state |= TS_BUSY; -#else /* MACH_KERNEL */ - if (tp->t_flags & (RAW|LITOUT)) - nch = ndqb(&tp->t_outq,0); - else { - nch = ndqb(&tp->t_outq, 0200); - if (nch == 0) { - nch = getc(&tp->t_outq); - timeout(ttrstrt,(caddr_t)tp,(nch&0x7f)+6); - tp->t_state |= TS_TIMEOUT; - splx(s); - return(0); - } - } - if (nch) { - nch=getc(&tp->t_outq); - outb(DATA(addr), nch); - outb(INTR_ENAB(addr),inb(INTR_ENAB(addr)) | 0x01); - outb(INTR_ENAB(addr),inb(INTR_ENAB(addr)) & 0x1e); - tp->t_state |= TS_BUSY; - } -#endif /* MACH_KERNEL */ splx(s); return; } -#ifdef MACH_KERNEL void lprstop(tp, flags) register struct tty *tp; @@ -380,17 +281,6 @@ int flags; if ((tp->t_state & TS_BUSY) && (tp->t_state & TS_TTSTOP) == 0) tp->t_state |= TS_FLUSH; } -#else /* MACH_KERNEL */ -void lprstop(tp, flag) -struct tty *tp; -{ - int s = spltty(); - - if ((tp->t_state&TS_BUSY) && (!(tp->t_state&TS_TTSTOP))) - tp->t_state |= TS_FLUSH; - splx(s); -} -#endif /* MACH_KERNEL */ int lprpr(unit) { -- cgit v1.2.3