svn commit: r354494 - head/sys/dev/iwm
Mark Johnston
markj at FreeBSD.org
Thu Nov 7 23:29:26 UTC 2019
Author: markj
Date: Thu Nov 7 23:29:25 2019
New Revision: 354494
URL: https://svnweb.freebsd.org/changeset/base/354494
Log:
iwm: Simplify fw_has_{api,capa}().
No functional change intended.
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Modified:
head/sys/dev/iwm/if_iwm.c
head/sys/dev/iwm/if_iwm_scan.c
head/sys/dev/iwm/if_iwmvar.h
Modified: head/sys/dev/iwm/if_iwm.c
==============================================================================
--- head/sys/dev/iwm/if_iwm.c Thu Nov 7 23:29:00 2019 (r354493)
+++ head/sys/dev/iwm/if_iwm.c Thu Nov 7 23:29:25 2019 (r354494)
@@ -4442,8 +4442,7 @@ static boolean_t
iwm_mvm_is_lar_supported(struct iwm_softc *sc)
{
boolean_t nvm_lar = sc->nvm_data->lar_enabled;
- boolean_t tlv_lar = fw_has_capa(&sc->sc_fw.ucode_capa,
- IWM_UCODE_TLV_CAPA_LAR_SUPPORT);
+ boolean_t tlv_lar = iwm_fw_has_capa(sc, IWM_UCODE_TLV_CAPA_LAR_SUPPORT);
if (iwm_lar_disable)
return FALSE;
@@ -4461,10 +4460,8 @@ iwm_mvm_is_lar_supported(struct iwm_softc *sc)
static boolean_t
iwm_mvm_is_wifi_mcc_supported(struct iwm_softc *sc)
{
- return fw_has_api(&sc->sc_fw.ucode_capa,
- IWM_UCODE_TLV_API_WIFI_MCC_UPDATE) ||
- fw_has_capa(&sc->sc_fw.ucode_capa,
- IWM_UCODE_TLV_CAPA_LAR_MULTI_MCC);
+ return iwm_fw_has_api(sc, IWM_UCODE_TLV_API_WIFI_MCC_UPDATE) ||
+ iwm_fw_has_capa(sc, IWM_UCODE_TLV_CAPA_LAR_MULTI_MCC);
}
static int
@@ -4484,8 +4481,7 @@ iwm_send_update_mcc_cmd(struct iwm_softc *sc, const ch
int n_channels;
uint16_t mcc;
#endif
- int resp_v2 = fw_has_capa(&sc->sc_fw.ucode_capa,
- IWM_UCODE_TLV_CAPA_LAR_SUPPORT_V2);
+ int resp_v2 = iwm_fw_has_capa(sc, IWM_UCODE_TLV_CAPA_LAR_SUPPORT_V2);
if (!iwm_mvm_is_lar_supported(sc)) {
IWM_DPRINTF(sc, IWM_DEBUG_LAR, "%s: no LAR support\n",
@@ -4646,7 +4642,7 @@ iwm_init_hw(struct iwm_softc *sc)
if ((error = iwm_send_update_mcc_cmd(sc, "ZZ")) != 0)
goto error;
- if (fw_has_capa(&sc->sc_fw.ucode_capa, IWM_UCODE_TLV_CAPA_UMAC_SCAN)) {
+ if (iwm_fw_has_capa(sc, IWM_UCODE_TLV_CAPA_UMAC_SCAN)) {
if ((error = iwm_mvm_config_umac_scan(sc)) != 0)
goto error;
}
@@ -6183,7 +6179,7 @@ iwm_scan_start(struct ieee80211com *ic)
device_printf(sc->sc_dev,
"%s: Previous scan not completed yet\n", __func__);
}
- if (fw_has_capa(&sc->sc_fw.ucode_capa, IWM_UCODE_TLV_CAPA_UMAC_SCAN))
+ if (iwm_fw_has_capa(sc, IWM_UCODE_TLV_CAPA_UMAC_SCAN))
error = iwm_mvm_umac_scan(sc);
else
error = iwm_mvm_lmac_scan(sc);
Modified: head/sys/dev/iwm/if_iwm_scan.c
==============================================================================
--- head/sys/dev/iwm/if_iwm_scan.c Thu Nov 7 23:29:00 2019 (r354493)
+++ head/sys/dev/iwm/if_iwm_scan.c Thu Nov 7 23:29:25 2019 (r354494)
@@ -215,8 +215,7 @@ static inline boolean_t
iwm_mvm_rrm_scan_needed(struct iwm_softc *sc)
{
/* require rrm scan whenever the fw supports it */
- return fw_has_capa(&sc->sc_fw.ucode_capa,
- IWM_UCODE_TLV_CAPA_DS_PARAM_SET_IE_SUPPORT);
+ return iwm_fw_has_capa(sc, IWM_UCODE_TLV_CAPA_DS_PARAM_SET_IE_SUPPORT);
}
#ifdef IWM_DEBUG
@@ -251,7 +250,7 @@ iwm_mvm_rx_lmac_scan_complete_notif(struct iwm_softc *
/* If this happens, the firmware has mistakenly sent an LMAC
* notification during UMAC scans -- warn and ignore it.
*/
- if (fw_has_capa(&sc->sc_fw.ucode_capa, IWM_UCODE_TLV_CAPA_UMAC_SCAN)) {
+ if (iwm_fw_has_capa(sc, IWM_UCODE_TLV_CAPA_UMAC_SCAN)) {
device_printf(sc->sc_dev,
"%s: Mistakenly got LMAC notification during UMAC scan\n",
__func__);
@@ -866,7 +865,7 @@ iwm_mvm_scan_stop_wait(struct iwm_softc *sc)
IWM_DPRINTF(sc, IWM_DEBUG_SCAN, "Preparing to stop scan\n");
- if (fw_has_capa(&sc->sc_fw.ucode_capa, IWM_UCODE_TLV_CAPA_UMAC_SCAN))
+ if (iwm_fw_has_capa(sc, IWM_UCODE_TLV_CAPA_UMAC_SCAN))
ret = iwm_mvm_umac_scan_abort(sc);
else
ret = iwm_mvm_lmac_scan_abort(sc);
Modified: head/sys/dev/iwm/if_iwmvar.h
==============================================================================
--- head/sys/dev/iwm/if_iwmvar.h Thu Nov 7 23:29:00 2019 (r354493)
+++ head/sys/dev/iwm/if_iwmvar.h Thu Nov 7 23:29:25 2019 (r354494)
@@ -165,20 +165,6 @@ struct iwm_ucode_capabilities {
uint8_t enabled_capa[howmany(IWM_NUM_UCODE_TLV_CAPA, NBBY)];
};
-static inline int
-fw_has_api(const struct iwm_ucode_capabilities *capabilities,
- unsigned int api)
-{
- return isset(capabilities->enabled_api, api);
-}
-
-static inline int
-fw_has_capa(const struct iwm_ucode_capabilities *capabilities,
- unsigned int capa)
-{
- return isset(capabilities->enabled_capa, capa);
-}
-
/* one for each uCode image (inst/data, init/runtime/wowlan) */
struct iwm_fw_desc {
const void *data; /* vmalloc'ed data */
@@ -576,3 +562,15 @@ struct iwm_softc {
#define IWM_LOCK(_sc) mtx_lock(&(_sc)->sc_mtx)
#define IWM_UNLOCK(_sc) mtx_unlock(&(_sc)->sc_mtx)
#define IWM_LOCK_DESTROY(_sc) mtx_destroy(&(_sc)->sc_mtx)
+
+static inline bool
+iwm_fw_has_api(struct iwm_softc *sc, unsigned int api)
+{
+ return isset(sc->sc_fw.ucode_capa.enabled_api, api);
+}
+
+static inline bool
+iwm_fw_has_capa(struct iwm_softc *sc, unsigned int capa)
+{
+ return isset(sc->sc_fw.ucode_capa.enabled_capa, capa);
+}
More information about the svn-src-head
mailing list