From: Benjamin Philip <benjamin.philip495@gmail.com>
To: platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: "Mark Pearson" <mpearson-lenovo@squebb.ca>,
"Derek J. Clark" <derekjohn.clark@gmail.com>,
"Hans de Goede" <hansg@kernel.org>,
"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
"Benjamin Philip" <benjamin.philip495@gmail.com>
Subject: [PATCH 3/5] platform/x86: think-lmi: Clean up misc checks
Date: Tue, 23 Dec 2025 11:24:09 -0800 [thread overview]
Message-ID: <CAMEXYWcuZXx285npcPB3q0Umit2bAwmFzo1sBPLYnyhoUT0EnQ@mail.gmail.com> (raw)
In-Reply-To: <CAMEXYWcY-7Kn8V1EwZ=fUPFWDwnAHEuferY9Ap0zO6xfmXx4JQ@mail.gmail.com>
This commit cleans up the following checks:
- CHECK: braces {} should be used on all arms of this statement
- CHECK: Please use a blank line after function/struct/union/enum
declarations
- CHECK: Prefer kzalloc(sizeof(*new_pwd)...) over
kzalloc(sizeof(struct tlmi_pwd_setting)...)
- CHECK: spaces preferred around that '/' (ctx:VxV)
- CHECK: Unbalanced braces around else statement
Signed-off-by: Benjamin Philip <benjamin.philip495@gmail.com>
---
drivers/platform/x86/lenovo/think-lmi.c | 32 +++++++++++++------------
1 file changed, 17 insertions(+), 15 deletions(-)
diff --git a/drivers/platform/x86/lenovo/think-lmi.c
b/drivers/platform/x86/lenovo/think-lmi.c
index 1fac8986d077..1ada4d800383 100644
--- a/drivers/platform/x86/lenovo/think-lmi.c
+++ b/drivers/platform/x86/lenovo/think-lmi.c
@@ -223,14 +223,16 @@ static const struct tlmi_err_codes tlmi_errs[] = {
{"Set Certificate operation failed with status:Certificate too
large.", -EFBIG},
};
-static const char * const encoding_options[] = {
+static const char *const encoding_options[] = {
[TLMI_ENCODING_ASCII] = "ascii",
[TLMI_ENCODING_SCANCODE] = "scancode",
};
-static const char * const level_options[] = {
+
+static const char *const level_options[] = {
[TLMI_LEVEL_USER] = "user",
[TLMI_LEVEL_MASTER] = "master",
};
+
static struct think_lmi tlmi_priv;
static DEFINE_MUTEX(tlmi_mutex);
@@ -249,7 +251,7 @@ static int tlmi_errstr_to_err(const char *errstr)
{
int i;
- for (i = 0; i < sizeof(tlmi_errs)/sizeof(struct tlmi_err_codes); i++) {
+ for (i = 0; i < sizeof(tlmi_errs) / sizeof(struct tlmi_err_codes); i++) {
if (!strcmp(tlmi_errs[i].err_str, errstr))
return tlmi_errs[i].err_code;
}
@@ -570,19 +572,19 @@ static ssize_t mechanism_show(struct kobject
*kobj, struct kobj_attribute *attr,
return sysfs_emit(buf, "certificate\n");
return sysfs_emit(buf, "password\n");
}
+
static struct kobj_attribute auth_mechanism = __ATTR_RO(mechanism);
static ssize_t encoding_show(struct kobject *kobj, struct kobj_attribute *attr,
- char *buf)
+ char *buf)
{
struct tlmi_pwd_setting *setting = to_tlmi_pwd_setting(kobj);
return sysfs_emit(buf, "%s\n", encoding_options[setting->encoding]);
}
-static ssize_t encoding_store(struct kobject *kobj,
- struct kobj_attribute *attr,
- const char *buf, size_t count)
+static ssize_t encoding_store(struct kobject *kobj, struct
kobj_attribute *attr,
+ const char *buf, size_t count)
{
struct tlmi_pwd_setting *setting = to_tlmi_pwd_setting(kobj);
int i;
@@ -632,19 +634,19 @@ static ssize_t role_show(struct kobject *kobj,
struct kobj_attribute *attr,
return sysfs_emit(buf, "%s\n", setting->role);
}
+
static struct kobj_attribute auth_role = __ATTR_RO(role);
static ssize_t index_show(struct kobject *kobj, struct kobj_attribute *attr,
- char *buf)
+ char *buf)
{
struct tlmi_pwd_setting *setting = to_tlmi_pwd_setting(kobj);
return sysfs_emit(buf, "%d\n", setting->index);
}
-static ssize_t index_store(struct kobject *kobj,
- struct kobj_attribute *attr,
- const char *buf, size_t count)
+static ssize_t index_store(struct kobject *kobj, struct kobj_attribute *attr,
+ const char *buf, size_t count)
{
struct tlmi_pwd_setting *setting = to_tlmi_pwd_setting(kobj);
int err, val;
@@ -1047,9 +1049,9 @@ static ssize_t current_value_show(struct kobject
*kobj, struct kobj_attribute *a
/* validate and split from `item,value` -> `value` */
value = strpbrk(item, ",");
- if (!value || value == item || !strlen(value + 1))
+ if (!value || value == item || !strlen(value + 1)) {
ret = -EINVAL;
- else {
+ } else {
/* On Workstations remove the Options part after the value */
strreplace(value, ';', '\0');
ret = sysfs_emit(buf, "%s\n", value + 1);
@@ -1585,11 +1587,11 @@ static int tlmi_sysfs_init(void)
/* ---- Base Driver -------------------------------------------------------- */
static struct tlmi_pwd_setting *tlmi_create_auth(const char *pwd_type,
- const char *pwd_role)
+ const char *pwd_role)
{
struct tlmi_pwd_setting *new_pwd;
- new_pwd = kzalloc(sizeof(struct tlmi_pwd_setting), GFP_KERNEL);
+ new_pwd = kzalloc(sizeof(*new_pwd), GFP_KERNEL);
if (!new_pwd)
return NULL;
--
2.52.0
next prev parent reply other threads:[~2025-12-23 19:24 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-23 19:09 [PATCH 0/5] platform/x86: think-lmi: Clean up code style Benjamin Philip
2025-12-23 19:19 ` [PATCH 1/5] platform/x86: think-lmi: Clean up types in headers Benjamin Philip
[not found] ` <20251223191932.946794-1-benjamin.philip495@gmail.com>
2025-12-23 19:23 ` [PATCH 2/5] platform/x86: think-lmi: Remove unnecessary parens Benjamin Philip
2025-12-23 20:28 ` Mark Pearson
2025-12-24 11:44 ` Benjamin Philip
2025-12-23 19:24 ` Benjamin Philip [this message]
2025-12-23 20:30 ` [PATCH 3/5] platform/x86: think-lmi: Clean up misc checks Mark Pearson
2025-12-23 19:24 ` [PATCH 4/5] platform/x86: think-lmi: fix column limit overflow Benjamin Philip
2025-12-23 20:34 ` Mark Pearson
2025-12-24 11:33 ` Benjamin Philip
2025-12-29 15:59 ` Ilpo Järvinen
2025-12-29 17:00 ` Benjamin Philip
2025-12-29 17:32 ` Ilpo Järvinen
2025-12-30 3:07 ` Mark Pearson
2025-12-30 3:24 ` Benjamin Philip
2025-12-31 2:47 ` Mark Pearson
2026-01-06 19:33 ` Benjamin Philip
2026-01-07 14:34 ` Mark Pearson
2025-12-23 19:24 ` [PATCH 5/5] platform/x86: think-lmi: Clean up alignment Benjamin Philip
2025-12-23 20:35 ` Mark Pearson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAMEXYWcuZXx285npcPB3q0Umit2bAwmFzo1sBPLYnyhoUT0EnQ@mail.gmail.com \
--to=benjamin.philip495@gmail.com \
--cc=derekjohn.clark@gmail.com \
--cc=hansg@kernel.org \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mpearson-lenovo@squebb.ca \
--cc=platform-driver-x86@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®