public inbox for linux-input@vger.kernel.org
 help / color / mirror / Atom feed
From: Lee Jones <lee.jones-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
To: Geert Uytterhoeven <geert-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.org>
Cc: Steve Twiss
	<stwiss.opensource-WBD+wuPFNBhBDgjK7y7TUQ@public.gmane.org>,
	kbuild test robot <lkp-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
	"kbuild-all-JC7UmRfGjtg@public.gmane.org"
	<kbuild-all-JC7UmRfGjtg@public.gmane.org>,
	LINUX-KERNEL
	<linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	DEVICETREE <devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	Dmitry Torokhov
	<dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	Eduardo Valentin
	<edubezval-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	Guenter Roeck <linux-0h96xk9xTtrk1uMJSBkQmQ@public.gmane.org>,
	LINUX-INPUT <linux-input-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	LINUX-PM <linux-pm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	LINUX-WATCHDOG
	<linux-watchdog-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	Liam Girdwood <lgirdwood-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	Mark Brown <broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	Mark Rutland <mark.rutland-5wv7dgnIgG8@public.gmane.org>,
	Rob Herring <robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	Support Opensource
	<Support.Opensource-WBD+wuPFNBhBDgjK7y7TUQ@public.gmane.org>,
	Wim Van Sebroeck <wim-IQzOog9fTRqzQB+pC5nmwQ@public.gmane.org>,
	Zhang Rui <rui.zhang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Subject: Re: [PATCH V6 4/7] mfd: da9061: MFD core support
Date: Wed, 29 Mar 2017 09:30:58 +0100	[thread overview]
Message-ID: <20170329083058.6pcslbsq3qnifwjv@dell> (raw)
In-Reply-To: <CAMuHMdU-kaAZ-Reji2v3jSypoDSiwYEWqD0vyYWwJpr6+rAPOA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>

On Tue, 28 Mar 2017, Geert Uytterhoeven wrote:

> Hi Steve,
> 
> On Tue, Mar 28, 2017 at 12:42 PM, Steve Twiss
> <stwiss.opensource-WBD+wuPFNBhBDgjK7y7TUQ@public.gmane.org> wrote:
> > On 28 March 2017 09:37, Geert Uytterhoeven wrote:
> >> Subject: Re: [PATCH V6 4/7] mfd: da9061: MFD core support
> >> On Tue, Mar 28, 2017 at 10:21 AM, Lee Jones <lee.jones-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> wrote:
> >> >> [auto build test WARNING on ljones-mfd/for-mfd-next]
> >> >> [also build test WARNING on v4.11-rc4 next-20170327]
> >> >> base:   https://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd.git for-mfd-next
> >> >> config: x86_64-randconfig-x009-201713 (attached as .config)
> >> >> compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
> >> >> reproduce:
> >> >>         # save the attached .config to linux build tree
> >> >>         make ARCH=x86_64
> >> >>
> >> >> All warnings (new ones prefixed by >>):
> >> >>
> >> >>    drivers//mfd/da9062-core.c: In function 'da9062_i2c_probe':
> >> >> >> drivers//mfd/da9062-core.c:845:21: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
> >> >>       chip->chip_type = (int)match->data;
> >> >>                        ^
> >> >
> >> > Please use longs or enums.
> >>
> >> Enums would still give a warning on 64-bit.
> >> The simple fix is change the cast from (int) to (uintptr_t).
> >
> > Hi Lee and Geert,
> >
> > How about this? Fix by redefining the enum chip_type to be an int.
> > Then, just use substitution:
> > #define COMPAT_TYPE_DA9061  1
> > #define COMPAT_TYPE_DA9062  2
> >
> > That would be simple.
> > Are there any reasons this would not be acceptable?
> 
> I don't see how that can help.
> The warning is caused by casting the "void *" (which is either 32-bit or
> 64-bit) in of_device_if.data to an integer or enum (which is always 32-bit).
> 
> The right fix is to cast it to uintptr_t intead of int, like other drivers do.

That's a hack though, isn't it?  chip->chip_type is not of type
uintptr_t, so all you're doing here is making the compiler happy.

I see people using (int)(uintptr_t), which I guess keeps the
compiler happy in the first instance and actually culminates in a
correct cast to the right type.

So how about something like (enum da9062_compatible_types)(long)?

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2017-03-29  8:30 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-27  9:51 [PATCH V6 0/7] da9061: DA9061 driver submission Steve Twiss
     [not found] ` <cover.1490608293.git.stwiss.opensource-WBD+wuPFNBhBDgjK7y7TUQ@public.gmane.org>
2017-03-27  9:51   ` [PATCH V6 2/7] Documentation: devicetree: thermal: da9062/61 TJUNC temperature binding Steve Twiss
2017-03-27  9:51   ` [PATCH V6 3/7] Documentation: devicetree: mfd: da9062/61 MFD binding Steve Twiss
2017-03-27  9:51   ` [PATCH V6 5/7] regulator: da9061: BUCK and LDO regulator driver Steve Twiss
2017-06-07 19:32     ` Applied "regulator: da9061: BUCK and LDO regulator driver" to the regulator tree Mark Brown
2017-03-27  9:51 ` [PATCH V6 1/7] Documentation: devicetree: watchdog: da9062/61 watchdog timer binding Steve Twiss
2017-03-27  9:51 ` [PATCH V6 4/7] mfd: da9061: MFD core support Steve Twiss
2017-03-27 14:51   ` kbuild test robot
2017-03-28  8:21     ` Lee Jones
2017-03-28  8:36       ` Geert Uytterhoeven
2017-03-28 10:42         ` Steve Twiss
2017-03-28 10:50           ` Geert Uytterhoeven
2017-03-28 11:24             ` Steve Twiss
     [not found]             ` <CAMuHMdU-kaAZ-Reji2v3jSypoDSiwYEWqD0vyYWwJpr6+rAPOA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-03-29  8:30               ` Lee Jones [this message]
2017-03-29  9:12                 ` Geert Uytterhoeven
2017-03-27  9:51 ` [PATCH V6 6/7] thermal: da9062/61: Thermal junction temperature monitoring driver Steve Twiss
2017-03-27  9:51 ` [PATCH V6 7/7] MAINTAINERS: da9062/61 updates to the Dialog Semiconductor search terms Steve Twiss

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=20170329083058.6pcslbsq3qnifwjv@dell \
    --to=lee.jones-qsej5fyqhm4dnm+yrofe0a@public.gmane.org \
    --cc=Support.Opensource-WBD+wuPFNBhBDgjK7y7TUQ@public.gmane.org \
    --cc=broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=edubezval-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=geert-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.org \
    --cc=kbuild-all-JC7UmRfGjtg@public.gmane.org \
    --cc=lgirdwood-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=linux-0h96xk9xTtrk1uMJSBkQmQ@public.gmane.org \
    --cc=linux-input-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-pm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-watchdog-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=lkp-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    --cc=mark.rutland-5wv7dgnIgG8@public.gmane.org \
    --cc=robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=rui.zhang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    --cc=stwiss.opensource-WBD+wuPFNBhBDgjK7y7TUQ@public.gmane.org \
    --cc=wim-IQzOog9fTRqzQB+pC5nmwQ@public.gmane.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox