mfd: lpc_ich: Use ALIGN_DOWN() to obtain the start of the SPI base range
authorIlpo Järvinen <ilpo.jarvinen@linux.intel.com>
Fri, 29 Dec 2023 14:50:59 +0000 (16:50 +0200)
committerLee Jones <lee@kernel.org>
Fri, 23 Feb 2024 14:58:00 +0000 (14:58 +0000)
Instead of open coding, use ALIGN_DOWN() for alignment.

Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Link: https://lore.kernel.org/r/20231229145059.6138-1-ilpo.jarvinen@linux.intel.com
Signed-off-by: Lee Jones <lee@kernel.org>
drivers/mfd/lpc_ich.c

index 73a0e7f9bd3116d1e8c8a14f5fa6784e8f788092..f14901660147f562b475d74c95a62e26f44877fb 100644 (file)
@@ -38,6 +38,7 @@
 
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 
+#include <linux/align.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/errno.h>
@@ -1321,7 +1322,7 @@ static int lpc_ich_init_spi(struct pci_dev *dev)
        case INTEL_SPI_BYT:
                pci_read_config_dword(dev, SPIBASE_BYT, &spi_base);
                if (spi_base & SPIBASE_BYT_EN) {
-                       res->start = spi_base & ~(SPIBASE_BYT_SZ - 1);
+                       res->start = ALIGN_DOWN(spi_base, SPIBASE_BYT_SZ);
                        res->end = res->start + SPIBASE_BYT_SZ - 1;
 
                        info->set_writeable = lpc_ich_byt_set_writeable;