drivers: staging: iio: frequency: ad9832.h: Fixed TODO note.
Subsystems (4)
PATCH 1/1 drivers: staging: iio: frequency: ad9832.h: Fixed TODO note.
- drivers/staging/iio/frequency/ad9832.c: Changed .h file location
- drivers/staging/iio/frequency/ad9832.h: Removed struct definition
- include/linux/iio/dac/ad9832.h: Added header file according to the TODO note.
--- drivers/staging/iio/frequency/ad9832.c | 3 +-- drivers/staging/iio/frequency/ad9832.h | 23 ------------------ include/linux/iio/dac/ad9832.h | 33 ++++++++++++++++++++++++++ 3 files changed, 34 insertions(+), 25 deletions(-) create mode 100644 include/linux/iio/dac/ad9832.h
drivers/staging/iio/frequency/ad9832.c +1 -2
@@ -22,8 +22,7 @@#include <linux/iio/iio.h> #include <linux/iio/sysfs.h> - -#include "ad9832.h" +#include <linux/iio/dac/ad9832.h> #include "dds.h"
drivers/staging/iio/frequency/ad9832.h +0 -23
@@ -7,27 +7,4 @@#ifndef IIO_DDS_AD9832_H_ #define IIO_DDS_AD9832_H_ -/* -* TODO: struct ad9832_platform_data needs to go into include/linux/iio -*/ - -/** -* struct ad9832_platform_data - platform specific information -* @freq0: power up freq0 tuning word in Hz -* @freq1: power up freq1 tuning word in Hz -* @phase0: power up phase0 value [0..4095] correlates with 0..2PI -* @phase1: power up phase1 value [0..4095] correlates with 0..2PI -* @phase2: power up phase2 value [0..4095] correlates with 0..2PI -* @phase3: power up phase3 value [0..4095] correlates with 0..2PI -*/ - -struct ad9832_platform_data { -unsigned long freq0; -unsigned long freq1; -unsigned short phase0; -unsigned short phase1; -unsigned short phase2; -unsigned short phase3; -}; -#endif /* IIO_DDS_AD9832_H_ */
include/linux/iio/dac/ad9832.h new file +33 -0
@@ -0,0 +1,33 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* +* AD9832 SPI DDS driver +* +* Copyright 2011 Analog Devices Inc. +*/ +#ifndef IIO_DDS_AD9832_H_ +#define IIO_DDS_AD9832_H_ + +/* +* struct ad9832_platform_data moved from drivers/staging/iio/frequency/ +*/ + +/** +* struct ad9832_platform_data - platform specific information +* @freq0: power up freq0 tuning word in Hz +* @freq1: power up freq1 tuning word in Hz +* @phase0: power up phase0 value [0..4095] correlates with 0..2PI +* @phase1: power up phase1 value [0..4095] correlates with 0..2PI +* @phase2: power up phase2 value [0..4095] correlates with 0..2PI +* @phase3: power up phase3 value [0..4095] correlates with 0..2PI +*/ + +struct ad9832_platform_data { +unsigned long freq0; +unsigned long freq1; +unsigned short phase0; +unsigned short phase1; +unsigned short phase2; +unsigned short phase3; +}; + +#endif /* IIO_DDS_AD9832_H_ */
Signature · 1 line
2.43.0
Quoted 2 lines · Abdalla Al-Dalleh
-
drivers/staging/iio/frequency/ad9832.c: Changed .h file location
-drivers/staging/iio/frequency/ad9832.h: Removed struct definition
Nothing of the above explains "why you are doing this".
Quoted 2 lines
-
include/linux/iio/dac/ad9832.h: Added header file according to the TODO note.
Also it sounds like you put three different things in one basket.
...
Quoted 3 lines
#include <
linux/iio/iio.h>
#include <linux/iio/sysfs.h>
-
This blank line should stay. It will delimit the groups of headers.
drivers/staging/iio/frequency/ad9832.c
Quoted 7 lines
drivers/staging/iio/frequency/ad9832.c +2
-1-#include "ad9832.h" +#include <linux/iio/dac/ad9832.h> #include "dds.h" +++ b/include/linux/iio/dac/ad9832.h@@ -0,0 +1,33 @@
Haven't you added -M -C when preparing the patch? This will make sure you are really copying / moving the context and show only the differences.
...
include/linux/iio/dac/ad9832.h line 31
Quoted 8 lines
include/linux/iio/dac/ad9832.h new file +8
-0+struct ad9832_platform_data { +unsigned long freq0; +unsigned long freq1; +unsigned short phase0; +unsigned short phase1; +unsigned short phase2; +unsigned short phase3; +};
Ideally this should be dropped from any global header file. If one needs something like this, it can be propagated via software nodes.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Hi
Quoted 1 line
Nothing of the above explains "why you are doing this".
The original TODO in drivers/staging/iio/frequency/ad9832.h was:
Quoted 1 line
TODO: struct
ad9832_platform_dataneeds to go intoinclude/linux/iio
So I guess if it really needs to go into include/linux/iio and ad9832 being a DAC, then include/linux/iio/dac/ is the appropriate place. Otherwise, the TODO note needs to be removed.
Quoted 1 line
Also it sounds like you put three different things in one basket.
I don't think it is; the header file is now empty (like some of the header files), subsequently the header moved to a new location and the c source needs to include the new file.
Quoted 1 line
Haven't you added -M -C when preparing the patch? This will make sure you are really copying / moving the context and show only the differences.
Both gave exact patch file.
Quoted 1 line
Ideally this should be dropped from any global header file. If one needs something like this, it can be propagated via software nodes.
Well, Including it in include/linux/iio/ made sense to me, would you please elaborate?
Best Regards,
Abdalla
________________________________________
From: Andy Shevchenko <[email protected]>
Sent: Friday, June 27, 2025 9:35 PM
To: Abdalla Ahmad <[email protected]>
Cc: Lars-Peter Clausen <[email protected]>; Michael Hennerich <[email protected]>; Jonathan Cameron <[email protected]>; David Lechner <[email protected]>; Nuno Sá <[email protected]>; Andy Shevchenko <[email protected]>; Greg Kroah-Hartman <[email protected]>; Gabriel Shahrouzi <[email protected]>; open list <[email protected]>; open list:IIO SUBSYSTEM AND DRIVERS <[email protected]>; open list:STAGING SUBSYSTEM <[email protected]> Subject: Re: [PATCH] drivers: staging: iio: frequency: ad9832.h: Fixed TODO note.
Quoted 2 lines · Abdalla Al-Dalleh
-
drivers/staging/iio/frequency/ad9832.c: Changed .h file location
-drivers/staging/iio/frequency/ad9832.h: Removed struct definition
Nothing of the above explains "why you are doing this".
Quoted 2 lines
-
include/linux/iio/dac/ad9832.h: Added header file according to the TODO note.
Also it sounds like you put three different things in one basket.
...
Quoted 3 lines
#include <
linux/iio/iio.h>
#include <linux/iio/sysfs.h>
-
This blank line should stay. It will delimit the groups of headers.
Review
Quoted 7 lines
drivers/staging/iio/frequency/ad9832.c +1
-1-#include "ad9832.h" +#include <linux/iio/dac/ad9832.h>
#include "dds.h"+++
b/include/linux/iio/dac/ad9832.h(quoted diff) +0
-0@@ -0,0 +1,33 @@
Haven't you added -M -C when preparing the patch? This will make sure you are really copying / moving the context and show only the differences.
...
include/linux/iio/dac/ad9832.h line 31
Quoted 8 lines
include/linux/iio/dac/ad9832.h new file +8
-0+struct ad9832_platform_data { + unsigned long freq0; + unsigned long freq1; + unsigned short phase0; + unsigned short phase1; + unsigned short phase2; + unsigned short phase3; +};
Ideally this should be dropped from any global header file. If one needs something like this, it can be propagated via software nodes.
--
With Best Regards,
Andy Shevchenko
Quoted 8 lines · Abdalla Ahmad
Hi
Quoted 1 line
Nothing of the above explains "why you are doing this".
The original TODO in
drivers/staging/iio/frequency/ad9832.hwas:Quoted 1 line
TODO: struct
ad9832_platform_dataneeds to go intoinclude/linux/iioSo I guess if it really needs to go into
include/linux/iioand ad9832 being a DAC, theninclude/linux/iio/dac/is the appropriate place. Otherwise, the TODO note needs to be removed.
Please, change your email client to line wrap at 74 characters.
The way you quoted Andy's email it weird as well. You'll want to configure your email client to do it properly.
regards,
dan carpenter
David Lechner
reviewerQuoted 1 line · Abdalla Ahmad
Hi
...
Quoted 4 lines
Quoted 3 lines
Ideally this should be dropped from any global header file. If one needs
something like this, it can be propagated via software nodes.> Well, Including it ininclude/linux/iio/made sense to me, would you please elaborate?
No one uses platform data anymore. We use linux/properties.h instead to give named properties for this sort of thing. So the right thing to do would be to create a proper devicetree binding for the chip to define the properties and fix up the driver so that we can move it out of staging. Then the header file would just be deleted as part of these changes when we stop using platform data.
If you don't care about the driver and just want the TODO to go away, then we can just delete the comment since it is no longer applicable. It doesn't make sense to move the header out of staging without moving the rest of the driver out of staging at the same time.
Jonathan Cameron
maintainerQuoted 17 lines · On Fri, 27 Jun 2025 15:32:43 -0500 David Lechner <[email protected]> wrote:
Quoted 1 line · Abdalla Ahmad
Hi
...
Quoted 4 lines
Quoted 3 lines
Ideally this should be dropped from any global header file. If one needs
something like this, it can be propagated via software nodes.> Well, Including it ininclude/linux/iio/made sense to me, would you please elaborate?No one uses platform data anymore. We use
linux/properties.hinstead to give named properties for this sort of thing. So the right thing to do would be to create a proper devicetree binding for the chip to define the properties and fix up the driver so that we can move it out of staging. Then the header file would just be deleted as part of these changes when we stop using platform data.
Quoted 5 lines
If you don't care about the driver and just want the TODO to go away, then we can just delete the comment since it is no longer applicable. It doesn't make sense to move the header out of staging without moving the rest of the driver out of staging at the same time.
I think larger, better change would be to also delete the platform data definition and the use of it in the driver. I don't think the content needs to come from firmware or board files.
Jonathan
Greg Kroah-Hartman
maintainerQuoted 10 lines · Abdalla Al-Dalleh
-
drivers/staging/iio/frequency/ad9832.c: Changed .h file location
-drivers/staging/iio/frequency/ad9832.h: Removed struct definition
-include/linux/iio/dac/ad9832.h: Added header file according to the TODO note.Signed-off-by Abdalla Al-Dalleh <[email protected]>--- drivers/staging/iio/frequency/ad9832.c | 3 +-- drivers/staging/iio/frequency/ad9832.h | 23 ------------------ include/linux/iio/dac/ad9832.h | 33 ++++++++++++++++++++++++++
Staging drivers need to be "self-contained" for now.
Why do you even need a .h file for a single .c file anyway? Why not just remove it?
thanks,
greg k-h
Jonathan Cameron
maintainerQuoted 12 lines · On Sat, 28 Jun 2025 07:08:46 +0100 Greg Kroah-Hartman…
Quoted 10 lines · Abdalla Al-Dalleh
-
drivers/staging/iio/frequency/ad9832.c: Changed .h file location
-drivers/staging/iio/frequency/ad9832.h: Removed struct definition
-include/linux/iio/dac/ad9832.h: Added header file according to the TODO note.Signed-off-by Abdalla Al-Dalleh <[email protected]>--- drivers/staging/iio/frequency/ad9832.c | 3 +-- drivers/staging/iio/frequency/ad9832.h | 23 ------------------ include/linux/iio/dac/ad9832.h | 33 ++++++++++++++++++++++++++
Quoted 5 lines
Staging drivers need to be "self-contained" for now.
Why do you even need a .h file for a single .c file anyway? Why not just remove it?
Better yet would be to switch away from platform data as that belongs to a long gone era.
However in this case it's all a bit pointless as we don't normally support 'power up settings' of things like this. Power up state until someone opts in should be to output nothing at all. That should be same as before the driver loads if the device doesn't have non volatile storage to save a requested setup from a previous boot.
The policy decision on what to output is a user space script problem, not something that we should provide from firmware.
Jonathan
Quoted 3 lines
thanks,
greg k-h