Hi Pavel On Montag, 9. März 2020 23:49:27 CET Pavel Machek wrote: > Hi! > > > > +#define FLASH_TIMEOUT_DEFAULT 250000 /* 250ms */ > > > +#define FLASH_MAX_TIMEOUT_DEFAULT 300000 /* 300ms */ > > > > Add U, and you can remove the cast elsewhere. > > I'll disagree here. Avoid U, avoid cast. Neither is needed. If neither cast to u32 nor the U suffix is used, then this warning will be printed: In file included from ./include/asm-generic/bug.h:19, from ./arch/arm64/include/asm/bug.h:26, from ./include/linux/bug.h:5, from ./include/linux/gpio/consumer.h:5, from drivers/leds/leds-sgm3140.c:4: drivers/leds/leds-sgm3140.c: In function 'sgm3140_probe': ./include/linux/kernel.h:835:29: warning: comparison of distinct pointer types lacks a cast 835 | (!!(sizeof((typeof(x) *)1 == (typeof(y) *)1))) | ^~ ./include/linux/kernel.h:849:4: note: in expansion of macro '__typecheck' 849 | (__typecheck(x, y) && __no_side_effects(x, y)) | ^~~~~~~~~~~ ./include/linux/kernel.h:859:24: note: in expansion of macro '__safe_cmp' 859 | __builtin_choose_expr(__safe_cmp(x, y), \ | ^~~~~~~~~~ ./include/linux/kernel.h:868:19: note: in expansion of macro '__careful_cmp' 868 | #define min(x, y) __careful_cmp(x, y, <) | ^~~~~~~~~~~~~ drivers/leds/leds-sgm3140.c:187:18: note: in expansion of macro 'min' 187 | priv->timeout = min(priv->max_timeout, FLASH_TIMEOUT_DEFAULT); | ^~~ So one of both is needed. > > Best regards, > Pavel Regards Luca