hc
2024-12-19 9370bb92b2d16684ee45cf24e879c93c509162da
kernel/drivers/net/wireless/intel/iwlegacy/common.c
....@@ -1,25 +1,7 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /******************************************************************************
23 *
3
- * GPL LICENSE SUMMARY
4
- *
54 * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
6
- *
7
- * This program is free software; you can redistribute it and/or modify
8
- * it under the terms of version 2 of the GNU General Public License as
9
- * published by the Free Software Foundation.
10
- *
11
- * This program is distributed in the hope that it will be useful, but
12
- * WITHOUT ANY WARRANTY; without even the implied warranty of
13
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
- * General Public License for more details.
15
- *
16
- * You should have received a copy of the GNU General Public License
17
- * along with this program; if not, write to the Free Software
18
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110,
19
- * USA
20
- *
21
- * The full GNU General Public License is included in this distribution
22
- * in the file called LICENSE.GPL.
235 *
246 * Contact Information:
257 * Intel Linux Wireless <ilw@linux.intel.com>
....@@ -703,7 +685,7 @@
703685 }
704686 EXPORT_SYMBOL(il_eeprom_query16);
705687
706
-/**
688
+/*
707689 * il_eeprom_init - read EEPROM contents
708690 *
709691 * Load the EEPROM contents from adapter into il->eeprom
....@@ -854,7 +836,7 @@
854836
855837 #define CHECK_AND_PRINT(x) ((eeprom_ch->flags & EEPROM_CHANNEL_##x) \
856838 ? # x " " : "")
857
-/**
839
+/*
858840 * il_mod_ht40_chan_info - Copy ht40 channel info into driver's il.
859841 *
860842 * Does not set up a command, or touch hardware.
....@@ -895,7 +877,7 @@
895877 #define CHECK_AND_PRINT_I(x) ((eeprom_ch_info[ch].flags & EEPROM_CHANNEL_##x) \
896878 ? # x " " : "")
897879
898
-/**
880
+/*
899881 * il_init_channel_map - Set up driver's info for all possible channels
900882 */
901883 int
....@@ -1042,7 +1024,7 @@
10421024 }
10431025 EXPORT_SYMBOL(il_free_channel_map);
10441026
1045
-/**
1027
+/*
10461028 * il_get_channel_info - Find driver's ilate channel info
10471029 *
10481030 * Based on band and channel number.
....@@ -1090,7 +1072,7 @@
10901072 static void
10911073 il_build_powertable_cmd(struct il_priv *il, struct il_powertable_cmd *cmd)
10921074 {
1093
- const __le32 interval[3][IL_POWER_VEC_SIZE] = {
1075
+ static const __le32 interval[3][IL_POWER_VEC_SIZE] = {
10941076 SLP_VEC(2, 2, 4, 6, 0xFF),
10951077 SLP_VEC(2, 4, 7, 10, 10),
10961078 SLP_VEC(4, 7, 10, 10, 0xFF)
....@@ -1361,7 +1343,7 @@
13611343 D_SCAN("Successfully send scan abort\n");
13621344 }
13631345
1364
-/**
1346
+/*
13651347 * il_scan_cancel - Cancel any currently executing HW scan
13661348 */
13671349 int
....@@ -1373,7 +1355,7 @@
13731355 }
13741356 EXPORT_SYMBOL(il_scan_cancel);
13751357
1376
-/**
1358
+/*
13771359 * il_scan_cancel_timeout - Cancel any currently executing HW scan
13781360 * @ms: amount of time to wait (in milliseconds) for scan to abort
13791361 *
....@@ -1625,10 +1607,9 @@
16251607 mutex_unlock(&il->mutex);
16261608 }
16271609
1628
-/**
1610
+/*
16291611 * il_fill_probe_req - fill in all required fields and IE for probe request
16301612 */
1631
-
16321613 u16
16331614 il_fill_probe_req(struct il_priv *il, struct ieee80211_mgmt *frame,
16341615 const u8 *ta, const u8 *ies, int ie_len, int left)
....@@ -1931,7 +1912,7 @@
19311912 return;
19321913 }
19331914
1934
-/**
1915
+/*
19351916 * il_prep_station - Prepare station information for addition
19361917 *
19371918 * should be called with sta_lock held
....@@ -2018,7 +1999,7 @@
20181999
20192000 #define STA_WAIT_TIMEOUT (HZ/2)
20202001
2021
-/**
2002
+/*
20222003 * il_add_station_common -
20232004 */
20242005 int
....@@ -2078,7 +2059,7 @@
20782059 }
20792060 EXPORT_SYMBOL(il_add_station_common);
20802061
2081
-/**
2062
+/*
20822063 * il_sta_ucode_deactivate - deactivate ucode status for a station
20832064 *
20842065 * il->sta_lock must be held
....@@ -2154,7 +2135,7 @@
21542135 return ret;
21552136 }
21562137
2157
-/**
2138
+/*
21582139 * il_remove_station - Remove driver's knowledge of station.
21592140 */
21602141 int
....@@ -2210,7 +2191,7 @@
22102191 }
22112192 EXPORT_SYMBOL_GPL(il_remove_station);
22122193
2213
-/**
2194
+/*
22142195 * il_clear_ucode_stations - clear ucode station table bits
22152196 *
22162197 * This function clears all the bits in the driver indicating
....@@ -2242,7 +2223,7 @@
22422223 }
22432224 EXPORT_SYMBOL(il_clear_ucode_stations);
22442225
2245
-/**
2226
+/*
22462227 * il_restore_stations() - Restore driver known stations to device
22472228 *
22482229 * All stations considered active by driver, but not present in ucode, is
....@@ -2374,7 +2355,7 @@
23742355 }
23752356 #endif
23762357
2377
-/**
2358
+/*
23782359 * il_is_lq_table_valid() - Test one aspect of LQ cmd for validity
23792360 *
23802361 * It sometimes happens when a HT rate has been in use and we
....@@ -2403,7 +2384,7 @@
24032384 return true;
24042385 }
24052386
2406
-/**
2387
+/*
24072388 * il_send_lq_cmd() - Send link quality command
24082389 * @init: This command is sent as part of station initialization right
24092390 * after station has been added.
....@@ -2549,7 +2530,7 @@
25492530 *
25502531 */
25512532
2552
-/**
2533
+/*
25532534 * il_rx_queue_space - Return number of free slots available in queue.
25542535 */
25552536 int
....@@ -2566,7 +2547,7 @@
25662547 }
25672548 EXPORT_SYMBOL(il_rx_queue_space);
25682549
2569
-/**
2550
+/*
25702551 * il_rx_queue_update_write_ptr - Update the write pointer for the RX queue
25712552 */
25722553 void
....@@ -2695,6 +2676,7 @@
26952676 if ((decrypt_res & RX_RES_STATUS_DECRYPT_TYPE_MSK) ==
26962677 RX_RES_STATUS_BAD_KEY_TTAK)
26972678 break;
2679
+ fallthrough;
26982680
26992681 case RX_RES_STATUS_SEC_TYPE_WEP:
27002682 if ((decrypt_res & RX_RES_STATUS_DECRYPT_TYPE_MSK) ==
....@@ -2704,6 +2686,7 @@
27042686 D_RX("Packet destroyed\n");
27052687 return -1;
27062688 }
2689
+ fallthrough;
27072690 case RX_RES_STATUS_SEC_TYPE_CCMP:
27082691 if ((decrypt_res & RX_RES_STATUS_DECRYPT_TYPE_MSK) ==
27092692 RX_RES_STATUS_DECRYPT_OK) {
....@@ -2719,7 +2702,7 @@
27192702 }
27202703 EXPORT_SYMBOL(il_set_decrypted_flag);
27212704
2722
-/**
2705
+/*
27232706 * il_txq_update_write_ptr - Send new write idx to hardware
27242707 */
27252708 void
....@@ -2759,7 +2742,7 @@
27592742 }
27602743 EXPORT_SYMBOL(il_txq_update_write_ptr);
27612744
2762
-/**
2745
+/*
27632746 * il_tx_queue_unmap - Unmap any remaining DMA mappings and free skb's
27642747 */
27652748 void
....@@ -2778,7 +2761,7 @@
27782761 }
27792762 EXPORT_SYMBOL(il_tx_queue_unmap);
27802763
2781
-/**
2764
+/*
27822765 * il_tx_queue_free - Deallocate DMA queue.
27832766 * @txq: Transmit queue to deallocate.
27842767 *
....@@ -2821,7 +2804,7 @@
28212804 }
28222805 EXPORT_SYMBOL(il_tx_queue_free);
28232806
2824
-/**
2807
+/*
28252808 * il_cmd_queue_unmap - Unmap any remaining DMA mappings from command queue
28262809 */
28272810 void
....@@ -2859,9 +2842,8 @@
28592842 }
28602843 EXPORT_SYMBOL(il_cmd_queue_unmap);
28612844
2862
-/**
2845
+/*
28632846 * il_cmd_queue_free - Deallocate DMA queue.
2864
- * @txq: Transmit queue to deallocate.
28652847 *
28662848 * Empty queue by removing and destroying all BD's.
28672849 * Free all buffers.
....@@ -2940,7 +2922,7 @@
29402922 EXPORT_SYMBOL(il_queue_space);
29412923
29422924
2943
-/**
2925
+/*
29442926 * il_queue_init - Initialize queue's high/low-water and read/write idxes
29452927 */
29462928 static int
....@@ -2974,7 +2956,7 @@
29742956 return 0;
29752957 }
29762958
2977
-/**
2959
+/*
29782960 * il_tx_queue_alloc - Alloc driver data and TFD CB for one Tx/cmd queue
29792961 */
29802962 static int
....@@ -3014,7 +2996,7 @@
30142996 return -ENOMEM;
30152997 }
30162998
3017
-/**
2999
+/*
30183000 * il_tx_queue_init - Allocate and initialize one tx/cmd queue
30193001 */
30203002 int
....@@ -3121,7 +3103,7 @@
31213103
31223104 /*************** HOST COMMAND QUEUE FUNCTIONS *****/
31233105
3124
-/**
3106
+/*
31253107 * il_enqueue_hcmd - enqueue a uCode command
31263108 * @il: device ilate data point
31273109 * @cmd: a point to the ucode command structure
....@@ -3139,7 +3121,6 @@
31393121 struct il_cmd_meta *out_meta;
31403122 dma_addr_t phys_addr;
31413123 unsigned long flags;
3142
- int len;
31433124 u32 idx;
31443125 u16 fix_size;
31453126
....@@ -3198,9 +3179,6 @@
31983179 cpu_to_le16(QUEUE_TO_SEQ(il->cmd_queue) | IDX_TO_SEQ(q->write_ptr));
31993180 if (cmd->flags & CMD_SIZE_HUGE)
32003181 out_cmd->hdr.sequence |= SEQ_HUGE_FRAME;
3201
- len = sizeof(struct il_device_cmd);
3202
- if (idx == TFD_CMD_SLOTS)
3203
- len = IL_MAX_CMD_SIZE;
32043182
32053183 #ifdef CONFIG_IWLEGACY_DEBUG
32063184 switch (out_cmd->hdr.cmd) {
....@@ -3249,7 +3227,7 @@
32493227 return idx;
32503228 }
32513229
3252
-/**
3230
+/*
32533231 * il_hcmd_queue_reclaim - Reclaim TX command queue entries already Tx'd
32543232 *
32553233 * When FW advances 'R' idx, all entries between old and new 'R' idx
....@@ -3282,7 +3260,7 @@
32823260 }
32833261 }
32843262
3285
-/**
3263
+/*
32863264 * il_tx_cmd_complete - Pull unused buffers off the queue and reclaim them
32873265 * @rxb: Rx buffer to reclaim
32883266 *
....@@ -3433,7 +3411,7 @@
34333411 }
34343412 }
34353413
3436
-/**
3414
+/*
34373415 * il_init_geos - Initialize mac80211's geo/channel info based from eeprom
34383416 */
34393417 int
....@@ -3779,7 +3757,7 @@
37793757 }
37803758 EXPORT_SYMBOL(il_check_rxon_cmd);
37813759
3782
-/**
3760
+/*
37833761 * il_full_rxon_required - check if full RXON (vs RXON_ASSOC) cmd is needed
37843762 * @il: staging_rxon is compared to active_rxon
37853763 *
....@@ -3959,7 +3937,7 @@
39593937 }
39603938 EXPORT_SYMBOL(il_get_single_channel_number);
39613939
3962
-/**
3940
+/*
39633941 * il_set_rxon_channel - Set the band and channel values in staging RXON
39643942 * @ch: requested channel as a pointer to struct ieee80211_channel
39653943
....@@ -4162,7 +4140,7 @@
41624140 }
41634141 EXPORT_SYMBOL(il_print_rx_config_cmd);
41644142 #endif
4165
-/**
4143
+/*
41664144 * il_irq_handle_error - called for HW or SW error interrupt from card
41674145 */
41684146 void
....@@ -4958,8 +4936,7 @@
49584936 static int
49594937 il_pci_suspend(struct device *device)
49604938 {
4961
- struct pci_dev *pdev = to_pci_dev(device);
4962
- struct il_priv *il = pci_get_drvdata(pdev);
4939
+ struct il_priv *il = dev_get_drvdata(device);
49634940
49644941 /*
49654942 * This function is called when system goes into suspend state
....@@ -5028,7 +5005,7 @@
50285005 &il->qos_data.def_qos_parm, NULL);
50295006 }
50305007
5031
-/**
5008
+/*
50325009 * il_mac_config - mac80211 config callback
50335010 */
50345011 int
....@@ -5199,8 +5176,7 @@
51995176 memset(&il->current_ht_config, 0, sizeof(struct il_ht_config));
52005177
52015178 /* new association get rid of ibss beacon skb */
5202
- if (il->beacon_skb)
5203
- dev_kfree_skb(il->beacon_skb);
5179
+ dev_consume_skb_irq(il->beacon_skb);
52045180 il->beacon_skb = NULL;
52055181 il->timestamp = 0;
52065182
....@@ -5319,10 +5295,7 @@
53195295 }
53205296
53215297 spin_lock_irqsave(&il->lock, flags);
5322
-
5323
- if (il->beacon_skb)
5324
- dev_kfree_skb(il->beacon_skb);
5325
-
5298
+ dev_consume_skb_irq(il->beacon_skb);
53265299 il->beacon_skb = skb;
53275300
53285301 timestamp = ((struct ieee80211_mgmt *)skb->data)->u.beacon.timestamp;