Content-Type: multipart/mixed; boundary="===============7867727507380203083==" MIME-Version: 1.0 From: kernel test robot To: kbuild-all@lists.01.org Subject: Re: [PATCH v5 06/10] clk: Add Sunplus SP7021 clock driver Date: Sat, 04 Dec 2021 00:09:23 +0800 Message-ID: <202112032353.vXXsrZu2-lkp@intel.com> In-Reply-To: <8d23a5e00d870173993032c6a68fb5f48182691d.1638515726.git.qinjian@cqplus1.com> List-Id: --===============7867727507380203083== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Hi Qin, I love your patch! Perhaps something to improve: [auto build test WARNING on clk/clk-next] [also build test WARNING on tip/irq/core linus/master v5.16-rc3 next-202112= 03] [cannot apply to pza/reset/next robh/for-next] [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/0day-ci/linux/commits/Qin-Jian/Add-Sunplus-SP702= 1-SoC-Support/20211203-154345 base: https://git.kernel.org/pub/scm/linux/kernel/git/clk/linux.git clk-n= ext config: arc-allyesconfig (https://download.01.org/0day-ci/archive/20211203/= 202112032353.vXXsrZu2-lkp(a)intel.com/config) compiler: arceb-elf-gcc (GCC) 11.2.0 reproduce (this is a W=3D1 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/0day-ci/linux/commit/ebecbb4f178661a7de3c03b73= ccd59722c3ee26c git remote add linux-review https://github.com/0day-ci/linux git fetch --no-tags linux-review Qin-Jian/Add-Sunplus-SP7021-SoC-Su= pport/20211203-154345 git checkout ebecbb4f178661a7de3c03b73ccd59722c3ee26c # save the config file to linux build tree mkdir build_dir COMPILER_INSTALL_PATH=3D$HOME/0day COMPILER=3Dgcc-11.2.0 make.cross= O=3Dbuild_dir ARCH=3Darc SHELL=3D/bin/bash drivers/clk/ drivers/irqchip/ If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot All warnings (new ones prefixed by >>): drivers/clk/clk-sp7021.c: In function 'plltv_fractional_div': >> drivers/clk/clk-sp7021.c:304:13: warning: variable 'diff_min_sign' set b= ut not used [-Wunused-but-set-variable] 304 | u32 diff_min_sign =3D 0; | ^~~~~~~~~~~~~ drivers/clk/clk-sp7021.c: At top level: >> drivers/clk/clk-sp7021.c:638:13: warning: no previous prototype for 'clk= _register_sp_pll' [-Wmissing-prototypes] 638 | struct clk *clk_register_sp_pll(const char *name, const char *pa= rent, | ^~~~~~~~~~~~~~~~~~~ vim +/diff_min_sign +304 drivers/clk/clk-sp7021.c 298 = 299 static long plltv_fractional_div(struct sp_pll *clk, unsigned long f= req) 300 { 301 u32 m, r; 302 u32 nint, nfra; 303 u32 diff_min_quotient =3D 210000000, diff_min_remainder =3D 0; > 304 u32 diff_min_sign =3D 0; 305 unsigned long fvco, nf, f, fout =3D 0; 306 int sdm, ph; 307 = 308 /* check freq */ 309 if (freq < F_MIN) { 310 pr_warn("%s: %s freq:%lu < F_MIN:%lu, round up\n", 311 __func__, clk_hw_get_name(&clk->hw), freq, F_MIN); 312 freq =3D F_MIN; 313 } else if (freq > F_MAX) { 314 pr_warn("%s: %s freq:%lu > F_MAX:%lu, round down\n", 315 __func__, clk_hw_get_name(&clk->hw), freq, F_MAX); 316 freq =3D F_MAX; 317 } 318 = 319 /* DIVR 0~3 */ 320 for (r =3D 0; r <=3D 3; r++) { 321 fvco =3D freq << r; 322 if (fvco <=3D FVCO_MAX) 323 break; 324 } 325 f =3D F_27M >> r; 326 = 327 /* PH_SEL 1/0 */ 328 for (ph =3D 1; ph >=3D 0; ph--) { 329 const u32 *pp =3D pt[ph]; 330 u32 ms =3D 1; 331 = 332 /* SDM_MOD 0/1 */ 333 for (sdm =3D 0; sdm <=3D 1; sdm++) { 334 u32 mod =3D mods[sdm]; 335 = 336 /* DIVM 1~32 */ 337 for (m =3D ms; m <=3D 32; m++) { 338 u32 diff_freq; 339 u32 diff_freq_quotient =3D 0, diff_freq_remainder =3D 0; 340 u32 diff_freq_sign =3D 0; /* 0:Positive number, 1:Negative numbe= r */ 341 = 342 nf =3D fvco * m; 343 nint =3D nf / pp[3]; 344 = 345 if (nint < pp[1]) 346 continue; 347 if (nint > pp[1]) 348 break; 349 = 350 nfra =3D (((nf % pp[3]) * mod * pp[4]) + (F_27M / 2)) / F_27M; 351 if (nfra) 352 diff_freq =3D (f * (nint + pp[2]) / pp[0]) - 353 (f * (mod - nfra) / mod / pp[4]); 354 else 355 diff_freq =3D (f * (nint) / pp[0]); 356 = 357 diff_freq_quotient =3D diff_freq / m; 358 diff_freq_remainder =3D ((diff_freq % m) * 1000) / m; 359 = 360 if (freq > diff_freq_quotient) { 361 diff_freq_quotient =3D freq - diff_freq_quotient - 1; 362 diff_freq_remainder =3D 1000 - diff_freq_remainder; 363 diff_freq_sign =3D 1; 364 } else { 365 diff_freq_quotient =3D diff_freq_quotient - freq; 366 diff_freq_sign =3D 0; 367 } 368 = 369 if (diff_min_quotient > diff_freq_quotient || 370 (diff_min_quotient =3D=3D diff_freq_quotient && 371 diff_min_remainder > diff_freq_remainder)) { 372 /* found a closer freq, save parameters */ 373 clk->p[SEL_FRA] =3D 1; 374 clk->p[SDM_MOD] =3D sdm; 375 clk->p[PH_SEL] =3D ph; 376 clk->p[NFRA] =3D nfra; 377 clk->p[DIVR] =3D r; 378 clk->p[DIVM] =3D m; 379 = 380 fout =3D diff_freq / m; 381 diff_min_quotient =3D diff_freq_quotient; 382 diff_min_remainder =3D diff_freq_remainder; 383 diff_min_sign =3D diff_freq_sign; 384 } 385 } 386 } 387 } 388 = 389 if (!fout) { 390 pr_err("%s: %s freq:%lu not found a valid setting\n", 391 __func__, clk_hw_get_name(&clk->hw), freq); 392 return -EINVAL; 393 } 394 = 395 return fout; 396 } 397 = --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org --===============7867727507380203083==--