Skip to contentSkip to conversation

iio: frequency: ad9832: cleanups

PATCH Superseded Joshua Crofts 2 participants 12 messages Apr 15

Subsystems (4)

v4 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

v4 cover iio: frequency: ad9832: cleanups

This series cleans up issues in the AD9832 driver, including proxy header removal and bit math simplification.

v2:
- PATCH 1: removed redundant bits.h include as it is implied in bitops.h
- PATCH 2: changed ull to u64 type
v3:
- PATCH 2: remove rogue vim typo
v4:
- PATCH 1: removed slab.h based on IWYU recommendation, header reordering

Joshua Crofts (2):
iio: frequency: ad9832: remove kernel.h proxy header.
iio: frequency: ad9832: simplify bitwise math

 drivers/staging/iio/frequency/ad9832.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)
Signature · 1 line
2.47.3
#1 lore raw

PATCH v4 1/2 iio: frequency: ad9832: remove kernel.h proxy header.

Remove kernel.h proxy header and add bitops.h for better dependency control and code clarity. Also removed slab.h and moved asm header below generic linux headers.

Checked with IWYU.

---
 drivers/staging/iio/frequency/ad9832.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/staging/iio/frequency/ad9832.c +3 -5
index b87ea1781b..fbcfdbd398 100644
@@ -5,21 +5,19 @@
  * Copyright 2011 Analog Devices Inc.
  */
 
-#include <asm/div64.h>
-
 #include <linux/bitfield.h>
-#include <linux/bits.h>
+#include <linux/bitops.h>
 #include <linux/clk.h>
 #include <linux/device.h>
 #include <linux/err.h>
-#include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/regulator/consumer.h>
-#include <linux/slab.h>
 #include <linux/spi/spi.h>
 #include <linux/sysfs.h>
 #include <linux/unaligned.h>
 
+#include <asm/div64.h>
+
 #include <linux/iio/iio.h>
 #include <linux/iio/sysfs.h>
 
Signature · 1 line
2.47.3
Reviewed-by on v4 1/2
#2 lore raw

Re: [PATCH v4 1/2] iio: frequency: ad9832: remove kernel.h proxy header.

On Wed, Apr 15, 2026 at 08:08:11AM +0000, Joshua Crofts wrote:

Drop the period at the end of Subject.

Quoted 4 lines

Remove kernel.h proxy header and add bitops.h for
better dependency control and code clarity. Also
removed slab.h and moved asm header below generic
linux headers.

I wonder if we need to elaborate a bit on 'linux' word as usually we refer to the project as Linux. Maybe write it as '<linux/*>' (without quotes)?

Quoted 1 line

Checked with IWYU.

We have a (recently new) tag: Assisted-by or so. Can we use it here?

Otherwise LGTM, so after addressing the above:

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#3 lore raw

Re: [PATCH v4 1/2] iio: frequency: ad9832: remove kernel.h proxy header.

Quoted 11 lines · Andy Shevchenko
Quoted 4 lines

Remove kernel.h proxy header and add bitops.h for
better dependency control and code clarity. Also
removed slab.h and moved asm header below generic
linux headers.

I wonder if we need to elaborate a bit on 'linux' word as usually we refer to the project as Linux. Maybe write it as '<linux/*>' (without quotes)?

Quoted 1 line

Checked with IWYU.

We have a (recently new) tag: Assisted-by or so. Can we use it here?

Thanks for the reviews and patience with my patches. I seem to have finally learned the workflow. I'll send a v5 addressing the issues above tomorrow.

Signature · 3 lines
Kind regards

CJD
#4 lore raw

Re: [PATCH v4 1/2] iio: frequency: ad9832: remove kernel.h proxy header.

In reply to Andy Shevchenko
Quoted 3 lines · Andy Shevchenko
Quoted 1 line

Checked with IWYU.

We have a (recently new) tag: Assisted-by or so. Can we use it here?

BTW, I thought that the Assisted-by tag only applied to AI coding assistants, per the documentation.

