From owner-freebsd-bugs@FreeBSD.ORG Sun Jul 22 21:10:10 2012 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 855D81065674 for ; Sun, 22 Jul 2012 21:10:10 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 5E6EC8FC19 for ; Sun, 22 Jul 2012 21:10:10 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.5/8.14.5) with ESMTP id q6MLAAuZ059951 for ; Sun, 22 Jul 2012 21:10:10 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.5/8.14.5/Submit) id q6MLAALI059950; Sun, 22 Jul 2012 21:10:10 GMT (envelope-from gnats) Resent-Date: Sun, 22 Jul 2012 21:10:10 GMT Resent-Message-Id: <201207222110.q6MLAALI059950@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Arvydas Sidorenko Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 8F41A106566B for ; Sun, 22 Jul 2012 21:06:09 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22]) by mx1.freebsd.org (Postfix) with ESMTP id 7A5E08FC14 for ; Sun, 22 Jul 2012 21:06:09 +0000 (UTC) Received: from red.freebsd.org (localhost [127.0.0.1]) by red.freebsd.org (8.14.4/8.14.4) with ESMTP id q6ML699p080156 for ; Sun, 22 Jul 2012 21:06:09 GMT (envelope-from nobody@red.freebsd.org) Received: (from nobody@localhost) by red.freebsd.org (8.14.4/8.14.4/Submit) id q6ML69TQ080129; Sun, 22 Jul 2012 21:06:09 GMT (envelope-from nobody) Message-Id: <201207222106.q6ML69TQ080129@red.freebsd.org> Date: Sun, 22 Jul 2012 21:06:09 GMT From: Arvydas Sidorenko To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Cc: Subject: kern/170076: [PATCH] lpt: check readiness with predefined macros X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Jul 2012 21:10:10 -0000 >Number: 170076 >Category: kern >Synopsis: [PATCH] lpt: check readiness with predefined macros >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Sun Jul 22 21:10:10 UTC 2012 >Closed-Date: >Last-Modified: >Originator: Arvydas Sidorenko >Release: >Organization: >Environment: >Description: >How-To-Repeat: >Fix: >From cd8ed3e8a1f2d2ebb618e697c432d9fcf85f13a7 Mon Sep 17 00:00:00 2001 From: Arvydas Sidorenko Date: Fri, 20 Jul 2012 01:28:52 +0200 Subject: [PATCH] lpt: check readiness with predefined macros Signed-off-by: Arvydas Sidorenko --- sys/dev/ppbus/lpt.c | 11 +++-------- 1 files changed, 3 insertions(+), 8 deletions(-) diff --git a/sys/dev/ppbus/lpt.c b/sys/dev/ppbus/lpt.c index 3a28efd2..8d89323 100644 --- a/sys/dev/ppbus/lpt.c +++ b/sys/dev/ppbus/lpt.c @@ -242,8 +242,7 @@ lpt_port_test(device_t ppbus, u_char data, u_char mask) do { DELAY(10); temp = ppb_rdtr(ppbus) & mask; - } - while (temp != data && --timeout); + } while (temp != data && --timeout); lprintf(("out=%x\tin=%x\ttout=%d\n", data, temp, timeout)); return (temp == data); } @@ -564,9 +563,7 @@ lptopen(struct cdev *dev, int flags, int fmt, struct thread *td) } /* is printer online and ready for output */ - } while ((ppb_rstr(ppbus) & - (LPS_SEL|LPS_OUT|LPS_NBSY|LPS_NERR)) != - (LPS_SEL|LPS_NBSY|LPS_NERR)); + } while ((ppb_rstr(ppbus) & RDY_MASK) != LP_READY); sc->sc_control = LPC_SEL|LPC_NINIT; if (sc->sc_flags & LP_AUTOLF) @@ -623,9 +620,7 @@ lptclose(struct cdev *dev, int flags, int fmt, struct thread *td) /* if the last write was interrupted, don't complete it */ if ((!(sc->sc_state & INTERRUPTED)) && (sc->sc_irq & LP_USE_IRQ)) - while ((ppb_rstr(ppbus) & - (LPS_SEL|LPS_OUT|LPS_NBSY|LPS_NERR)) != - (LPS_SEL|LPS_NBSY|LPS_NERR) || sc->sc_xfercnt) + while (((ppb_rstr(ppbus) & RDY_MASK) != LP_READY) || sc->sc_xfercnt) /* wait 1 second, give up if we get a signal */ if (ppb_sleep(ppbus, lptdev, LPPRI | PCATCH, "lpclose", hz) != EWOULDBLOCK) -- 1.7.8.6 >Release-Note: >Audit-Trail: >Unformatted: