public inbox for linux-staging@lists.linux.dev
 help / color / mirror / Atom feed
From: Dan Carpenter <error27@gmail.com>
To: Joe Perches <joe@perches.com>
Cc: Deepak R Varma <drv@mailo.com>,
	Lars-Peter Clausen <lars@metafoo.de>,
	Michael Hennerich <Michael.Hennerich@analog.com>,
	Jonathan Cameron <jic23@kernel.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-iio@vger.kernel.org, linux-staging@lists.linux.dev,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] staging: iio: meter: use min() for comparison and assignment
Date: Mon, 7 Nov 2022 18:38:35 +0300	[thread overview]
Message-ID: <Y2kme/FDg/4K2VW5@kadam> (raw)
In-Reply-To: <41a43f3865f3c86c6c2d1fbf3d82c42b685c7041.camel@perches.com>

On Mon, Nov 07, 2022 at 07:22:24AM -0800, Joe Perches wrote:
> > In terms of run time, this patch is fine but in terms of reading the
> > code using min() makes it less readable.
> 
> It's not a runtime question, either should compile to the same object
> code.  It's definitely a readabiity and standardization issue.
> 
> In this case, IMO it'd be better to use the much more common
> 
> 	if (ret < 0)
> 		return ret;
> 
> 	return 0;

I also prefer this format.

But at the same time, I can't advise Deepak to go around changing
existing code where the author like ternaries.

regards,
dan carpenter

  reply	other threads:[~2022-11-07 15:38 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-07  4:10 [PATCH] staging: iio: meter: use min() for comparison and assignment Deepak R Varma
2022-11-07 13:08 ` Dan Carpenter
2022-11-07 15:15   ` Deepak R Varma
2022-11-07 15:22   ` Joe Perches
2022-11-07 15:38     ` Dan Carpenter [this message]
2022-11-07 16:27       ` Deepak R Varma
2022-11-08 15:12 ` Greg Kroah-Hartman
2022-11-08 15:36   ` Deepak R Varma
2022-11-12 16:35     ` Jonathan Cameron

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=Y2kme/FDg/4K2VW5@kadam \
    --to=error27@gmail.com \
    --cc=Michael.Hennerich@analog.com \
    --cc=drv@mailo.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jic23@kernel.org \
    --cc=joe@perches.com \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-staging@lists.linux.dev \
    /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