platform/x86: think-lmi: Don't display unnecessary authentication settings
authorMark Pearson <mpearson-lenovo@squebb.ca>
Thu, 1 Jun 2023 20:05:52 +0000 (16:05 -0400)
committerHans de Goede <hdegoede@redhat.com>
Thu, 8 Jun 2023 09:00:17 +0000 (11:00 +0200)
If Opcode support is available (which is the standard for all platforms
going forward) then there is no need to have the encoding and kbdlang
attributes visible.

Signed-off-by: Mark Pearson <mpearson-lenovo@squebb.ca>
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20230601200552.4396-8-mpearson-lenovo@squebb.ca
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
drivers/platform/x86/think-lmi.c

index 2aaaee8..52d1ce8 100644 (file)
@@ -885,6 +885,11 @@ static umode_t auth_attr_is_visible(struct kobject *kobj,
                return 0;
        }
 
+       /* Don't display un-needed settings if opcode available */
+       if ((attr == &auth_encoding.attr || attr == &auth_kbdlang.attr) &&
+           tlmi_priv.opcode_support)
+               return 0;
+
        return attr->mode;
 }