Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/sys pmf(9): *_child_register never fails. Make it retur...
details: https://anonhg.NetBSD.org/src/rev/21efeb07a20a
branches: trunk
changeset: 369621:21efeb07a20a
user: riastradh <riastradh%NetBSD.org@localhost>
date: Wed Aug 24 11:19:24 2022 +0000
description:
pmf(9): *_child_register never fails. Make it return void.
No kernel bump because this isn't documented or used in any modules,
only in dev/pci/pci.c and dev/cardbus/cardbus.c which are as far as I
know always statically linked into the kernel.
The next change, however, will require a revbump -- to make
pmf_device_register return void so we can prune vast swaths of dead
error branches.
diffstat:
sys/dev/cardbus/cardbus.c | 10 ++++------
sys/dev/pci/pci.c | 10 ++++------
sys/kern/kern_pmf.c | 9 +++------
sys/kern/subr_autoconf.c | 12 ++++++------
sys/sys/device.h | 6 +++---
sys/sys/device_impl.h | 4 ++--
6 files changed, 22 insertions(+), 29 deletions(-)
diffs (199 lines):
diff -r bd287167d908 -r 21efeb07a20a sys/dev/cardbus/cardbus.c
--- a/sys/dev/cardbus/cardbus.c Wed Aug 24 11:19:10 2022 +0000
+++ b/sys/dev/cardbus/cardbus.c Wed Aug 24 11:19:24 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cardbus.c,v 1.114 2022/03/26 13:41:16 martin Exp $ */
+/* $NetBSD: cardbus.c,v 1.115 2022/08/24 11:19:24 riastradh Exp $ */
/*
* Copyright (c) 1997, 1998, 1999 and 2000
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cardbus.c,v 1.114 2022/03/26 13:41:16 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cardbus.c,v 1.115 2022/08/24 11:19:24 riastradh Exp $");
#include "opt_cardbus.h"
@@ -83,7 +83,7 @@
static void enable_function(struct cardbus_softc *, int, int);
static void disable_function(struct cardbus_softc *, int);
-static bool cardbus_child_register(device_t);
+static void cardbus_child_register(device_t);
CFATTACH_DECL3_NEW(cardbus, sizeof(struct cardbus_softc),
cardbusmatch, cardbusattach, cardbusdetach, NULL,
@@ -1218,7 +1218,7 @@
free(priv, M_DEVBUF);
}
-static bool
+static void
cardbus_child_register(device_t child)
{
device_t self = device_parent(child);
@@ -1250,6 +1250,4 @@
device_pmf_bus_register(child, priv, cardbus_child_suspend,
cardbus_child_resume, 0, cardbus_child_deregister);
-
- return true;
}
diff -r bd287167d908 -r 21efeb07a20a sys/dev/pci/pci.c
--- a/sys/dev/pci/pci.c Wed Aug 24 11:19:10 2022 +0000
+++ b/sys/dev/pci/pci.c Wed Aug 24 11:19:24 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pci.c,v 1.164 2022/01/21 15:55:36 thorpej Exp $ */
+/* $NetBSD: pci.c,v 1.165 2022/08/24 11:19:25 riastradh Exp $ */
/*
* Copyright (c) 1995, 1996, 1997, 1998
@@ -36,7 +36,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pci.c,v 1.164 2022/01/21 15:55:36 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci.c,v 1.165 2022/08/24 11:19:25 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_pci.h"
@@ -59,7 +59,7 @@
#include "locators.h"
-static bool pci_child_register(device_t);
+static void pci_child_register(device_t);
#ifdef PCI_CONFIG_DUMP
int pci_config_dump = 1;
@@ -1321,7 +1321,7 @@
free(priv, M_DEVBUF);
}
-static bool
+static void
pci_child_register(device_t child)
{
device_t self = device_parent(child);
@@ -1355,8 +1355,6 @@
device_pmf_bus_register(child, priv, pci_child_suspend,
pci_child_resume, pci_child_shutdown, pci_child_deregister);
-
- return true;
}
MODULE(MODULE_CLASS_DRIVER, pci, NULL);
diff -r bd287167d908 -r 21efeb07a20a sys/kern/kern_pmf.c
--- a/sys/kern/kern_pmf.c Wed Aug 24 11:19:10 2022 +0000
+++ b/sys/kern/kern_pmf.c Wed Aug 24 11:19:24 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_pmf.c,v 1.49 2022/08/24 11:18:56 riastradh Exp $ */
+/* $NetBSD: kern_pmf.c,v 1.50 2022/08/24 11:19:25 riastradh Exp $ */
/*-
* Copyright (c) 2007 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_pmf.c,v 1.49 2022/08/24 11:18:56 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_pmf.c,v 1.50 2022/08/24 11:19:25 riastradh Exp $");
#include <sys/types.h>
#include <sys/param.h>
@@ -419,10 +419,7 @@
{
device_pmf_driver_register(dev, suspend, resume, shutdown);
- if (!device_pmf_driver_child_register(dev)) {
- device_pmf_driver_deregister(dev);
- return false;
- }
+ device_pmf_driver_child_register(dev);
return true;
}
diff -r bd287167d908 -r 21efeb07a20a sys/kern/subr_autoconf.c
--- a/sys/kern/subr_autoconf.c Wed Aug 24 11:19:10 2022 +0000
+++ b/sys/kern/subr_autoconf.c Wed Aug 24 11:19:24 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: subr_autoconf.c,v 1.303 2022/08/24 11:18:56 riastradh Exp $ */
+/* $NetBSD: subr_autoconf.c,v 1.304 2022/08/24 11:19:25 riastradh Exp $ */
/*
* Copyright (c) 1996, 2000 Christopher G. Demetriou
@@ -77,7 +77,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: subr_autoconf.c,v 1.303 2022/08/24 11:18:56 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_autoconf.c,v 1.304 2022/08/24 11:19:25 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_ddb.h"
@@ -3174,19 +3174,19 @@
mutex_exit(&dvl->dvl_mtx);
}
-bool
+void
device_pmf_driver_child_register(device_t dev)
{
device_t parent = device_parent(dev);
if (parent == NULL || parent->dv_driver_child_register == NULL)
- return true;
- return (*parent->dv_driver_child_register)(dev);
+ return;
+ (*parent->dv_driver_child_register)(dev);
}
void
device_pmf_driver_set_child_register(device_t dev,
- bool (*child_register)(device_t))
+ void (*child_register)(device_t))
{
dev->dv_driver_child_register = child_register;
}
diff -r bd287167d908 -r 21efeb07a20a sys/sys/device.h
--- a/sys/sys/device.h Wed Aug 24 11:19:10 2022 +0000
+++ b/sys/sys/device.h Wed Aug 24 11:19:24 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: device.h,v 1.184 2022/08/24 11:19:10 riastradh Exp $ */
+/* $NetBSD: device.h,v 1.185 2022/08/24 11:19:25 riastradh Exp $ */
/*
* Copyright (c) 2021 The NetBSD Foundation, Inc.
@@ -669,9 +669,9 @@
device_compatible_lookup_id(uintptr_t const, uintptr_t const,
const struct device_compatible_entry *);
-bool device_pmf_driver_child_register(device_t);
+void device_pmf_driver_child_register(device_t);
void device_pmf_driver_set_child_register(device_t,
- bool (*)(device_t));
+ void (*)(device_t));
void *device_pmf_bus_private(device_t);
bool device_pmf_bus_suspend(device_t, const pmf_qual_t *);
diff -r bd287167d908 -r 21efeb07a20a sys/sys/device_impl.h
--- a/sys/sys/device_impl.h Wed Aug 24 11:19:10 2022 +0000
+++ b/sys/sys/device_impl.h Wed Aug 24 11:19:24 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: device_impl.h,v 1.2 2022/08/24 11:19:10 riastradh Exp $ */
+/* $NetBSD: device_impl.h,v 1.3 2022/08/24 11:19:25 riastradh Exp $ */
/*
* Copyright (c) 2022 The NetBSD Foundation, Inc.
@@ -155,7 +155,7 @@
bool (*dv_driver_suspend)(device_t, const pmf_qual_t *);
bool (*dv_driver_resume)(device_t, const pmf_qual_t *);
bool (*dv_driver_shutdown)(device_t, int);
- bool (*dv_driver_child_register)(device_t);
+ void (*dv_driver_child_register)(device_t);
void *dv_bus_private;
bool (*dv_bus_suspend)(device_t, const pmf_qual_t *);
Home |
Main Index |
Thread Index |
Old Index