Module Name: src
Committed By: riastradh
Date: Wed Aug 24 11:19:25 UTC 2022
Modified Files:
src/sys/dev/cardbus: cardbus.c
src/sys/dev/pci: pci.c
src/sys/kern: kern_pmf.c subr_autoconf.c
src/sys/sys: device.h device_impl.h
Log Message:
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.
To generate a diff of this commit:
cvs rdiff -u -r1.114 -r1.115 src/sys/dev/cardbus/cardbus.c
cvs rdiff -u -r1.164 -r1.165 src/sys/dev/pci/pci.c
cvs rdiff -u -r1.49 -r1.50 src/sys/kern/kern_pmf.c
cvs rdiff -u -r1.303 -r1.304 src/sys/kern/subr_autoconf.c
cvs rdiff -u -r1.184 -r1.185 src/sys/sys/device.h
cvs rdiff -u -r1.2 -r1.3 src/sys/sys/device_impl.h
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/dev/cardbus/cardbus.c
diff -u src/sys/dev/cardbus/cardbus.c:1.114 src/sys/dev/cardbus/cardbus.c:1.115
--- src/sys/dev/cardbus/cardbus.c:1.114 Sat Mar 26 13:41:16 2022
+++ src/sys/dev/cardbus/cardbus.c Wed Aug 24 11:19:24 2022
@@ -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 int cardbus_read_tuples(struct ca
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 @@ cardbus_child_deregister(device_t dv)
free(priv, M_DEVBUF);
}
-static bool
+static void
cardbus_child_register(device_t child)
{
device_t self = device_parent(child);
@@ -1250,6 +1250,4 @@ cardbus_child_register(device_t child)
device_pmf_bus_register(child, priv, cardbus_child_suspend,
cardbus_child_resume, 0, cardbus_child_deregister);
-
- return true;
}
Index: src/sys/dev/pci/pci.c
diff -u src/sys/dev/pci/pci.c:1.164 src/sys/dev/pci/pci.c:1.165
--- src/sys/dev/pci/pci.c:1.164 Fri Jan 21 15:55:36 2022
+++ src/sys/dev/pci/pci.c Wed Aug 24 11:19:25 2022
@@ -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 @@ __KERNEL_RCSID(0, "$NetBSD: pci.c,v 1.16
#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 @@ pci_child_deregister(device_t dv)
free(priv, M_DEVBUF);
}
-static bool
+static void
pci_child_register(device_t child)
{
device_t self = device_parent(child);
@@ -1355,8 +1355,6 @@ pci_child_register(device_t child)
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);
Index: src/sys/kern/kern_pmf.c
diff -u src/sys/kern/kern_pmf.c:1.49 src/sys/kern/kern_pmf.c:1.50
--- src/sys/kern/kern_pmf.c:1.49 Wed Aug 24 11:18:56 2022
+++ src/sys/kern/kern_pmf.c Wed Aug 24 11:19:25 2022
@@ -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 <[email protected]>
@@ -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 @@ pmf_device_register1(device_t dev,
{
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;
}
Index: src/sys/kern/subr_autoconf.c
diff -u src/sys/kern/subr_autoconf.c:1.303 src/sys/kern/subr_autoconf.c:1.304
--- src/sys/kern/subr_autoconf.c:1.303 Wed Aug 24 11:18:56 2022
+++ src/sys/kern/subr_autoconf.c Wed Aug 24 11:19:25 2022
@@ -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 @@ device_pmf_driver_deregister(device_t de
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;
}
Index: src/sys/sys/device.h
diff -u src/sys/sys/device.h:1.184 src/sys/sys/device.h:1.185
--- src/sys/sys/device.h:1.184 Wed Aug 24 11:19:10 2022
+++ src/sys/sys/device.h Wed Aug 24 11:19:25 2022
@@ -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 @@ const struct device_compatible_entry *
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 *);
Index: src/sys/sys/device_impl.h
diff -u src/sys/sys/device_impl.h:1.2 src/sys/sys/device_impl.h:1.3
--- src/sys/sys/device_impl.h:1.2 Wed Aug 24 11:19:10 2022
+++ src/sys/sys/device_impl.h Wed Aug 24 11:19:25 2022
@@ -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 @@ struct device {
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 *);