CVS commit: src/sys/arch/sandpoint/sandpoint
Module Name:src Committed By: riastradh Date: Wed May 10 00:08:14 UTC 2023 Modified Files: src/sys/arch/sandpoint/sandpoint: flash_cfi.c Log Message: sandpoint: Use config_detach_children to reduce error branch bugs. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sys/arch/sandpoint/sandpoint/flash_cfi.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/sandpoint/sandpoint/flash_cfi.c diff -u src/sys/arch/sandpoint/sandpoint/flash_cfi.c:1.4 src/sys/arch/sandpoint/sandpoint/flash_cfi.c:1.5 --- src/sys/arch/sandpoint/sandpoint/flash_cfi.c:1.4 Mon Sep 7 23:00:08 2015 +++ src/sys/arch/sandpoint/sandpoint/flash_cfi.c Wed May 10 00:08:14 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: flash_cfi.c,v 1.4 2015/09/07 23:00:08 phx Exp $ */ +/* $NetBSD: flash_cfi.c,v 1.5 2023/05/10 00:08:14 riastradh Exp $ */ /*- * Copyright (c) 2011 Frank Wille. @@ -32,7 +32,7 @@ * NOR CFI driver support for sandpoint */ #include -__KERNEL_RCSID(0, "$NetBSD: flash_cfi.c,v 1.4 2015/09/07 23:00:08 phx Exp $"); +__KERNEL_RCSID(0, "$NetBSD: flash_cfi.c,v 1.5 2023/05/10 00:08:14 riastradh Exp $"); #include #include @@ -158,16 +158,15 @@ sandpointcfi_attach(device_t parent, dev static int sandpointcfi_detach(device_t self, int flags) { - struct sandpointcfi_softc *sc; - int rv; + struct sandpointcfi_softc *sc device_private(self); + int error; - pmf_device_deregister(self); - sc = device_private(self); - rv = 0; + error = config_detach_children(self, flags); + if (error) + return error; - if (sc->sc_nordev != NULL) - rv = config_detach(sc->sc_nordev, flags); + pmf_device_deregister(self); bus_space_unmap(sc->sc_cfi.cfi_bst, sc->sc_cfi.cfi_bsh, sc->sc_size); - return rv; + return 0; }
CVS commit: src/sys/arch/sandpoint/sandpoint
Module Name:src Committed By: riastradh Date: Wed May 10 00:08:14 UTC 2023 Modified Files: src/sys/arch/sandpoint/sandpoint: flash_cfi.c Log Message: sandpoint: Use config_detach_children to reduce error branch bugs. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sys/arch/sandpoint/sandpoint/flash_cfi.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Re: CVS commit: src/sys/arch/sandpoint/sandpoint
David Young wrote: You should be able to detach it so that you know that the driver can return the hardware to initial conditions, and so that in a modular universe you can unload the old driver software and load new. Ok, you're right. I forgot about the modules. I have reverted my changes. -- Frank Wille
Re: CVS commit: src/sys/arch/sandpoint/sandpoint
On Mon, 23 Jan 2012 18:52:11 -0600 David Young dyo...@pobox.com wrote: Log Message: A detach function for the onboard flash probably makes no sense, so remove it. Sure it makes sense. Hmm... how do you detach it? With drvctl(8)? Why should you do that? Has it been tested, though? The detach function? No. Regards, -- Frank Wille
Re: CVS commit: src/sys/arch/sandpoint/sandpoint
On Tue, Jan 24, 2012 at 12:10:07PM +0100, Frank Wille wrote: On Mon, 23 Jan 2012 18:52:11 -0600 David Young dyo...@pobox.com wrote: Log Message: A detach function for the onboard flash probably makes no sense, so remove it. Sure it makes sense. Hmm... how do you detach it? With drvctl(8)? Why should you do that? drvctl -d device You should be able to detach it so that you know that the driver can return the hardware to initial conditions, and so that in a modular universe you can unload the old driver software and load new. Dave -- David Young dyo...@pobox.comUrbana, IL(217) 721-9981
Re: CVS commit: src/sys/arch/sandpoint/sandpoint
On Tue, Jan 24, 2012 at 09:07:47PM +0100, Frank Wille wrote: A detach function for the onboard flash probably makes no sense, so remove it. Sure it makes sense. Hmm... how do you detach it? With drvctl(8)? Why should you do that? Power consumption comes to mind... I doubt that detaching the driver will change power consumption a lot. And I cannot remove the NOR flash chip from the mainboard. ;) It does if you have to detach the driver to power the thing off. Then again, I'm making this up as I go along as I have no idea what power management for flash actually looks like. -- David A. Holland dholl...@netbsd.org
Re: CVS commit: src/sys/arch/sandpoint/sandpoint
On Mon, Jan 23, 2012 at 03:16:38PM +, Frank Wille wrote: Module Name: src Committed By: phx Date: Mon Jan 23 15:16:38 UTC 2012 Modified Files: src/sys/arch/sandpoint/sandpoint: flash_cfi.c Log Message: A detach function for the onboard flash probably makes no sense, so remove it. Sure it makes sense. Has it been tested, though? Dave -- David Young dyo...@pobox.comUrbana, IL(217) 721-9981