linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drivers: staging: iio: frequency: ad9832.h: Fixed TODO note.
@ 2025-06-27 17:51 Abdalla Al-Dalleh
  2025-06-27 18:35 ` Andy Shevchenko
  2025-06-28  6:08 ` Greg Kroah-Hartman
  0 siblings, 2 replies; 8+ messages in thread
From: Abdalla Al-Dalleh @ 2025-06-27 17:51 UTC (permalink / raw)
  To: Lars-Peter Clausen, Michael Hennerich, Jonathan Cameron,
	David Lechner, Nuno Sá, Andy Shevchenko, Greg Kroah-Hartman,
	Gabriel Shahrouzi, Abdalla Al-Dalleh, open list,
	open list:IIO SUBSYSTEM AND DRIVERS, open list:STAGING SUBSYSTEM

- 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 <abdalla.ahmad@sesame.org.jo>
---
 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

diff --git a/drivers/staging/iio/frequency/ad9832.c b/drivers/staging/iio/frequency/ad9832.c
index 49388da5a684..4c7d618b2572 100644
--- a/drivers/staging/iio/frequency/ad9832.c
+++ b/drivers/staging/iio/frequency/ad9832.c
@@ -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"
 
diff --git a/drivers/staging/iio/frequency/ad9832.h b/drivers/staging/iio/frequency/ad9832.h
index d0d840edb8d2..a0819042a81e 100644
--- a/drivers/staging/iio/frequency/ad9832.h
+++ b/drivers/staging/iio/frequency/ad9832.h
@@ -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_ */
diff --git a/include/linux/iio/dac/ad9832.h b/include/linux/iio/dac/ad9832.h
new file mode 100644
index 000000000000..8259a0b0f981
--- /dev/null
+++ b/include/linux/iio/dac/ad9832.h
@@ -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_ */
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH] drivers: staging: iio: frequency: ad9832.h: Fixed TODO note.
  2025-06-27 17:51 [PATCH] drivers: staging: iio: frequency: ad9832.h: Fixed TODO note Abdalla Al-Dalleh
@ 2025-06-27 18:35 ` Andy Shevchenko
  2025-06-27 19:29   ` Abdalla Ahmad
  2025-06-28  6:08 ` Greg Kroah-Hartman
  1 sibling, 1 reply; 8+ messages in thread
From: Andy Shevchenko @ 2025-06-27 18:35 UTC (permalink / raw)
  To: Abdalla Al-Dalleh
  Cc: Lars-Peter Clausen, Michael Hennerich, Jonathan Cameron,
	David Lechner, Nuno Sá, Andy Shevchenko, Greg Kroah-Hartman,
	Gabriel Shahrouzi, open list, open list:IIO SUBSYSTEM AND DRIVERS,
	open list:STAGING SUBSYSTEM

On Fri, Jun 27, 2025 at 08:51:14PM +0300, Abdalla Al-Dalleh wrote:
> - 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".

> - 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.

...

>  #include <linux/iio/iio.h>
>  #include <linux/iio/sysfs.h>
> -

This blank line should stay. It will delimit the groups of headers.

> -#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.

...

> +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



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] drivers: staging: iio: frequency: ad9832.h: Fixed TODO note.
  2025-06-27 18:35 ` Andy Shevchenko
@ 2025-06-27 19:29   ` Abdalla Ahmad
  2025-06-27 19:45     ` Dan Carpenter
  2025-06-27 20:32     ` David Lechner
  0 siblings, 2 replies; 8+ messages in thread
From: Abdalla Ahmad @ 2025-06-27 19:29 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Lars-Peter Clausen, Michael Hennerich, Jonathan Cameron,
	David Lechner, Nuno Sá, Andy Shevchenko, Greg Kroah-Hartman,
	Gabriel Shahrouzi, open list, open list:IIO SUBSYSTEM AND DRIVERS,
	open list:STAGING SUBSYSTEM

Hi

> Nothing of the above explains "why you are doing this".

The original TODO in drivers/staging/iio/frequency/ad9832.h was:
> TODO: struct ad9832_platform_data needs to go into include/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.

> 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.

> 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.

> 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 <andriy.shevchenko@intel.com>
Sent: Friday, June 27, 2025 9:35 PM
To: Abdalla Ahmad <Abdalla.Ahmad@sesame.org.jo>
Cc: Lars-Peter Clausen <lars@metafoo.de>; Michael Hennerich <Michael.Hennerich@analog.com>; Jonathan Cameron <jic23@kernel.org>; David Lechner <dlechner@baylibre.com>; Nuno Sá <nuno.sa@analog.com>; Andy Shevchenko <andy@kernel.org>; Greg Kroah-Hartman <gregkh@linuxfoundation.org>; Gabriel Shahrouzi <gshahrouzi@gmail.com>; open list <linux-kernel@vger.kernel.org>; open list:IIO SUBSYSTEM AND DRIVERS <linux-iio@vger.kernel.org>; open list:STAGING SUBSYSTEM <linux-staging@lists.linux.dev>
Subject: Re: [PATCH] drivers: staging: iio: frequency: ad9832.h: Fixed TODO note.
 
On Fri, Jun 27, 2025 at 08:51:14PM +0300, Abdalla Al-Dalleh wrote:
> - 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".

> - 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.

...

>  #include <linux/iio/iio.h>
>  #include <linux/iio/sysfs.h>
> -

This blank line should stay. It will delimit the groups of headers.

> -#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.

...

> +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


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] drivers: staging: iio: frequency: ad9832.h: Fixed TODO note.
  2025-06-27 19:29   ` Abdalla Ahmad
@ 2025-06-27 19:45     ` Dan Carpenter
  2025-06-27 20:32     ` David Lechner
  1 sibling, 0 replies; 8+ messages in thread
