Re: [PATCH 3/3] lpd: marvell: do not exit early on empty /sys/class/leds dir (OPAL)

Vasant Hegde <[email protected]> Tue, 8 Nov 2016 16:39:56 +0530
Newsgroups gmane.linux.tools.diag.devel
Message-ID <[email protected]>
On 10/21/2016 07:31 PM, Mauricio Faria de Oliveira wrote:
> 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;
>   	}

In theory, open_sysfs_led_dir() may fail. You are returning if 
open_sysfs_led_dir() fails.. I think we have to fix that.

Also I'm thinking of splitting this function. How about splitting this to two 
function
   - One detects platform LEDS and second one for Marvell LED ?

>
> +	/*
> +	 * 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);

+close_sysfs_led_dir(led_dir);

-Vasant


------------------------------------------------------------------------------
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today. http://sdm.link/xeonphi