Skip to content

Commit 3325169

Browse files
fancergroeck
authored andcommitted
hwmon: (bt1-pvt) Define Temp- and Volt-to-N poly as maybe-unused
Clang-based kernel building with W=1 warns that some static const variables are unused: drivers/hwmon/bt1-pvt.c:67:30: warning: unused variable 'poly_temp_to_N' [-Wunused-const-variable] static const struct pvt_poly poly_temp_to_N = { ^ drivers/hwmon/bt1-pvt.c:99:30: warning: unused variable 'poly_volt_to_N' [-Wunused-const-variable] static const struct pvt_poly poly_volt_to_N = { ^ Indeed these polynomials are utilized only when the PVT sensor alarms are enabled. In that case they are used to convert the temperature and voltage alarm limits from normal quantities (Volts and degree Celsius) to the sensor data representation N = [0, 1023]. Otherwise when alarms are disabled the driver only does the detected data conversion to the human readable form and doesn't need that polynomials defined. So let's mark the Temp-to-N and Volt-to-N polynomials with __maybe_unused attribute. Note gcc with W=1 doesn't notice the problem. Fixes: 87976ce ("hwmon: Add Baikal-T1 PVT sensor driver") Reported-by: kbuild test robot <[email protected]> Signed-off-by: Serge Semin <[email protected]> Cc: Maxim Kaurkin <[email protected]> Cc: Alexey Malahov <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Guenter Roeck <[email protected]>
1 parent 4877846 commit 3325169

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/hwmon/bt1-pvt.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ static const struct pvt_sensor_info pvt_info[] = {
6464
* 48380,
6565
* where T = [-48380, 147438] mC and N = [0, 1023].
6666
*/
67-
static const struct pvt_poly poly_temp_to_N = {
67+
static const struct pvt_poly __maybe_unused poly_temp_to_N = {
6868
.total_divider = 10000,
6969
.terms = {
7070
{4, 18322, 10000, 10000},
@@ -96,7 +96,7 @@ static const struct pvt_poly poly_N_to_temp = {
9696
* N = (18658e-3*V - 11572) / 10,
9797
* V = N * 10^5 / 18658 + 11572 * 10^4 / 18658.
9898
*/
99-
static const struct pvt_poly poly_volt_to_N = {
99+
static const struct pvt_poly __maybe_unused poly_volt_to_N = {
100100
.total_divider = 10,
101101
.terms = {
102102
{1, 18658, 1000, 1},

0 commit comments

Comments
 (0)