Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/arm/cortex arm/cortex: Use container_of, not bespok...



details:   https://anonhg.NetBSD.org/src/rev/cb1a1063900e
branches:  trunk
changeset: 364555:cb1a1063900e
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Mon Mar 28 19:59:35 2022 +0000

description:
arm/cortex: Use container_of, not bespoke offsetof arithmetic.

diffstat:

 sys/arch/arm/cortex/gicv3.c |  8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diffs (30 lines):

diff -r db6253d1d8de -r cb1a1063900e sys/arch/arm/cortex/gicv3.c
--- a/sys/arch/arm/cortex/gicv3.c       Mon Mar 28 19:59:26 2022 +0000
+++ b/sys/arch/arm/cortex/gicv3.c       Mon Mar 28 19:59:35 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: gicv3.c,v 1.49 2021/10/02 20:52:09 skrll Exp $ */
+/* $NetBSD: gicv3.c,v 1.50 2022/03/28 19:59:35 riastradh Exp $ */
 
 /*-
  * Copyright (c) 2018 Jared McNeill <jmcneill%invisible.ca@localhost>
@@ -32,7 +32,7 @@
 #define        _INTR_PRIVATE
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: gicv3.c,v 1.49 2021/10/02 20:52:09 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gicv3.c,v 1.50 2022/03/28 19:59:35 riastradh Exp $");
 
 #include <sys/param.h>
 #include <sys/kernel.h>
@@ -58,9 +58,9 @@
 #endif
 
 #define        PICTOSOFTC(pic) \
-       ((void *)((uintptr_t)(pic) - offsetof(struct gicv3_softc, sc_pic)))
+       container_of(pic, struct gicv3_softc, sc_pic)
 #define        LPITOSOFTC(lpi) \
-       ((void *)((uintptr_t)(lpi) - offsetof(struct gicv3_softc, sc_lpi)))
+       container_of(lpi, struct gicv3_softc, sc_lpi)
 
 #define        IPL_TO_PRIORITY(sc, ipl)        (((0xff - (ipl)) << (sc)->sc_priority_shift) & 0xff)
 #define        IPL_TO_PMR(sc, ipl)             (((0xff - (ipl)) << (sc)->sc_pmr_shift) & 0xff)



Home | Main Index | Thread Index | Old Index