Commit 1410b2fc authored by Akinobu Mita's avatar Akinobu Mita Committed by Linus Torvalds

iwlegacy: use <linux/units.h> helpers

This switches the iwlegacy driver to use celsius_to_kelvin() and
kelvin_to_celsius() in <linux/units.h>.

[akinobu.mita@gmail.com: fix build warnings with format string]
  Link: http://lkml.kernel.org/r/1579014483-9226-1-git-send-email-akinobu.mita@gmail.com
  Link: https://lore.kernel.org/r/20200106171452.201c3b4c@canb.auug.org.au
Link: http://lkml.kernel.org/r/1576386975-7941-10-git-send-email-akinobu.mita@gmail.comSigned-off-by: default avatarAkinobu Mita <akinobu.mita@gmail.com>
Reviewed-by: default avatarAndy Shevchenko <andy.shevchenko@gmail.com>
Acked-by: default avatarKalle Valo <kvalo@codeaurora.org>
Cc: Kalle Valo <kvalo@codeaurora.org>
Cc: Stanislaw Gruszka <sgruszka@redhat.com>
Cc: Amit Kucheria <amit.kucheria@verdurent.com>
Cc: Andy Shevchenko <andy@infradead.org>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
Cc: Darren Hart <dvhart@infradead.org>
Cc: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Cc: Guenter Roeck <linux@roeck-us.net>
Cc: Hartmut Knaack <knaack.h@gmx.de>
Cc: Jean Delvare <jdelvare@suse.com>
Cc: Jens Axboe <axboe@fb.com>
Cc: Johannes Berg <johannes.berg@intel.com>
Cc: Jonathan Cameron <jic23@kernel.org>
Cc: Keith Busch <kbusch@kernel.org>
Cc: Lars-Peter Clausen <lars@metafoo.de>
Cc: Luca Coelho <luciano.coelho@intel.com>
Cc: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
Cc: Sagi Grimberg <sagi@grimberg.me>
Cc: Sujith Thomas <sujith.thomas@intel.com>
Cc: Zhang Rui <rui.zhang@intel.com>
Cc: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent cdf309fb
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#include <linux/firmware.h> #include <linux/firmware.h>
#include <linux/etherdevice.h> #include <linux/etherdevice.h>
#include <linux/if_arp.h> #include <linux/if_arp.h>
#include <linux/units.h>
#include <net/mac80211.h> #include <net/mac80211.h>
...@@ -6468,7 +6469,7 @@ il4965_set_hw_params(struct il_priv *il) ...@@ -6468,7 +6469,7 @@ il4965_set_hw_params(struct il_priv *il)
il->hw_params.valid_rx_ant = il->cfg->valid_rx_ant; il->hw_params.valid_rx_ant = il->cfg->valid_rx_ant;
il->hw_params.ct_kill_threshold = il->hw_params.ct_kill_threshold =
CELSIUS_TO_KELVIN(CT_KILL_THRESHOLD_LEGACY); celsius_to_kelvin(CT_KILL_THRESHOLD_LEGACY);
il->hw_params.sens = &il4965_sensitivity; il->hw_params.sens = &il4965_sensitivity;
il->hw_params.beacon_time_tsf_bits = IL4965_EXT_BEACON_TIME_POS; il->hw_params.beacon_time_tsf_bits = IL4965_EXT_BEACON_TIME_POS;
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
#include <linux/sched.h> #include <linux/sched.h>
#include <linux/skbuff.h> #include <linux/skbuff.h>
#include <linux/netdevice.h> #include <linux/netdevice.h>
#include <linux/units.h>
#include <net/mac80211.h> #include <net/mac80211.h>
#include <linux/etherdevice.h> #include <linux/etherdevice.h>
#include <asm/unaligned.h> #include <asm/unaligned.h>
...@@ -1104,7 +1105,7 @@ il4965_fill_txpower_tbl(struct il_priv *il, u8 band, u16 channel, u8 is_ht40, ...@@ -1104,7 +1105,7 @@ il4965_fill_txpower_tbl(struct il_priv *il, u8 band, u16 channel, u8 is_ht40,
/* get current temperature (Celsius) */ /* get current temperature (Celsius) */
current_temp = max(il->temperature, IL_TX_POWER_TEMPERATURE_MIN); current_temp = max(il->temperature, IL_TX_POWER_TEMPERATURE_MIN);
current_temp = min(il->temperature, IL_TX_POWER_TEMPERATURE_MAX); current_temp = min(il->temperature, IL_TX_POWER_TEMPERATURE_MAX);
current_temp = KELVIN_TO_CELSIUS(current_temp); current_temp = kelvin_to_celsius(current_temp);
/* select thermal txpower adjustment params, based on channel group /* select thermal txpower adjustment params, based on channel group
* (same frequency group used for mimo txatten adjustment) */ * (same frequency group used for mimo txatten adjustment) */
...@@ -1610,8 +1611,8 @@ il4965_hw_get_temperature(struct il_priv *il) ...@@ -1610,8 +1611,8 @@ il4965_hw_get_temperature(struct il_priv *il)
temperature = temperature =
(temperature * 97) / 100 + TEMPERATURE_CALIB_KELVIN_OFFSET; (temperature * 97) / 100 + TEMPERATURE_CALIB_KELVIN_OFFSET;
D_TEMP("Calibrated temperature: %dK, %dC\n", temperature, D_TEMP("Calibrated temperature: %dK, %ldC\n", temperature,
KELVIN_TO_CELSIUS(temperature)); kelvin_to_celsius(temperature));
return temperature; return temperature;
} }
...@@ -1670,12 +1671,12 @@ il4965_temperature_calib(struct il_priv *il) ...@@ -1670,12 +1671,12 @@ il4965_temperature_calib(struct il_priv *il)
if (il->temperature != temp) { if (il->temperature != temp) {
if (il->temperature) if (il->temperature)
D_TEMP("Temperature changed " "from %dC to %dC\n", D_TEMP("Temperature changed " "from %ldC to %ldC\n",
KELVIN_TO_CELSIUS(il->temperature), kelvin_to_celsius(il->temperature),
KELVIN_TO_CELSIUS(temp)); kelvin_to_celsius(temp));
else else
D_TEMP("Temperature " "initialized to %dC\n", D_TEMP("Temperature " "initialized to %ldC\n",
KELVIN_TO_CELSIUS(temp)); kelvin_to_celsius(temp));
} }
il->temperature = temp; il->temperature = temp;
......
...@@ -779,9 +779,6 @@ struct il_sensitivity_ranges { ...@@ -779,9 +779,6 @@ struct il_sensitivity_ranges {
u16 nrg_th_cca; u16 nrg_th_cca;
}; };
#define KELVIN_TO_CELSIUS(x) ((x)-273)
#define CELSIUS_TO_KELVIN(x) ((x)+273)
/** /**
* struct il_hw_params * struct il_hw_params
* @bcast_id: f/w broadcast station ID * @bcast_id: f/w broadcast station ID
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment