aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/leds/simple
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2022-03-27 14:09:48 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2022-03-27 14:09:48 -0700
commitdfb0a0b715fdda25a5a1f54cb9c73e1410a868e8 (patch)
treeafe6d503b462c1265a2903be5479a1f2d22955ff /drivers/leds/simple
parentMerge tag 'perf-tools-for-v5.18-2022-03-26' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux (diff)
parentleds: pca955x: Allow zero LEDs to be specified (diff)
downloadlinux-dev-dfb0a0b715fdda25a5a1f54cb9c73e1410a868e8.tar.xz
linux-dev-dfb0a0b715fdda25a5a1f54cb9c73e1410a868e8.zip
Merge tag 'leds-5.18-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/pavel/linux-leds
Pull LED updates from Pavel Machek: "Nothing major here, there are two drivers that need review and did not make it into this round" * tag 'leds-5.18-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/pavel/linux-leds: leds: pca955x: Allow zero LEDs to be specified leds: pca955x: Make the gpiochip always expose all pins leds: simatic-ipc-leds: Don't directly deref ioremap_resource() returned ptr leds: simatic-ipc-leds: Make simatic_ipc_led_mem_res static leds: lm3692x: Return 0 from remove callback leds: sgm3140: Add ocs,ocp8110 compatible dt-bindings: vendor-prefixes: Add ocs prefix dt-bindings: leds: common: fix unit address in max77693 example
Diffstat (limited to 'drivers/leds/simple')
-rw-r--r--drivers/leds/simple/simatic-ipc-leds.c34
1 files changed, 19 insertions, 15 deletions
diff --git a/drivers/leds/simple/simatic-ipc-leds.c b/drivers/leds/simple/simatic-ipc-leds.c
index ff2c96e73241..078d43f5ba38 100644
--- a/drivers/leds/simple/simatic-ipc-leds.c
+++ b/drivers/leds/simple/simatic-ipc-leds.c
@@ -39,9 +39,9 @@ static struct simatic_ipc_led simatic_ipc_leds_io[] = {
};
/* the actual start will be discovered with PCI, 0 is a placeholder */
-struct resource simatic_ipc_led_mem_res = DEFINE_RES_MEM_NAMED(0, SZ_4K, KBUILD_MODNAME);
+static struct resource simatic_ipc_led_mem_res = DEFINE_RES_MEM_NAMED(0, SZ_4K, KBUILD_MODNAME);
-static void *simatic_ipc_led_memory;
+static void __iomem *simatic_ipc_led_memory;
static struct simatic_ipc_led simatic_ipc_leds_mem[] = {
{0x500 + 0x1A0, "red:" LED_FUNCTION_STATUS "-1"},
@@ -92,21 +92,22 @@ static void simatic_ipc_led_set_mem(struct led_classdev *led_cd,
enum led_brightness brightness)
{
struct simatic_ipc_led *led = cdev_to_led(led_cd);
+ void __iomem *reg = simatic_ipc_led_memory + led->value;
+ u32 val;
- u32 *p;
-
- p = simatic_ipc_led_memory + led->value;
- *p = (*p & ~1) | (brightness == LED_OFF);
+ val = readl(reg);
+ val = (val & ~1) | (brightness == LED_OFF);
+ writel(val, reg);
}
static enum led_brightness simatic_ipc_led_get_mem(struct led_classdev *led_cd)
{
struct simatic_ipc_led *led = cdev_to_led(led_cd);
+ void __iomem *reg = simatic_ipc_led_memory + led->value;
+ u32 val;
- u32 *p;
-
- p = simatic_ipc_led_memory + led->value;
- return (*p & 1) ? LED_OFF : led_cd->max_brightness;
+ val = readl(reg);
+ return (val & 1) ? LED_OFF : led_cd->max_brightness;
}
static int simatic_ipc_leds_probe(struct platform_device *pdev)
@@ -116,8 +117,9 @@ static int simatic_ipc_leds_probe(struct platform_device *pdev)
struct simatic_ipc_led *ipcled;
struct led_classdev *cdev;
struct resource *res;
+ void __iomem *reg;
int err, type;
- u32 *p;
+ u32 val;
switch (plat->devmode) {
case SIMATIC_IPC_DEVICE_227D:
@@ -157,11 +159,13 @@ static int simatic_ipc_leds_probe(struct platform_device *pdev)
return PTR_ERR(simatic_ipc_led_memory);
/* initialize power/watchdog LED */
- p = simatic_ipc_led_memory + 0x500 + 0x1D8; /* PM_WDT_OUT */
- *p = (*p & ~1);
- p = simatic_ipc_led_memory + 0x500 + 0x1C0; /* PM_BIOS_BOOT_N */
- *p = (*p | 1);
+ reg = simatic_ipc_led_memory + 0x500 + 0x1D8; /* PM_WDT_OUT */
+ val = readl(reg);
+ writel(val & ~1, reg);
+ reg = simatic_ipc_led_memory + 0x500 + 0x1C0; /* PM_BIOS_BOOT_N */
+ val = readl(reg);
+ writel(val | 1, reg);
break;
default:
return -ENODEV;