[v4,8/8] platform/x86: think-lmi: Don't display unnecessary authentication settings

Message ID 20230601200552.4396-8-mpearson-lenovo@squebb.ca
State New
Headers
Series [v4,1/8] platform/x86: think-lmi: mutex protection around multiple WMI calls |

Commit Message

Mark Pearson June 1, 2023, 8:05 p.m. UTC
  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>
---
Changes in v2 & v3:
 - None. Version bumped in series.
Changes in v4:
 - Fixed code alignment as requested.
 - This patch was previously #4 and is now #8 in series.

 drivers/platform/x86/think-lmi.c | 5 +++++
 1 file changed, 5 insertions(+)
  

Comments

Ilpo Järvinen June 2, 2023, 11:12 a.m. UTC | #1
On Thu, 1 Jun 2023, Mark Pearson wrote:

> 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>

Thanks a lot, the patches look good now. One small thing for future: next 
time, try to arrange a series such that the patches with Fixes tags are 
the first patches, in here I think it's not a big deal since 2/8 doesn't 
seem to conflict with 3/8.

For all patches 1-8:

Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
  
Mark Pearson June 2, 2023, 2:58 p.m. UTC | #2
On Fri, Jun 2, 2023, at 7:12 AM, Ilpo Järvinen wrote:
> On Thu, 1 Jun 2023, Mark Pearson wrote:
>
>> 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>
>
> Thanks a lot, the patches look good now. One small thing for future: next 
> time, try to arrange a series such that the patches with Fixes tags are 
> the first patches, in here I think it's not a big deal since 2/8 doesn't 
> seem to conflict with 3/8.
>
Ah - OK, thanks for the note, I didn't know that.

> For all patches 1-8:
>
> Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
>

Many thanks
Mark
  

Patch

diff --git a/drivers/platform/x86/think-lmi.c b/drivers/platform/x86/think-lmi.c
index 2aaaee879488..52d1ce8dfe44 100644
--- a/drivers/platform/x86/think-lmi.c
+++ b/drivers/platform/x86/think-lmi.c
@@ -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;
 }