Commit 8fa0a44e authored by Ilpo Järvinen's avatar Ilpo Järvinen Committed by Bjorn Helgaas

PCI: Make minimum bridge window alignment reference more obvious

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_1M).

Link: https://lore.kernel.org/r/20240507102523.57320-8-ilpo.jarvinen@linux.intel.comSigned-off-by: default avatarIlpo Järvinen <ilpo.jarvinen@linux.intel.com>
[bhelgaas: squash https://lore.kernel.org/r/20240612093250.17544-1-ilpo.jarvinen@linux.intel.com]
Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
Reviewed-by: default avatarMika Westerberg <mika.westerberg@linux.intel.com>
parent 903534fa
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
* tighter packing. Prefetchable range support. * tighter packing. Prefetchable range support.
*/ */
#include <linux/bitops.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/module.h> #include <linux/module.h>
...@@ -21,6 +22,7 @@ ...@@ -21,6 +22,7 @@
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/ioport.h> #include <linux/ioport.h>
#include <linux/cache.h> #include <linux/cache.h>
#include <linux/sizes.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/acpi.h> #include <linux/acpi.h>
#include "pci.h" #include "pci.h"
...@@ -957,7 +959,7 @@ static inline resource_size_t calculate_mem_align(resource_size_t *aligns, ...@@ -957,7 +959,7 @@ static inline resource_size_t calculate_mem_align(resource_size_t *aligns,
for (order = 0; order <= max_order; order++) { for (order = 0; order <= max_order; order++) {
resource_size_t align1 = 1; resource_size_t align1 = 1;
align1 <<= (order + 20); align1 <<= order + __ffs(SZ_1M);
if (!align) if (!align)
min_align = align1; min_align = align1;
...@@ -1047,7 +1049,7 @@ static int pbus_size_mem(struct pci_bus *bus, unsigned long mask, ...@@ -1047,7 +1049,7 @@ static int pbus_size_mem(struct pci_bus *bus, unsigned long mask,
* resources. * resources.
*/ */
align = pci_resource_alignment(dev, r); align = pci_resource_alignment(dev, r);
order = __ffs(align) - 20; order = __ffs(align) - __ffs(SZ_1M);
if (order < 0) if (order < 0)
order = 0; order = 0;
if (order >= ARRAY_SIZE(aligns)) { if (order >= ARRAY_SIZE(aligns)) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment