Skip to contentSkip to conversation

iio: frequency: ad9832: cleanups

PATCH RESEND Superseded Joshua Crofts 4 participants 11 messages Apr 11 – Apr 14

Subsystems (4)

v2 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

v2 cover iio: frequency: ad9832: cleanups

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

Resent because of typo in linux-staging list
email.

v2:
- PATCH 1: removed redundant bits.h include as it is implied in bitops.h
- PATCH 2: changed ull to u64 type

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

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

PATCH RESEND v2 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.

---
v2:
- removed redundant bits.h header

 drivers/staging/iio/frequency/ad9832.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/staging/iio/frequency/ad9832.c +1 -2
index b87ea1781b..8873a6d11e 100644
@@ -8,11 +8,10 @@
 #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>
Signature · 1 line
2.34.1
#2 lore raw

PATCH RESEND v2 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.

---
v2:
- changed ull to u64 type

 drivers/staging/iio/frequency/ad9832.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/iio/frequency/ad9832.c +2 -2
index 8873a6d11e..4221e51dc4 100644
@@ -112,8 +112,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)i;
+
 	do_div(freqreg, mclk);
 	return freqreg;
 }
Signature · 1 line
2.34.1
#3 lore raw

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

Quoted 17 lines · Joshua Crofts

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

---
v2:
- changed ull to u64 type

 drivers/staging/iio/frequency/ad9832.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/iio/frequency/ad9832.c +0 -0
index 8873a6d11e..4221e51dc4 100644

drivers/staging/iio/frequency/ad9832.c struct ad9832_state { · line 115

Quoted 6 lines
drivers/staging/iio/frequency/ad9832.c +1 -2
@@ -112,8 +112,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)i;
                                                           ^

This extra i char is something I really dread as a vim user. :P

regards,
dan carpenter

#4 lore raw

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

Quoted 7 lines · Dan Carpenter

drivers/staging/iio/frequency/ad9832.c struct ad9832_state { · line 115

Quoted 5 lines

static unsigned long ad9832_calc_freqreg(unsigned long mclk, unsigned long fout) {

drivers/staging/iio/frequency/ad9832.c +1 -2
-     unsigned long long freqreg = (u64)fout *
-                                  (u64)((u64)1L << AD9832_FREQ_BITS);
+     u64 freqreg = (u64)fout * BIT_ULL(AD9832_FREQ_BITS)i;
                                                           ^

This extra i char is something I really dread as a vim user. :P

Damn, that's embarrassing... Should I wait 24 hours before submitting a fix even if it's this trivial? Thanks.

Signature · 3 lines
Kind regards

CJD
#5 lore raw

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

Quoted 11 lines · Joshua Crofts
Quoted 7 lines · Dan Carpenter

drivers/staging/iio/frequency/ad9832.c struct ad9832_state { · line 115

Quoted 5 lines

static unsigned long ad9832_calc_freqreg(unsigned long mclk, unsigned long fout) {

drivers/staging/iio/frequency/ad9832.c +1 -2
-     unsigned long long freqreg = (u64)fout *
-                                  (u64)((u64)1L << AD9832_FREQ_BITS);
+     u64 freqreg = (u64)fout * BIT_ULL(AD9832_FREQ_BITS)i;
                                                           ^

This extra i char is something I really dread as a vim user. :P

Damn, that's embarrassing... Should I wait 24 hours before submitting a fix even if it's this trivial? Thanks.

We're not the boss of you. Do whatever you want to. :P

regards,
dan carpenter

reviewer
#6 lore raw

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

In reply to Joshua Crofts
Quoted 6 lines · Joshua Crofts
Quoted 5 lines · Dan Carpenter
Quoted 5 lines

static unsigned long ad9832_calc_freqreg(unsigned long mclk, unsigned long fout) {

drivers/staging/iio/frequency/ad9832.c +1 -2
-     unsigned long long freqreg = (u64)fout *
-                                  (u64)((u64)1L << AD9832_FREQ_BITS);
+     u64 freqreg = (u64)fout * BIT_ULL(AD9832_FREQ_BITS)i;
Quoted 6 lines
Quoted 2 lines
                                                           ^

This extra i char is something I really dread as a vim user. :P

Damn, that's embarrassing... Should I wait 24 hours before submitting a fix even if it's this trivial? Thanks.

The risk of not waiting though is now you have a review tag on v2 and you've already sent a v3 without it.

#7 lore raw

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

In reply to Joshua Crofts
Quoted 1 line · Joshua Crofts

On Sat, 11 Apr 2026 at 12:38, Dan Carpenter <[email protected]> wrote:

...

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

+ u64 freqreg = (u64)fout * BIT_ULL(AD9832_FREQ_BITS)i;

                                                           ^

This extra i char is something I really dread as a vim user. :P

Damn, that's embarrassing... Should I wait 24 hours before submitting a fix even if it's this trivial? Thanks.

Yes, please slow down as you also missed a tag.

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

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

Quoted 1 line · Andy Shevchenko

Yes, please slow down as you also missed a tag.

Yes, I've realized that it was stupid not to wait. What is the proper etiquette here if the
v3 patch doesn't have the reviewed-by tag? Should I do a RESEND PATCH or a v4? I've attached the tag in a reply to the v3 cover letter but not sure if that will do something.

Thanks for your response.

Signature · 3 lines
Kind regards

CJD
#9 lore raw

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

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

Yes, please slow down as you also missed a tag.

Yes, I've realized that it was stupid not to wait. What is the proper etiquette here if the
v3 patch doesn't have the reviewed-by tag? Should I do a RESEND PATCH or a v4? I've attached the tag in a reply to the v3 cover letter but not sure if that will do something.

In this case it was fine what you have done with attaching the missed tag, but be careful in the future.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#10 lore raw
In reply to Joshua Crofts
Quoted 6 lines · Joshua Crofts

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

Resent because of typo in linux-staging list
email.

Seems Nuno already gave a tag that's missing here...

Signature · 2 lines
With Best Regards,
Andy Shevchenko