summaryrefslogtreecommitdiffstats
path: root/drivers/leds/leds-powernv.c
Commit message (Collapse)AuthorAgeFilesLines
* leds: Convert all platform drivers to return voidUwe Kleine-König2023-11-011-3/+2
| | | | | | | | | | | | | | | | | | | The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Eventually after all drivers are converted, .remove_new() is renamed to .remove(). All platform drivers below drivers/leds/ unconditionally return zero in their remove callback and so can be converted trivially to the variant returning void. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Link: https://lore.kernel.org/r/20230917130947.1122198-1-u.kleine-koenig@pengutronix.de Signed-off-by: Lee Jones <lee@kernel.org>
* leds: various: use only available OF childrenMarek Behún2020-09-261-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Various drivers count and iterate over OF children nodes via of_get_child_count and for_each_child_of_node. Instead they should use of_get_available_child_count and for_each_available_child_of_node, so that if a given node has the `status` property set to `disabled`, the child will be ignored. Signed-off-by: Marek Behún <marek.behun@nic.cz> Cc: Andrew Lunn <andrew@lunn.ch> Cc: Andrey Utkin <andrey_utkin@fastmail.com> Cc: Baolin Wang <baolin.wang7@gmail.com> Cc: Baolin Wang <baolin.wang@linaro.org> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Christian Mauderer <oss@c-mauderer.de> Cc: Chunyan Zhang <zhang.lyra@gmail.com> Cc: Dan Murphy <dmurphy@ti.com> Cc: David Rivshin <drivshin@allworx.com> Cc: Haojian Zhuang <haojian.zhuang@marvell.com> Cc: H. Nikolaus Schaller <hns@goldelico.com> Cc: Michael Ellerman <mpe@ellerman.id.au> Cc: Milo Kim <milo.kim@ti.com> Cc: NeilBrown <neilb@suse.de> Cc: Nikita Travkin <nikitos.tr@gmail.com> Cc: Orson Zhai <orsonzhai@gmail.com> Cc: Paul Mackerras <paulus@samba.org> Cc: Philippe Retornaz <philippe.retornaz@epfl.ch> Cc: Riku Voipio <riku.voipio@iki.fi> Cc: Simon Guinot <sguinot@lacie.com> Cc: Simon Shields <simon@lineageos.org> Cc: Vasant Hegde <hegdevasant@linux.vnet.ibm.com> Cc: Xiaotong Lu <xiaotong.lu@spreadtrum.com> Signed-off-by: Pavel Machek <pavel@ucw.cz>
* treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152Thomas Gleixner2019-05-301-5/+1
| | | | | | | | | | | | | | | | | | | | | Based on 1 normalized pattern(s): this program is free software you can redistribute it and or modify it under the terms of the gnu general public license as published by the free software foundation either version 2 of the license or at your option any later version extracted by the scancode license scanner the SPDX license identifier GPL-2.0-or-later has been chosen to replace the boilerplate/reference in 3029 file(s). Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Allison Randal <allison@lohutok.net> Cc: linux-spdx@vger.kernel.org Link: https://lkml.kernel.org/r/20190527070032.746973796@linutronix.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* leds: powernv: add of_node_put()Yangtao Li2018-11-211-3/+9
| | | | | | | | | of_find_node_by_path() acquires a reference to the node returned by it and that reference needs to be dropped by its caller. powernv_led_probe() doesn't do that, so fix it. Signed-off-by: Yangtao Li <tiny.windzz@gmail.com> Signed-off-by: Jacek Anaszewski <jacek.anaszewski@gmail.com>
* leds: powernv: Delete an error message for a failed memory allocation in ↵Markus Elfring2017-08-291-5/+1
| | | | | | | | | | | | powernv_led_create() Omit an extra message for a memory allocation failure in this function. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> Acked-by: Pavel Machek <pavel@ucw.cz> Signed-off-by: Jacek Anaszewski <jacek.anaszewski@gmail.com>
* powerpc/opal: Add inline function to get rc from an ASYNC_COMP opal_msgSuraj Jitindar Singh2016-06-291-1/+1
| | | | | | | | | | | | | An opal_msg of type OPAL_MSG_ASYNC_COMP contains the return code in the params[1] struct member. However this isn't intuitive or obvious when reading the code and requires that a user look at the skiboot documentation or opal-api.h to verify this. Add an inline function to get the return code from an opal_msg and update call sites accordingly. Signed-off-by: Suraj Jitindar Singh <sjitindarsingh@gmail.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
* leds: powernv: Implement brightness_set_blocking opJacek Anaszewski2016-01-041-6/+10
| | | | | | | | | Since brightness setting can sleep for this driver, implement brightness_set_blocking op, instead of brightness_set. It makes this driver compatible with LED triggers. Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com> Cc: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
* leds: powernv: removing NULL checkSaurabh Sengar2016-01-041-2/+0
| | | | | | | | | | No need to explicitly check for pointer to be null, of_prop_next_string anyways returns NULL, if passed pointer is NULL and hence loop will continue. Signed-off-by: Saurabh Sengar <saurabh.truth@gmail.com> Acked-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com> Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
* powerpc/powernv: add missing of_node_putJulia Lawall2015-11-031-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | for_each_child_of_node performs an of_node_get on each iteration, so a break out of the loop requires an of_node_put. A simplified version of the semantic patch that fixes this problem is as follows (http://coccinelle.lip6.fr): // <smpl> @@ expression root,e; local idexpression child; @@ for_each_child_of_node(root, child) { ... when != of_node_put(child) when != e = child ( return child; | + of_node_put(child); ? return ...; ) ... } // </smpl> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
* powerpc/powernv: Fix mis-merge of OPAL support for LEDS driverMichael Ellerman2015-08-221-3/+3
| | | | | | | | | | | | | | | | When I merged the OPAL support for the powernv LEDS driver I missed a hunk. This is slightly modified from the original patch, as the original added code to opal-api.h which is not in the skiboot version, which is discouraged. Instead those values are moved into the driver, which is the only place they are used. Fixes: 8a8d91817aec ("powerpc/powernv: Add OPAL interfaces for accessing and modifying system LED states") Reviewed-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
* leds/powernv: Add driver for PowerNV platformVasant Hegde2015-08-201-0/+345
This patch implements LED driver for PowerNV platform using the existing generic LED class framework. PowerNV platform has below type of LEDs: - System attention Indicates there is a problem with the system that needs attention. - Identify Helps the user locate/identify a particular FRU or resource in the system. - Fault Indicates there is a problem with the FRU or resource at the location with which the indicator is associated. We register classdev structures for all individual LEDs detected on the system through LED specific device tree nodes. Device tree nodes specify what all kind of LEDs present on the same location code. It registers LED classdev structure for each of them. All the system LEDs can be found in the same regular path /sys/class/leds/. We don't use LED colors. We use LED node and led-types property to form LED classdev. Our LEDs have names in this format. <location_code>:<attention|identify|fault> Any positive brightness value would turn on the LED and a zero value would turn off the LED. The driver will return LED_FULL (255) for any turned on LED and LED_OFF (0) for any turned off LED. The platform level implementation of LED get and set state has been achieved through OPAL calls. These calls are made available for the driver by exporting from architecture specific codes. Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com> Signed-off-by: Anshuman Khandual <khandual@linux.vnet.ibm.com> Acked-by: Stewart Smith <stewart@linux.vnet.ibm.com> Tested-by: Stewart Smith <stewart@linux.vnet.ibm.com> Acked-by: Jacek Anaszewski <j.anaszewski@samsung.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>