Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev Call pmf_device_register(9) in ahc_attahc() rather t...
details: https://anonhg.NetBSD.org/src/rev/9da7e1467d97
branches: trunk
changeset: 747098:9da7e1467d97
user: tsutsui <tsutsui%NetBSD.org@localhost>
date: Wed Sep 02 11:10:37 2009 +0000
description:
Call pmf_device_register(9) in ahc_attahc() rather than ahc_pci_attach()
since pmf_device_deregister(9) is called from ahc_detach() so that
cardbus backend also gets proper pmf(9) calls.
PCI backend is tested on on O2, but cardbus is untested.
diffstat:
sys/dev/ic/aic7xxx_osm.c | 39 +++++++++++++++++++++++++++++++++++++--
sys/dev/pci/ahc_pci.c | 37 ++-----------------------------------
2 files changed, 39 insertions(+), 37 deletions(-)
diffs (147 lines):
diff -r 8e73610d5769 -r 9da7e1467d97 sys/dev/ic/aic7xxx_osm.c
--- a/sys/dev/ic/aic7xxx_osm.c Wed Sep 02 10:54:20 2009 +0000
+++ b/sys/dev/ic/aic7xxx_osm.c Wed Sep 02 11:10:37 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: aic7xxx_osm.c,v 1.31 2009/05/16 06:44:05 tsutsui Exp $ */
+/* $NetBSD: aic7xxx_osm.c,v 1.32 2009/09/02 11:10:37 tsutsui Exp $ */
/*
* Bus independent FreeBSD shim for the aic7xxx based adaptec SCSI controllers
@@ -39,7 +39,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: aic7xxx_osm.c,v 1.31 2009/05/16 06:44:05 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: aic7xxx_osm.c,v 1.32 2009/09/02 11:10:37 tsutsui Exp $");
#include <dev/ic/aic7xxx_osm.h>
#include <dev/ic/aic7xxx_inline.h>
@@ -58,6 +58,8 @@
static int ahc_ioctl(struct scsipi_channel *channel, u_long cmd,
void *addr, int flag, struct proc *p);
+static bool ahc_pmf_suspend(device_t PMF_FN_PROTO);
+static bool ahc_pmf_resume(device_t PMF_FN_PROTO);
/*
@@ -124,11 +126,44 @@
if ((ahc->features & AHC_TWIN) && ahc->flags & AHC_RESET_BUS_B)
ahc_reset_channel(ahc, 'B', TRUE);
+ if (!pmf_device_register(ahc->sc_dev, ahc_pmf_suspend, ahc_pmf_resume))
+ aprint_error_dev(ahc->sc_dev,
+ "couldn't establish power handler\n");
+
ahc_unlock(ahc, &s);
return (1);
}
/*
+ * XXX we should call the real suspend and resume functions here
+ * but for some reason ahc_suspend() panics on shutdown
+ */
+
+static bool
+ahc_pmf_suspend(device_t dev PMF_FN_ARGS)
+{
+ struct ahc_softc *sc = device_private(dev);
+#if 0
+ return (ahc_suspend(sc) == 0);
+#else
+ ahc_shutdown(sc);
+ return true;
+#endif
+}
+
+static bool
+ahc_pmf_resume(device_t dev PMF_FN_ARGS)
+{
+#if 0
+ struct ahc_softc *sc = device_private(dev);
+
+ return (ahc_resume(sc) == 0);
+#else
+ return true;
+#endif
+}
+
+/*
* Catch an interrupt from the adapter
*/
void
diff -r 8e73610d5769 -r 9da7e1467d97 sys/dev/pci/ahc_pci.c
--- a/sys/dev/pci/ahc_pci.c Wed Sep 02 10:54:20 2009 +0000
+++ b/sys/dev/pci/ahc_pci.c Wed Sep 02 11:10:37 2009 +0000
@@ -39,7 +39,7 @@
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGES.
*
- * $Id: ahc_pci.c,v 1.66 2009/05/06 09:25:14 cegger Exp $
+ * $Id: ahc_pci.c,v 1.67 2009/09/02 11:10:37 tsutsui Exp $
*
* //depot/aic7xxx/aic7xxx/aic7xxx_pci.c#57 $
*
@@ -50,7 +50,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ahc_pci.c,v 1.66 2009/05/06 09:25:14 cegger Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ahc_pci.c,v 1.67 2009/09/02 11:10:37 tsutsui Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -709,9 +709,6 @@
static void ahc_pci_intr(struct ahc_softc *);
-static bool ahc_pci_suspend(device_t PMF_FN_PROTO);
-static bool ahc_pci_resume(device_t PMF_FN_PROTO);
-
static const struct ahc_pci_identity *
ahc_find_pci_device(pcireg_t id, pcireg_t subid, u_int func)
{
@@ -1102,7 +1099,6 @@
if (ahc_init(ahc))
goto error_out;
- pmf_device_register(self, ahc_pci_suspend, ahc_pci_resume);
ahc_attach(ahc);
return;
@@ -1112,35 +1108,6 @@
return;
}
-/*
- * XXX we should call the real suspend and resume functions here
- * but for some reason ahc_suspend() panics on shutdown
- */
-
-static bool
-ahc_pci_suspend(device_t dev PMF_FN_ARGS)
-{
- struct ahc_softc *sc = device_private(dev);
-#if 0
- return (ahc_suspend(sc) == 0);
-#else
- ahc_shutdown(sc);
- return true;
-#endif
-}
-
-static bool
-ahc_pci_resume(device_t dev PMF_FN_ARGS)
-{
-#if 0
- struct ahc_softc *sc = device_private(dev);
-
- return (ahc_resume(sc) == 0);
-#else
- return true;
-#endif
-}
-
CFATTACH_DECL_NEW(ahc_pci, sizeof(struct ahc_softc),
ahc_pci_probe, ahc_pci_attach, NULL, NULL);
Home |
Main Index |
Thread Index |
Old Index