git: 04bf43505bae - main - cxgbe(4): Use correct priority in begin_synchronized_op.

From: Navdeep Parhar <np_at_FreeBSD.org>
Date: Fri, 14 Feb 2025 06:39:08 UTC
The branch main has been updated by np:

URL: https://cgit.FreeBSD.org/src/commit/?id=04bf43505bae1bb20d315a44e977d97aed3e5733

commit 04bf43505bae1bb20d315a44e977d97aed3e5733
Author:     Navdeep Parhar <np@FreeBSD.org>
AuthorDate: 2024-10-04 18:14:33 +0000
Commit:     Navdeep Parhar <np@FreeBSD.org>
CommitDate: 2025-02-14 06:15:18 +0000

    cxgbe(4): Use correct priority in begin_synchronized_op.
    
    It was always set to PCATCH because the driver tested (INTR_OK) instead
    of (flags & INTR_OK).  Fit a WITNESS_WARN in a single line while here.
    
    MFC after:      1 week
    Sponsored by:   Chelsio Communications
---
 sys/dev/cxgbe/t4_main.c | 14 ++++----------
 1 file changed, 4 insertions(+), 10 deletions(-)

diff --git a/sys/dev/cxgbe/t4_main.c b/sys/dev/cxgbe/t4_main.c
index 5542481e03d8..51ba6d94b5fa 100644
--- a/sys/dev/cxgbe/t4_main.c
+++ b/sys/dev/cxgbe/t4_main.c
@@ -6324,20 +6324,13 @@ int
 begin_synchronized_op(struct adapter *sc, struct vi_info *vi, int flags,
     char *wmesg)
 {
-	int rc, pri;
+	int rc;
 
 #ifdef WITNESS
 	/* the caller thinks it's ok to sleep, but is it really? */
 	if (flags & SLEEP_OK)
-		WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL,
-		    "begin_synchronized_op");
+		WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL, __func__);
 #endif
-
-	if (INTR_OK)
-		pri = PCATCH;
-	else
-		pri = 0;
-
 	ADAPTER_LOCK(sc);
 	for (;;) {
 
@@ -6356,7 +6349,8 @@ begin_synchronized_op(struct adapter *sc, struct vi_info *vi, int flags,
 			goto done;
 		}
 
-		if (mtx_sleep(&sc->flags, &sc->sc_lock, pri, wmesg, 0)) {
+		if (mtx_sleep(&sc->flags, &sc->sc_lock,
+		    flags & INTR_OK ? PCATCH : 0, wmesg, 0)) {
 			rc = EINTR;
 			goto done;
 		}