git: fac45b6b9a58 - stable/13 - ahc(4): resolve some minor nits

From: Kyle Evans <kevans_at_FreeBSD.org>
Date: Thu, 25 Apr 2024 04:00:45 UTC
The branch stable/13 has been updated by kevans:

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

commit fac45b6b9a58911a13c2709407863dbf8b7fd5b7
Author:     Kyle Evans <kevans@FreeBSD.org>
AuthorDate: 2024-04-21 03:04:04 +0000
Commit:     Kyle Evans <kevans@FreeBSD.org>
CommitDate: 2024-04-25 03:59:20 +0000

    ahc(4): resolve some minor nits
    
    In ahc_init(), qoutfifo is already assigned to effectively the same
    value a couple lines up, except in the first assignment it uses the
    proper definition; keep the more descriptive assignment.
    
    ahc_targetcmd_offset() gets the offset wrong entirely; as per the
    area of ahc_init() this diff also touches, targetcmds is laid out first
    in the shared map and it's followed by the qoutfifo.  As a result, we'd
    generally be getting negative offsets here.  We can't actually do a
    partial sync anyways, so there was no consequence to getting this wrong.
    
    Reviewed by:    imp, mav
    
    (cherry picked from commit b5e0cc2fa44f52f16fc0b9c3f1709bc0f43fe2d0)
---
 sys/dev/aic7xxx/aic7xxx.c        | 1 -
 sys/dev/aic7xxx/aic7xxx_inline.h | 2 +-
 2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/sys/dev/aic7xxx/aic7xxx.c b/sys/dev/aic7xxx/aic7xxx.c
index 91bc68121067..141a0b526c97 100644
--- a/sys/dev/aic7xxx/aic7xxx.c
+++ b/sys/dev/aic7xxx/aic7xxx.c
@@ -4937,7 +4937,6 @@ ahc_init(struct ahc_softc *ahc)
 		for (i = 0; i < AHC_TMODE_CMDS; i++)
 			ahc->targetcmds[i].cmd_valid = 0;
 		ahc_sync_tqinfifo(ahc, BUS_DMASYNC_PREREAD);
-		ahc->qoutfifo = (uint8_t *)&ahc->targetcmds[256];
 	}
 	ahc->qinfifo = &ahc->qoutfifo[256];
 
diff --git a/sys/dev/aic7xxx/aic7xxx_inline.h b/sys/dev/aic7xxx/aic7xxx_inline.h
index ac043ddb8bbd..6a6501b72c13 100644
--- a/sys/dev/aic7xxx/aic7xxx_inline.h
+++ b/sys/dev/aic7xxx/aic7xxx_inline.h
@@ -217,7 +217,7 @@ ahc_sync_sglist(struct ahc_softc *ahc, struct scb *scb, int op)
 static __inline uint32_t
 ahc_targetcmd_offset(struct ahc_softc *ahc, u_int index)
 {
-	return (((uint8_t *)&ahc->targetcmds[index]) - ahc->qoutfifo);
+	return (((uint8_t *)&ahc->targetcmds[index]) - (uint8_t *)ahc->targetcmds);
 }
 
 /******************************** Debugging ***********************************/