[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2804366.mvXUDI8C0e@g550jk>
Date: Mon, 09 Mar 2020 23:52:06 +0100
From: Luca Weiss <luca@...tu.xyz>
To: Sakari Ailus <sakari.ailus@....fi>, Pavel Machek <pavel@....cz>
Cc: linux-leds@...r.kernel.org, Dan Murphy <dmurphy@...com>,
Heiko Stuebner <heiko@...ech.de>,
Icenowy Zheng <icenowy@...c.io>,
Jacek Anaszewski <jacek.anaszewski@...il.com>,
Laurent Pinchart <laurent.pinchart@...asonboard.com>,
Mark Rutland <mark.rutland@....com>,
Maxime Ripard <mripard@...nel.org>,
Rob Herring <robh+dt@...nel.org>,
Shawn Guo <shawnguo@...nel.org>, devicetree@...r.kernel.org,
linux-kernel@...r.kernel.org, ~postmarketos/upstreaming@...ts.sr.ht
Subject: Re: [PATCH 3/3] leds: add sgm3140 driver
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
Powered by blists - more mailing lists