hc
2024-12-19 9370bb92b2d16684ee45cf24e879c93c509162da
kernel/drivers/net/wireless/intel/iwlegacy/4965.c
....@@ -1,22 +1,7 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /******************************************************************************
23 *
34 * Copyright(c) 2003 - 2011 Intel Corporation. All rights reserved.
4
- *
5
- * This program is free software; you can redistribute it and/or modify it
6
- * under the terms of version 2 of the GNU General Public License as
7
- * published by the Free Software Foundation.
8
- *
9
- * This program is distributed in the hope that it will be useful, but WITHOUT
10
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12
- * more details.
13
- *
14
- * You should have received a copy of the GNU General Public License along with
15
- * this program; if not, write to the Free Software Foundation, Inc.,
16
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
17
- *
18
- * The full GNU General Public License is included in this distribution in the
19
- * file called LICENSE.
205 *
216 * Contact Information:
227 * Intel Linux Wireless <ilw@linux.intel.com>
....@@ -32,6 +17,7 @@
3217 #include <linux/sched.h>
3318 #include <linux/skbuff.h>
3419 #include <linux/netdevice.h>
20
+#include <linux/units.h>
3521 #include <net/mac80211.h>
3622 #include <linux/etherdevice.h>
3723 #include <asm/unaligned.h>
....@@ -39,7 +25,7 @@
3925 #include "common.h"
4026 #include "4965.h"
4127
42
-/**
28
+/*
4329 * il_verify_inst_sparse - verify runtime uCode image in card vs. host,
4430 * using sample data 100 bytes apart. If these sample points are good,
4531 * it's a pretty good bet that everything between them is good, too.
....@@ -71,7 +57,7 @@
7157 return ret;
7258 }
7359
74
-/**
60
+/*
7561 * il4965_verify_inst_full - verify runtime uCode image in card vs. host,
7662 * looking at all data.
7763 */
....@@ -110,7 +96,7 @@
11096 return ret;
11197 }
11298
113
-/**
99
+/*
114100 * il4965_verify_ucode - determine which instruction image is in SRAM,
115101 * and verify its contents
116102 */
....@@ -306,7 +292,7 @@
306292 return 0;
307293 }
308294
309
-/**
295
+/*
310296 * il4965_load_bsm - Load bootstrap instructions
311297 *
312298 * BSM operation:
....@@ -416,7 +402,7 @@
416402 return 0;
417403 }
418404
419
-/**
405
+/*
420406 * il4965_set_ucode_ptrs - Set uCode address location
421407 *
422408 * Tell initialization uCode where to find runtime uCode.
....@@ -430,7 +416,6 @@
430416 {
431417 dma_addr_t pinst;
432418 dma_addr_t pdata;
433
- int ret = 0;
434419
435420 /* bits 35:4 for 4965 */
436421 pinst = il->ucode_code.p_addr >> 4;
....@@ -447,10 +432,10 @@
447432 il->ucode_code.len | BSM_DRAM_INST_LOAD);
448433 D_INFO("Runtime uCode pointers are set.\n");
449434
450
- return ret;
435
+ return 0;
451436 }
452437
453
-/**
438
+/*
454439 * il4965_init_alive_start - Called after N_ALIVE notification received
455440 *
456441 * Called after N_ALIVE notification received from "initialize" uCode.
....@@ -577,13 +562,12 @@
577562 sign = -sign;
578563 denom = -denom;
579564 }
580
- *res = 1;
581565 *res = ((num * 2 + denom) / (denom * 2)) * sign;
582566
583567 return 1;
584568 }
585569
586
-/**
570
+/*
587571 * il4965_get_voltage_compensation - Power supply voltage comp for txpower
588572 *
589573 * Determines power supply voltage compensation for txpower calculations.
....@@ -670,7 +654,7 @@
670654 }
671655 }
672656
673
-/**
657
+/*
674658 * il4965_interpolate_chan - Interpolate factory measurements for one channel
675659 *
676660 * Interpolates factory measurements from the two sample channels within a
....@@ -1120,7 +1104,7 @@
11201104 /* get current temperature (Celsius) */
11211105 current_temp = max(il->temperature, IL_TX_POWER_TEMPERATURE_MIN);
11221106 current_temp = min(il->temperature, IL_TX_POWER_TEMPERATURE_MAX);
1123
- current_temp = KELVIN_TO_CELSIUS(current_temp);
1107
+ current_temp = kelvin_to_celsius(current_temp);
11241108
11251109 /* select thermal txpower adjustment params, based on channel group
11261110 * (same frequency group used for mimo txatten adjustment) */
....@@ -1247,7 +1231,7 @@
12471231 return 0;
12481232 }
12491233
1250
-/**
1234
+/*
12511235 * il4965_send_tx_power - Configure the TXPOWER level user limit
12521236 *
12531237 * Uses the active RXON for channel, band, and characteristics (ht40, high)
....@@ -1296,6 +1280,8 @@
12961280 struct il4965_rxon_assoc_cmd rxon_assoc;
12971281 const struct il_rxon_cmd *rxon1 = &il->staging;
12981282 const struct il_rxon_cmd *rxon2 = &il->active;
1283
+
1284
+ lockdep_assert_held(&il->mutex);
12991285
13001286 if (rxon1->flags == rxon2->flags &&
13011287 rxon1->filter_flags == rxon2->filter_flags &&
....@@ -1542,7 +1528,7 @@
15421528 return il_send_cmd_pdu(il, C_CHANNEL_SWITCH, sizeof(cmd), &cmd);
15431529 }
15441530
1545
-/**
1531
+/*
15461532 * il4965_txq_update_byte_cnt_tbl - Set up entry in Tx byte-count array
15471533 */
15481534 static void
....@@ -1567,9 +1553,8 @@
15671553 bc_ent;
15681554 }
15691555
1570
-/**
1556
+/*
15711557 * il4965_hw_get_temperature - return the calibrated temperature (in Kelvin)
1572
- * @stats: Provides the temperature reading from the uCode
15731558 *
15741559 * A return of <0 indicates bogus data in the stats
15751560 */
....@@ -1624,8 +1609,8 @@
16241609 temperature =
16251610 (temperature * 97) / 100 + TEMPERATURE_CALIB_KELVIN_OFFSET;
16261611
1627
- D_TEMP("Calibrated temperature: %dK, %dC\n", temperature,
1628
- KELVIN_TO_CELSIUS(temperature));
1612
+ D_TEMP("Calibrated temperature: %dK, %ldC\n", temperature,
1613
+ kelvin_to_celsius(temperature));
16291614
16301615 return temperature;
16311616 }
....@@ -1633,7 +1618,7 @@
16331618 /* Adjust Txpower only if temperature variance is greater than threshold. */
16341619 #define IL_TEMPERATURE_THRESHOLD 3
16351620
1636
-/**
1621
+/*
16371622 * il4965_is_temp_calib_needed - determines if new calibration is needed
16381623 *
16391624 * If the temperature changed has changed sufficiently, then a recalibration
....@@ -1684,12 +1669,12 @@
16841669
16851670 if (il->temperature != temp) {
16861671 if (il->temperature)
1687
- D_TEMP("Temperature changed " "from %dC to %dC\n",
1688
- KELVIN_TO_CELSIUS(il->temperature),
1689
- KELVIN_TO_CELSIUS(temp));
1672
+ D_TEMP("Temperature changed " "from %ldC to %ldC\n",
1673
+ kelvin_to_celsius(il->temperature),
1674
+ kelvin_to_celsius(temp));
16901675 else
1691
- D_TEMP("Temperature " "initialized to %dC\n",
1692
- KELVIN_TO_CELSIUS(temp));
1676
+ D_TEMP("Temperature " "initialized to %ldC\n",
1677
+ kelvin_to_celsius(temp));
16931678 }
16941679
16951680 il->temperature = temp;