]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
PCI: Use align and resource helpers, and SZ_* in quirk_s3_64M()
authorIlpo Järvinen <ilpo.jarvinen@linux.intel.com>
Fri, 14 Jun 2024 10:06:05 +0000 (13:06 +0300)
committerBjorn Helgaas <bhelgaas@google.com>
Thu, 10 Oct 2024 22:45:34 +0000 (17:45 -0500)
Use IS_ALIGNED(), resource_size(), and SZ_* defines in quirk_s3_64M().

Link: https://lore.kernel.org/r/20240614100606.15830-4-ilpo.jarvinen@linux.intel.com
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/pci/quirks.c

index e25476a766a7356af67a4e64dfbc71805159ef71..e85b89ca5601703326a007490ea5d7fc85713db6 100644 (file)
@@ -12,6 +12,7 @@
  * file, where their drivers can use them.
  */
 
+#include <linux/align.h>
 #include <linux/bitfield.h>
 #include <linux/types.h>
 #include <linux/kernel.h>
@@ -604,7 +605,7 @@ static void quirk_s3_64M(struct pci_dev *dev)
 {
        struct resource *r = &dev->resource[0];
 
-       if ((r->start & 0x3ffffff) || r->end != r->start + 0x3ffffff) {
+       if (!IS_ALIGNED(r->start, SZ_64M) || resource_size(r) != SZ_64M) {
                r->flags |= IORESOURCE_UNSET;
                resource_set_range(r, 0, SZ_64M);
        }