mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Mark Pearson" <mpearson-lenovo@squebb.ca>
To: "Benjamin Philip" <benjamin.philip495@gmail.com>,
	"platform-driver-x86@vger.kernel.org"
	<platform-driver-x86@vger.kernel.org>,
	linux-kernel@vger.kernel.org
Cc: "Derek J . Clark" <derekjohn.clark@gmail.com>,
	"Hans de Goede" <hansg@kernel.org>,
	"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
Subject: Re: [PATCH 2/5] platform/x86: think-lmi: Remove unnecessary parens
Date: Tue, 23 Dec 2025 15:28:18 -0500	[thread overview]
Message-ID: <ca3cca35-9f30-4c77-87c2-7ac3ec85d2dd@app.fastmail.com> (raw)
In-Reply-To: <CAMEXYWdFn05=kx-NYejm4nznbKQahHUJJDesc_W1OKk_X3OOgg@mail.gmail.com>

On Tue, Dec 23, 2025, at 2:23 PM, Benjamin Philip wrote:
> This commit removes any unnecessary parentheses as flagged by
> checkpatch in the following check:
>
> CHECK: Unnecessary parentheses around '...'
>

Shouldn't you mention that you also corrected pieces of code alignment here too?

> Signed-off-by: Benjamin Philip <benjamin.philip495@gmail.com>
> ---
>  drivers/platform/x86/lenovo/think-lmi.c | 22 +++++++++++-----------
>  1 file changed, 11 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/platform/x86/lenovo/think-lmi.c
> b/drivers/platform/x86/lenovo/think-lmi.c
> index 540b472b1bf3..1fac8986d077 100644
> --- a/drivers/platform/x86/lenovo/think-lmi.c
> +++ b/drivers/platform/x86/lenovo/think-lmi.c
> @@ -440,7 +440,7 @@ static ssize_t current_password_store(struct kobject *kobj,
>
>  	pwdlen = strlen(buf);
>  	/* pwdlen == 0 is allowed to clear the password */
> -	if (pwdlen && ((pwdlen < setting->minlen) || (pwdlen > setting->maxlen)))
> +	if (pwdlen && (pwdlen < setting->minlen || pwdlen > setting->maxlen))
>  		return -EINVAL;
>
>  	strscpy(setting->password, buf, setting->maxlen);
> @@ -476,7 +476,7 @@ static ssize_t new_password_store(struct kobject *kobj,
>
>  	pwdlen = strlen(new_pwd);
>  	/* pwdlen == 0 is allowed to clear the password */
> -	if (pwdlen && ((pwdlen < setting->minlen) || (pwdlen > setting->maxlen))) {
> +	if (pwdlen && (pwdlen < setting->minlen || pwdlen > setting->maxlen)) {
>  		ret = -EINVAL;
>  		goto out;
>  	}
> @@ -859,7 +859,7 @@ static ssize_t certificate_store(struct kobject *kobj,
>  			signature = setting->signature;
>  	} else { /* Cert install */
>  		/* Check if SMC and SVC already installed */
> -		if ((setting == tlmi_priv.pwd_system) &&
> tlmi_priv.pwd_admin->cert_installed) {
> +		if (setting == tlmi_priv.pwd_system && tlmi_priv.pwd_admin->cert_installed) {
>  			/* This gets treated as a cert update */
>  			install_mode = TLMI_CERT_UPDATE;
>  			signature = tlmi_priv.pwd_admin->signature;
> @@ -881,7 +881,7 @@ static ssize_t certificate_store(struct kobject *kobj,
>  	} else {
>  		/* This is a fresh install */
>  		/* To set admin cert, a password must be enabled */
> -		if ((setting == tlmi_priv.pwd_admin) &&
> +		if (setting == tlmi_priv.pwd_admin &&
>  		    (!setting->pwd_enabled || !setting->password[0])) {
>  			kfree(new_cert);
>  			return -EACCES;
> @@ -965,13 +965,13 @@ static ssize_t save_signature_store(struct kobject *kobj,
>  static struct kobj_attribute auth_save_signature = __ATTR_WO(save_signature);
>
>  static umode_t auth_attr_is_visible(struct kobject *kobj,
> -					     struct attribute *attr, int n)
> +				    struct attribute *attr, int n)
>  {
>  	struct tlmi_pwd_setting *setting = to_tlmi_pwd_setting(kobj);
>
>  	/* We only want to display level and index settings on HDD/NVMe */
>  	if (attr == &auth_index.attr || attr == &auth_level.attr) {
> -		if ((setting == tlmi_priv.pwd_hdd) || (setting == tlmi_priv.pwd_nvme))
> +		if (setting == tlmi_priv.pwd_hdd || setting == tlmi_priv.pwd_nvme)
>  			return attr->mode;
>  		return 0;
>  	}
> @@ -985,8 +985,8 @@ static umode_t auth_attr_is_visible(struct kobject *kobj,
>  		if (tlmi_priv.certificate_support) {
>  			if (setting == tlmi_priv.pwd_admin)
>  				return attr->mode;
> -			if ((tlmi_priv.pwdcfg.core.password_mode >= TLMI_PWDCFG_MODE_MULTICERT) &&
> -			    (setting == tlmi_priv.pwd_system))
> +			if (tlmi_priv.pwdcfg.core.password_mode >= TLMI_PWDCFG_MODE_MULTICERT &&
> +			    setting == tlmi_priv.pwd_system)
>  				return attr->mode;
>  		}
>  		return 0;
> @@ -1216,13 +1216,13 @@ static struct kobj_attribute attr_current_val
> = __ATTR_RW_MODE(current_value, 06
>
>  static struct kobj_attribute attr_type = __ATTR_RO(type);
>
> -static umode_t attr_is_visible(struct kobject *kobj,
> -					     struct attribute *attr, int n)
> +static umode_t attr_is_visible(struct kobject *kobj, struct attribute *attr,
> +			       int n)
>  {
>  	struct tlmi_attr_setting *setting = to_tlmi_attr_setting(kobj);
>
>  	/* We don't want to display possible_values attributes if not available */
> -	if ((attr == &attr_possible_values.attr) && (!setting->possible_values))
> +	if (attr == &attr_possible_values.attr && !setting->possible_values)
>  		return 0;
>
>  	return attr->mode;
> -- 
> 2.52.0

I prefer the brackets as they were - for me it's clearer and removing them adds little value.
But the changes are fine, and I guess it's preferred overall by kernel community, so shrug.

Reviewed-by: Mark Pearson <mpearson-lenovo@squebb.ca>

  reply	other threads:[~2025-12-23 20:28 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 [this message]
2025-12-24 11:44       ` Benjamin Philip
2025-12-23 19:24   ` [PATCH 3/5] platform/x86: think-lmi: Clean up misc checks Benjamin Philip
2025-12-23 20:30     ` 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=ca3cca35-9f30-4c77-87c2-7ac3ec85d2dd@app.fastmail.com \
    --to=mpearson-lenovo@squebb.ca \
    --cc=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=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®