Re: [Outreachy kernel] [PATCH 1/2] staging: iio: adc: ad7192: Reformat lines crossing 80 columns

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 3/18/20 5:43 PM, DEEPAK VARMA wrote:
On Wed, Mar 18, 2020 at 09:52:41PM +0530, Rohit Sarkar wrote:
On Wed, Mar 18, 2020 at 09:36:50PM +0530, DEEPAK VARMA wrote:
On Wed, Mar 18, 2020 at 09:31:58AM +0100, Stefano Brivio wrote:
On Wed, 18 Mar 2020 09:56:59 +0530
Deepak R Varma <mh12gx2825@xxxxxxxxx> wrote:

Macro arguments are computed at the time of macro invocation. This makes
the lines cross 80 column width. Add variables to perform the
calculations before hand and use these new variable in the macro calls
instead.

Also re-indent enum members to address checkpatch warning / check messages.

Signed-off-by: Deepak R Varma <mh12gx2825@xxxxxxxxx>
---
  drivers/staging/iio/adc/ad7192.c | 15 ++++++++-------
  1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/iio/adc/ad7192.c b/drivers/staging/iio/adc/ad7192.c
index bf3e2a9cc07f..0265f6607d75 100644
--- a/drivers/staging/iio/adc/ad7192.c
+++ b/drivers/staging/iio/adc/ad7192.c
@@ -156,8 +156,8 @@
   */
enum {
-   AD7192_SYSCALIB_ZERO_SCALE,
-   AD7192_SYSCALIB_FULL_SCALE,
+	AD7192_SYSCALIB_ZERO_SCALE,
+	AD7192_SYSCALIB_FULL_SCALE,
  };
struct ad7192_state {
@@ -477,17 +477,18 @@ static ssize_t ad7192_set(struct device *dev,
  }
static void ad7192_get_available_filter_freq(struct ad7192_state *st,
-						    int *freq)
+					     int *freq)
  {
  	unsigned int fadc;
+	unsigned int sync3_filter, sync4_filter;
/* Formulas for filter at page 25 of the datasheet */
-	fadc = DIV_ROUND_CLOSEST(st->fclk,
-				 AD7192_SYNC4_FILTER * AD7192_MODE_RATE(st->mode));
+	sync4_filter = AD7192_SYNC4_FILTER * AD7192_MODE_RATE(st->mode);

Have you read page 25 of the datasheet? Why is this called
sync4_filter, with a 'y'?


Sorry, I am not sure what you are referring to. Can you please elaborate
or point me to where the data sheet is located?

Deepak.

Hey Deepak,
You can find the datasheet for ad7192 here https://pdf1.alldatasheet.com/datasheet-pdf/view/988287/AD/AD7192.html


Thank you Rohit. I got it. I understand Stefano's comments now. I named
the variables with a 'y' to keep it similar to the macro
AD7192_SYNCn_FILTER. Let me know if the variable name looks odd and I
should rename it to sinc4_filter instead.

Hi,

Please send a patch to rename the macro to SINC as well. This is a typo in the macro.

Thanks,
- Lars



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux