Message ID | 20220326192347.2940747-3-michael@walle.cc (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | hwmon: add lan9668 driver | expand |
Hi Michael,
I love your patch! Yet something to improve:
[auto build test ERROR on groeck-staging/hwmon-next]
[also build test ERROR on robh/for-next linus/master v5.17 next-20220325]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/intel-lab-lkp/linux/commits/Michael-Walle/hwmon-add-lan9668-driver/20220327-032606
base: https://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging.git hwmon-next
config: ia64-allyesconfig (https://download.01.org/0day-ci/archive/20220327/202203270834.xEWniPdY-lkp@intel.com/config)
compiler: ia64-linux-gcc (GCC) 11.2.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/intel-lab-lkp/linux/commit/51d4d93c8777a757e21386aa76ccc128a6bd85af
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Michael-Walle/hwmon-add-lan9668-driver/20220327-032606
git checkout 51d4d93c8777a757e21386aa76ccc128a6bd85af
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=ia64 SHELL=/bin/bash
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All errors (new ones prefixed by >>):
ia64-linux-ld: drivers/hwmon/bt1-pvt.o: in function `pvt_read_data':
bt1-pvt.c:(.text+0xa32): undefined reference to `polynomial_calc'
ia64-linux-ld: drivers/hwmon/bt1-pvt.o: in function `pvt_write_limit':
bt1-pvt.c:(.text+0xae2): undefined reference to `polynomial_calc'
>> ia64-linux-ld: bt1-pvt.c:(.text+0xb22): undefined reference to `polynomial_calc'
ia64-linux-ld: drivers/hwmon/bt1-pvt.o: in function `pvt_hwmon_read':
bt1-pvt.c:(.text+0x2532): undefined reference to `polynomial_calc'
ia64-linux-ld: bt1-pvt.c:(.text+0x2732): undefined reference to `polynomial_calc'
ia64-linux-ld: drivers/hwmon/bt1-pvt.o:bt1-pvt.c:(.text+0x27e2): more undefined references to `polynomial_calc' follow
`adc3xxx_i2c_remove' referenced in section `.data' of sound/soc/codecs/tlv320adc3xxx.o: defined in discarded section `.exit.text' of sound/soc/codecs/tlv320adc3xxx.o
Hi Michael,
I love your patch! Yet something to improve:
[auto build test ERROR on groeck-staging/hwmon-next]
[also build test ERROR on robh/for-next linus/master v5.17 next-20220325]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/intel-lab-lkp/linux/commits/Michael-Walle/hwmon-add-lan9668-driver/20220327-032606
base: https://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging.git hwmon-next
config: ia64-buildonly-randconfig-r002-20220327 (https://download.01.org/0day-ci/archive/20220327/202203270925.NrqU6SE8-lkp@intel.com/config)
compiler: ia64-linux-gcc (GCC) 11.2.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/intel-lab-lkp/linux/commit/51d4d93c8777a757e21386aa76ccc128a6bd85af
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Michael-Walle/hwmon-add-lan9668-driver/20220327-032606
git checkout 51d4d93c8777a757e21386aa76ccc128a6bd85af
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=ia64 SHELL=/bin/bash
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All errors (new ones prefixed by >>):
ia64-linux-ld: drivers/hwmon/bt1-pvt.o: in function `pvt_read_data':
>> bt1-pvt.c:(.text+0xeb2): undefined reference to `polynomial_calc'
On 3/26/22 12:23, Michael Walle wrote: > The polynomial calculation function was moved into lib/ to be able to > reuse it. Move over to this one. > > Signed-off-by: Michael Walle <michael@walle.cc> > --- select POLYNOMIAL missing in Kconfig > drivers/hwmon/bt1-pvt.c | 50 +++++++++++------------------------------ > 1 file changed, 13 insertions(+), 37 deletions(-) > > diff --git a/drivers/hwmon/bt1-pvt.c b/drivers/hwmon/bt1-pvt.c > index 74ce5211eb75..21ab172774ec 100644 > --- a/drivers/hwmon/bt1-pvt.c > +++ b/drivers/hwmon/bt1-pvt.c > @@ -26,6 +26,7 @@ > #include <linux/mutex.h> > #include <linux/of.h> > #include <linux/platform_device.h> > +#include <linux/polynomial.h> > #include <linux/seqlock.h> > #include <linux/sysfs.h> > #include <linux/types.h> > @@ -65,7 +66,7 @@ static const struct pvt_sensor_info pvt_info[] = { > * 48380, > * where T = [-48380, 147438] mC and N = [0, 1023]. > */ > -static const struct pvt_poly __maybe_unused poly_temp_to_N = { > +static const struct polynomial __maybe_unused poly_temp_to_N = { > .total_divider = 10000, > .terms = { > {4, 18322, 10000, 10000}, > @@ -76,7 +77,7 @@ static const struct pvt_poly __maybe_unused poly_temp_to_N = { > } > }; > > -static const struct pvt_poly poly_N_to_temp = { > +static const struct polynomial poly_N_to_temp = { > .total_divider = 1, > .terms = { > {4, -16743, 1000, 1}, > @@ -97,7 +98,7 @@ static const struct pvt_poly poly_N_to_temp = { > * N = (18658e-3*V - 11572) / 10, > * V = N * 10^5 / 18658 + 11572 * 10^4 / 18658. > */ > -static const struct pvt_poly __maybe_unused poly_volt_to_N = { > +static const struct polynomial __maybe_unused poly_volt_to_N = { > .total_divider = 10, > .terms = { > {1, 18658, 1000, 1}, > @@ -105,7 +106,7 @@ static const struct pvt_poly __maybe_unused poly_volt_to_N = { > } > }; > > -static const struct pvt_poly poly_N_to_volt = { > +static const struct polynomial poly_N_to_volt = { > .total_divider = 10, > .terms = { > {1, 100000, 18658, 1}, > @@ -113,31 +114,6 @@ static const struct pvt_poly poly_N_to_volt = { > } > }; > > -/* > - * Here is the polynomial calculation function, which performs the > - * redistributed terms calculations. It's pretty straightforward. We walk > - * over each degree term up to the free one, and perform the redistributed > - * multiplication of the term coefficient, its divider (as for the rationale > - * fraction representation), data power and the rational fraction divider > - * leftover. Then all of this is collected in a total sum variable, which > - * value is normalized by the total divider before being returned. > - */ > -static long pvt_calc_poly(const struct pvt_poly *poly, long data) > -{ > - const struct pvt_poly_term *term = poly->terms; > - long tmp, ret = 0; > - int deg; > - > - do { > - tmp = term->coef; > - for (deg = 0; deg < term->deg; ++deg) > - tmp = mult_frac(tmp, data, term->divider); > - ret += tmp / term->divider_leftover; > - } while ((term++)->deg); > - > - return ret / poly->total_divider; > -} > - > static inline u32 pvt_update(void __iomem *reg, u32 mask, u32 data) > { > u32 old; > @@ -324,9 +300,9 @@ static int pvt_read_data(struct pvt_hwmon *pvt, enum pvt_sensor_type type, > } while (read_seqretry(&cache->data_seqlock, seq)); > > if (type == PVT_TEMP) > - *val = pvt_calc_poly(&poly_N_to_temp, data); > + *val = polynomial_calc(&poly_N_to_temp, data); > else > - *val = pvt_calc_poly(&poly_N_to_volt, data); > + *val = polynomial_calc(&poly_N_to_volt, data); > > return 0; > } > @@ -345,9 +321,9 @@ static int pvt_read_limit(struct pvt_hwmon *pvt, enum pvt_sensor_type type, > data = FIELD_GET(PVT_THRES_HI_MASK, data); > > if (type == PVT_TEMP) > - *val = pvt_calc_poly(&poly_N_to_temp, data); > + *val = polynomial_calc(&poly_N_to_temp, data); > else > - *val = pvt_calc_poly(&poly_N_to_volt, data); > + *val = polynomial_calc(&poly_N_to_volt, data); > > return 0; > } > @@ -360,10 +336,10 @@ static int pvt_write_limit(struct pvt_hwmon *pvt, enum pvt_sensor_type type, > > if (type == PVT_TEMP) { > val = clamp(val, PVT_TEMP_MIN, PVT_TEMP_MAX); > - data = pvt_calc_poly(&poly_temp_to_N, val); > + data = polynomial_calc(&poly_temp_to_N, val); > } else { > val = clamp(val, PVT_VOLT_MIN, PVT_VOLT_MAX); > - data = pvt_calc_poly(&poly_volt_to_N, val); > + data = polynomial_calc(&poly_volt_to_N, val); > } > > /* Serialize limit update, since a part of the register is changed. */ > @@ -522,9 +498,9 @@ static int pvt_read_data(struct pvt_hwmon *pvt, enum pvt_sensor_type type, > return -ETIMEDOUT; > > if (type == PVT_TEMP) > - *val = pvt_calc_poly(&poly_N_to_temp, data); > + *val = polynomial_calc(&poly_N_to_temp, data); > else > - *val = pvt_calc_poly(&poly_N_to_volt, data); > + *val = polynomial_calc(&poly_N_to_volt, data); > > return 0; > }
diff --git a/drivers/hwmon/bt1-pvt.c b/drivers/hwmon/bt1-pvt.c index 74ce5211eb75..21ab172774ec 100644 --- a/drivers/hwmon/bt1-pvt.c +++ b/drivers/hwmon/bt1-pvt.c @@ -26,6 +26,7 @@ #include <linux/mutex.h> #include <linux/of.h> #include <linux/platform_device.h> +#include <linux/polynomial.h> #include <linux/seqlock.h> #include <linux/sysfs.h> #include <linux/types.h> @@ -65,7 +66,7 @@ static const struct pvt_sensor_info pvt_info[] = { * 48380, * where T = [-48380, 147438] mC and N = [0, 1023]. */ -static const struct pvt_poly __maybe_unused poly_temp_to_N = { +static const struct polynomial __maybe_unused poly_temp_to_N = { .total_divider = 10000, .terms = { {4, 18322, 10000, 10000}, @@ -76,7 +77,7 @@ static const struct pvt_poly __maybe_unused poly_temp_to_N = { } }; -static const struct pvt_poly poly_N_to_temp = { +static const struct polynomial poly_N_to_temp = { .total_divider = 1, .terms = { {4, -16743, 1000, 1}, @@ -97,7 +98,7 @@ static const struct pvt_poly poly_N_to_temp = { * N = (18658e-3*V - 11572) / 10, * V = N * 10^5 / 18658 + 11572 * 10^4 / 18658. */ -static const struct pvt_poly __maybe_unused poly_volt_to_N = { +static const struct polynomial __maybe_unused poly_volt_to_N = { .total_divider = 10, .terms = { {1, 18658, 1000, 1}, @@ -105,7 +106,7 @@ static const struct pvt_poly __maybe_unused poly_volt_to_N = { } }; -static const struct pvt_poly poly_N_to_volt = { +static const struct polynomial poly_N_to_volt = { .total_divider = 10, .terms = { {1, 100000, 18658, 1}, @@ -113,31 +114,6 @@ static const struct pvt_poly poly_N_to_volt = { } }; -/* - * Here is the polynomial calculation function, which performs the - * redistributed terms calculations. It's pretty straightforward. We walk - * over each degree term up to the free one, and perform the redistributed - * multiplication of the term coefficient, its divider (as for the rationale - * fraction representation), data power and the rational fraction divider - * leftover. Then all of this is collected in a total sum variable, which - * value is normalized by the total divider before being returned. - */ -static long pvt_calc_poly(const struct pvt_poly *poly, long data) -{ - const struct pvt_poly_term *term = poly->terms; - long tmp, ret = 0; - int deg; - - do { - tmp = term->coef; - for (deg = 0; deg < term->deg; ++deg) - tmp = mult_frac(tmp, data, term->divider); - ret += tmp / term->divider_leftover; - } while ((term++)->deg); - - return ret / poly->total_divider; -} - static inline u32 pvt_update(void __iomem *reg, u32 mask, u32 data) { u32 old; @@ -324,9 +300,9 @@ static int pvt_read_data(struct pvt_hwmon *pvt, enum pvt_sensor_type type, } while (read_seqretry(&cache->data_seqlock, seq)); if (type == PVT_TEMP) - *val = pvt_calc_poly(&poly_N_to_temp, data); + *val = polynomial_calc(&poly_N_to_temp, data); else - *val = pvt_calc_poly(&poly_N_to_volt, data); + *val = polynomial_calc(&poly_N_to_volt, data); return 0; } @@ -345,9 +321,9 @@ static int pvt_read_limit(struct pvt_hwmon *pvt, enum pvt_sensor_type type, data = FIELD_GET(PVT_THRES_HI_MASK, data); if (type == PVT_TEMP) - *val = pvt_calc_poly(&poly_N_to_temp, data); + *val = polynomial_calc(&poly_N_to_temp, data); else - *val = pvt_calc_poly(&poly_N_to_volt, data); + *val = polynomial_calc(&poly_N_to_volt, data); return 0; } @@ -360,10 +336,10 @@ static int pvt_write_limit(struct pvt_hwmon *pvt, enum pvt_sensor_type type, if (type == PVT_TEMP) { val = clamp(val, PVT_TEMP_MIN, PVT_TEMP_MAX); - data = pvt_calc_poly(&poly_temp_to_N, val); + data = polynomial_calc(&poly_temp_to_N, val); } else { val = clamp(val, PVT_VOLT_MIN, PVT_VOLT_MAX); - data = pvt_calc_poly(&poly_volt_to_N, val); + data = polynomial_calc(&poly_volt_to_N, val); } /* Serialize limit update, since a part of the register is changed. */ @@ -522,9 +498,9 @@ static int pvt_read_data(struct pvt_hwmon *pvt, enum pvt_sensor_type type, return -ETIMEDOUT; if (type == PVT_TEMP) - *val = pvt_calc_poly(&poly_N_to_temp, data); + *val = polynomial_calc(&poly_N_to_temp, data); else - *val = pvt_calc_poly(&poly_N_to_volt, data); + *val = polynomial_calc(&poly_N_to_volt, data); return 0; }
The polynomial calculation function was moved into lib/ to be able to reuse it. Move over to this one. Signed-off-by: Michael Walle <michael@walle.cc> --- drivers/hwmon/bt1-pvt.c | 50 +++++++++++------------------------------ 1 file changed, 13 insertions(+), 37 deletions(-)