public inbox for linux-iio@vger.kernel.org
 help / color / mirror / Atom feed
From: Stefano Brivio <sbrivio@redhat.com>
To: Deepak R Varma <mh12gx2825@gmail.com>
Cc: outreachy-kernel@googlegroups.com, gregkh@linuxfoundation.org,
	daniel.baluta@gmail.com, kieran.bingham@ideasonboard.com,
	lars@metafoo.de, Michael.Hennerich@analog.com, jic23@kernel.org,
	knaack.h@gmx.de, pmeerw@pmeerw.net, linux-iio@vger.kernel.org
Subject: Re: [Outreachy kernel] [PATCH 3/3] staging: iio: adc: ad7192: Reformat lines crossing 80 columns
Date: Wed, 18 Mar 2020 23:45:10 +0100	[thread overview]
Message-ID: <20200318234510.28b08a0d@elisabeth> (raw)
In-Reply-To: <89282ed6f355553eb1e81ae9b5f991eae4cd96ba.1584557481.git.mh12gx2825@gmail.com>

On Thu, 19 Mar 2020 00:40:02 +0530
Deepak R Varma <mh12gx2825@gmail.com> wrote:

> Macro arguments are computed at the time of calling the macro. This
> makes the lines cross 80 column width. Add variables to perform the
> calculations before hand and use these variable in the macro calls instead.
> 
> Signed-off-by: Deepak R Varma <mh12gx2825@gmail.com>
> ---
>  drivers/staging/iio/adc/ad7192.c | 9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/staging/iio/adc/ad7192.c b/drivers/staging/iio/adc/ad7192.c
> index a5b6cc1fc375..2a9c68aa8260 100644
> --- a/drivers/staging/iio/adc/ad7192.c
> +++ b/drivers/staging/iio/adc/ad7192.c
> @@ -480,14 +480,15 @@ static void ad7192_get_available_filter_freq(struct ad7192_state *st,
>  						    int *freq)
>  {
>  	unsigned int fadc;
> +	unsigned int sinc3_filter, sinc4_filter;
>  
>  	/* Formulas for filter at page 25 of the datasheet */
> -	fadc = DIV_ROUND_CLOSEST(st->fclk,
> -				 AD7192_SINC4_FILTER * AD7192_MODE_RATE(st->mode));
> +	sinc4_filter = AD7192_SINC4_FILTER * AD7192_MODE_RATE(st->mode);
> +	fadc = DIV_ROUND_CLOSEST(st->fclk, sinc4_filter);

The name sinc4_filter is at least not derived from another typo anymore,
but it still doesn't make sense to me. Is it a filtering... factor,
as the name would suggest? No. It comes from a "mode" register and it
becomes a divisor of the output data rate.

Besides, you don't need separate variables (why two, even?). As I
already mentioned to you offline, DIV_ROUND_CLOSEST() is used. If '/'
is the DIV_ROUND_CLOSEST() operation, then, I guess:

	a = b / (x * y) <=> a = b / x / y

-- 
Stefano


  reply	other threads:[~2020-03-18 22:45 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-18 19:07 [PATCH v2 0/3] staging: iio: adc: General code reformatting / cleanup patchset Deepak R Varma
2020-03-18 19:08 ` [PATCH 1/3] staging: iio: adc: ad7192: Re-indent enum labels Deepak R Varma
2020-03-18 22:46   ` [Outreachy kernel] " Stefano Brivio
2020-03-18 19:09 ` [PATCH 2/3] staging: iio: adc: ad7192: Correct macro names from SYNC to SINC Deepak R Varma
2020-03-18 22:50   ` [Outreachy kernel] " Stefano Brivio
2020-03-18 19:10 ` [PATCH 3/3] staging: iio: adc: ad7192: Reformat lines crossing 80 columns Deepak R Varma
2020-03-18 22:45   ` Stefano Brivio [this message]
2020-03-18 19:58 ` [PATCH v2 0/3] staging: iio: adc: General code reformatting / cleanup patchset Lars-Peter Clausen

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=20200318234510.28b08a0d@elisabeth \
    --to=sbrivio@redhat.com \
    --cc=Michael.Hennerich@analog.com \
    --cc=daniel.baluta@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jic23@kernel.org \
    --cc=kieran.bingham@ideasonboard.com \
    --cc=knaack.h@gmx.de \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=mh12gx2825@gmail.com \
    --cc=outreachy-kernel@googlegroups.com \
    --cc=pmeerw@pmeerw.net \
    /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