Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src-draft/trunk]: src/sys/dev/pci Defer rest of config after cprng functions...
details: https://anonhg.NetBSD.org/src-all/rev/042ed59083fb
branches: trunk
changeset: 370816:042ed59083fb
user: Nathanial Sloss <nat%netbsd.org@localhost>
date: Wed May 13 12:09:40 2020 +1000
description:
Defer rest of config after cprng functions have been initialized.
diffstat:
sys/dev/pci/if_iwn.c | 70 ++++++++++++++++++++++++++++++++++-----------------
1 files changed, 47 insertions(+), 23 deletions(-)
diffs (119 lines):
diff -r 0ba292df67b4 -r 042ed59083fb sys/dev/pci/if_iwn.c
--- a/sys/dev/pci/if_iwn.c Wed May 13 12:08:53 2020 +1000
+++ b/sys/dev/pci/if_iwn.c Wed May 13 12:09:40 2020 +1000
@@ -205,6 +205,7 @@
static int iwn_match(device_t , struct cfdata *, void *);
static void iwn_attach(device_t , device_t , void *);
+static int iwn_config_complete(device_t);
static int iwn4965_attach(struct iwn_softc *, pci_product_id_t);
static int iwn5000_attach(struct iwn_softc *, pci_product_id_t);
//static void iwn_radiotap_attach(struct iwn_softc *);
@@ -452,7 +453,6 @@
iwn_attach(device_t parent __unused, device_t self, void *aux)
{
struct iwn_softc *sc = device_private(self);
- struct ieee80211com *ic = &sc->sc_ic;
struct pci_attach_args *pa = aux;
const char *intrstr;
pcireg_t memtype, reg;
@@ -618,6 +618,46 @@
((sc->rxchainmask >> 2) & 1) +
((sc->rxchainmask >> 1) & 1) +
((sc->rxchainmask >> 0) & 1);
+
+ if (config_finalize_register(self, iwn_config_complete)) {
+ aprint_error_dev(self,
+ "Falied to register config finalize");
+ goto fail4;
+ }
+
+ return;
+
+ /* Free allocated memory if something failed during attachment. */
+//fail5: iwn_free_rx_ring(sc, &sc->rxq);
+fail4: while (--i >= 0)
+ iwn_free_tx_ring(sc, &sc->txq[i]);
+#ifdef IWN_USE_RBUF
+ iwn_free_rpool(sc);
+#endif
+ iwn_free_sched(sc);
+fail3: if (sc->ict != NULL)
+ iwn_free_ict(sc);
+fail2: iwn_free_kw(sc);
+fail1: iwn_free_fwmem(sc);
+failih: pci_intr_disestablish(sc->sc_pct, sc->sc_ih);
+ sc->sc_ih = NULL;
+failia: pci_intr_release(sc->sc_pct, sc->sc_pihp, 1);
+ sc->sc_pihp = NULL;
+failsi: softint_disestablish(sc->sc_soft_ih);
+ sc->sc_soft_ih = NULL;
+unmap: bus_space_unmap(sc->sc_st, sc->sc_sh, sc->sc_sz);
+
+}
+
+static int
+iwn_config_complete(device_t self)
+{
+ struct iwn_softc *sc = device_private(self);
+ struct ieee80211com *ic = &sc->sc_ic;
+
+ if (ic->ic_name != NULL && strcmp("iwn", ic->ic_name) == 0)
+ return 0;
+
aprint_normal_dev(self, "MIMO %dT%dR, %.4s, address %s\n",
sc->ntxchains, sc->nrxchains, sc->eeprom_domain,
ether_sprintf(ic->ic_macaddr));
@@ -711,9 +751,9 @@
ic->ic_ampdu_tx_stop = iwn_ampdu_tx_stop;
#endif
+#if 0
/* XXX media locking needs revisiting */
mutex_init(&sc->sc_media_mtx, MUTEX_DEFAULT, IPL_SOFTNET);
-#if 0
ieee80211_media_init_with_lock(ic,
iwn_media_change, ieee80211_media_status, &sc->sc_media_mtx);
#endif
@@ -735,36 +775,20 @@
if (vap == NULL) {
/* Didn't work ... now what! */
printf ("NNN vap_create didn't work ...\n");
+ return 0;
}
if (pmf_device_register(self, NULL, iwn_resume))
pmf_class_network_register(self, vap->iv_ifp);
- else
+ else {
aprint_error_dev(self, "couldn't establish power handler\n");
+ return 0;
+ }
ieee80211_announce(ic);
- return;
-
- /* Free allocated memory if something failed during attachment. */
-fail4: while (--i >= 0)
- iwn_free_tx_ring(sc, &sc->txq[i]);
-#ifdef IWN_USE_RBUF
- iwn_free_rpool(sc);
-#endif
- iwn_free_sched(sc);
-fail3: if (sc->ict != NULL)
- iwn_free_ict(sc);
-fail2: iwn_free_kw(sc);
-fail1: iwn_free_fwmem(sc);
-failih: pci_intr_disestablish(sc->sc_pct, sc->sc_ih);
- sc->sc_ih = NULL;
-failia: pci_intr_release(sc->sc_pct, sc->sc_pihp, 1);
- sc->sc_pihp = NULL;
-failsi: softint_disestablish(sc->sc_soft_ih);
- sc->sc_soft_ih = NULL;
-unmap: bus_space_unmap(sc->sc_st, sc->sc_sh, sc->sc_sz);
+ return 0;
}
static void
Home |
Main Index |
Thread Index |
Old Index