Signature · 3 lines
Kind regards

CJD
#5 lore raw

Re: [PATCH v4 1/2] iio: frequency: ad9832: remove kernel.h proxy header.

Quoted 8 lines · Joshua Crofts
Quoted 3 lines · Andy Shevchenko
Quoted 1 line

Checked with IWYU.

We have a (recently new) tag: Assisted-by or so. Can we use it here?

BTW, I thought that the Assisted-by tag only applied to AI coding assistants, per the documentation.

Mainly for that, but it's not limited to. Coccinelle is not an AI tool, yet you may found it in the tag. Ex.: 8aa9fd0350b8 ("parisc: update outdated comments for renamed ccio_alloc_consistent()").

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#6 lore raw

Re: [PATCH v4 1/2] iio: frequency: ad9832: remove kernel.h proxy header.

Quoted 5 lines · Andy Shevchenko
Quoted 4 lines · Joshua Crofts
Quoted 2 lines · Andy Shevchenko
Quoted 1 line

Checked with IWYU.

Quoted 8 lines
Quoted 4 lines
Quoted 1 line

We have a (recently new) tag: Assisted-by or so. Can we use it here?

BTW, I thought that the Assisted-by tag only applied to AI coding assistants, per the documentation.

Mainly for that, but it's not limited to. Coccinelle is not an AI tool, yet you may found it in the tag. Ex.: 8aa9fd0350b8 ("parisc: update outdated comments for renamed ccio_alloc_consistent()").

Ah, all of them have the first one an AI... Perhaps you are right.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#7 lore raw

Re: [PATCH v4 1/2] iio: frequency: ad9832: remove kernel.h proxy header.

Quoted 1 line · Andy Shevchenko

Ah, all of them have the first one an AI... Perhaps you are right.

Therefore, should I send a v5 amending the period and <linux/*> header fix?

Signature · 3 lines
Kind regards

CJD
#8 lore raw

Re: [PATCH v4 1/2] iio: frequency: ad9832: remove kernel.h proxy header.

Quoted 5 lines · Joshua Crofts
Quoted 1 line · Andy Shevchenko

Ah, all of them have the first one an AI... Perhaps you are right.

Therefore, should I send a v5 amending the period and <linux/*> header fix?

Yes, please. And don't forget to carry on the given tag.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#9 lore raw

Re: [PATCH v4 1/2] iio: frequency: ad9832: remove kernel.h proxy header.

Quoted 1 line · Andy Shevchenko

Yes, please. And don't forget to carry on the given tag.

Okay, will do tomorrow.

Signature · 3 lines
Kind regards

CJD
#10 lore raw

PATCH v4 2/2 iio: frequency: ad9832: simplify bitwise math

In reply to Joshua Crofts

Refactor the ad9832_calc_freqreg by adding a BIT_ULL() macro instead of manual bit shifting for better readability.

---
 drivers/staging/iio/frequency/ad9832.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/iio/frequency/ad9832.c +2 -2
index fbcfdbd398..cd7c7727f7 100644
@@ -111,8 +111,8 @@ struct ad9832_state {
 
 static unsigned long ad9832_calc_freqreg(unsigned long mclk, unsigned long fout)
 {
-	unsigned long long freqreg = (u64)fout *
-				     (u64)((u64)1L << AD9832_FREQ_BITS);
+	u64 freqreg = (u64)fout * BIT_ULL(AD9832_FREQ_BITS);
+
 	do_div(freqreg, mclk);
 	return freqreg;
 }
Signature · 1 line
2.47.3
Reviewed-by on v4 2/2
#11 lore raw

Re: [PATCH v4 2/2] iio: frequency: ad9832: simplify bitwise math

Quoted 3 lines · Joshua Crofts

Refactor the ad9832_calc_freqreg by adding a BIT_ULL() macro instead of manual bit shifting for better readability.

Signature · 2 lines
With Best Regards,
Andy Shevchenko