From: Dan Carpenter @ 2025-06-27 19:45 UTC (permalink / raw)
  To: Abdalla Ahmad
  Cc: Andy Shevchenko, Lars-Peter Clausen, Michael Hennerich,
	Jonathan Cameron, David Lechner, Nuno Sá, Andy Shevchenko,
	Greg Kroah-Hartman, Gabriel Shahrouzi, open list,
	open list:IIO SUBSYSTEM AND DRIVERS, open list:STAGING SUBSYSTEM

On Fri, Jun 27, 2025 at 07:29:36PM +0000, Abdalla Ahmad wrote:
> Hi
> 
> > Nothing of the above explains "why you are doing this".
> 
> The original TODO in drivers/staging/iio/frequency/ad9832.h was:
> > TODO: struct ad9832_platform_data needs to go into include/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.
>

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


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] drivers: staging: iio: frequency: ad9832.h: Fixed TODO note.
  2025-06-27 19:29   ` Abdalla Ahmad
  2025-06-27 19:45     ` Dan Carpenter
@ 2025-06-27 20:32     ` David Lechner
  2025-06-28 15:12       ` Jonathan Cameron
  1 sibling, 1 reply; 8+ messages in thread
From: David Lechner @ 2025-06-27 20:32 UTC (permalink / raw)
  To: Abdalla Ahmad, Andy Shevchenko
  Cc: Lars-Peter Clausen, Michael Hennerich, Jonathan Cameron,
	Nuno Sá, Andy Shevchenko, Greg Kroah-Hartman,
	Gabriel Shahrouzi, open list, open list:IIO SUBSYSTEM AND DRIVERS,
	open list:STAGING SUBSYSTEM

On 6/27/25 2:29 PM, Abdalla Ahmad wrote:
> Hi

...

> 
>> 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?
> 

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.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] drivers: staging: iio: frequency: ad9832.h: Fixed TODO note.
  2025-06-27 17:51 [PATCH] drivers: staging: iio: frequency: ad9832.h: Fixed TODO note Abdalla Al-Dalleh
  2025-06-27 18:35 ` Andy Shevchenko
@ 2025-06-28  6:08 ` Greg Kroah-Hartman
  2025-06-28 15:10   ` Jonathan Cameron
  1 sibling, 1 reply; 8+ messages in thread
From: Greg Kroah-Hartman @ 2025-06-28  6:08 UTC (permalink / raw)
  To: Abdalla Al-Dalleh
  Cc: Lars-Peter Clausen, Michael Hennerich, Jonathan Cameron,
	David Lechner, Nuno Sá, Andy Shevchenko, Gabriel Shahrouzi,
	open list, open list:IIO SUBSYSTEM AND DRIVERS,
	open list:STAGING SUBSYSTEM

On Fri, Jun 27, 2025 at 08:51:14PM +0300, Abdalla Al-Dalleh wrote:
> - 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 <abdalla.ahmad@sesame.org.jo>
> ---
>  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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] drivers: staging: iio: frequency: ad9832.h: Fixed TODO note.
  2025-06-28  6:08 ` Greg Kroah-Hartman
@ 2025-06-28 15:10   ` Jonathan Cameron
  0 siblings, 0 replies; 8+ messages in thread
From: Jonathan Cameron @ 2025-06-28 15:10 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Abdalla Al-Dalleh, Lars-Peter Clausen, Michael Hennerich,
	David Lechner, Nuno Sá, Andy Shevchenko, Gabriel Shahrouzi,
	open list, open list:IIO SUBSYSTEM AND DRIVERS,
	open list:STAGING SUBSYSTEM

On Sat, 28 Jun 2025 07:08:46 +0100
Greg Kroah-Hartman <gregkh@linuxfoundation.org> wrote:

> On Fri, Jun 27, 2025 at 08:51:14PM +0300, Abdalla Al-Dalleh wrote:
> > - 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 <abdalla.ahmad@sesame.org.jo>
> > ---
> >  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?
> 

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


> thanks,
> 
> greg k-h


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] drivers: staging: iio: frequency: ad9832.h: Fixed TODO note.
  2025-06-27 20:32     ` David Lechner
@ 2025-06-28 15:12       ` Jonathan Cameron
  0 siblings, 0 replies; 8+ messages in thread
From: Jonathan Cameron @ 2025-06-28 15:12 UTC (permalink / raw)
  To: David Lechner
  Cc: Abdalla Ahmad, Andy Shevchenko, Lars-Peter Clausen,
	Michael Hennerich, Nuno Sá, Andy Shevchenko,
	Greg Kroah-Hartman, Gabriel Shahrouzi, open list,
	open list:IIO SUBSYSTEM AND DRIVERS, open list:STAGING SUBSYSTEM

On Fri, 27 Jun 2025 15:32:43 -0500
David Lechner <dlechner@baylibre.com> wrote:

> On 6/27/25 2:29 PM, Abdalla Ahmad wrote:
> > Hi  
> 
> ...
> 
> >   
> >> 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?  
> >   
> 
> 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.
> 

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


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2025-06-28 15:12 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-27 17:51 [PATCH] drivers: staging: iio: frequency: ad9832.h: Fixed TODO note Abdalla Al-Dalleh
2025-06-27 18:35 ` Andy Shevchenko
2025-06-27 19:29   ` Abdalla Ahmad
2025-06-27 19:45     ` Dan Carpenter
2025-06-27 20:32     ` David Lechner
2025-06-28 15:12       ` Jonathan Cameron
2025-06-28  6:08 ` Greg Kroah-Hartman
2025-06-28 15:10   ` Jonathan Cameron

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).