ACPI: button: Refactor lid_init_state module parsing code
authorHans de Goede <hdegoede@redhat.com>
Sat, 26 Oct 2019 20:24:31 +0000 (22:24 +0200)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Mon, 28 Oct 2019 14:40:26 +0000 (15:40 +0100)
commit065bd4d35b3fb4484c61fc40a51eeffd5abe52e8
tree7cd29c2d37ace5fb5adf96bc4fee21aad92cac4b
parentd6d5df1db6e9d7f8f76d2911707f7d5877251b02
ACPI: button: Refactor lid_init_state module parsing code

Replace the weird strncmp() calls in param_set_lid_init_state(),
which look to me like they will also accept things like "opennnn"
to use sysfs_match_string instead.

Also rewrite param_get_lid_init_state() using the new lid_init_state_str
array. Instead of doing a straightforward one line replacement, e.g. :
  return sprintf(buffer, lid_init_state_str[lid_init_state]);
print all possible values, putting [] around the selected value, so
that users can easily find out what the possible values are.

Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/acpi/button.c