mirror of
https://xff.cz/git/u-boot/
synced 2025-09-02 01:02:19 +02:00
k210: fix k210_pll_calc_config()
The k210 driver is selected by sandbox_defconfig. Building the sandbox on 32bit systems fails with: test/dm/k210_pll.c: In function ‘dm_test_k210_pll_calc_config’: include/linux/bitops.h:11:38: warning: left shift count >= width of type [-Wshift-count-overflow] 11 | #define BIT(nr) (1UL << (nr)) | ^~ test/dm/k210_pll.c:36:54: note: in expansion of macro ‘BIT’ 36 | error = abs((error - BIT(32))) >> 16; | ^~~ Use the BIT_ULL() macro to create a u64 value. Replace abs() by abs64() to get correct results on 32bit system Apply the same for the unit test. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Reviewed-by: Sean Anderson <seanga2@gmail.com>
This commit is contained in:
committed by
Leo Yu-Chi Liang
parent
e67f34f778
commit
e77ef0bb74
@@ -846,7 +846,7 @@ again:
|
|||||||
|
|
||||||
error = DIV_ROUND_CLOSEST_ULL(f * inv_ratio, r * od);
|
error = DIV_ROUND_CLOSEST_ULL(f * inv_ratio, r * od);
|
||||||
/* The lower 16 bits are spurious */
|
/* The lower 16 bits are spurious */
|
||||||
error = abs((error - BIT(32))) >> 16;
|
error = abs64((error - BIT_ULL(32))) >> 16;
|
||||||
|
|
||||||
if (error < best_error) {
|
if (error < best_error) {
|
||||||
best->r = r;
|
best->r = r;
|
||||||
|
@@ -33,7 +33,7 @@ static int dm_test_k210_pll_calc_config(u32 rate, u32 rate_in,
|
|||||||
error = DIV_ROUND_CLOSEST_ULL(f * inv_ratio,
|
error = DIV_ROUND_CLOSEST_ULL(f * inv_ratio,
|
||||||
r * od);
|
r * od);
|
||||||
/* The lower 16 bits are spurious */
|
/* The lower 16 bits are spurious */
|
||||||
error = abs((error - BIT(32))) >> 16;
|
error = abs64((error - BIT_ULL(32))) >> 16;
|
||||||
if (error < best_error) {
|
if (error < best_error) {
|
||||||
best->r = r;
|
best->r = r;
|
||||||
best->f = f;
|
best->f = f;
|
||||||
|
Reference in New Issue
Block a user