[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Zjo0HJDBVr-FPFfn@smile.fi.intel.com>
Date: Tue, 7 May 2024 17:01:00 +0300
From: Andy Shevchenko <andriy.shevchenko@...el.com>
To: Ilpo Järvinen <ilpo.jarvinen@...ux.intel.com>,
Yury Norov <yury.norov@...il.com>
Cc: linux-pci@...r.kernel.org, Bjorn Helgaas <bhelgaas@...gle.com>,
Lorenzo Pieralisi <lorenzo.pieralisi@....com>,
Rob Herring <robh@...nel.org>,
Krzysztof Wilczyński <kw@...ux.com>,
Igor Mammedov <imammedo@...hat.com>,
Mika Westerberg <mika.westerberg@...ux.intel.com>,
"Rafael J . Wysocki" <rafael@...nel.org>,
Jonathan Cameron <Jonathan.Cameron@...wei.com>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3 7/8] PCI: Make minimum bridge window alignment
reference more obvious
On Tue, May 07, 2024 at 01:25:22PM +0300, Ilpo Järvinen wrote:
> Calculations related to bridge window size contain literal 20 that is
> the minimum alignment for a bridge window. Make the code more obvious
> by converting the literal 20 to __ffs(SZ_1MB).
..
> - align1 <<= (order + 20);
> + align1 <<= (order + __ffs(SZ_1M));
No need for outer parentheses.
..
> + order = __ffs(align) - __ffs(SZ_1M);
Yeah, would be nice to have something like
#define bit_distance(a, b) (ffs(a) - fls(b))
in bitops.h as we have a few users and I have heard about one more coming,
but this is topic to another discussion. (Yuri, just FYI.)
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists