[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220131151346.45792-4-andriy.shevchenko@linux.intel.com>
Date: Mon, 31 Jan 2022 17:13:41 +0200
From: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
Wolfram Sang <wsa@...nel.org>, Jean Delvare <jdelvare@...e.de>,
Heiner Kallweit <hkallweit1@...il.com>,
Lee Jones <lee.jones@...aro.org>,
Hans de Goede <hdegoede@...hat.com>,
Linus Walleij <linus.walleij@...aro.org>,
Tan Jui Nee <jui.nee.tan@...el.com>,
Kate Hsuan <hpa@...hat.com>,
Jonathan Yong <jonathan.yong@...el.com>,
linux-kernel@...r.kernel.org, linux-edac@...r.kernel.org,
linux-i2c@...r.kernel.org, linux-gpio@...r.kernel.org,
platform-driver-x86@...r.kernel.org
Cc: Borislav Petkov <bp@...en8.de>,
Mauro Carvalho Chehab <mchehab@...nel.org>,
Tony Luck <tony.luck@...el.com>,
James Morse <james.morse@....com>,
Robert Richter <rric@...nel.org>,
Jean Delvare <jdelvare@...e.com>,
Peter Tyser <ptyser@...-inc.com>,
Mika Westerberg <mika.westerberg@...ux.intel.com>,
Andy Shevchenko <andy@...nel.org>,
Mark Gross <markgross@...nel.org>,
Henning Schild <henning.schild@...mens.com>
Subject: [PATCH v4 3/8] mfd: lpc_ich: Factor out lpc_ich_enable_spi_write()
Factor out duplicate code to lpc_ich_enable_spi_write() helper function.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Acked-by: Hans de Goede <hdegoede@...hat.com>
Acked-by: Linus Walleij <linus.walleij@...aro.org>
Acked-for-MFD-by: Lee Jones <lee.jones@...aro.org>
---
drivers/mfd/lpc_ich.c | 17 ++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)
diff --git a/drivers/mfd/lpc_ich.c b/drivers/mfd/lpc_ich.c
index f10e53187f67..13d8c64318e6 100644
--- a/drivers/mfd/lpc_ich.c
+++ b/drivers/mfd/lpc_ich.c
@@ -1084,12 +1084,21 @@ static int lpc_ich_init_wdt(struct pci_dev *dev)
return ret;
}
+static void lpc_ich_test_spi_write(struct pci_dev *dev, unsigned int devfn,
+ struct intel_spi_boardinfo *info)
+{
+ u32 bcr;
+
+ pci_bus_read_config_dword(dev->bus, devfn, BCR, &bcr);
+ info->writeable = !!(bcr & BCR_WPD);
+}
+
static int lpc_ich_init_spi(struct pci_dev *dev)
{
struct lpc_ich_priv *priv = pci_get_drvdata(dev);
struct resource *res = &intel_spi_res[0];
struct intel_spi_boardinfo *info;
- u32 spi_base, rcba, bcr;
+ u32 spi_base, rcba;
info = devm_kzalloc(&dev->dev, sizeof(*info), GFP_KERNEL);
if (!info)
@@ -1113,8 +1122,7 @@ static int lpc_ich_init_spi(struct pci_dev *dev)
res->start = spi_base + SPIBASE_LPT;
res->end = res->start + SPIBASE_LPT_SZ - 1;
- pci_read_config_dword(dev, BCR, &bcr);
- info->writeable = !!(bcr & BCR_WPD);
+ lpc_ich_test_spi_write(dev, dev->devfn, info);
}
break;
@@ -1135,8 +1143,7 @@ static int lpc_ich_init_spi(struct pci_dev *dev)
res->start = spi_base & 0xfffffff0;
res->end = res->start + SPIBASE_APL_SZ - 1;
- pci_bus_read_config_dword(bus, spi, BCR, &bcr);
- info->writeable = !!(bcr & BCR_WPD);
+ lpc_ich_test_spi_write(dev, spi, info);
}
pci_bus_write_config_byte(bus, p2sb, 0xe1, 0x1);
--
2.34.1
Powered by blists - more mailing lists