Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/ic Fix another portability issue. Part of PR kern/3...
details: https://anonhg.NetBSD.org/src/rev/7b1ca5e12d13
branches: trunk
changeset: 582215:7b1ca5e12d13
user: darcy <darcy%NetBSD.org@localhost>
date: Mon Jun 20 20:40:21 2005 +0000
description:
Fix another portability issue. Part of PR kern/30456.
diffstat:
sys/dev/ic/aac.c | 13 ++++++-------
1 files changed, 6 insertions(+), 7 deletions(-)
diffs (41 lines):
diff -r 9e5e59ccbaea -r 7b1ca5e12d13 sys/dev/ic/aac.c
--- a/sys/dev/ic/aac.c Mon Jun 20 15:32:29 2005 +0000
+++ b/sys/dev/ic/aac.c Mon Jun 20 20:40:21 2005 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: aac.c,v 1.20 2005/06/20 11:37:47 darcy Exp $ */
+/* $NetBSD: aac.c,v 1.21 2005/06/20 20:40:21 darcy Exp $ */
/*-
* Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -77,7 +77,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: aac.c,v 1.20 2005/06/20 11:37:47 darcy Exp $");
+__KERNEL_RCSID(0, "$NetBSD: aac.c,v 1.21 2005/06/20 20:40:21 darcy Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -454,8 +454,7 @@
{
int nsegs, i, rv, state, norm, high;
struct aac_adapter_init *ip;
- u_int32_t code;
- u_int8_t *qaddr;
+ u_int32_t code, qoff;
state = 0;
@@ -554,9 +553,9 @@
* generic list manipulation functions which 'know' the size of each
* list by virtue of a table.
*/
- qaddr = &sc->sc_common->ac_qbuf[0] + AAC_QUEUE_ALIGN;
- qaddr -= (u_int32_t)qaddr % AAC_QUEUE_ALIGN; /* XXX not portable */
- sc->sc_queues = (struct aac_queue_table *)qaddr;
+ qoff = offsetof(struct aac_common, ac_qbuf) + AAC_QUEUE_ALIGN;
+ qoff &= ~(AAC_QUEUE_ALIGN - 1);
+ sc->sc_queues = (struct aac_queue_table *)((uintptr_t)sc->sc_common + qoff);
ip->CommHeaderAddress = htole32(sc->sc_common_seg.ds_addr +
((caddr_t)sc->sc_queues - (caddr_t)sc->sc_common));
memset(sc->sc_queues, 0, sizeof(struct aac_queue_table));
Home |
Main Index |
Thread Index |
Old Index