• Serge Semin's avatar
    hwmon: (bt1-pvt) Define Temp- and Volt-to-N poly as maybe-unused · 33251694
    Serge Semin authored
    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: 87976ce2 ("hwmon: Add Baikal-T1 PVT sensor driver")
    Reported-by: default avatarkbuild test robot <lkp@intel.com>
    Signed-off-by: default avatarSerge Semin <Sergey.Semin@baikalelectronics.ru>
    Cc: Maxim Kaurkin <Maxim.Kaurkin@baikalelectronics.ru>
    Cc: Alexey Malahov <Alexey.Malahov@baikalelectronics.ru>
    Link: https://lore.kernel.org/r/20200603000753.391-1-Sergey.Semin@baikalelectronics.ruSigned-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
    33251694
bt1-pvt.c 29.2 KB