Author: markj
Date: Thu Nov  7 23:29:43 2019
New Revision: 354495
URL: https://svnweb.freebsd.org/changeset/base/354495

Log:
  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

Modified:
  head/sys/dev/iwm/if_iwm.c

Modified: head/sys/dev/iwm/if_iwm.c
==============================================================================
--- head/sys/dev/iwm/if_iwm.c   Thu Nov  7 23:29:25 2019        (r354494)
+++ head/sys/dev/iwm/if_iwm.c   Thu Nov  7 23:29:43 2019        (r354495)
@@ -5743,8 +5743,6 @@ iwm_pci_detach(device_t dev)
                    rman_get_rid(sc->sc_mem), sc->sc_mem);
 }
 
-
-
 static int
 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);
        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);
        if (sc->sc_notif_wait == NULL) {
                device_printf(dev, "failed to init notification wait struct\n");
@@ -5785,11 +5787,6 @@ iwm_attach(device_t dev)
                goto fail;
 
        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);
        /*
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to