Module Name:    src
Committed By:   nonaka
Date:           Fri Feb 13 18:02:32 UTC 2015

Modified Files:
        src/sys/dev/pci: if_iwm.c

Log Message:
Make some functions and variables static.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/pci/if_iwm.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/pci/if_iwm.c
diff -u src/sys/dev/pci/if_iwm.c:1.3 src/sys/dev/pci/if_iwm.c:1.4
--- src/sys/dev/pci/if_iwm.c:1.3	Fri Feb 13 17:40:13 2015
+++ src/sys/dev/pci/if_iwm.c	Fri Feb 13 18:02:32 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_iwm.c,v 1.3 2015/02/13 17:40:13 nonaka Exp $	*/
+/*	$NetBSD: if_iwm.c,v 1.4 2015/02/13 18:02:32 nonaka Exp $	*/
 /*	OpenBSD: if_iwm.c,v 1.18 2015/02/11 01:12:42 brad Exp	*/
 
 /*
@@ -105,7 +105,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_iwm.c,v 1.3 2015/02/13 17:40:13 nonaka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_iwm.c,v 1.4 2015/02/13 18:02:32 nonaka Exp $");
 
 #include <sys/param.h>
 #include <sys/conf.h>
@@ -163,7 +163,7 @@ int iwm_debug = 1;
 #include <dev/pci/if_iwmreg.h>
 #include <dev/pci/if_iwmvar.h>
 
-const uint8_t iwm_nvm_channels[] = {
+static const uint8_t iwm_nvm_channels[] = {
 	/* 2.4 GHz */
 	1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
 	/* 5 GHz */
