Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/arm/apple arm/apple: Use container_of, not bespoke ...
details: https://anonhg.NetBSD.org/src/rev/db6253d1d8de
branches: trunk
changeset: 364554:db6253d1d8de
user: riastradh <riastradh%NetBSD.org@localhost>
date: Mon Mar 28 19:59:26 2022 +0000
description:
arm/apple: Use container_of, not bespoke offsetof arithmetic.
Better type-safety this way.
diffstat:
sys/arch/arm/apple/apple_intc.c | 10 ++++------
1 files changed, 4 insertions(+), 6 deletions(-)
diffs (31 lines):
diff -r 145383a2e318 -r db6253d1d8de sys/arch/arm/apple/apple_intc.c
--- a/sys/arch/arm/apple/apple_intc.c Mon Mar 28 19:08:43 2022 +0000
+++ b/sys/arch/arm/apple/apple_intc.c Mon Mar 28 19:59:26 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: apple_intc.c,v 1.6 2021/11/26 19:39:58 skrll Exp $ */
+/* $NetBSD: apple_intc.c,v 1.7 2022/03/28 19:59:26 riastradh Exp $ */
/*-
* Copyright (c) 2021 Jared McNeill <jmcneill%invisible.ca@localhost>
@@ -32,7 +32,7 @@
#define _INTR_PRIVATE
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: apple_intc.c,v 1.6 2021/11/26 19:39:58 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: apple_intc.c,v 1.7 2022/03/28 19:59:26 riastradh Exp $");
#include <sys/param.h>
#include <sys/bus.h>
@@ -112,10 +112,8 @@
static struct apple_intc_softc *intc_softc;
-#define PICTOSOFTC(pic) \
- ((void *)((uintptr_t)(pic) - offsetof(struct apple_intc_softc, sc_pic)))
-#define PICTOPERCPU(pic) \
- ((void *)((uintptr_t)(pic) - offsetof(struct apple_intc_percpu, pc_pic)))
+#define PICTOSOFTC(pic) container_of(pic, struct apple_intc_softc, sc_pic)
+#define PICTOPERCPU(pic) container_of(pic, struct apple_intc_percpu, pc_pic)
#define AIC_READ(sc, reg) \
bus_space_read_4((sc)->sc_bst, (sc)->sc_bsh, (reg))
Home |
Main Index |
Thread Index |
Old Index