From 3c78bc9451ce7ce927aaecc9f8e5113de7023a9c Mon Sep 17 00:00:00 2001 From: tb Date: Thu, 7 Apr 2022 09:37:32 +0000 Subject: [PATCH] Fix kernel builds with pseudo-device rd Make the cf_attach member of struct cfdata const and sprinkle a few const into subr_autoconf.c to make this work. Fixes the compilation of sys/dev/rd.c with newly const rd_ca. ok miod (who had a similar diff) --- sys/kern/subr_autoconf.c | 12 ++++++------ sys/sys/device.h | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/sys/kern/subr_autoconf.c b/sys/kern/subr_autoconf.c index eccf09d10e8..a35b2224724 100644 --- a/sys/kern/subr_autoconf.c +++ b/sys/kern/subr_autoconf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: subr_autoconf.c,v 1.95 2021/10/26 16:29:49 deraadt Exp $ */ +/* $OpenBSD: subr_autoconf.c,v 1.96 2022/04/07 09:37:32 tb Exp $ */ /* $NetBSD: subr_autoconf.c,v 1.21 1996/04/04 06:06:18 cgd Exp $ */ /* @@ -348,7 +348,7 @@ config_attach(struct device *parent, void *match, void *aux, cfprint_t print) struct cfdata *cf; struct device *dev; struct cfdriver *cd; - struct cfattach *ca; + const struct cfattach *ca; mtx_enter(&autoconf_attdet_mtx); while (autoconf_attdet < 0) @@ -428,7 +428,7 @@ config_make_softc(struct device *parent, struct cfdata *cf) { struct device *dev; struct cfdriver *cd; - struct cfattach *ca; + const struct cfattach *ca; cd = cf->cf_driver; ca = cf->cf_attach; @@ -507,7 +507,7 @@ int config_detach(struct device *dev, int flags) { struct cfdata *cf; - struct cfattach *ca; + const struct cfattach *ca; struct cfdriver *cd; int rv = 0, i; #ifdef DIAGNOSTIC @@ -816,7 +816,7 @@ config_detach_children(struct device *parent, int flags) int config_suspend(struct device *dev, int act) { - struct cfattach *ca = dev->dv_cfdata->cf_attach; + const struct cfattach *ca = dev->dv_cfdata->cf_attach; int r; device_ref(dev); @@ -998,7 +998,7 @@ device_ref(struct device *dv) void device_unref(struct device *dv) { - struct cfattach *ca; + const struct cfattach *ca; if (atomic_dec_int_nv(&dv->dv_ref) == 0) { ca = dv->dv_cfdata->cf_attach; diff --git a/sys/sys/device.h b/sys/sys/device.h index 1ac19bb65a7..1d1b5bcf80a 100644 --- a/sys/sys/device.h +++ b/sys/sys/device.h @@ -1,4 +1,4 @@ -/* $OpenBSD: device.h,v 1.62 2022/02/16 06:41:27 deraadt Exp $ */ +/* $OpenBSD: device.h,v 1.63 2022/04/07 09:37:32 tb Exp $ */ /* $NetBSD: device.h,v 1.15 1996/04/09 20:55:24 cgd Exp $ */ /* @@ -89,7 +89,7 @@ TAILQ_HEAD(devicelist, device); * Configuration data (i.e., data placed in ioconf.c). */ struct cfdata { - struct cfattach *cf_attach; /* config attachment */ + const struct cfattach *cf_attach; /* config attachment */ struct cfdriver *cf_driver; /* config driver */ short cf_unit; /* unit number */ short cf_fstate; /* finding state (below) */ -- 2.20.1