Re: [PATCH] x86/platform/uv: Use sysfs_match_string() for string parsing in param_set_action()

From: Steve Wahl
Date: Wed Sep 13 2023 - 12:57:12 EST


On Wed, Sep 13, 2023 at 05:16:56PM +0200, Hans de Goede wrote:
> Remove the custom, hard to read code to:
>
> 1. Make a copy of "val" with any potential '\n' at the end stripped
> 2. Compare the copy against an array of allowed string values
>
> Linux has the sysfs_match_string() helper exactly for cases like this,
> switch to this.

Hans,

I like this patch, compiling and testing now.

I was wondering, as long as we're in the neighborhood, how you feel
about changing the stored variable uv_nmi_action to an int or enum
rather than a string, since it can only be one of 6 values, and the
string compare while processing an NMI strikes me as inefficent.

It could extend this patch, or be done as a follow on. And I'm
willing to supply the effort if you want me to.

--> Steve Wahl

--
Steve Wahl, Hewlett Packard Enterprise