linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1 1/1] ata: libata: Move inclusion to where it belongs
@ 2024-04-04 19:21 Andy Shevchenko
  2024-04-04 23:16 ` Damien Le Moal
  0 siblings, 1 reply; 3+ messages in thread
From: Andy Shevchenko @ 2024-04-04 19:21 UTC (permalink / raw)
  To: Martin K. Petersen, Damien Le Moal, Hannes Reinecke, linux-ide,
	linux-kernel
  Cc: Niklas Cassel, Andy Shevchenko

Replace rather heavy acpi.h inclusion by a simple forward declaration
in the public header. Update the local one to include acpi.h as some
of the code requires it.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/ata/libata.h   | 3 +++
 include/linux/libata.h | 5 ++++-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/ata/libata.h b/drivers/ata/libata.h
index 5c685bb1939e..29e9387eb249 100644
--- a/drivers/ata/libata.h
+++ b/drivers/ata/libata.h
@@ -90,6 +90,9 @@ extern unsigned int ata_read_log_page(struct ata_device *dev, u8 log,
 #define to_ata_port(d) container_of(d, struct ata_port, tdev)
 
 /* libata-acpi.c */
+
+#include <linux/acpi.h>
+
 #ifdef CONFIG_ATA_ACPI
 extern unsigned int ata_acpi_gtf_filter;
 extern void ata_acpi_dissociate(struct ata_host *host);
diff --git a/include/linux/libata.h b/include/linux/libata.h
index 66937b787cca..68b969de410f 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -19,7 +19,6 @@
 #include <linux/ata.h>
 #include <linux/workqueue.h>
 #include <scsi/scsi_host.h>
-#include <linux/acpi.h>
 #include <linux/cdrom.h>
 #include <linux/sched.h>
 #include <linux/async.h>
@@ -660,6 +659,10 @@ struct ata_cpr_log {
 	struct ata_cpr		cpr[] __counted_by(nr_cpr);
 };
 
+#ifdef CONFIG_ATA_ACPI
+union acpi_object;
+#endif
+
 struct ata_device {
 	struct ata_link		*link;
 	unsigned int		devno;		/* 0 or 1 */
-- 
2.43.0.rc1.1.gbec44491f096


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

* Re: [PATCH v1 1/1] ata: libata: Move inclusion to where it belongs
  2024-04-04 19:21 [PATCH v1 1/1] ata: libata: Move inclusion to where it belongs Andy Shevchenko
@ 2024-04-04 23:16 ` Damien Le Moal
  2024-04-05 15:24   ` Andy Shevchenko
  0 siblings, 1 reply; 3+ messages in thread
From: Damien Le Moal @ 2024-04-04 23:16 UTC (permalink / raw)
  To: Andy Shevchenko, Martin K. Petersen, Hannes Reinecke, linux-ide,
	linux-kernel
  Cc: Niklas Cassel

On 4/5/24 04:21, Andy Shevchenko wrote:
> Replace rather heavy acpi.h inclusion by a simple forward declaration
> in the public header. Update the local one to include acpi.h as some
> of the code requires it.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
>  drivers/ata/libata.h   | 3 +++
>  include/linux/libata.h | 5 ++++-
>  2 files changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/ata/libata.h b/drivers/ata/libata.h
> index 5c685bb1939e..29e9387eb249 100644
> --- a/drivers/ata/libata.h
> +++ b/drivers/ata/libata.h
> @@ -90,6 +90,9 @@ extern unsigned int ata_read_log_page(struct ata_device *dev, u8 log,
>  #define to_ata_port(d) container_of(d, struct ata_port, tdev)
>  
>  /* libata-acpi.c */
> +
> +#include <linux/acpi.h>

I am really not a big fan of including files in the middle of a header file.

> +
>  #ifdef CONFIG_ATA_ACPI
>  extern unsigned int ata_acpi_gtf_filter;
>  extern void ata_acpi_dissociate(struct ata_host *host);
> diff --git a/include/linux/libata.h b/include/linux/libata.h
> index 66937b787cca..68b969de410f 100644
> --- a/include/linux/libata.h
> +++ b/include/linux/libata.h
> @@ -19,7 +19,6 @@
>  #include <linux/ata.h>
>  #include <linux/workqueue.h>
>  #include <scsi/scsi_host.h>
> -#include <linux/acpi.h>

Why not:

#ifdef CONFIG_ATA_ACPI
#include <linux/acpi.h>
#endif

Which avoids the union forward declaration below.

>  #include <linux/cdrom.h>
>  #include <linux/sched.h>
>  #include <linux/async.h>
> @@ -660,6 +659,10 @@ struct ata_cpr_log {
>  	struct ata_cpr		cpr[] __counted_by(nr_cpr);
>  };
>  
> +#ifdef CONFIG_ATA_ACPI
> +union acpi_object;
> +#endif
> +
>  struct ata_device {
>  	struct ata_link		*link;
>  	unsigned int		devno;		/* 0 or 1 */

-- 
Damien Le Moal
Western Digital Research


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

* Re: [PATCH v1 1/1] ata: libata: Move inclusion to where it belongs
  2024-04-04 23:16 ` Damien Le Moal
@ 2024-04-05 15:24   ` Andy Shevchenko
  0 siblings, 0 replies; 3+ messages in thread
From: Andy Shevchenko @ 2024-04-05 15:24 UTC (permalink / raw)
  To: Damien Le Moal
  Cc: Martin K. Petersen, Hannes Reinecke, linux-ide, linux-kernel,
	Niklas Cassel

On Fri, Apr 05, 2024 at 08:16:29AM +0900, Damien Le Moal wrote:
> On 4/5/24 04:21, Andy Shevchenko wrote:

...

> >  /* libata-acpi.c */
> > +
> > +#include <linux/acpi.h>
> 
> I am really not a big fan of including files in the middle of a header file.

I'm fine to place it at the top.

...

> > -#include <linux/acpi.h>
> 
> Why not:
> 
> #ifdef CONFIG_ATA_ACPI
> #include <linux/acpi.h>
> #endif
> 
> Which avoids the union forward declaration below.

The point is to reduce dependency hell. The header does NOT dependent on
ACPI guts, that's why I really prefer forward declaration over including
a monstrous acpi.h.

-- 
With Best Regards,
Andy Shevchenko



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

end of thread, other threads:[~2024-04-05 15:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-04 19:21 [PATCH v1 1/1] ata: libata: Move inclusion to where it belongs Andy Shevchenko
2024-04-04 23:16 ` Damien Le Moal
2024-04-05 15:24   ` Andy Shevchenko

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