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
Hi Steve,
On 9/13/23 18:56, Steve Wahl wrote:
> 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.
I must admit I did not look at the code consuming uv_nmi_action
and I did wonder why this was not an enum from day 1.
I'll prepare a v2 of this patch which changes uv_nmi_action
to an enum.
Note I can compile test this only, so I gope you will be able to
test the v2 a bit more thoroughly :)
Regards,
Hans