Module Name: src Committed By: dyoung Date: Thu Mar 4 22:57:37 UTC 2010
Modified Files: src/sys/dev/pci: if_rtw_pci.c Log Message: Make cosmetic changes in order to reduce differences with sys/dev/cardbus/if_rtw_cardbus.c: remove an unnecessary #include. Change a few cut & paste instances of ADM8211 to RTL8180. Make the suspend & resume functions static, add declarations for them at the top of the file, and move the functions themselves to the bottom. To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 src/sys/dev/pci/if_rtw_pci.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/dev/pci/if_rtw_pci.c diff -u src/sys/dev/pci/if_rtw_pci.c:1.17 src/sys/dev/pci/if_rtw_pci.c:1.18 --- src/sys/dev/pci/if_rtw_pci.c:1.17 Wed Feb 24 22:38:00 2010 +++ src/sys/dev/pci/if_rtw_pci.c Thu Mar 4 22:57:37 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: if_rtw_pci.c,v 1.17 2010/02/24 22:38:00 dyoung Exp $ */ +/* $NetBSD: if_rtw_pci.c,v 1.18 2010/03/04 22:57:37 dyoung Exp $ */ /*- * Copyright (c) 1998, 1999, 2000, 2002 The NetBSD Foundation, Inc. @@ -39,7 +39,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: if_rtw_pci.c,v 1.17 2010/02/24 22:38:00 dyoung Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_rtw_pci.c,v 1.18 2010/03/04 22:57:37 dyoung Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -66,7 +66,6 @@ #include <sys/intr.h> #include <dev/ic/rtwreg.h> -#include <dev/ic/sa2400reg.h> #include <dev/ic/rtwvar.h> #include <dev/pci/pcivar.h> @@ -74,13 +73,13 @@ #include <dev/pci/pcidevs.h> /* - * PCI configuration space registers used by the ADM8211. + * PCI configuration space registers used by the RTL8180. */ #define RTW_PCI_IOBA 0x10 /* i/o mapped base */ #define RTW_PCI_MMBA 0x14 /* memory mapped base */ struct rtw_pci_softc { - struct rtw_softc psc_rtw; /* real ADM8211 softc */ + struct rtw_softc psc_rtw; /* real RTL8180 softc */ pci_intr_handle_t psc_ih; /* interrupt handle */ void *psc_intrcookie; @@ -96,6 +95,9 @@ CFATTACH_DECL_NEW(rtw_pci, sizeof(struct rtw_pci_softc), rtw_pci_match, rtw_pci_attach, rtw_pci_detach, NULL); +static bool rtw_pci_resume(device_t, const pmf_qual_t *); +static bool rtw_pci_suspend(device_t, const pmf_qual_t *); + static const struct rtw_pci_product { u_int32_t app_vendor; /* PCI vendor ID */ u_int32_t app_product; /* PCI product ID */ @@ -135,37 +137,6 @@ return (0); } -static bool -rtw_pci_resume(device_t self, const pmf_qual_t *qual) -{ - struct rtw_pci_softc *psc = device_private(self); - struct rtw_softc *sc = &psc->psc_rtw; - - /* Establish the interrupt. */ - psc->psc_intrcookie = pci_intr_establish(psc->psc_pc, psc->psc_ih, - IPL_NET, rtw_intr, sc); - if (psc->psc_intrcookie == NULL) { - aprint_error_dev(sc->sc_dev, "unable to establish interrupt\n"); - return false; - } - - return rtw_resume(self, qual); -} - -static bool -rtw_pci_suspend(device_t self, const pmf_qual_t *qual) -{ - struct rtw_pci_softc *psc = device_private(self); - - if (!rtw_suspend(self, qual)) - return false; - - /* Unhook the interrupt handler. */ - pci_intr_disestablish(psc->psc_pc, psc->psc_intrcookie); - psc->psc_intrcookie = NULL; - return true; -} - static void rtw_pci_attach(device_t parent, device_t self, void *aux) { @@ -278,3 +249,34 @@ return 0; } + +static bool +rtw_pci_resume(device_t self, const pmf_qual_t *qual) +{ + struct rtw_pci_softc *psc = device_private(self); + struct rtw_softc *sc = &psc->psc_rtw; + + /* Establish the interrupt. */ + psc->psc_intrcookie = pci_intr_establish(psc->psc_pc, psc->psc_ih, + IPL_NET, rtw_intr, sc); + if (psc->psc_intrcookie == NULL) { + aprint_error_dev(sc->sc_dev, "unable to establish interrupt\n"); + return false; + } + + return rtw_resume(self, qual); +} + +static bool +rtw_pci_suspend(device_t self, const pmf_qual_t *qual) +{ + struct rtw_pci_softc *psc = device_private(self); + + if (!rtw_suspend(self, qual)) + return false; + + /* Unhook the interrupt handler. */ + pci_intr_disestablish(psc->psc_pc, psc->psc_intrcookie); + psc->psc_intrcookie = NULL; + return true; +}