iio: frequency: ad9832: cleanups
Subsystems (4)
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
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
@@ -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
PATCH RESEND v2 2/2 iio: frequency: ad9832: simplify bitwise math
In reply to Joshua CroftsRefactor 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
@@ -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
Re: [RESEND PATCH v2 2/2] iio: frequency: ad9832: simplify bitwise math
Quoted 17 lines · Joshua Crofts
Refactor the
ad9832_calc_freqregby adding aBIT_ULL()macro instead of manual bit shifting for better readability.Signed-off-by Joshua Crofts <[email protected]>---
v2:
- changed ull to u64 typedrivers/staging/iio/frequency/ad9832.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/staging/iio/frequency/ad9832.c +0
-0
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
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
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
David Lechner
reviewerRe: [RESEND PATCH v2 2/2] iio: frequency: ad9832: simplify bitwise math
In reply to Joshua CroftsQuoted 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.
Re: [RESEND PATCH v2 2/2] iio: frequency: ad9832: simplify bitwise math
In reply to Joshua CroftsQuoted 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
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
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
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