summaryrefslogtreecommitdiff
path: root/drivers/leds/simple
diff options
context:
space:
mode:
authorHenning Schild <henning.schild@siemens.com>2022-06-06 19:41:36 +0300
committerLee Jones <lee@kernel.org>2022-07-14 10:50:36 +0100
commit759273c3c429ffbd8f24655fd0480cd408a1804c (patch)
treea64160e117442f0d7b245005a1d9c079257e8721 /drivers/leds/simple
parente38da7d30f56ec6f9fae505a80561d4357cc7024 (diff)
leds: simatic-ipc-leds: Convert to use P2SB accessor
Since we have a common P2SB accessor in tree we may use it instead of open coded variants. Replace custom code by p2sb_bar() call. Signed-off-by: Henning Schild <henning.schild@siemens.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Lee Jones <lee@kernel.org>
Diffstat (limited to 'drivers/leds/simple')
-rw-r--r--drivers/leds/simple/Kconfig1
-rw-r--r--drivers/leds/simple/simatic-ipc-leds.c14
2 files changed, 8 insertions, 7 deletions
diff --git a/drivers/leds/simple/Kconfig b/drivers/leds/simple/Kconfig
index 9f6a68336659..bbf8cff3c3f6 100644
--- a/drivers/leds/simple/Kconfig
+++ b/drivers/leds/simple/Kconfig
@@ -3,6 +3,7 @@ config LEDS_SIEMENS_SIMATIC_IPC
tristate "LED driver for Siemens Simatic IPCs"
depends on LEDS_CLASS
depends on SIEMENS_SIMATIC_IPC
+ select P2SB
help
This option enables support for the LEDs of several Industrial PCs
from Siemens.
diff --git a/drivers/leds/simple/simatic-ipc-leds.c b/drivers/leds/simple/simatic-ipc-leds.c
index 078d43f5ba38..2e7597c143d8 100644
--- a/drivers/leds/simple/simatic-ipc-leds.c
+++ b/drivers/leds/simple/simatic-ipc-leds.c
@@ -15,6 +15,7 @@
#include <linux/leds.h>
#include <linux/module.h>
#include <linux/pci.h>
+#include <linux/platform_data/x86/p2sb.h>
#include <linux/platform_data/x86/simatic-ipc-base.h>
#include <linux/platform_device.h>
#include <linux/sizes.h>
@@ -38,8 +39,8 @@ static struct simatic_ipc_led simatic_ipc_leds_io[] = {
{ }
};
-/* the actual start will be discovered with PCI, 0 is a placeholder */
-static struct resource simatic_ipc_led_mem_res = DEFINE_RES_MEM_NAMED(0, SZ_4K, KBUILD_MODNAME);
+/* the actual start will be discovered with p2sb, 0 is a placeholder */
+static struct resource simatic_ipc_led_mem_res = DEFINE_RES_MEM_NAMED(0, 0, KBUILD_MODNAME);
static void __iomem *simatic_ipc_led_memory;
@@ -145,14 +146,13 @@ static int simatic_ipc_leds_probe(struct platform_device *pdev)
ipcled = simatic_ipc_leds_mem;
type = IORESOURCE_MEM;
- /* get GPIO base from PCI */
- res->start = simatic_ipc_get_membase0(PCI_DEVFN(13, 0));
- if (res->start == 0)
- return -ENODEV;
+ err = p2sb_bar(NULL, 0, res);
+ if (err)
+ return err;
/* do the final address calculation */
res->start = res->start + (0xC5 << 16);
- res->end += res->start;
+ res->end = res->start + SZ_4K - 1;
simatic_ipc_led_memory = devm_ioremap_resource(dev, res);
if (IS_ERR(simatic_ipc_led_memory))