diff options
| author | dyoung <dyoung@NetBSD.org> | 2010-03-04 22:57:37 +0000 |
|---|---|---|
| committer | dyoung <dyoung@NetBSD.org> | 2010-03-04 22:57:37 +0000 |
| commit | 797e51d63e5f67dede6a3d6733e5a2f49e1f8c0f (patch) | |
| tree | 4028f8bd09a0847508d98b8fab365ad82c66a310 /sys/dev | |
| parent | 5980434120f9236a8da8ae7c79a4cb5889269fe7 (diff) | |
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.
Diffstat (limited to 'sys/dev')
| -rw-r--r-- | sys/dev/pci/if_rtw_pci.c | 74 |
1 files changed, 38 insertions, 36 deletions
diff --git a/sys/dev/pci/if_rtw_pci.c b/sys/dev/pci/if_rtw_pci.c index 80e3da28677..a8d0e813e5a 100644 --- a/sys/dev/pci/if_rtw_pci.c +++ b/sys/dev/pci/if_rtw_pci.c @@ -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 @@ __KERNEL_RCSID(0, "$NetBSD: if_rtw_pci.c,v 1.17 2010/02/24 22:38:00 dyoung Exp $ #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 @@ __KERNEL_RCSID(0, "$NetBSD: if_rtw_pci.c,v 1.17 2010/02/24 22:38:00 dyoung Exp $ #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 @@ static int rtw_pci_detach(device_t, int); 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 @@ rtw_pci_match(device_t parent, cfdata_t match, void *aux) 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 @@ rtw_pci_detach(device_t self, int flags) 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; +} |
