[PATCH 3/3] lpd: marvell: do not exit early on empty /sys/class/leds dir (OPAL)
Mauricio Faria de Oliveira <[email protected]> Fri, 21 Oct 2016 12:01:19 -0200
| Newsgroups | gmane.linux.tools.diag.devel |
|---|---|
| Message-ID | <[email protected]> |
Some systems/conditions have no kernel LEDs present (thus nothing in the /sys/class/leds directory), which would cause usysident to early exit in the OPAL platform, and not give a chance for other LED types (e.g., Marvell HDD LEDs) to be used. This patch adds a check for that in the OPAL platform probe function, and in case Marvell HDD devices are found, prevent usysident to exit early, so they can be used. Signed-off-by: Mauricio Faria de Oliveira <[email protected]> --- lpd/indicator_opal.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/lpd/indicator_opal.c b/lpd/indicator_opal.c index 31e3fd2..0d28bab 100644 --- a/lpd/indicator_opal.c +++ b/lpd/indicator_opal.c @@ -293,6 +293,7 @@ opal_indicator_probe(void) int rc = -1; DIR *led_dir; struct dirent *dirent; + struct loc_code *list = NULL; led_dir = open_sysfs_led_dir(); if (!led_dir) @@ -314,6 +315,18 @@ opal_indicator_probe(void) return 0; } + /* + * Marvell HDD LEDs are not presented/controlled via kernel LEDs + * (i.e., /sys/class/leds), and some OPAL systems might not have + * any kernel LEDs (e.g., modules not loaded) but still have the + * Marvell SATA controller with LEDs available, and able to work. + */ + get_mv_indices(LED_TYPE_IDENT, &list); + if (list) { + free_indicator_list(list); + return 0; + } + fprintf(stderr, "Service indicators are not supported on this system." "\nMake sure 'leds_powernv' kernel module is loaded.\n"); close_sysfs_led_dir(led_dir); -- 1.8.3.1 ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot