Re: [PATCH v1 2/2] regulator: rt6245: Add support for Richtek RT6245

From: ChiYuan Huang
Date: Wed May 26 2021 - 23:54:22 EST


HI,

Mark Brown <broonie@xxxxxxxxxx> 於 2021年5月27日 週四 上午2:21寫道:
>
> On Wed, May 26, 2021 at 02:12:58PM +0800, cy_huang wrote:
>
> > + /* xor checksum for bit 6 to 0 */
> > + bit_count = __sw_hweight8(code & RT6245_CODE_MASK);
>
> This doesn't compile with an x86 allmodconfig:
>
> ERROR: modpost: "__sw_hweight8" [drivers/regulator/rt6245-regulator.ko] undefined!

I think I found the problem, x86 only defined __sw_hweight32 and __sw_hweight64.
If user touch hweight8 or 16, it will auto convert to use thest two functions.
And the x86 arch didn't define __sw_hweight8 or __sw_hweight16.
The best way is to use hweight8 macro and let the macro convert it to
arch_hweight8
Ack in next, Thanks for reminding me.