All of lore.kernel.org
 help / color / mirror / Atom feed
From: Luca Weiss <luca@z3ntu.xyz>
To: Sakari Ailus <sakari.ailus@iki.fi>, Pavel Machek <pavel@ucw.cz>
Cc: linux-leds@vger.kernel.org, Dan Murphy <dmurphy@ti.com>,
	Heiko Stuebner <heiko@sntech.de>, Icenowy Zheng <icenowy@aosc.io>,
	Jacek Anaszewski <jacek.anaszewski@gmail.com>,
	Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	Mark Rutland <mark.rutland@arm.com>,
	Maxime Ripard <mripard@kernel.org>,
	Rob Herring <robh+dt@kernel.org>, Shawn Guo <shawnguo@kernel.org>,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	~postmarketos/upstreaming@lists.sr.ht
Subject: Re: [PATCH 3/3] leds: add sgm3140 driver
Date: Mon, 09 Mar 2020 23:52:06 +0100	[thread overview]
Message-ID: <2804366.mvXUDI8C0e@g550jk> (raw)
In-Reply-To: <20200309224926.GA2917@duo.ucw.cz>

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



  reply	other threads:[~2020-03-09 22:52 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-09 20:35 [PATCH 0/3] Add sgm3140 flash led driver Luca Weiss
2020-03-09 20:35 ` [PATCH 1/3] dt-bindings: Add vendor prefix for SG Micro Corp Luca Weiss
2020-03-23 20:54   ` Rob Herring
2020-03-09 20:35 ` [PATCH 2/3] dt-bindings: leds: Add binding for sgm3140 Luca Weiss
2020-03-09 22:22   ` Sakari Ailus
2020-03-11 12:49   ` Dan Murphy
2020-03-15 10:47     ` Luca Weiss
2020-03-15 10:53       ` Laurent Pinchart
2020-03-23 21:30         ` Dan Murphy
2020-03-23 20:57   ` Rob Herring
2020-03-24 20:02     ` Luca Weiss
2020-03-09 20:35 ` [PATCH 3/3] leds: add sgm3140 driver Luca Weiss
2020-03-09 22:18   ` Sakari Ailus
2020-03-09 22:49     ` Pavel Machek
2020-03-09 22:52       ` Luca Weiss [this message]
2020-03-11 13:02   ` Dan Murphy
2020-03-11 21:09     ` Jacek Anaszewski
2020-03-15 10:42     ` Luca Weiss

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2804366.mvXUDI8C0e@g550jk \
    --to=luca@z3ntu.xyz \
    --cc=devicetree@vger.kernel.org \
    --cc=dmurphy@ti.com \
    --cc=heiko@sntech.de \
    --cc=icenowy@aosc.io \
    --cc=jacek.anaszewski@gmail.com \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-leds@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mripard@kernel.org \
    --cc=pavel@ucw.cz \
    --cc=robh+dt@kernel.org \
    --cc=sakari.ailus@iki.fi \
    --cc=shawnguo@kernel.org \
    --cc=~postmarketos/upstreaming@lists.sr.ht \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.