mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Philipp Zabel <p.zabel@pengutronix.de>
To: Liao Yuanhong <liaoyuanhong@vivo.com>,
	open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] reset: canaan: Remove redundant ternary operators
Date: Thu, 28 Aug 2025 15:10:12 +0200	[thread overview]
Message-ID: <eca2aee2cc628a4a67b39c284c1be643592c1905.camel@pengutronix.de> (raw)
In-Reply-To: <20250828122843.48722-1-liaoyuanhong@vivo.com>

On Do, 2025-08-28 at 20:28 +0800, Liao Yuanhong wrote:
> For ternary operators in the form of "a ? true : false", if 'a' itself
> returns a boolean result, the ternary operator can be omitted.

Here you are replacing "a ? false : true" with "!a", though.

> Remove
> redundant ternary operators to clean up the code.
> 
> Signed-off-by: Liao Yuanhong <liaoyuanhong@vivo.com>
> ---
>  drivers/reset/reset-k230.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/reset/reset-k230.c b/drivers/reset/reset-k230.c
> index c81045bb4a14..2eb16aac60c0 100644
> --- a/drivers/reset/reset-k230.c
> +++ b/drivers/reset/reset-k230.c
> @@ -218,7 +218,7 @@ static int k230_rst_assert(struct reset_controller_dev *rcdev, unsigned long id)
>  		break;
>  	case RST_TYPE_SW_DONE:
>  		k230_rst_update(rstc, id, true, false,
> -				id == RST_SPI2AXI ? false : true);
> +				id != RST_SPI2AXI);

Remove the line break. The line is short enough. Same for the other
occurrence.

regards
Philipp

      reply	other threads:[~2025-08-28 13:10 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-28 12:28 Liao Yuanhong
2025-08-28 13:10 ` Philipp Zabel [this message]

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=eca2aee2cc628a4a67b39c284c1be643592c1905.camel@pengutronix.de \
    --to=p.zabel@pengutronix.de \
    --cc=liaoyuanhong@vivo.com \
    --cc=linux-kernel@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®