Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-8]: src/sys/dev Pull up following revision(s) (requested by maya ...
details: https://anonhg.NetBSD.org/src/rev/a63c45da847f
branches: netbsd-8
changeset: 434164:a63c45da847f
user: snj <snj%NetBSD.org@localhost>
date: Tue Aug 01 23:10:00 2017 +0000
description:
Pull up following revision(s) (requested by maya in ticket #162):
sys/dev/pci/if_ral_pci.c: revision 1.24
sys/dev/ic/rt2860.c: revision 1.28
sys/dev/ic/rt2860var.h: revision 1.5
enable rt2860 power management code
adjust to fit netbsd:
make suspend,resume functions match desired pmf* prototypes
remove wakeup/activate wrapper functions
avoid jumping to NULL on resume by initializing if_stop
the problem machine has other issues on resume, so there might be further
issues, but it's an improvement over a jump to NULL.
tested by Riccardo Mottola
diffstat:
sys/dev/ic/rt2860.c | 30 ++++++++++++++++--------
sys/dev/ic/rt2860var.h | 4 +--
sys/dev/pci/if_ral_pci.c | 60 ++---------------------------------------------
3 files changed, 24 insertions(+), 70 deletions(-)
diffs (211 lines):
diff -r fb8bf3b58106 -r a63c45da847f sys/dev/ic/rt2860.c
--- a/sys/dev/ic/rt2860.c Wed Jul 26 07:40:01 2017 +0000
+++ b/sys/dev/ic/rt2860.c Tue Aug 01 23:10:00 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rt2860.c,v 1.26.2.1 2017/07/25 02:08:31 snj Exp $ */
+/* $NetBSD: rt2860.c,v 1.26.2.2 2017/08/01 23:10:00 snj Exp $ */
/* $OpenBSD: rt2860.c,v 1.90 2016/04/13 10:49:26 mpi Exp $ */
/* $FreeBSD: head/sys/dev/ral/rt2860.c 306591 2016-10-02 20:35:55Z avos $ */
@@ -25,7 +25,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rt2860.c,v 1.26.2.1 2017/07/25 02:08:31 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rt2860.c,v 1.26.2.2 2017/08/01 23:10:00 snj Exp $");
#include <sys/param.h>
#include <sys/sockio.h>
@@ -74,6 +74,8 @@
#define MAXQS 6 /* Tx (4 EDCAs + HCCA + Mgt) and Rx rings */
static void rt2860_attachhook(device_t);
+static bool rt2860_suspend(device_t self, const pmf_qual_t *qual);
+static bool rt2860_wakeup(device_t self, const pmf_qual_t *qual);
static int rt2860_alloc_tx_ring(struct rt2860_softc *,
struct rt2860_tx_ring *);
static void rt2860_reset_tx_ring(struct rt2860_softc *,
@@ -394,6 +396,7 @@
ifp->if_init = rt2860_init;
ifp->if_ioctl = rt2860_ioctl;
ifp->if_start = rt2860_start;
+ ifp->if_stop = rt2860_stop;
ifp->if_watchdog = rt2860_watchdog;
IFQ_SET_READY(&ifp->if_snd);
memcpy(ifp->if_xname, device_xname(sc->sc_dev), IFNAMSIZ);
@@ -434,7 +437,7 @@
ieee80211_announce(ic);
- if (pmf_device_register(sc->sc_dev, NULL, NULL))
+ if (pmf_device_register(sc->sc_dev, rt2860_wakeup, rt2860_suspend))
pmf_class_network_register(sc->sc_dev, ifp);
else
aprint_error_dev(sc->sc_dev,
@@ -471,24 +474,31 @@
return 0;
}
-void
-rt2860_suspend(void *xsc)
+static bool
+rt2860_suspend(device_t self, const pmf_qual_t *qual)
{
- struct rt2860_softc *sc = xsc;
+ struct rt2860_softc *sc = device_private(self);
struct ifnet *ifp = &sc->sc_if;
if (ifp->if_flags & IFF_RUNNING)
rt2860_stop(ifp, 1);
+
+ return true;
}
-void
-rt2860_wakeup(void *xsc)
+static bool
+rt2860_wakeup(device_t self, const pmf_qual_t *qual)
{
- struct rt2860_softc *sc = xsc;
+ struct rt2860_softc *sc = device_private(self);
struct ifnet *ifp = &sc->sc_if;
-
+ int s;
+
+ s = splnet();
if (ifp->if_flags & IFF_UP)
rt2860_init(ifp);
+ splx(s);
+
+ return true;
}
static int
diff -r fb8bf3b58106 -r a63c45da847f sys/dev/ic/rt2860var.h
--- a/sys/dev/ic/rt2860var.h Wed Jul 26 07:40:01 2017 +0000
+++ b/sys/dev/ic/rt2860var.h Tue Aug 01 23:10:00 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rt2860var.h,v 1.4 2017/02/02 10:05:35 nonaka Exp $ */
+/* $NetBSD: rt2860var.h,v 1.4.6.1 2017/08/01 23:10:00 snj Exp $ */
/* $OpenBSD: rt2860var.h,v 1.23 2016/03/21 21:16:30 stsp Exp $ */
/*-
@@ -212,6 +212,4 @@
int rt2860_attach(void *, int);
int rt2860_detach(void *);
-void rt2860_suspend(void *);
-void rt2860_wakeup(void *);
int rt2860_intr(void *);
diff -r fb8bf3b58106 -r a63c45da847f sys/dev/pci/if_ral_pci.c
--- a/sys/dev/pci/if_ral_pci.c Wed Jul 26 07:40:01 2017 +0000
+++ b/sys/dev/pci/if_ral_pci.c Tue Aug 01 23:10:00 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_ral_pci.c,v 1.23 2016/07/06 14:28:51 christos Exp $ */
+/* $NetBSD: if_ral_pci.c,v 1.23.10.1 2017/08/01 23:10:00 snj Exp $ */
/* $OpenBSD: if_ral_pci.c,v 1.24 2015/11/24 17:11:39 mpi Exp $ */
/*-
@@ -21,7 +21,7 @@
* PCI front-end for the Ralink RT2560/RT2561/RT2860/RT3090 driver.
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_ral_pci.c,v 1.23 2016/07/06 14:28:51 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ral_pci.c,v 1.23.10.1 2017/08/01 23:10:00 snj Exp $");
#include <sys/param.h>
@@ -56,42 +56,24 @@
#include <dev/pci/pcivar.h>
#include <dev/pci/pcidevs.h>
-#define RAL_POWER_MANAGEMENT 0 /* Disabled for now */
-
static struct ral_opns {
int (*attach)(void *, int);
int (*detach)(void *);
-#if RAL_POWER_MANAGEMENT
- void (*suspend)(void *);
- void (*wakeup)(void *);
-#endif
int (*intr)(void *);
} ral_rt2560_opns = {
rt2560_attach,
rt2560_detach,
-#if RAL_POWER_MANAGEMENT
- rt2560_suspend,
- rt2560_wakeup,
-#endif
rt2560_intr
}, ral_rt2661_opns = {
rt2661_attach,
rt2661_detach,
-#if RAL_POWER_MANAGEMENT
- rt2661_suspend,
- rt2661_wakeup,
-#endif
rt2661_intr
}, ral_rt2860_opns = {
rt2860_attach,
rt2860_detach,
-#if RAL_POWER_MANAGEMENT
- rt2860_suspend,
- rt2860_wakeup,
-#endif
rt2860_intr
};
@@ -116,15 +98,9 @@
int ral_pci_match(device_t, cfdata_t, void *);
void ral_pci_attach(device_t, device_t, void *);
int ral_pci_detach(device_t, int);
-#if RAL_POWER_MANAGEMENT
-int ral_pci_activate(struct device *, devact_t);
-void ral_pci_wakeup(struct ral_pci_softc *);
-#else
-#define ral_pci_activate NULL
-#endif
CFATTACH_DECL_NEW(ral_pci, sizeof (struct ral_pci_softc),
- ral_pci_match, ral_pci_attach, ral_pci_detach, ral_pci_activate);
+ ral_pci_match, ral_pci_attach, ral_pci_detach, NULL);
static const struct ral_pci_matchid {
pci_vendor_id_t ral_vendor;
@@ -276,33 +252,3 @@
return 0;
}
-
-#if RAL_POWER_MANAGEMENT
-int
-ral_pci_activate(struct device *self, devact_t act)
-{
- struct ral_pci_softc *psc = (struct ral_pci_softc *)self;
- struct rt2560_softc *sc = &psc->sc_sc;
-
- switch (act) {
- case DVACT_SUSPEND:
- (*psc->sc_opns->suspend)(sc);
- break;
- case DVACT_WAKEUP:
- ral_pci_wakeup(psc);
- break;
- }
- return 0;
-}
-
-void
-ral_pci_wakeup(struct ral_pci_softc *psc)
-{
- struct rt2560_softc *sc = &psc->sc_sc;
- int s;
-
- s = splnet();
- (*psc->sc_opns->wakeup)(sc);
- splx(s);
-}
-#endif
Home |
Main Index |
Thread Index |
Old Index