From 8d836581f9b1f57ceaa2b47654754ef1260b410b Mon Sep 17 00:00:00 2001 From: Niklas Cassel Date: Wed, 16 Sep 2026 15:00:32 +0200 Subject: ata: libata-scsi: fix ata_dsm_trim_pages() kernel-doc make htmldocs fails with: Documentation/driver-api/libata:604: ./drivers/ata/libata-scsi.c:2301: ERROR: Unexpected indentation. [docutils] The Return: section of ata_dsm_trim_pages() ends its first sentence with a colon and continues with an indented bullet list. reStructuredText requires a blank line before an indented block, so docutils chokes on the list. Simply adding the missing blank line does not work either: Return: is a kernel-doc "special section", which is terminated by the first blank line, so the bullet list would end up in the Description section, detached from the sentence introducing it. Spell the two bounds out as prose instead, so that the Return: section stays self-contained. Documentation-only change. Fixes: e64e6b5dc867 ("ata: libata-scsi: scale DSM TRIM payload by MAX PAGES PER DSM COMMAND") Reported-by: Thomas Huth Closes: https://lore.kernel.org/linux-ide/b0a0b8e8-cc4f-4c7b-8bc5-fee0712d405a@redhat.com/ Reviewed-by: Damien Le Moal Reviewed-by: Thomas Huth Link: https://lore.kernel.org/r/20260916130031.29990-2-cassel@kernel.org Signed-off-by: Niklas Cassel --- drivers/leds/leds-syscon.c | 137 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 137 insertions(+) create mode 100644 drivers/leds/leds-syscon.c (limited to 'drivers/leds/leds-syscon.c') diff --git a/drivers/leds/leds-syscon.c b/drivers/leds/leds-syscon.c new file mode 100644 index 000000000..d633ad519 --- /dev/null +++ b/drivers/leds/leds-syscon.c @@ -0,0 +1,137 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Generic Syscon LEDs Driver + * + * Copyright (c) 2014, Linaro Limited + * Author: Linus Walleij + */ +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/** + * struct syscon_led - state container for syscon based LEDs + * @cdev: LED class device for this LED + * @map: regmap to access the syscon device backing this LED + * @offset: the offset into the syscon regmap for the LED register + * @mask: the bit in the register corresponding to the LED + * @state: current state of the LED + */ +struct syscon_led { + struct led_classdev cdev; + struct regmap *map; + u32 offset; + u32 mask; + bool state; +}; + +static void syscon_led_set(struct led_classdev *led_cdev, + enum led_brightness value) +{ + struct syscon_led *sled = + container_of(led_cdev, struct syscon_led, cdev); + u32 val; + int ret; + + if (value == LED_OFF) { + val = 0; + sled->state = false; + } else { + val = sled->mask; + sled->state = true; + } + + ret = regmap_update_bits(sled->map, sled->offset, sled->mask, val); + if (ret < 0) + dev_err(sled->cdev.dev, "error updating LED status\n"); +} + +static int syscon_led_probe(struct platform_device *pdev) +{ + struct led_init_data init_data = {}; + struct device *dev = &pdev->dev; + struct device_node *np = dev_of_node(dev); + struct device *parent; + struct regmap *map; + struct syscon_led *sled; + enum led_default_state state; + u32 value; + int ret; + + parent = dev->parent; + if (!parent) { + dev_err(dev, "no parent for syscon LED\n"); + return -ENODEV; + } + map = syscon_node_to_regmap(dev_of_node(parent)); + if (IS_ERR(map)) { + dev_err(dev, "no regmap for syscon LED parent\n"); + return PTR_ERR(map); + } + + sled = devm_kzalloc(dev, sizeof(*sled), GFP_KERNEL); + if (!sled) + return -ENOMEM; + + sled->map = map; + + if (of_property_read_u32(np, "reg", &sled->offset) && + of_property_read_u32(np, "offset", &sled->offset)) + return -EINVAL; + if (of_property_read_u32(np, "mask", &sled->mask)) + return -EINVAL; + + init_data.fwnode = of_fwnode_handle(np); + + state = led_init_default_state_get(init_data.fwnode); + switch (state) { + case LEDS_DEFSTATE_ON: + ret = regmap_update_bits(map, sled->offset, sled->mask, sled->mask); + if (ret < 0) + return ret; + sled->state = true; + break; + case LEDS_DEFSTATE_KEEP: + ret = regmap_read(map, sled->offset, &value); + if (ret < 0) + return ret; + sled->state = !!(value & sled->mask); + break; + default: + ret = regmap_update_bits(map, sled->offset, sled->mask, 0); + if (ret < 0) + return ret; + sled->state = false; + } + sled->cdev.brightness_set = syscon_led_set; + + ret = devm_led_classdev_register_ext(dev, &sled->cdev, &init_data); + if (ret < 0) + return ret; + + platform_set_drvdata(pdev, sled); + dev_info(dev, "registered LED %s\n", sled->cdev.name); + + return 0; +} + +static const struct of_device_id of_syscon_leds_match[] = { + { .compatible = "register-bit-led", }, + {}, +}; + +static struct platform_driver syscon_led_driver = { + .probe = syscon_led_probe, + .driver = { + .name = "leds-syscon", + .of_match_table = of_syscon_leds_match, + .suppress_bind_attrs = true, + }, +}; +builtin_platform_driver(syscon_led_driver); -- cgit v1.3.1