[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <ab04933a7dea42049d20597cb65d84f1@AcuMS.aculab.com>
Date: Wed, 28 Aug 2019 08:27:45 +0000
From: David Laight <David.Laight@...LAB.COM>
To: 'Joe Perches' <joe@...ches.com>,
Geert Uytterhoeven <geert@...ux-m68k.org>,
Al Viro <viro@...iv.linux.org.uk>,
Andrew Morton <akpm@...ux-foundation.org>
CC: Bernard Metzler <bmt@...ich.ibm.com>,
Doug Ledford <dledford@...hat.com>,
Jason Gunthorpe <jgg@...pe.ca>,
linux-rdma <linux-rdma@...r.kernel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH] RDMA/siw: Fix compiler warnings on 32-bit due to
u64/pointer abuse
From: Joe Perches
> Sent: 27 August 2019 19:33
> On Tue, 2019-08-27 at 19:59 +0200, Geert Uytterhoeven wrote:
> > On Tue, Aug 27, 2019 at 7:46 PM Al Viro <viro@...iv.linux.org.uk> wrote:
> > > On Tue, Aug 27, 2019 at 07:29:52PM +0200, Geert Uytterhoeven wrote:
> > > > On Tue, Aug 27, 2019 at 4:17 PM David Laight <David.Laight@...lab.com> wrote:
> > > > > From: Geert Uytterhoeven
> > > > > > Sent: 19 August 2019 18:15
> > > > > ...
> > > > > > > I think a cast to unsigned long is rather more common.
> > > > > > >
> > > > > > > uintptr_t is used ~1300 times in the kernel.
> > > > > > > I believe a cast to unsigned long is much more common.
>
> btw: apparently that's not true.
>
> This grep may be incomplete but it seems there are fewer
> kernel uses of a cast to unsigned long then pointer:
>
> $ git grep -P '\(\s*\w+(\s+\w+){0,3}(\s*\*)+\s*\)\s*\(\s*unsigned\s+long\s*\)'|wc -l
> 423
>
> Maybe add a cast_to_ptr macro like
>
> #define cast_to_ptr(type, val) ((type)(uintptr_t)(val))
>
> though that may not save any horizontal space
And it is another bit of pointless obfuscation....
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
Powered by blists - more mailing lists