The branch main has been updated by imp:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=4584c8f0ef54e19f7be79aeee1ba1c1154af14e1

commit 4584c8f0ef54e19f7be79aeee1ba1c1154af14e1
Author:     Arvydas Sidorenko <asi...@gmail.com>
AuthorDate: 2024-10-11 22:54:17 +0000
Commit:     Warner Losh <i...@freebsd.org>
CommitDate: 2024-10-12 20:40:24 +0000

    lpt: check readiness with predefined macros
    
    Replace spelled-out bits with pre-defined macros for those same bits.
    No functional change.
    
    PR: 170076
    Reviewed by: imp
---
 sys/dev/ppbus/lpt.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/sys/dev/ppbus/lpt.c b/sys/dev/ppbus/lpt.c
index 994adcc6a608..d6f5b34d0e60 100644
--- a/sys/dev/ppbus/lpt.c
+++ b/sys/dev/ppbus/lpt.c
@@ -238,8 +238,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);
 }
@@ -560,9 +559,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)
@@ -619,9 +616,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)

Reply via email to