[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20191119170019.GU43905@e119886-lin.cambridge.arm.com>
Date: Tue, 19 Nov 2019 17:00:21 +0000
From: Andrew Murray <andrew.murray@....com>
To: Jason Gunthorpe <jgg@...pe.ca>
Cc: Nicolas Saenz Julienne <nsaenzjulienne@...e.de>,
Heiko Stuebner <heiko@...ech.de>, linux-pci@...r.kernel.org,
Shawn Lin <shawn.lin@...k-chips.com>,
Christoph Hellwig <hch@....de>,
Marek Szyprowski <m.szyprowski@...sung.com>,
Lorenzo Pieralisi <lorenzo.pieralisi@....com>,
linux-rdma@...r.kernel.org, maz@...nel.org, phil@...pberrypi.org,
iommu@...ts.linux-foundation.org,
linux-rockchip@...ts.infradead.org, f.fainelli@...il.com,
Bjorn Helgaas <bhelgaas@...gle.com>,
linux-arm-kernel@...ts.infradead.org, mbrugger@...e.com,
netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
jeremy.linton@....com, Tom Joseph <tjoseph@...ence.com>,
wahrenst@....net, james.quinlan@...adcom.com,
Robin Murphy <robin.murphy@....com>,
"David S. Miller" <davem@...emloft.net>,
Tariq Toukan <tariqt@...lanox.com>
Subject: Re: [PATCH v2 1/6] linux/log2.h: Add roundup/rounddown_pow_two64()
family of functions
On Tue, Nov 19, 2019 at 12:55:02PM -0400, Jason Gunthorpe wrote:
> On Tue, Nov 19, 2019 at 04:28:50PM +0000, Andrew Murray wrote:
> > On Tue, Nov 19, 2019 at 01:43:39PM +0100, Nicolas Saenz Julienne wrote:
> > > On Tue, 2019-11-19 at 12:30 +0100, Nicolas Saenz Julienne wrote:
> > > > Hi Andrew, thanks for the review.
> > > > > > +/**
> > > > > > + * __roundup_pow_of_two64() - round 64bit value up to nearest power of
> > > > > > two
> > > > > > + * @n: value to round up
> > > > > > + */
> > > > > > +static inline __attribute__((const)) __u64 __roundup_pow_of_two64(__u64
> > > > > > n)
> > > > >
> > > > > To be consistent with other functions in the same file (__ilog_u64) you may
> > > > > want to rename this to __roundup_pow_of_two_u64.
> > > >
> > > > Sounds good to me.
> > > >
> > > > > Also do you know why u64 is used in some places and __u64 in others?
> > > >
> > > > That's unwarranted, it should be __u64 everywhere.
> > >
> > > Sorry, now that I look deeper into it, it should be u64.
> >
> > Do you know the reason why? I'd be interested to know.
>
> __u64 must be used in header files that are under uapi - ie it is the
> name of the symbol in userspace, and u64 does not exist.
>
> u64 should be used in all code that is only inside the kernel, ie .c
> files, internal headers, etc
>
> I routinely discourage use of __uXX in kernel native code.
Thanks for this, much appreciated!
Andrew Murray
>
> Jason
Powered by blists - more mailing lists