@@ -176,7 +176,7 @@ const uint8_t iwm_nvm_channels[] = {
 /* It looks like 11a TX is broken, unfortunately. */
 #define IWM_NO_5GHZ		1
 
-const struct iwm_rate {
+static const struct iwm_rate {
 	uint8_t rate;
 	uint8_t plcp;
 } iwm_rates[] = {
@@ -207,210 +207,238 @@ struct iwm_newstate_state {
 	int ns_generation;
 };
 
-int	iwm_store_cscheme(struct iwm_softc *, uint8_t *, size_t);
-int	iwm_firmware_store_section(struct iwm_softc *, enum iwm_ucode_type,
-					uint8_t *, size_t);
-int	iwm_set_default_calib(struct iwm_softc *, const void *);
-int	iwm_read_firmware(struct iwm_softc *);
-uint32_t iwm_read_prph(struct iwm_softc *, uint32_t);
-void	iwm_write_prph(struct iwm_softc *, uint32_t, uint32_t);
-int	iwm_read_mem(struct iwm_softc *, uint32_t, void *, int);
-int	iwm_write_mem(struct iwm_softc *, uint32_t, const void *, int);
-int	iwm_write_mem32(struct iwm_softc *, uint32_t, uint32_t);
-int	iwm_poll_bit(struct iwm_softc *, int, uint32_t, uint32_t, int);
-int	iwm_nic_lock(struct iwm_softc *);
-void	iwm_nic_unlock(struct iwm_softc *);
-void	iwm_set_bits_mask_prph(struct iwm_softc *, uint32_t, uint32_t,
-				uint32_t); 
-void	iwm_set_bits_prph(struct iwm_softc *, uint32_t, uint32_t);
-void	iwm_clear_bits_prph(struct iwm_softc *, uint32_t, uint32_t);
-int	iwm_dma_contig_alloc(bus_dma_tag_t, struct iwm_dma_info *,
-				bus_size_t, bus_size_t);
-void	iwm_dma_contig_free(struct iwm_dma_info *);
-int	iwm_alloc_fwmem(struct iwm_softc *);
-void	iwm_free_fwmem(struct iwm_softc *);
-int	iwm_alloc_sched(struct iwm_softc *);
-void	iwm_free_sched(struct iwm_softc *);
-int	iwm_alloc_kw(struct iwm_softc *);
-void	iwm_free_kw(struct iwm_softc *);
-int	iwm_alloc_ict(struct iwm_softc *);
-void	iwm_free_ict(struct iwm_softc *);
-int	iwm_alloc_rx_ring(struct iwm_softc *, struct iwm_rx_ring *);
-void	iwm_reset_rx_ring(struct iwm_softc *, struct iwm_rx_ring *);
-void	iwm_free_rx_ring(struct iwm_softc *, struct iwm_rx_ring *);
-int	iwm_alloc_tx_ring(struct iwm_softc *, struct iwm_tx_ring *, int);
-void	iwm_reset_tx_ring(struct iwm_softc *, struct iwm_tx_ring *);
-void	iwm_free_tx_ring(struct iwm_softc *, struct iwm_tx_ring *);
-void	iwm_enable_rfkill_int(struct iwm_softc *);
-int	iwm_check_rfkill(struct iwm_softc *);
-void	iwm_enable_interrupts(struct iwm_softc *);
-void	iwm_restore_interrupts(struct iwm_softc *);
-void	iwm_disable_interrupts(struct iwm_softc *);
-void	iwm_ict_reset(struct iwm_softc *);
-int	iwm_set_hw_ready(struct iwm_softc *);
-int	iwm_prepare_card_hw(struct iwm_softc *);
-void	iwm_apm_config(struct iwm_softc *);
-int	iwm_apm_init(struct iwm_softc *);
-void	iwm_apm_stop(struct iwm_softc *);
-int	iwm_start_hw(struct iwm_softc *);
-void	iwm_stop_device(struct iwm_softc *);
-void	iwm_set_pwr(struct iwm_softc *);
-void	iwm_mvm_nic_config(struct iwm_softc *);
-int	iwm_nic_rx_init(struct iwm_softc *);
-int	iwm_nic_tx_init(struct iwm_softc *);
-int	iwm_nic_init(struct iwm_softc *);
-void	iwm_enable_txq(struct iwm_softc *, int, int);
-int	iwm_post_alive(struct iwm_softc *);
-int	iwm_is_valid_channel(uint16_t);
-uint8_t	iwm_ch_id_to_ch_index(uint16_t);
-uint16_t iwm_channel_id_to_papd(uint16_t);
-uint16_t iwm_channel_id_to_txp(struct iwm_softc *, uint16_t);
-int	iwm_phy_db_get_section_data(struct iwm_softc *, uint32_t, uint8_t **,
-					uint16_t *, uint16_t);
-int	iwm_send_phy_db_cmd(struct iwm_softc *, uint16_t, uint16_t, void *);
-int	iwm_send_phy_db_data(struct iwm_softc *);
-int	iwm_send_phy_db_data(struct iwm_softc *);
-void	iwm_mvm_te_v2_to_v1(const struct iwm_time_event_cmd_v2 *,
-				struct iwm_time_event_cmd_v1 *);
-int	iwm_mvm_send_time_event_cmd(struct iwm_softc *,
-					const struct iwm_time_event_cmd_v2 *);
-int	iwm_mvm_time_event_send_add(struct iwm_softc *, struct iwm_node *,
-					void *, struct iwm_time_event_cmd_v2 *);
-void	iwm_mvm_protect_session(struct iwm_softc *, struct iwm_node *,
-				uint32_t, uint32_t, uint32_t);
-int	iwm_nvm_read_chunk(struct iwm_softc *, uint16_t, uint16_t, uint16_t,
-				uint8_t *, uint16_t *);
-int	iwm_nvm_read_section(struct iwm_softc *, uint16_t, uint8_t *,
-				uint16_t *);
-void	iwm_init_channel_map(struct iwm_softc *, const uint16_t * const);
-int	iwm_parse_nvm_data(struct iwm_softc *, const uint16_t *,
-				const uint16_t *, const uint16_t *, uint8_t,
-				uint8_t);
-int	iwm_nvm_init(struct iwm_softc *);
-int	iwm_firmware_load_chunk(struct iwm_softc *, uint32_t, const uint8_t *,
-				uint32_t);
-int	iwm_load_firmware(struct iwm_softc *, enum iwm_ucode_type);
-int	iwm_start_fw(struct iwm_softc *, enum iwm_ucode_type);
-int	iwm_fw_alive(struct iwm_softc *, uint32_t);
-int	iwm_send_tx_ant_cfg(struct iwm_softc *, uint8_t);
-int	iwm_send_phy_cfg_cmd(struct iwm_softc *);
-int	iwm_mvm_load_ucode_wait_alive(struct iwm_softc *, enum iwm_ucode_type);
-int	iwm_run_init_mvm_ucode(struct iwm_softc *, int);
-int	iwm_rx_addbuf(struct iwm_softc *, int, int);
-int	iwm_mvm_calc_rssi(struct iwm_softc *, struct iwm_rx_phy_info *);
-int	iwm_mvm_get_signal_strength(struct iwm_softc *,
-					struct iwm_rx_phy_info *);
-void	iwm_mvm_rx_rx_phy_cmd(struct iwm_softc *, struct iwm_rx_packet *,
-				struct iwm_rx_data *);
-int	iwm_get_noise(const struct iwm_mvm_statistics_rx_non_phy *);
-void	iwm_mvm_rx_rx_mpdu(struct iwm_softc *, struct iwm_rx_packet *,
-				struct iwm_rx_data *);
-void	iwm_mvm_rx_tx_cmd_single(struct iwm_softc *, struct iwm_rx_packet *,
-				struct iwm_node *);
-void	iwm_mvm_rx_tx_cmd(struct iwm_softc *, struct iwm_rx_packet *,
-			struct iwm_rx_data *);
-int	iwm_mvm_binding_cmd(struct iwm_softc *, struct iwm_node *, uint32_t);
-int	iwm_mvm_binding_update(struct iwm_softc *, struct iwm_node *, int);
-int	iwm_mvm_binding_add_vif(struct iwm_softc *, struct iwm_node *);
-void	iwm_mvm_phy_ctxt_cmd_hdr(struct iwm_softc *, struct iwm_mvm_phy_ctxt *,
-			struct iwm_phy_context_cmd *, uint32_t, uint32_t);
-void	iwm_mvm_phy_ctxt_cmd_data(struct iwm_softc *,
-		struct iwm_phy_context_cmd *, struct ieee80211_channel *,
-		uint8_t, uint8_t);
-int	iwm_mvm_phy_ctxt_apply(struct iwm_softc *, struct iwm_mvm_phy_ctxt *,
-				uint8_t, uint8_t, uint32_t, uint32_t);
-int	iwm_mvm_phy_ctxt_add(struct iwm_softc *, struct iwm_mvm_phy_ctxt *,
-				struct ieee80211_channel *, uint8_t, uint8_t);
-int	iwm_mvm_phy_ctxt_changed(struct iwm_softc *, struct iwm_mvm_phy_ctxt *,
-				struct ieee80211_channel *, uint8_t, uint8_t);
-int	iwm_send_cmd(struct iwm_softc *, struct iwm_host_cmd *);
-int	iwm_mvm_send_cmd_pdu(struct iwm_softc *, uint8_t, uint32_t, uint16_t,
-				const void *);
-int	iwm_mvm_send_cmd_status(struct iwm_softc *, struct iwm_host_cmd *,
-				uint32_t *);
-int	iwm_mvm_send_cmd_pdu_status(struct iwm_softc *, uint8_t,
-					uint16_t, const void *, uint32_t *);
-void	iwm_free_resp(struct iwm_softc *, struct iwm_host_cmd *);
-void	iwm_cmd_done(struct iwm_softc *, struct iwm_rx_packet *);
-void	iwm_update_sched(struct iwm_softc *, int, int, uint8_t, uint16_t);
-const struct iwm_rate *iwm_tx_fill_cmd(struct iwm_softc *, struct iwm_node *,
-			struct ieee80211_frame *, struct iwm_tx_cmd *);
-int	iwm_tx(struct iwm_softc *, struct mbuf *, struct ieee80211_node *, int);
-int	iwm_mvm_beacon_filter_send_cmd(struct iwm_softc *,
-					struct iwm_beacon_filter_cmd *);
-void	iwm_mvm_beacon_filter_set_cqm_params(struct iwm_softc *,
-			struct iwm_node *, struct iwm_beacon_filter_cmd *);
-int	iwm_mvm_update_beacon_abort(struct iwm_softc *, struct iwm_node *, int);
-void	iwm_mvm_power_log(struct iwm_softc *, struct iwm_mac_power_cmd *);
-void	iwm_mvm_power_build_cmd(struct iwm_softc *, struct iwm_node *,
-				struct iwm_mac_power_cmd *);
-int	iwm_mvm_power_mac_update_mode(struct iwm_softc *, struct iwm_node *);
-int	iwm_mvm_power_update_device(struct iwm_softc *);
-int	iwm_mvm_enable_beacon_filter(struct iwm_softc *, struct iwm_node *);
-int	iwm_mvm_disable_beacon_filter(struct iwm_softc *, struct iwm_node *);
-void	iwm_mvm_add_sta_cmd_v6_to_v5(struct iwm_mvm_add_sta_cmd_v6 *,
-					struct iwm_mvm_add_sta_cmd_v5 *);
-int	iwm_mvm_send_add_sta_cmd_status(struct iwm_softc *,
-					struct iwm_mvm_add_sta_cmd_v6 *, int *);
-int	iwm_mvm_sta_send_to_fw(struct iwm_softc *, struct iwm_node *, int);
-int	iwm_mvm_add_sta(struct iwm_softc *, struct iwm_node *);
-int	iwm_mvm_update_sta(struct iwm_softc *, struct iwm_node *);
-int	iwm_mvm_add_int_sta_common(struct iwm_softc *, struct iwm_int_sta *,
-				const uint8_t *, uint16_t, uint16_t);
-int	iwm_mvm_add_aux_sta(struct iwm_softc *);
-uint16_t iwm_mvm_scan_rx_chain(struct iwm_softc *);
-uint32_t iwm_mvm_scan_max_out_time(struct iwm_softc *, uint32_t, int);
-uint32_t iwm_mvm_scan_suspend_time(struct iwm_softc *, int);
-uint32_t iwm_mvm_scan_rxon_flags(struct iwm_softc *, int);
-uint32_t iwm_mvm_scan_rate_n_flags(struct iwm_softc *, int, int);
-uint16_t iwm_mvm_get_active_dwell(struct iwm_softc *, int, int);
-uint16_t iwm_mvm_get_passive_dwell(struct iwm_softc *, int);
-int	iwm_mvm_scan_fill_channels(struct iwm_softc *, struct iwm_scan_cmd *,
-				int, int, int);
-uint16_t iwm_mvm_fill_probe_req(struct iwm_softc *, struct ieee80211_frame *,
-	const uint8_t *, int, const uint8_t *, int, const uint8_t *, int, int);
-int	iwm_mvm_scan_request(struct iwm_softc *, int, int, uint8_t *, int);
-void	iwm_mvm_ack_rates(struct iwm_softc *, struct iwm_node *, int *, int *);
-void	iwm_mvm_mac_ctxt_cmd_common(struct iwm_softc *, struct iwm_node *,
-					struct iwm_mac_ctx_cmd *, uint32_t);
-int	iwm_mvm_mac_ctxt_send_cmd(struct iwm_softc *, struct iwm_mac_ctx_cmd *);
-void	iwm_mvm_mac_ctxt_cmd_fill_sta(struct iwm_softc *, struct iwm_node *,
-					struct iwm_mac_data_sta *, int);
-int	iwm_mvm_mac_ctxt_cmd_station(struct iwm_softc *, struct iwm_node *,
-					uint32_t);
-int	iwm_mvm_mac_ctx_send(struct iwm_softc *, struct iwm_node *, uint32_t);
-int	iwm_mvm_mac_ctxt_add(struct iwm_softc *, struct iwm_node *);
-int	iwm_mvm_mac_ctxt_changed(struct iwm_softc *, struct iwm_node *);
-int	iwm_mvm_update_quotas(struct iwm_softc *, struct iwm_node *);
-int	iwm_auth(struct iwm_softc *);
-int	iwm_assoc(struct iwm_softc *);
-int	iwm_release(struct iwm_softc *, struct iwm_node *);
-void	iwm_calib_timeout(void *);
-void	iwm_setrates(struct iwm_node *);
-int	iwm_media_change(struct ifnet *);
-void	iwm_newstate_cb(void *);
-int	iwm_newstate(struct ieee80211com *, enum ieee80211_state, int);
-void	iwm_endscan_cb(void *);
-int	iwm_init_hw(struct iwm_softc *);
-int	iwm_init(struct ifnet *);
-void	iwm_start(struct ifnet *);
-void	iwm_stop(struct ifnet *, int);
-void	iwm_watchdog(struct ifnet *);
-int	iwm_ioctl(struct ifnet *, u_long, void *);
-const char *iwm_desc_lookup(uint32_t);
+static int	iwm_store_cscheme(struct iwm_softc *, uint8_t *, size_t);
+static int	iwm_firmware_store_section(struct iwm_softc *,
+		    enum iwm_ucode_type, uint8_t *, size_t);
+static int	iwm_set_default_calib(struct iwm_softc *, const void *);
+static int	iwm_read_firmware(struct iwm_softc *);
+static uint32_t iwm_read_prph(struct iwm_softc *, uint32_t);
+static void	iwm_write_prph(struct iwm_softc *, uint32_t, uint32_t);
 #ifdef IWM_DEBUG
-void	iwm_nic_error(struct iwm_softc *);
+static int	iwm_read_mem(struct iwm_softc *, uint32_t, void *, int);
 #endif
-void	iwm_notif_intr(struct iwm_softc *);
-int	iwm_intr(void *);
-int	iwm_preinit(struct iwm_softc *);
-void	iwm_attach_hook(struct device *);
-void	iwm_attach(struct device *, struct device *, void *);
-void	iwm_init_task(void *);
-int	iwm_activate(struct device *, int);
-void	iwm_wakeup(struct iwm_softc *);
-
-void	iwm_radiotap_attach(struct iwm_softc *);
+static int	iwm_write_mem(struct iwm_softc *, uint32_t, const void *, int);
+static int	iwm_write_mem32(struct iwm_softc *, uint32_t, uint32_t);
+static int	iwm_poll_bit(struct iwm_softc *, int, uint32_t, uint32_t, int);
+static int	iwm_nic_lock(struct iwm_softc *);
+static void	iwm_nic_unlock(struct iwm_softc *);
+static void	iwm_set_bits_mask_prph(struct iwm_softc *, uint32_t, uint32_t,
+		    uint32_t); 
+static void	iwm_set_bits_prph(struct iwm_softc *, uint32_t, uint32_t);
+static void	iwm_clear_bits_prph(struct iwm_softc *, uint32_t, uint32_t);
+static int	iwm_dma_contig_alloc(bus_dma_tag_t, struct iwm_dma_info *,
+		    bus_size_t, bus_size_t);
+static void	iwm_dma_contig_free(struct iwm_dma_info *);
+static int	iwm_alloc_fwmem(struct iwm_softc *);
+static void	iwm_free_fwmem(struct iwm_softc *);
+static int	iwm_alloc_sched(struct iwm_softc *);
+static void	iwm_free_sched(struct iwm_softc *);
+static int	iwm_alloc_kw(struct iwm_softc *);
+static void	iwm_free_kw(struct iwm_softc *);
+static int	iwm_alloc_ict(struct iwm_softc *);
+static void	iwm_free_ict(struct iwm_softc *);
+static int	iwm_alloc_rx_ring(struct iwm_softc *, struct iwm_rx_ring *);
+static void	iwm_reset_rx_ring(struct iwm_softc *, struct iwm_rx_ring *);
+static void	iwm_free_rx_ring(struct iwm_softc *, struct iwm_rx_ring *);
+static int	iwm_alloc_tx_ring(struct iwm_softc *, struct iwm_tx_ring *,
+		    int);
+static void	iwm_reset_tx_ring(struct iwm_softc *, struct iwm_tx_ring *);
+static void	iwm_free_tx_ring(struct iwm_softc *, struct iwm_tx_ring *);
+static void	iwm_enable_rfkill_int(struct iwm_softc *);
+static int	iwm_check_rfkill(struct iwm_softc *);
+static void	iwm_enable_interrupts(struct iwm_softc *);
+static void	iwm_restore_interrupts(struct iwm_softc *);
+static void	iwm_disable_interrupts(struct iwm_softc *);
+static void	iwm_ict_reset(struct iwm_softc *);
+static int	iwm_set_hw_ready(struct iwm_softc *);
+static int	iwm_prepare_card_hw(struct iwm_softc *);
+static void	iwm_apm_config(struct iwm_softc *);
+static int	iwm_apm_init(struct iwm_softc *);
+static void	iwm_apm_stop(struct iwm_softc *);
+static int	iwm_start_hw(struct iwm_softc *);
+static void	iwm_stop_device(struct iwm_softc *);
+static void	iwm_set_pwr(struct iwm_softc *);
+static void	iwm_mvm_nic_config(struct iwm_softc *);
+static int	iwm_nic_rx_init(struct iwm_softc *);
+static int	iwm_nic_tx_init(struct iwm_softc *);
+static int	iwm_nic_init(struct iwm_softc *);
+static void	iwm_enable_txq(struct iwm_softc *, int, int);
+static int	iwm_post_alive(struct iwm_softc *);
+static int	iwm_is_valid_channel(uint16_t);
+static uint8_t	iwm_ch_id_to_ch_index(uint16_t);
+static uint16_t iwm_channel_id_to_papd(uint16_t);
+static uint16_t iwm_channel_id_to_txp(struct iwm_softc *, uint16_t);
+static int	iwm_phy_db_get_section_data(struct iwm_softc *, uint32_t,
+		    uint8_t **, uint16_t *, uint16_t);
+static int	iwm_send_phy_db_cmd(struct iwm_softc *, uint16_t, uint16_t,
+		    void *);
+static int	iwm_send_phy_db_data(struct iwm_softc *);
+static int	iwm_send_phy_db_data(struct iwm_softc *);
+static void	iwm_mvm_te_v2_to_v1(const struct iwm_time_event_cmd_v2 *,
+		    struct iwm_time_event_cmd_v1 *);
+static int	iwm_mvm_send_time_event_cmd(struct iwm_softc *,
+		    const struct iwm_time_event_cmd_v2 *);
+static int	iwm_mvm_time_event_send_add(struct iwm_softc *,
+		    struct iwm_node *, void *, struct iwm_time_event_cmd_v2 *);
+static void	iwm_mvm_protect_session(struct iwm_softc *, struct iwm_node *,
+		    uint32_t, uint32_t, uint32_t);
+static int	iwm_nvm_read_chunk(struct iwm_softc *, uint16_t, uint16_t,
+		    uint16_t, uint8_t *, uint16_t *);
+static int	iwm_nvm_read_section(struct iwm_softc *, uint16_t, uint8_t *,
+		    uint16_t *);
+static void	iwm_init_channel_map(struct iwm_softc *,
+		    const uint16_t * const);
+static int	iwm_parse_nvm_data(struct iwm_softc *, const uint16_t *,
+		    const uint16_t *, const uint16_t *, uint8_t, uint8_t);
+static int	iwm_nvm_init(struct iwm_softc *);
+static int	iwm_firmware_load_chunk(struct iwm_softc *, uint32_t,
+		    const uint8_t *, uint32_t);
+static int	iwm_load_firmware(struct iwm_softc *, enum iwm_ucode_type);
+static int	iwm_start_fw(struct iwm_softc *, enum iwm_ucode_type);
+static int	iwm_fw_alive(struct iwm_softc *, uint32_t);
+static int	iwm_send_tx_ant_cfg(struct iwm_softc *, uint8_t);
+static int	iwm_send_phy_cfg_cmd(struct iwm_softc *);
+static int	iwm_mvm_load_ucode_wait_alive(struct iwm_softc *,
+		    enum iwm_ucode_type);
+static int	iwm_run_init_mvm_ucode(struct iwm_softc *, int);
+static int	iwm_rx_addbuf(struct iwm_softc *, int, int);
+static int	iwm_mvm_calc_rssi(struct iwm_softc *, struct iwm_rx_phy_info *);
+static int	iwm_mvm_get_signal_strength(struct iwm_softc *,
+		    struct iwm_rx_phy_info *);
+static void	iwm_mvm_rx_rx_phy_cmd(struct iwm_softc *,
+		    struct iwm_rx_packet *, struct iwm_rx_data *);
+static int	iwm_get_noise(const struct iwm_mvm_statistics_rx_non_phy *);
+static void	iwm_mvm_rx_rx_mpdu(struct iwm_softc *, struct iwm_rx_packet *,
+		    struct iwm_rx_data *);
+static void	iwm_mvm_rx_tx_cmd_single(struct iwm_softc *,
+		    struct iwm_rx_packet *, struct iwm_node *);
+static void	iwm_mvm_rx_tx_cmd(struct iwm_softc *, struct iwm_rx_packet *,
+		    struct iwm_rx_data *);
+static int	iwm_mvm_binding_cmd(struct iwm_softc *, struct iwm_node *,
+		    uint32_t);
+static int	iwm_mvm_binding_update(struct iwm_softc *, struct iwm_node *,
+		    int);
+static int	iwm_mvm_binding_add_vif(struct iwm_softc *, struct iwm_node *);
+static void	iwm_mvm_phy_ctxt_cmd_hdr(struct iwm_softc *,
+		    struct iwm_mvm_phy_ctxt *, struct iwm_phy_context_cmd *,
+		    uint32_t, uint32_t);
+static void	iwm_mvm_phy_ctxt_cmd_data(struct iwm_softc *,
+		    struct iwm_phy_context_cmd *, struct ieee80211_channel *,
+		    uint8_t, uint8_t);
+static int	iwm_mvm_phy_ctxt_apply(struct iwm_softc *,
+		    struct iwm_mvm_phy_ctxt *, uint8_t, uint8_t, uint32_t,
+		    uint32_t);
+static int	iwm_mvm_phy_ctxt_add(struct iwm_softc *,
+		    struct iwm_mvm_phy_ctxt *, struct ieee80211_channel *,
+		    uint8_t, uint8_t);
+static int	iwm_mvm_phy_ctxt_changed(struct iwm_softc *,
+		    struct iwm_mvm_phy_ctxt *, struct ieee80211_channel *,
+		    uint8_t, uint8_t);
+static int	iwm_send_cmd(struct iwm_softc *, struct iwm_host_cmd *);
+static int	iwm_mvm_send_cmd_pdu(struct iwm_softc *, uint8_t, uint32_t,
+		    uint16_t, const void *);
+static int	iwm_mvm_send_cmd_status(struct iwm_softc *,
+		    struct iwm_host_cmd *, uint32_t *);
+static int	iwm_mvm_send_cmd_pdu_status(struct iwm_softc *, uint8_t,
+		    uint16_t, const void *, uint32_t *);
+static void	iwm_free_resp(struct iwm_softc *, struct iwm_host_cmd *);
+static void	iwm_cmd_done(struct iwm_softc *, struct iwm_rx_packet *);
+#if 0
+static void	iwm_update_sched(struct iwm_softc *, int, int, uint8_t,
+		    uint16_t);
+#endif
+static const struct iwm_rate *iwm_tx_fill_cmd(struct iwm_softc *,
+		    struct iwm_node *, struct ieee80211_frame *,
+		    struct iwm_tx_cmd *);
+static int	iwm_tx(struct iwm_softc *, struct mbuf *,
+		    struct ieee80211_node *, int);
+static int	iwm_mvm_beacon_filter_send_cmd(struct iwm_softc *,
+		    struct iwm_beacon_filter_cmd *);
+static void	iwm_mvm_beacon_filter_set_cqm_params(struct iwm_softc *,
+		    struct iwm_node *, struct iwm_beacon_filter_cmd *);
+static int	iwm_mvm_update_beacon_abort(struct iwm_softc *,
+		    struct iwm_node *, int);
+static void	iwm_mvm_power_log(struct iwm_softc *,
+		    struct iwm_mac_power_cmd *);
+static void	iwm_mvm_power_build_cmd(struct iwm_softc *, struct iwm_node *,
+		    struct iwm_mac_power_cmd *);
+static int	iwm_mvm_power_mac_update_mode(struct iwm_softc *,
+		    struct iwm_node *);
+static int	iwm_mvm_power_update_device(struct iwm_softc *);
+static int	iwm_mvm_enable_beacon_filter(struct iwm_softc *,
+		    struct iwm_node *);
+static int	iwm_mvm_disable_beacon_filter(struct iwm_softc *,
+		    struct iwm_node *);
+static void	iwm_mvm_add_sta_cmd_v6_to_v5(struct iwm_mvm_add_sta_cmd_v6 *,
+		    struct iwm_mvm_add_sta_cmd_v5 *);
+static int	iwm_mvm_send_add_sta_cmd_status(struct iwm_softc *,
+		    struct iwm_mvm_add_sta_cmd_v6 *, int *);
+static int	iwm_mvm_sta_send_to_fw(struct iwm_softc *, struct iwm_node *,
+		    int);
+static int	iwm_mvm_add_sta(struct iwm_softc *, struct iwm_node *);
+static int	iwm_mvm_update_sta(struct iwm_softc *, struct iwm_node *);
+static int	iwm_mvm_add_int_sta_common(struct iwm_softc *,
+		    struct iwm_int_sta *, const uint8_t *, uint16_t, uint16_t);
+static int	iwm_mvm_add_aux_sta(struct iwm_softc *);
+static uint16_t iwm_mvm_scan_rx_chain(struct iwm_softc *);
+static uint32_t iwm_mvm_scan_max_out_time(struct iwm_softc *, uint32_t, int);
+static uint32_t iwm_mvm_scan_suspend_time(struct iwm_softc *, int);
+static uint32_t iwm_mvm_scan_rxon_flags(struct iwm_softc *, int);
+static uint32_t iwm_mvm_scan_rate_n_flags(struct iwm_softc *, int, int);
+static uint16_t iwm_mvm_get_active_dwell(struct iwm_softc *, int, int);
+static uint16_t iwm_mvm_get_passive_dwell(struct iwm_softc *, int);
+static int	iwm_mvm_scan_fill_channels(struct iwm_softc *,
+		    struct iwm_scan_cmd *, int, int, int);
+static uint16_t iwm_mvm_fill_probe_req(struct iwm_softc *,
+		    struct ieee80211_frame *, const uint8_t *, int,
+		    const uint8_t *, int, const uint8_t *, int, int);
+static int	iwm_mvm_scan_request(struct iwm_softc *, int, int, uint8_t *,
+		    int);
+static void	iwm_mvm_ack_rates(struct iwm_softc *, struct iwm_node *, int *,
+		    int *);
+static void	iwm_mvm_mac_ctxt_cmd_common(struct iwm_softc *,
+		    struct iwm_node *, struct iwm_mac_ctx_cmd *, uint32_t);
+static int	iwm_mvm_mac_ctxt_send_cmd(struct iwm_softc *,
+		    struct iwm_mac_ctx_cmd *);
+static void	iwm_mvm_mac_ctxt_cmd_fill_sta(struct iwm_softc *,
+		    struct iwm_node *, struct iwm_mac_data_sta *, int);
+static int	iwm_mvm_mac_ctxt_cmd_station(struct iwm_softc *,
+		    struct iwm_node *, uint32_t);
+static int	iwm_mvm_mac_ctx_send(struct iwm_softc *, struct iwm_node *,
+		    uint32_t);
+static int	iwm_mvm_mac_ctxt_add(struct iwm_softc *, struct iwm_node *);
+static int	iwm_mvm_mac_ctxt_changed(struct iwm_softc *, struct iwm_node *);
+static int	iwm_mvm_update_quotas(struct iwm_softc *, struct iwm_node *);
+static int	iwm_auth(struct iwm_softc *);
+static int	iwm_assoc(struct iwm_softc *);
+static int	iwm_release(struct iwm_softc *, struct iwm_node *);
+static void	iwm_calib_timeout(void *);
+static void	iwm_setrates(struct iwm_node *);
+static int	iwm_media_change(struct ifnet *);
+static void	iwm_newstate_cb(void *);
+static int	iwm_newstate(struct ieee80211com *, enum ieee80211_state, int);
+static void	iwm_endscan_cb(void *);
+static int	iwm_init_hw(struct iwm_softc *);
+static int	iwm_init(struct ifnet *);
+static void	iwm_start(struct ifnet *);
+static void	iwm_stop(struct ifnet *, int);
+static void	iwm_watchdog(struct ifnet *);
+static int	iwm_ioctl(struct ifnet *, u_long, void *);
+#ifdef IWM_DEBUG
+static const char *iwm_desc_lookup(uint32_t);
+static void	iwm_nic_error(struct iwm_softc *);
+#endif
+static void	iwm_notif_intr(struct iwm_softc *);
+static int	iwm_intr(void *);
+static int	iwm_preinit(struct iwm_softc *);
+static void	iwm_attach_hook(device_t);
+static void	iwm_attach(device_t, device_t, void *);
+#if 0
+static void	iwm_init_task(void *);
+static int	iwm_activate(device_t, enum devact);
+static void	iwm_wakeup(struct iwm_softc *);
+#endif
+static void	iwm_radiotap_attach(struct iwm_softc *);
 
 static int
 iwm_firmload(struct iwm_softc *sc)
@@ -508,7 +536,7 @@ iwm_fix_channel(struct ieee80211com *ic,
  * Firmware parser.
  */
 
-int
+static int
 iwm_store_cscheme(struct iwm_softc *sc, uint8_t *data, size_t dlen)
 {
 	struct iwm_fw_cscheme_list *l = (void *)data;
@@ -522,7 +550,7 @@ iwm_store_cscheme(struct iwm_softc *sc, 
 	return 0;
 }
 
-int
+static int
 iwm_firmware_store_section(struct iwm_softc *sc,
 	enum iwm_ucode_type type, uint8_t *data, size_t dlen)
 {
@@ -563,7 +591,7 @@ struct iwm_tlv_calib_data {
 	struct iwm_tlv_calib_ctrl calib;
 } __packed;
 
-int
+static int
 iwm_set_default_calib(struct iwm_softc *sc, const void *data)
 {
 	const struct iwm_tlv_calib_data *def_calib = data;
@@ -583,7 +611,7 @@ iwm_set_default_calib(struct iwm_softc *
 	return 0;
 }
 
-int
+static int
 iwm_read_firmware(struct iwm_softc *sc)
 {
 	struct iwm_fw_info *fw = &sc->sc_fw;
@@ -790,7 +818,7 @@ iwm_read_firmware(struct iwm_softc *sc)
  * basic device access
  */
 
-uint32_t
+static uint32_t
 iwm_read_prph(struct iwm_softc *sc, uint32_t addr)
 {
 	IWM_WRITE(sc,
@@ -799,7 +827,7 @@ iwm_read_prph(struct iwm_softc *sc, uint
 	return IWM_READ(sc, IWM_HBUS_TARG_PRPH_RDAT);
 }
 
-void
+static void
 iwm_write_prph(struct iwm_softc *sc, uint32_t addr, uint32_t val)
 {
 	IWM_WRITE(sc,
@@ -808,8 +836,9 @@ iwm_write_prph(struct iwm_softc *sc, uin
 	IWM_WRITE(sc, IWM_HBUS_TARG_PRPH_WDAT, val);
 }
 
+#ifdef IWM_DEBUG
 /* iwlwifi: pcie/trans.c */
-int
+static int
 iwm_read_mem(struct iwm_softc *sc, uint32_t addr, void *buf, int dwords)
 {
 	int offs, ret = 0;
@@ -825,9 +854,10 @@ iwm_read_mem(struct iwm_softc *sc, uint3
 	}
 	return ret;
 }
+#endif
 
 /* iwlwifi: pcie/trans.c */
-int
+static int
 iwm_write_mem(struct iwm_softc *sc, uint32_t addr, const void *buf, int dwords)
 {
 	int offs;	
@@ -848,13 +878,13 @@ iwm_write_mem(struct iwm_softc *sc, uint
 	return 0;
 }
 
-int
+static int
 iwm_write_mem32(struct iwm_softc *sc, uint32_t addr, uint32_t val)
 {
 	return iwm_write_mem(sc, addr, &val, 1);
 }
 
-int
+static int
 iwm_poll_bit(struct iwm_softc *sc, int reg,
 	uint32_t bits, uint32_t mask, int timo)
 {
@@ -870,7 +900,7 @@ iwm_poll_bit(struct iwm_softc *sc, int r
 	}
 }
 
-int
+static int
 iwm_nic_lock(struct iwm_softc *sc)
 {
 	int rv = 0;
@@ -891,14 +921,14 @@ iwm_nic_lock(struct iwm_softc *sc)
 	return rv;
 }
 
-void
+static void
 iwm_nic_unlock(struct iwm_softc *sc)
 {
 	IWM_CLRBITS(sc, IWM_CSR_GP_CNTRL,
 	    IWM_CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ);
 }
 
-void
+static void
 iwm_set_bits_mask_prph(struct iwm_softc *sc,
 	uint32_t reg, uint32_t bits, uint32_t mask)
 {
@@ -913,13 +943,13 @@ iwm_set_bits_mask_prph(struct iwm_softc 
 	}
 }
 
-void
+static void
 iwm_set_bits_prph(struct iwm_softc *sc, uint32_t reg, uint32_t bits)
 {
 	iwm_set_bits_mask_prph(sc, reg, bits, ~0);
 }
 
-void
+static void
 iwm_clear_bits_prph(struct iwm_softc *sc, uint32_t reg, uint32_t bits)
 {
 	iwm_set_bits_mask_prph(sc, reg, 0, ~bits);
@@ -929,7 +959,7 @@ iwm_clear_bits_prph(struct iwm_softc *sc
  * DMA resource routines
  */
 
-int
+static int
 iwm_dma_contig_alloc(bus_dma_tag_t tag, struct iwm_dma_info *dma,
     bus_size_t size, bus_size_t alignment)
 {
@@ -970,7 +1000,7 @@ fail:	iwm_dma_contig_free(dma);
 	return error;
 }
 
-void
+static void
 iwm_dma_contig_free(struct iwm_dma_info *dma)
 {
 	if (dma->map != NULL) {
@@ -988,7 +1018,7 @@ iwm_dma_contig_free(struct iwm_dma_info 
 }
 
 /* fwmem is used to load firmware onto the card */
-int
+static int
 iwm_alloc_fwmem(struct iwm_softc *sc)
 {
 	/* Must be aligned on a 16-byte boundary. */
@@ -996,14 +1026,14 @@ iwm_alloc_fwmem(struct iwm_softc *sc)
 	    sc->sc_fwdmasegsz, 16);
 }
 
-void
+static void
 iwm_free_fwmem(struct iwm_softc *sc)
 {
 	iwm_dma_contig_free(&sc->fw_dma);
 }
 
 /* tx scheduler rings.  not used? */
-int
+static int
 iwm_alloc_sched(struct iwm_softc *sc)
 {
 	int rv;
@@ -1014,40 +1044,40 @@ iwm_alloc_sched(struct iwm_softc *sc)
 	return rv;
 }
 
-void
+static void
 iwm_free_sched(struct iwm_softc *sc)
 {
 	iwm_dma_contig_free(&sc->sched_dma);
 }
 
 /* keep-warm page is used internally by the card.  see iwl-fh.h for more info */
-int
+static int
 iwm_alloc_kw(struct iwm_softc *sc)
 {
 	return iwm_dma_contig_alloc(sc->sc_dmat, &sc->kw_dma, 4096, 4096);
 }
 
-void
+static void
 iwm_free_kw(struct iwm_softc *sc)
 {
 	iwm_dma_contig_free(&sc->kw_dma);
 }
 
 /* interrupt cause table */
-int
+static int
 iwm_alloc_ict(struct iwm_softc *sc)
 {
 	return iwm_dma_contig_alloc(sc->sc_dmat, &sc->ict_dma,
 	    IWM_ICT_SIZE, 1<<IWM_ICT_PADDR_SHIFT);
 }
 
-void
+static void
 iwm_free_ict(struct iwm_softc *sc)
 {
 	iwm_dma_contig_free(&sc->ict_dma);
 }
 
-int
+static int
 iwm_alloc_rx_ring(struct iwm_softc *sc, struct iwm_rx_ring *ring)
 {
 	bus_size_t size;
@@ -1101,7 +1131,7 @@ fail:	iwm_free_rx_ring(sc, ring);
 	return error;
 }
 
-void
+static void
 iwm_reset_rx_ring(struct iwm_softc *sc, struct iwm_rx_ring *ring)
 {
 	int ntries;
@@ -1119,7 +1149,7 @@ iwm_reset_rx_ring(struct iwm_softc *sc, 
 	ring->cur = 0;
 }
 
-void
+static void
 iwm_free_rx_ring(struct iwm_softc *sc, struct iwm_rx_ring *ring)
 {
 	int i;
@@ -1141,7 +1171,7 @@ iwm_free_rx_ring(struct iwm_softc *sc, s
 	}
 }
 
-int
+static int
 iwm_alloc_tx_ring(struct iwm_softc *sc, struct iwm_tx_ring *ring, int qid)
 {
 	bus_addr_t paddr;
@@ -1202,7 +1232,7 @@ fail:	iwm_free_tx_ring(sc, ring);
 	return error;
 }
 
-void
+static void
 iwm_reset_tx_ring(struct iwm_softc *sc, struct iwm_tx_ring *ring)
 {
 	int i;
@@ -1227,7 +1257,7 @@ iwm_reset_tx_ring(struct iwm_softc *sc, 
 	ring->cur = 0;
 }
 
-void
+static void
 iwm_free_tx_ring(struct iwm_softc *sc, struct iwm_tx_ring *ring)
 {
 	int i;
@@ -1253,14 +1283,14 @@ iwm_free_tx_ring(struct iwm_softc *sc, s
  * High-level hardware frobbing routines
  */
 
-void
+static void
 iwm_enable_rfkill_int(struct iwm_softc *sc)
 {
 	sc->sc_intmask = IWM_CSR_INT_BIT_RF_KILL;
 	IWM_WRITE(sc, IWM_CSR_INT_MASK, sc->sc_intmask);
 }
 
-int
+static int
 iwm_check_rfkill(struct iwm_softc *sc)
 {
 	uint32_t v;
@@ -1288,20 +1318,20 @@ iwm_check_rfkill(struct iwm_softc *sc)
 	return rv;
 }
 
-void
+static void
 iwm_enable_interrupts(struct iwm_softc *sc)
 {
 	sc->sc_intmask = IWM_CSR_INI_SET_MASK;
 	IWM_WRITE(sc, IWM_CSR_INT_MASK, sc->sc_intmask);
 }
 
-void
+static void
 iwm_restore_interrupts(struct iwm_softc *sc)
 {
 	IWM_WRITE(sc, IWM_CSR_INT_MASK, sc->sc_intmask);
 }
 
-void
+static void
 iwm_disable_interrupts(struct iwm_softc *sc)
 {
 	int s = splnet();
@@ -1316,7 +1346,7 @@ iwm_disable_interrupts(struct iwm_softc 
 	splx(s);
 }
 
-void
+static void
 iwm_ict_reset(struct iwm_softc *sc)
 {
 	iwm_disable_interrupts(sc);
@@ -1340,7 +1370,7 @@ iwm_ict_reset(struct iwm_softc *sc)
 }
 
 #define IWM_HW_READY_TIMEOUT 50
-int
+static int
 iwm_set_hw_ready(struct iwm_softc *sc)
 {
 	IWM_SETBITS(sc, IWM_CSR_HW_IF_CONFIG_REG,
@@ -1353,7 +1383,7 @@ iwm_set_hw_ready(struct iwm_softc *sc)
 }
 #undef IWM_HW_READY_TIMEOUT
 
-int
+static int
 iwm_prepare_card_hw(struct iwm_softc *sc)
 {
 	int rv = 0;
@@ -1379,7 +1409,7 @@ iwm_prepare_card_hw(struct iwm_softc *sc
 	return rv;
 }
 
-void
+static void
 iwm_apm_config(struct iwm_softc *sc)
 {
 	pcireg_t reg;
@@ -1402,7 +1432,7 @@ iwm_apm_config(struct iwm_softc *sc)
  * (e.g. after platform boot, or shutdown via iwm_pcie_apm_stop())
  * NOTE:  This does not load uCode nor start the embedded processor
  */
-int
+static int
 iwm_apm_init(struct iwm_softc *sc)
 {
 	int error = 0;
@@ -1504,7 +1534,7 @@ iwm_apm_init(struct iwm_softc *sc)
 }
 
 /* iwlwifi/pcie/trans.c */
-void
+static void
 iwm_apm_stop(struct iwm_softc *sc)
 {
 	/* stop device's busmaster DMA activity */
@@ -1518,7 +1548,7 @@ iwm_apm_stop(struct iwm_softc *sc)
 }
 
 /* iwlwifi pcie/trans.c */
-int
+static int
 iwm_start_hw(struct iwm_softc *sc)
 {
 	int error;
@@ -1543,7 +1573,7 @@ iwm_start_hw(struct iwm_softc *sc)
 
 /* iwlwifi pcie/trans.c */
 
-void
+static void
 iwm_stop_device(struct iwm_softc *sc)
 {
 	int chnl, ntries;
@@ -1613,7 +1643,7 @@ iwm_stop_device(struct iwm_softc *sc)
 }
 
 /* iwlwifi pcie/trans.c (always main power) */
-void
+static void
 iwm_set_pwr(struct iwm_softc *sc)
 {
 	iwm_set_bits_mask_prph(sc, IWM_APMG_PS_CTRL_REG,
@@ -1621,7 +1651,7 @@ iwm_set_pwr(struct iwm_softc *sc)
 }
 
 /* iwlwifi: mvm/ops.c */
-void
+static void
 iwm_mvm_nic_config(struct iwm_softc *sc)
 {
 	uint8_t radio_cfg_type, radio_cfg_step, radio_cfg_dash;
@@ -1660,7 +1690,7 @@ iwm_mvm_nic_config(struct iwm_softc *sc)
 	    ~IWM_APMG_PS_CTRL_EARLY_PWR_OFF_RESET_DIS);
 }
 
-int
+static int
 iwm_nic_rx_init(struct iwm_softc *sc)
 {
 	if (!iwm_nic_lock(sc))
@@ -1716,7 +1746,7 @@ iwm_nic_rx_init(struct iwm_softc *sc)
 	return 0;
 }
 
-int
+static int
 iwm_nic_tx_init(struct iwm_softc *sc)
 {
 	int qid;
@@ -1745,7 +1775,7 @@ iwm_nic_tx_init(struct iwm_softc *sc)
 	return 0;
 }
 
-int
+static int
 iwm_nic_init(struct iwm_softc *sc)
 {
 	int error;
@@ -1778,14 +1808,14 @@ enum iwm_mvm_tx_fifo {
 	IWM_MVM_TX_FIFO_MCAST = 5,
 };
 
-const uint8_t iwm_mvm_ac_to_tx_fifo[] = {
+static const uint8_t iwm_mvm_ac_to_tx_fifo[] = {
         IWM_MVM_TX_FIFO_VO,
         IWM_MVM_TX_FIFO_VI,
         IWM_MVM_TX_FIFO_BE,
         IWM_MVM_TX_FIFO_BK,
 };
 
-void
+static void
 iwm_enable_txq(struct iwm_softc *sc, int qid, int fifo)
 {
 	if (!iwm_nic_lock(sc)) {
@@ -1828,7 +1858,7 @@ iwm_enable_txq(struct iwm_softc *sc, int
 	DPRINTF(("enabled txq %d FIFO %d\n", qid, fifo));
 }
 
-int
+static int
 iwm_post_alive(struct iwm_softc *sc)
 {
 	int nwords;
@@ -1993,7 +2023,7 @@ iwm_phy_db_set_section(struct iwm_softc 
 	return 0;
 }
 
-int
+static int
 iwm_is_valid_channel(uint16_t ch_id)
 {
 	if (ch_id <= 14 ||
@@ -2004,7 +2034,7 @@ iwm_is_valid_channel(uint16_t ch_id)
 	return 0;
 }
 
-uint8_t
+static uint8_t
 iwm_ch_id_to_ch_index(uint16_t ch_id)
 {
 	if (!iwm_is_valid_channel(ch_id))
@@ -2020,7 +2050,7 @@ iwm_ch_id_to_ch_index(uint16_t ch_id)
 }
 
 
-uint16_t
+static uint16_t
 iwm_channel_id_to_papd(uint16_t ch_id)
 {
 	if (!iwm_is_valid_channel(ch_id))
@@ -2035,7 +2065,7 @@ iwm_channel_id_to_papd(uint16_t ch_id)
 	return 3;
 }
 
-uint16_t
+static uint16_t
 iwm_channel_id_to_txp(struct iwm_softc *sc, uint16_t ch_id)
 {
 	struct iwm_phy_db *phy_db = &sc->sc_phy_db;
@@ -2060,7 +2090,7 @@ iwm_channel_id_to_txp(struct iwm_softc *
 	return 0xff;
 }
 
-int
+static int
 iwm_phy_db_get_section_data(struct iwm_softc *sc,
 	uint32_t type, uint8_t **data, uint16_t *size, uint16_t ch_id)
 {
@@ -2086,7 +2116,7 @@ iwm_phy_db_get_section_data(struct iwm_s
 	return 0;
 }
 
-int
+static int
 iwm_send_phy_db_cmd(struct iwm_softc *sc, uint16_t type,
 	uint16_t length, void *data)
 {
@@ -2143,7 +2173,7 @@ iwm_phy_db_send_all_channel_groups(struc
 	return 0;
 }
 
-int
+static int
 iwm_send_phy_db_data(struct iwm_softc *sc)
 {
 	uint8_t *data = NULL;
@@ -2241,7 +2271,7 @@ iwm_te_v2_get_absence(uint16_t policy)
 	return (le16toh(policy) & IWM_TE_V2_ABSENCE) >> IWM_TE_V2_ABSENCE_POS;
 }
 
-void
+static void
 iwm_mvm_te_v2_to_v1(const struct iwm_time_event_cmd_v2 *cmd_v2,
 	struct iwm_time_event_cmd_v1 *cmd_v1)
 {
@@ -2265,7 +2295,7 @@ iwm_mvm_te_v2_to_v1(const struct iwm_tim
 	cmd_v1->notify = htole32(iwm_te_v2_get_notify(cmd_v2->policy));
 }
 
-int
+static int
 iwm_mvm_send_time_event_cmd(struct iwm_softc *sc,
 	const struct iwm_time_event_cmd_v2 *cmd)
 {
@@ -2280,7 +2310,7 @@ iwm_mvm_send_time_event_cmd(struct iwm_s
 	    sizeof(cmd_v1), &cmd_v1);
 }
 
-int
+static int
 iwm_mvm_time_event_send_add(struct iwm_softc *sc, struct iwm_node *in,
 	void *te_data, struct iwm_time_event_cmd_v2 *te_cmd)
 {
@@ -2297,7 +2327,7 @@ iwm_mvm_time_event_send_add(struct iwm_s
 	return ret;
 }
 
-void
+static void
 iwm_mvm_protect_session(struct iwm_softc *sc, struct iwm_node *in,
 	uint32_t duration, uint32_t min_duration, uint32_t max_delay)
 {
@@ -2337,7 +2367,7 @@ iwm_mvm_protect_session(struct iwm_softc
  */
 
 /* list of NVM sections we are allowed/need to read */
-const int nvm_to_read[] = {
+static const int nvm_to_read[] = {
 	IWM_NVM_SECTION_TYPE_HW,
 	IWM_NVM_SECTION_TYPE_SW,
 	IWM_NVM_SECTION_TYPE_CALIBRATION,
@@ -2351,7 +2381,7 @@ const int nvm_to_read[] = {
 #define IWM_NVM_WRITE_OPCODE 1
 #define IWM_NVM_READ_OPCODE 0
 
-int
+static int
 iwm_nvm_read_chunk(struct iwm_softc *sc, uint16_t section,
 	uint16_t offset, uint16_t length, uint8_t *data, uint16_t *len)
 {
@@ -2426,7 +2456,7 @@ iwm_nvm_read_chunk(struct iwm_softc *sc,
  * the uCode fills the response with as much data as we can,
  * without overflowing, so no check is needed.
  */
-int
+static int
 iwm_nvm_read_section(struct iwm_softc *sc,
 	uint16_t section, uint8_t *data, uint16_t *len)
 {
@@ -2520,7 +2550,7 @@ enum iwm_nvm_channel_flags {
 	IWM_NVM_CHANNEL_160MHZ = (1 << 11),
 };
 
-void
+static void
 iwm_init_channel_map(struct iwm_softc *sc, const uint16_t * const nvm_ch_flags)
 {
 	struct ieee80211com *ic = &sc->sc_ic;
@@ -2570,7 +2600,7 @@ iwm_init_channel_map(struct iwm_softc *s
 	}
 }
 
-int
+static int
 iwm_parse_nvm_data(struct iwm_softc *sc,
 	const uint16_t *nvm_hw, const uint16_t *nvm_sw,
 	const uint16_t *nvm_calib, uint8_t tx_chains, uint8_t rx_chains)
@@ -2664,7 +2694,7 @@ iwm_parse_nvm_sections(struct iwm_softc 
 	    IWM_FW_VALID_TX_ANT(sc), IWM_FW_VALID_RX_ANT(sc));
 }
 
-int
+static int
 iwm_nvm_init(struct iwm_softc *sc)
 {
 	struct iwm_nvm_section nvm_sections[IWM_NVM_NUM_OF_SECTIONS];
@@ -2702,7 +2732,7 @@ iwm_nvm_init(struct iwm_softc *sc)
  * iwn driver and the Linux iwlwifi driver.
  */
 
-int
+static int
 iwm_firmware_load_chunk(struct iwm_softc *sc, uint32_t dst_addr,
 	const uint8_t *section, uint32_t byte_cnt)
 {
@@ -2747,7 +2777,7 @@ iwm_firmware_load_chunk(struct iwm_softc
         return error;
 }
 
-int
+static int
 iwm_load_firmware(struct iwm_softc *sc, enum iwm_ucode_type ucode_type)
 {
 	struct iwm_fw_sects *fws;
@@ -2783,7 +2813,7 @@ iwm_load_firmware(struct iwm_softc *sc, 
 }
 
 /* iwlwifi: pcie/trans.c */
-int
+static int
 iwm_start_fw(struct iwm_softc *sc, enum iwm_ucode_type ucode_type)
 {
 	int error;
@@ -2813,13 +2843,13 @@ iwm_start_fw(struct iwm_softc *sc, enum 
 	return iwm_load_firmware(sc, ucode_type);
 }
 
-int
+static int
 iwm_fw_alive(struct iwm_softc *sc, uint32_t sched_base)
 {
 	return iwm_post_alive(sc);
 }
 
-int
+static int
 iwm_send_tx_ant_cfg(struct iwm_softc *sc, uint8_t valid_tx_ant)
 {
 	struct iwm_tx_ant_cfg_cmd tx_ant_cmd = {
@@ -2831,7 +2861,7 @@ iwm_send_tx_ant_cfg(struct iwm_softc *sc
 }
 
 /* iwlwifi: mvm/fw.c */
-int
+static int
 iwm_send_phy_cfg_cmd(struct iwm_softc *sc)
 {
 	struct iwm_phy_cfg_cmd phy_cfg_cmd;
@@ -2849,7 +2879,7 @@ iwm_send_phy_cfg_cmd(struct iwm_softc *s
 	    sizeof(phy_cfg_cmd), &phy_cfg_cmd);
 }
 
-int
+static int
 iwm_mvm_load_ucode_wait_alive(struct iwm_softc *sc,
 	enum iwm_ucode_type ucode_type)
 {
@@ -2876,7 +2906,7 @@ iwm_mvm_load_ucode_wait_alive(struct iwm
 /*
  * follows iwlwifi/fw.c
  */
-int
+static int
 iwm_run_init_mvm_ucode(struct iwm_softc *sc, int justnvm)
 {
 	int error;
@@ -2941,7 +2971,7 @@ iwm_run_init_mvm_ucode(struct iwm_softc 
  */
 
 /* (re)stock rx ring, called at init-time and at runtime */
-int
+static int
 iwm_rx_addbuf(struct iwm_softc *sc, int size, int idx)
 {
 	struct iwm_rx_ring *ring = &sc->rxq;
@@ -2991,7 +3021,7 @@ iwm_rx_addbuf(struct iwm_softc *sc, int 
 
 /* iwlwifi: mvm/rx.c */
 #define IWM_RSSI_OFFSET 50
-int
+static int
 iwm_mvm_calc_rssi(struct iwm_softc *sc, struct iwm_rx_phy_info *phy_info)
 {
 	int rssi_a, rssi_b, rssi_a_dbm, rssi_b_dbm, max_rssi_dbm;
@@ -3027,7 +3057,7 @@ iwm_mvm_calc_rssi(struct iwm_softc *sc, 
  * to obtain their dBM.  Account for missing antennas by replacing 0
  * values by -256dBm: practically 0 power and a non-feasible 8 bit value.
  */
-int
+static int
 iwm_mvm_get_signal_strength(struct iwm_softc *sc, struct iwm_rx_phy_info *phy_info)
 {
 	int energy_a, energy_b, energy_c, max_energy;
@@ -3052,7 +3082,7 @@ iwm_mvm_get_signal_strength(struct iwm_s
 	return max_energy;
 }
 
-void
+static void
 iwm_mvm_rx_rx_phy_cmd(struct iwm_softc *sc,
 	struct iwm_rx_packet *pkt, struct iwm_rx_data *data)
 {
@@ -3068,7 +3098,7 @@ iwm_mvm_rx_rx_phy_cmd(struct iwm_softc *
 /*
  * Retrieve the average noise (in dBm) among receivers.
  */
-int
+static int
 iwm_get_noise(const struct iwm_mvm_statistics_rx_non_phy *stats)
 {
 	int i, total, nbant, noise;
@@ -3091,7 +3121,7 @@ iwm_get_noise(const struct iwm_mvm_stati
  *
  * Handles the actual data of the Rx packet from the fw
  */
-void
+static void
 iwm_mvm_rx_rx_mpdu(struct iwm_softc *sc,
 	struct iwm_rx_packet *pkt, struct iwm_rx_data *data)
 {
@@ -3197,7 +3227,7 @@ iwm_mvm_rx_rx_mpdu(struct iwm_softc *sc,
 	ieee80211_free_node(ni);
 }
 
-void
+static void
 iwm_mvm_rx_tx_cmd_single(struct iwm_softc *sc, struct iwm_rx_packet *pkt,
 	struct iwm_node *in)
 {
@@ -3222,7 +3252,7 @@ iwm_mvm_rx_tx_cmd_single(struct iwm_soft
 		ifp->if_opackets++;
 }
 
-void
+static void
 iwm_mvm_rx_tx_cmd(struct iwm_softc *sc, 
 	struct iwm_rx_packet *pkt, struct iwm_rx_data *data)
 {
@@ -3281,7 +3311,7 @@ iwm_mvm_rx_tx_cmd(struct iwm_softc *sc, 
  * BEGIN iwlwifi/mvm/binding.c
  */
 
-int
+static int
 iwm_mvm_binding_cmd(struct iwm_softc *sc, struct iwm_node *in, uint32_t action)
 {
 	struct iwm_binding_cmd cmd;
@@ -3318,13 +3348,13 @@ iwm_mvm_binding_cmd(struct iwm_softc *sc
 	return ret;
 }
 
-int
+static int
 iwm_mvm_binding_update(struct iwm_softc *sc, struct iwm_node *in, int add)
 {
 	return iwm_mvm_binding_cmd(sc, in, IWM_FW_CTXT_ACTION_ADD);
 }
 
-int
+static int
 iwm_mvm_binding_add_vif(struct iwm_softc *sc, struct iwm_node *in)
 {
 	return iwm_mvm_binding_update(sc, in, IWM_FW_CTXT_ACTION_ADD);
@@ -3341,7 +3371,7 @@ iwm_mvm_binding_add_vif(struct iwm_softc
 /*
  * Construct the generic fields of the PHY context command
  */
-void
+static void
 iwm_mvm_phy_ctxt_cmd_hdr(struct iwm_softc *sc, struct iwm_mvm_phy_ctxt *ctxt,
 	struct iwm_phy_context_cmd *cmd, uint32_t action, uint32_t apply_time)
 {
@@ -3356,7 +3386,7 @@ iwm_mvm_phy_ctxt_cmd_hdr(struct iwm_soft
 /*
  * Add the phy configuration to the PHY context command
  */
-void
+static void
 iwm_mvm_phy_ctxt_cmd_data(struct iwm_softc *sc,
 	struct iwm_phy_context_cmd *cmd, struct ieee80211_channel *chan,
 	uint8_t chains_static, uint8_t chains_dynamic)
@@ -3390,7 +3420,7 @@ iwm_mvm_phy_ctxt_cmd_data(struct iwm_sof
  * first time that the phy configuration is applied or in case that the phy
  * configuration changed from the previous apply.
  */
-int
+static int
 iwm_mvm_phy_ctxt_apply(struct iwm_softc *sc,
 	struct iwm_mvm_phy_ctxt *ctxt,
 	uint8_t chains_static, uint8_t chains_dynamic,
@@ -3417,7 +3447,7 @@ iwm_mvm_phy_ctxt_apply(struct iwm_softc 
 /*
  * Send a command to add a PHY context based on the current HW configuration.
  */
-int
+static int
 iwm_mvm_phy_ctxt_add(struct iwm_softc *sc, struct iwm_mvm_phy_ctxt *ctxt,
 	struct ieee80211_channel *chan,
 	uint8_t chains_static, uint8_t chains_dynamic)
@@ -3432,7 +3462,7 @@ iwm_mvm_phy_ctxt_add(struct iwm_softc *s
  * configuration. Note that the function does not check that the configuration
  * changed.
  */
-int
+static int
 iwm_mvm_phy_ctxt_changed(struct iwm_softc *sc,
 	struct iwm_mvm_phy_ctxt *ctxt, struct ieee80211_channel *chan,
 	uint8_t chains_static, uint8_t chains_dynamic)
@@ -3457,7 +3487,7 @@ iwm_mvm_phy_ctxt_changed(struct iwm_soft
  *
  * For now, we always copy the first part and map the second one (if it exists).
  */
-int
+static int
 iwm_send_cmd(struct iwm_softc *sc, struct iwm_host_cmd *hcmd)
 {
 	struct iwm_tx_ring *ring = &sc->txq[IWM_MVM_CMD_QUEUE];
@@ -3611,7 +3641,7 @@ iwm_send_cmd(struct iwm_softc *sc, struc
 }
 
 /* iwlwifi: mvm/utils.c */
-int
+static int
 iwm_mvm_send_cmd_pdu(struct iwm_softc *sc, uint8_t id,
 	uint32_t flags, uint16_t len, const void *data)
 {
@@ -3626,7 +3656,7 @@ iwm_mvm_send_cmd_pdu(struct iwm_softc *s
 }
 
 /* iwlwifi: mvm/utils.c */
-int
+static int
 iwm_mvm_send_cmd_status(struct iwm_softc *sc,
 	struct iwm_host_cmd *cmd, uint32_t *status)
 {
@@ -3668,7 +3698,7 @@ iwm_mvm_send_cmd_status(struct iwm_softc
 }
 
 /* iwlwifi/mvm/utils.c */
-int
+static int
 iwm_mvm_send_cmd_pdu_status(struct iwm_softc *sc, uint8_t id,
 	uint16_t len, const void *data, uint32_t *status)
 {
@@ -3681,7 +3711,7 @@ iwm_mvm_send_cmd_pdu_status(struct iwm_s
 	return iwm_mvm_send_cmd_status(sc, &cmd, status);
 }
 
-void
+static void
 iwm_free_resp(struct iwm_softc *sc, struct iwm_host_cmd *hcmd)
 {
 	KASSERT(sc->sc_wantresp != -1);
@@ -3696,7 +3726,7 @@ iwm_free_resp(struct iwm_softc *sc, stru
  * processes waiting for a synchronous command completion.
  * from if_iwn
  */
-void
+static void
 iwm_cmd_done(struct iwm_softc *sc, struct iwm_rx_packet *pkt)
 {
 	struct iwm_tx_ring *ring = &sc->txq[IWM_MVM_CMD_QUEUE];
@@ -3760,7 +3790,7 @@ iwm_update_sched(struct iwm_softc *sc, i
  * unfilled for data frames (firmware takes care of that).
  * Return the selected TX rate.
  */
-const struct iwm_rate *
+static const struct iwm_rate *
 iwm_tx_fill_cmd(struct iwm_softc *sc, struct iwm_node *in,
 	struct ieee80211_frame *wh, struct iwm_tx_cmd *tx)
 {
@@ -3797,7 +3827,7 @@ iwm_tx_fill_cmd(struct iwm_softc *sc, st
 }
 
 #define TB0_SIZE 16
-int
+static int
 iwm_tx(struct iwm_softc *sc, struct mbuf *m, struct ieee80211_node *ni, int ac)
 {
 	struct ieee80211com *ic = &sc->sc_ic;
@@ -4027,7 +4057,7 @@ iwm_tx(struct iwm_softc *sc, struct mbuf
 
 #if 0
 /* not necessary? */
-int
+static int
 iwm_mvm_flush_tx_path(struct iwm_softc *sc, int tfd_msk, int sync)
 {
 	struct iwm_tx_path_flush_cmd flush_cmd = {
@@ -4053,7 +4083,7 @@ iwm_mvm_flush_tx_path(struct iwm_softc *
 
 #define IWM_POWER_KEEP_ALIVE_PERIOD_SEC    25
 
-int
+static int
 iwm_mvm_beacon_filter_send_cmd(struct iwm_softc *sc,
 	struct iwm_beacon_filter_cmd *cmd)
 {
@@ -4089,14 +4119,14 @@ iwm_mvm_beacon_filter_send_cmd(struct iw
 	return ret;
 }
 
-void
+static void
 iwm_mvm_beacon_filter_set_cqm_params(struct iwm_softc *sc,
 	struct iwm_node *in, struct iwm_beacon_filter_cmd *cmd)
 {
 	cmd->ba_enable_beacon_abort = htole32(sc->sc_bf.ba_enabled);
 }
 
-int
+static int
 iwm_mvm_update_beacon_abort(struct iwm_softc *sc, struct iwm_node *in,
 	int enable)
 {
@@ -4114,7 +4144,7 @@ iwm_mvm_update_beacon_abort(struct iwm_s
 	return iwm_mvm_beacon_filter_send_cmd(sc, &cmd);
 }
 
-void
+static void
 iwm_mvm_power_log(struct iwm_softc *sc, struct iwm_mac_power_cmd *cmd)
 {
 	DPRINTF(("Sending power table command on mac id 0x%X for "
@@ -4152,7 +4182,7 @@ iwm_mvm_power_log(struct iwm_softc *sc, 
 #endif
 }
 
-void
+static void
 iwm_mvm_power_build_cmd(struct iwm_softc *sc, struct iwm_node *in,
 	struct iwm_mac_power_cmd *cmd)
 {
@@ -4178,7 +4208,7 @@ iwm_mvm_power_build_cmd(struct iwm_softc
 	cmd->keep_alive_seconds = htole16(keep_alive);
 }
 
-int
+static int
 iwm_mvm_power_mac_update_mode(struct iwm_softc *sc, struct iwm_node *in)
 {
 	int ret;
@@ -4199,7 +4229,7 @@ iwm_mvm_power_mac_update_mode(struct iwm
 	return iwm_mvm_update_beacon_abort(sc, in, ba_enable);
 }
 
-int
+static int
 iwm_mvm_power_update_device(struct iwm_softc *sc)
 {
 	struct iwm_device_power_cmd cmd = {
@@ -4216,7 +4246,7 @@ iwm_mvm_power_update_device(struct iwm_s
 	    IWM_POWER_TABLE_CMD, IWM_CMD_SYNC, sizeof(cmd), &cmd);
 }
 
-int
+static int
 iwm_mvm_enable_beacon_filter(struct iwm_softc *sc, struct iwm_node *in)
 {
 	struct iwm_beacon_filter_cmd cmd = {
@@ -4234,7 +4264,7 @@ iwm_mvm_enable_beacon_filter(struct iwm_
 	return ret;
 }
 
-int
+static int
 iwm_mvm_disable_beacon_filter(struct iwm_softc *sc, struct iwm_node *in)
 {
 	struct iwm_beacon_filter_cmd cmd;
@@ -4252,7 +4282,7 @@ iwm_mvm_disable_beacon_filter(struct iwm
 }
 
 #if 0
-int
+static int
 iwm_mvm_update_beacon_filter(struct iwm_softc *sc, struct iwm_node *in)
 {
 	if (!sc->sc_bf.bf_enabled)
@@ -4270,7 +4300,7 @@ iwm_mvm_update_beacon_filter(struct iwm_
  * BEGIN mvm/sta.c
  */
 
-void
+static void
 iwm_mvm_add_sta_cmd_v6_to_v5(struct iwm_mvm_add_sta_cmd_v6 *cmd_v6,
 	struct iwm_mvm_add_sta_cmd_v5 *cmd_v5)
 {
@@ -4294,7 +4324,7 @@ iwm_mvm_add_sta_cmd_v6_to_v5(struct iwm_
 	cmd_v5->tfd_queue_msk = cmd_v6->tfd_queue_msk;
 }
 
-int
+static int
 iwm_mvm_send_add_sta_cmd_status(struct iwm_softc *sc,
 	struct iwm_mvm_add_sta_cmd_v6 *cmd, int *status)
 {
@@ -4312,7 +4342,7 @@ iwm_mvm_send_add_sta_cmd_status(struct i
 }
 
 /* send station add/update command to firmware */
-int
+static int
 iwm_mvm_sta_send_to_fw(struct iwm_softc *sc, struct iwm_node *in, int update)
 {
 	struct iwm_mvm_add_sta_cmd_v6 add_sta_cmd;
@@ -4349,7 +4379,7 @@ iwm_mvm_sta_send_to_fw(struct iwm_softc 
 	return ret;
 }
 
-int
+static int
 iwm_mvm_add_sta(struct iwm_softc *sc, struct iwm_node *in)
 {
 	int ret;
@@ -4361,13 +4391,13 @@ iwm_mvm_add_sta(struct iwm_softc *sc, st
 	return 0;
 }
 
-int
+static int
 iwm_mvm_update_sta(struct iwm_softc *sc, struct iwm_node *in)
 {
 	return iwm_mvm_sta_send_to_fw(sc, in, 1);
 }
 
-int
+static int
 iwm_mvm_add_int_sta_common(struct iwm_softc *sc, struct iwm_int_sta *sta,
 	const uint8_t *addr, uint16_t mac_id, uint16_t color)
 {
@@ -4401,7 +4431,7 @@ iwm_mvm_add_int_sta_common(struct iwm_so
 	return ret;
 }
 
-int
+static int
 iwm_mvm_add_aux_sta(struct iwm_softc *sc)
 {
 	int ret;
@@ -4431,7 +4461,7 @@ iwm_mvm_add_aux_sta(struct iwm_softc *sc
 #define SHORT_OUT_TIME_PERIOD 200
 #define SUSPEND_TIME_PERIOD 100
 
-uint16_t
+static uint16_t
 iwm_mvm_scan_rx_chain(struct iwm_softc *sc)
 {
 	uint16_t rx_chain;
@@ -4447,7 +4477,7 @@ iwm_mvm_scan_rx_chain(struct iwm_softc *
 
 #define ieee80211_tu_to_usec(a) (1024*(a))
 
-uint32_t
+static uint32_t
 iwm_mvm_scan_max_out_time(struct iwm_softc *sc, uint32_t flags, int is_assoc)
 {
 	if (!is_assoc)
@@ -4457,7 +4487,7 @@ iwm_mvm_scan_max_out_time(struct iwm_sof
 	return htole32(ieee80211_tu_to_usec(LONG_OUT_TIME_PERIOD));
 }
 
-uint32_t
+static uint32_t
 iwm_mvm_scan_suspend_time(struct iwm_softc *sc, int is_assoc)
 {
 	if (!is_assoc)
@@ -4465,7 +4495,7 @@ iwm_mvm_scan_suspend_time(struct iwm_sof
 	return htole32(ieee80211_tu_to_usec(SUSPEND_TIME_PERIOD));
 }
 
-uint32_t
+static uint32_t
 iwm_mvm_scan_rxon_flags(struct iwm_softc *sc, int flags)
 {
 	if (flags & IEEE80211_CHAN_2GHZ)
@@ -4474,7 +4504,7 @@ iwm_mvm_scan_rxon_flags(struct iwm_softc
 		return htole32(IWM_PHY_BAND_5);
 }
 
-uint32_t
+static uint32_t
 iwm_mvm_scan_rate_n_flags(struct iwm_softc *sc, int flags, int no_cck)
 {
 	uint32_t tx_ant;
@@ -4507,7 +4537,7 @@ iwm_mvm_scan_rate_n_flags(struct iwm_sof
  * already included in the probe template, so we need to set only
  * req->n_ssids - 1 bits in addition to the first bit.
  */
-uint16_t
+static uint16_t
 iwm_mvm_get_active_dwell(struct iwm_softc *sc, int flags, int n_ssids)
 {
 	if (flags & IEEE80211_CHAN_2GHZ)
@@ -4515,13 +4545,13 @@ iwm_mvm_get_active_dwell(struct iwm_soft
 	return 20  + 2 * (n_ssids + 1);
 }
 
-uint16_t
+static uint16_t
 iwm_mvm_get_passive_dwell(struct iwm_softc *sc, int flags)
 {
 	return (flags & IEEE80211_CHAN_2GHZ) ? 100 + 20 : 100 + 10;
 }
 
-int
+static int
 iwm_mvm_scan_fill_channels(struct iwm_softc *sc, struct iwm_scan_cmd *cmd,
 	int flags, int n_ssids, int basic_ssid)
 {
@@ -4566,7 +4596,7 @@ iwm_mvm_scan_fill_channels(struct iwm_so
  * SSID if a directed scan is requested. Second comes whatever extra
  * information was given to us as the scan request IE.
  */
-uint16_t
+static uint16_t
 iwm_mvm_fill_probe_req(struct iwm_softc *sc, struct ieee80211_frame *frame,
 	const uint8_t *ta, int n_ssids, const uint8_t *ssid, int ssid_len,
 	const uint8_t *ie, int ie_len, int left)
@@ -4621,7 +4651,7 @@ iwm_mvm_fill_probe_req(struct iwm_softc 
 	return (uint16_t)len;
 }
 
-int
+static int
 iwm_mvm_scan_request(struct iwm_softc *sc, int flags,
 	int n_ssids, uint8_t *ssid, int ssid_len)
 {
@@ -4719,7 +4749,7 @@ iwm_mvm_scan_request(struct iwm_softc *s
  * BEGIN mvm/mac-ctxt.c
  */
 
-void
+static void
 iwm_mvm_ack_rates(struct iwm_softc *sc, struct iwm_node *in,
 	int *cck_rates, int *ofdm_rates)
 {
@@ -4797,7 +4827,7 @@ iwm_mvm_ack_rates(struct iwm_softc *sc, 
 	*ofdm_rates = ofdm;
 }
 
-void
+static void
 iwm_mvm_mac_ctxt_cmd_common(struct iwm_softc *sc, struct iwm_node *in,
 	struct iwm_mac_ctx_cmd *cmd, uint32_t action)
 {
@@ -4846,7 +4876,7 @@ iwm_mvm_mac_ctxt_cmd_common(struct iwm_s
 	cmd->filter_flags = htole32(IWM_MAC_FILTER_ACCEPT_GRP);
 }
 
-int
+static int
 iwm_mvm_mac_ctxt_send_cmd(struct iwm_softc *sc, struct iwm_mac_ctx_cmd *cmd)
 {
 	int ret = iwm_mvm_send_cmd_pdu(sc, IWM_MAC_CONTEXT_CMD, IWM_CMD_SYNC,
@@ -4860,7 +4890,7 @@ iwm_mvm_mac_ctxt_send_cmd(struct iwm_sof
 /*
  * Fill the specific data for mac context of type station or p2p client
  */
-void
+static void
 iwm_mvm_mac_ctxt_cmd_fill_sta(struct iwm_softc *sc, struct iwm_node *in,
 	struct iwm_mac_data_sta *ctxt_sta, int force_assoc_off)
 {
@@ -4919,7 +4949,7 @@ iwm_mvm_mac_ctxt_cmd_fill_sta(struct iwm
 	ctxt_sta->assoc_id = htole32(ni->ni_associd);
 }
 
-int
+static int
 iwm_mvm_mac_ctxt_cmd_station(struct iwm_softc *sc, struct iwm_node *in,
 	uint32_t action)
 {
@@ -4942,13 +4972,13 @@ iwm_mvm_mac_ctxt_cmd_station(struct iwm_
 	return iwm_mvm_mac_ctxt_send_cmd(sc, &cmd);
 }
 
-int
+static int
 iwm_mvm_mac_ctx_send(struct iwm_softc *sc, struct iwm_node *in, uint32_t action)
 {
 	return iwm_mvm_mac_ctxt_cmd_station(sc, in, action);
 }
 
-int
+static int
 iwm_mvm_mac_ctxt_add(struct iwm_softc *sc, struct iwm_node *in)
 {
 	int ret;
@@ -4960,14 +4990,14 @@ iwm_mvm_mac_ctxt_add(struct iwm_softc *s
 	return 0;
 }
 
-int
+static int
 iwm_mvm_mac_ctxt_changed(struct iwm_softc *sc, struct iwm_node *in)
 {
 	return iwm_mvm_mac_ctx_send(sc, in, IWM_FW_CTXT_ACTION_MODIFY);
 }
 
 #if 0
-int
+static int
 iwm_mvm_mac_ctxt_remove(struct iwm_softc *sc, struct iwm_node *in)
 {
 	struct iwm_mac_ctx_cmd cmd;
@@ -5029,7 +5059,7 @@ iwm_mvm_rx_missed_beacons_notif(struct i
  * BEGIN mvm/quota.c
  */
 
-int
+static int
 iwm_mvm_update_quotas(struct iwm_softc *sc, struct iwm_node *in)
 {
 	struct iwm_time_quota_cmd cmd;
@@ -5107,7 +5137,7 @@ iwm_mvm_update_quotas(struct iwm_softc *
  * Change to AUTH state in 80211 state machine.  Roughly matches what
  * Linux does in bss_info_changed().
  */
-int
+static int
 iwm_auth(struct iwm_softc *sc)
 {
 	struct ieee80211com *ic = &sc->sc_ic;
@@ -5169,7 +5199,7 @@ iwm_auth(struct iwm_softc *sc)
 	return 0;
 }
 
-int
+static int
 iwm_assoc(struct iwm_softc *sc)
 {
 	struct ieee80211com *ic = &sc->sc_ic;
@@ -5190,7 +5220,7 @@ iwm_assoc(struct iwm_softc *sc)
 	return 0;
 }
 
-int
+static int
 iwm_release(struct iwm_softc *sc, struct iwm_node *in)
 {
 	/*
@@ -5258,7 +5288,7 @@ iwm_node_alloc(struct ieee80211_node_tab
 	return kmem_zalloc(sizeof (struct iwm_node), KM_NOSLEEP | M_ZERO);
 }
 
-void
+static void
 iwm_calib_timeout(void *arg)
 {
 	struct iwm_softc *sc = arg;
@@ -5277,7 +5307,7 @@ iwm_calib_timeout(void *arg)
 	callout_schedule(&sc->sc_calib_to, hz/2);
 }
 
-void
+static void
 iwm_setrates(struct iwm_node *in)
 {
 	struct ieee80211_node *ni = &in->in_ni;
@@ -5356,7 +5386,7 @@ iwm_setrates(struct iwm_node *in)
 	ni->ni_txrate = nrates-1;
 }
 
-int
+static int
 iwm_media_change(struct ifnet *ifp)
 {
 	struct iwm_softc *sc = ifp->if_softc;
@@ -5386,7 +5416,7 @@ iwm_media_change(struct ifnet *ifp)
 	return error;
 }
 
-void
+static void
 iwm_newstate_cb(void *wk)
 {
 	struct iwm_newstate_state *iwmns = (void *)wk;
@@ -5506,7 +5536,7 @@ iwm_newstate_cb(void *wk)
 	sc->sc_newstate(ic, nstate, arg);
 }
 
-int
+static int
 iwm_newstate(struct ieee80211com *ic, enum ieee80211_state nstate, int arg)
 {
 	struct iwm_newstate_state *iwmns;
@@ -5531,7 +5561,7 @@ iwm_newstate(struct ieee80211com *ic, en
 	return 0;
 }
 
-void
+static void
 iwm_endscan_cb(void *arg)
 {
 	struct iwm_softc *sc = arg;
@@ -5567,7 +5597,7 @@ iwm_endscan_cb(void *arg)
 	}
 }
 
-int
+static int
 iwm_init_hw(struct iwm_softc *sc)
 {
 	struct ieee80211com *ic = &sc->sc_ic;
@@ -5645,7 +5675,7 @@ iwm_init_hw(struct iwm_softc *sc)
  * ifnet interfaces
  */
 
-int
+static int
 iwm_init(struct ifnet *ifp)
 {
 	struct iwm_softc *sc = ifp->if_softc;
@@ -5679,7 +5709,7 @@ iwm_init(struct ifnet *ifp)
  * Dequeue packets from sendq and call send.
  * mostly from iwn
  */
-void
+static void
 iwm_start(struct ifnet *ifp)
 {
 	struct iwm_softc *sc = ifp->if_softc;
@@ -5764,7 +5794,7 @@ iwm_start(struct ifnet *ifp)
 	return;
 }
 
-void
+static void
 iwm_stop(struct ifnet *ifp, int disable)
 {
 	struct iwm_softc *sc = ifp->if_softc;
@@ -5784,7 +5814,7 @@ iwm_stop(struct ifnet *ifp, int disable)
 	iwm_stop_device(sc);
 }
 
-void
+static void
 iwm_watchdog(struct ifnet *ifp)
 {
 	struct iwm_softc *sc = ifp->if_softc;
@@ -5807,7 +5837,7 @@ iwm_watchdog(struct ifnet *ifp)
 	ieee80211_watchdog(&sc->sc_ic);
 }
 
-int
+static int
 iwm_ioctl(struct ifnet *ifp, u_long cmd, void *data)
 {
 	struct iwm_softc *sc = ifp->if_softc;
@@ -5927,7 +5957,8 @@ struct iwm_error_event_table {
 #define ERROR_START_OFFSET  (1 * sizeof(uint32_t))
 #define ERROR_ELEM_SIZE     (7 * sizeof(uint32_t))
 
-struct {
+#ifdef IWM_DEBUG
+static const struct {
 	const char *name;
 	uint8_t num;
 } advanced_lookup[] = {
@@ -5949,7 +5980,7 @@ struct {
 	{ "ADVANCED_SYSASSERT", 0 },
 };
 
-const char *
+static const char *
 iwm_desc_lookup(uint32_t num)
 {
 	int i;
@@ -5962,7 +5993,6 @@ iwm_desc_lookup(uint32_t num)
 	return advanced_lookup[i].name;
 }
 
-#ifdef IWM_DEBUG
 /*
  * Support for dumping the error log seemed like a good idea ...
  * but it's mostly hex junk and the only sensible thing is the
@@ -5970,7 +6000,7 @@ iwm_desc_lookup(uint32_t num)
  * I'll just leave it in, just in case e.g. the Intel guys want to
  * help us decipher some "ADVANCED_SYSASSERT" later.
  */
-void
+static void
 iwm_nic_error(struct iwm_softc *sc)
 {
 	struct iwm_error_event_table table;
@@ -6061,7 +6091,7 @@ do {									\
  * Process an IWM_CSR_INT_BIT_FH_RX or IWM_CSR_INT_BIT_SW_RX interrupt.
  * Basic structure from if_iwn
  */
-void
+static void
 iwm_notif_intr(struct iwm_softc *sc)
 {
 	uint16_t hw;
@@ -6258,7 +6288,7 @@ iwm_notif_intr(struct iwm_softc *sc)
 	IWM_WRITE(sc, IWM_FH_RSCSR_CHNL0_WPTR, hw & ~7);
 }
 
-int
+static int
 iwm_intr(void *arg)
 {
 	struct iwm_softc *sc = arg;
@@ -6415,7 +6445,7 @@ static const pci_product_id_t iwm_device
 };
 
 static int
-iwm_match(struct device *parent, cfdata_t match __unused, void *aux)
+iwm_match(device_t parent, cfdata_t match __unused, void *aux)
 {
 	struct pci_attach_args *pa = aux;
 	size_t i;
@@ -6430,7 +6460,7 @@ iwm_match(struct device *parent, cfdata_
 	return 0;
 }
 
-int
+static int
 iwm_preinit(struct iwm_softc *sc)
 {
 	int error;
@@ -6453,8 +6483,8 @@ iwm_preinit(struct iwm_softc *sc)
 	return error;
 }
 
-void
-iwm_attach_hook(struct device *dev)
+static void
+iwm_attach_hook(device_t dev)
 {
 	struct iwm_softc *sc = device_private(dev);
 	struct ieee80211com *ic = &sc->sc_ic;
@@ -6540,8 +6570,8 @@ iwm_attach_hook(struct device *dev)
 	//task_set(&sc->init_task, iwm_init_task, sc);
 }
 
-void
-iwm_attach(struct device *parent, struct device *self, void *aux)
+static void
+iwm_attach(device_t parent, device_t self, void *aux)
 {
 	struct iwm_softc *sc = device_private(self);
 	struct pci_attach_args *pa = aux;
@@ -6718,7 +6748,7 @@ iwm_radiotap_attach(struct iwm_softc *sc
 }
 
 #if 0
-void
+static void
 iwm_init_task(void *arg1)
 {
 	struct iwm_softc *sc = arg1;
@@ -6739,7 +6769,7 @@ iwm_init_task(void *arg1)
 	splx(s);
 }
 
-void
+static void
 iwm_wakeup(struct iwm_softc *sc)
 {
 	pcireg_t reg;
@@ -6749,26 +6779,22 @@ iwm_wakeup(struct iwm_softc *sc)
 	pci_conf_write(sc->sc_pct, sc->sc_pcitag, 0x40, reg & ~0xff00);
 
 	iwm_init_task(sc);
-
 }
 
-int
-iwm_activate(struct device *self, int act)
+static int
+iwm_activate(device_t self, enum devact act)
 {
-	struct iwm_softc *sc = (struct iwm_softc *)self;
-	struct ifnet *ifp = &sc->sc_ic.ic_if;
+	struct iwm_softc *sc = device_private(self);
+	struct ifnet *ifp = IC2IFP(&sc->sc_ic);
 
 	switch (act) {
-	case DVACT_SUSPEND:
+	case DVACT_DEACTIVATE:
 		if (ifp->if_flags & IFF_RUNNING)
 			iwm_stop(ifp, 0);
-		break;
-	case DVACT_WAKEUP:
-		iwm_wakeup(sc);
-		break;
+		return 0;
+	default:
+		return EOPNOTSUPP;
 	}
-
-	return 0;
 }
 #endif
 

Reply via email to