iwm: Call iwm_dev_check() earlier in iwm_attach().

This ensures that the driver softc reflects device capabilities as early
as possible, for use by device initialization code that is conditional
on certain capabilities.

MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
This commit is contained in:
Mark Johnston 2019-11-07 23:29:43 +00:00
parent eff8a9793e
commit 3cc50d22fd

View File

@ -5743,8 +5743,6 @@ iwm_pci_detach(device_t dev)
rman_get_rid(sc->sc_mem), sc->sc_mem); rman_get_rid(sc->sc_mem), sc->sc_mem);
} }
static int static int
iwm_attach(device_t dev) iwm_attach(device_t dev)
{ {
@ -5761,6 +5759,10 @@ iwm_attach(device_t dev)
callout_init_mtx(&sc->sc_led_blink_to, &sc->sc_mtx, 0); callout_init_mtx(&sc->sc_led_blink_to, &sc->sc_mtx, 0);
TASK_INIT(&sc->sc_es_task, 0, iwm_endscan_cb, sc); TASK_INIT(&sc->sc_es_task, 0, iwm_endscan_cb, sc);
error = iwm_dev_check(dev);
if (error != 0)
goto fail;
sc->sc_notif_wait = iwm_notification_wait_init(sc); sc->sc_notif_wait = iwm_notification_wait_init(sc);
if (sc->sc_notif_wait == NULL) { if (sc->sc_notif_wait == NULL) {
device_printf(dev, "failed to init notification wait struct\n"); device_printf(dev, "failed to init notification wait struct\n");
@ -5786,11 +5788,6 @@ iwm_attach(device_t dev)
sc->sc_wantresp = -1; sc->sc_wantresp = -1;
/* Match device id */
error = iwm_dev_check(dev);
if (error != 0)
goto fail;
sc->sc_hw_rev = IWM_READ(sc, IWM_CSR_HW_REV); sc->sc_hw_rev = IWM_READ(sc, IWM_CSR_HW_REV);
/* /*
* In the 8000 HW family the format of the 4 bytes of CSR_HW_REV have * In the 8000 HW family the format of the 4 bytes of CSR_HW_REV have