git: b5e0cc2fa44f - main - ahc(4): resolve some minor nits

From: Kyle Evans <kevans_at_FreeBSD.org>
Date: Sun, 21 Apr 2024 03:04:15 UTC
The branch main has been updated by kevans:

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

commit b5e0cc2fa44f52f16fc0b9c3f1709bc0f43fe2d0
Author:     Kyle Evans <kevans@FreeBSD.org>
AuthorDate: 2024-04-21 03:04:04 +0000
Commit:     Kyle Evans <kevans@FreeBSD.org>
CommitDate: 2024-04-21 03:04:04 +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
    Differential Revision:  https://reviews.freebsd.org/D44859
---
 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 9934fbcc41bb..4d97d8ee6367 100644
--- a/sys/dev/aic7xxx/aic7xxx.c
+++ b/sys/dev/aic7xxx/aic7xxx.c
@@ -4931,7 +4931,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 ***********************************/