2021-12-06 22:27:36

by Thomas Gleixner

[permalink] [raw]
Subject: [patch V2 03/23] genirq/msi: Guard sysfs code

No point in building unused code when CONFIG_SYSFS=n.

Signed-off-by: Thomas Gleixner <[email protected]>
Tested-by: Juergen Gross <[email protected]>
Reviewed-by: Jason Gunthorpe <[email protected]>
---
include/linux/msi.h | 10 ++++++++++
kernel/irq/msi.c | 2 ++
2 files changed, 12 insertions(+)

--- a/include/linux/msi.h
+++ b/include/linux/msi.h
@@ -239,9 +239,19 @@ void __pci_write_msi_msg(struct msi_desc
void pci_msi_mask_irq(struct irq_data *data);
void pci_msi_unmask_irq(struct irq_data *data);

+#ifdef CONFIG_SYSFS
const struct attribute_group **msi_populate_sysfs(struct device *dev);
void msi_destroy_sysfs(struct device *dev,
const struct attribute_group **msi_irq_groups);
+#else
+static inline const struct attribute_group **msi_populate_sysfs(struct device *dev)
+{
+ return NULL;
+}
+static inline void msi_destroy_sysfs(struct device *dev, const struct attribute_group **msi_irq_groups)
+{
+}
+#endif

/*
* The arch hooks to setup up msi irqs. Default functions are implemented
--- a/kernel/irq/msi.c
+++ b/kernel/irq/msi.c
@@ -72,6 +72,7 @@ void get_cached_msi_msg(unsigned int irq
}
EXPORT_SYMBOL_GPL(get_cached_msi_msg);

+#ifdef CONFIG_SYSFS
static ssize_t msi_mode_show(struct device *dev, struct device_attribute *attr,
char *buf)
{
@@ -204,6 +205,7 @@ void msi_destroy_sysfs(struct device *de
kfree(msi_irq_groups);
}
}
+#endif

#ifdef CONFIG_GENERIC_MSI_IRQ_DOMAIN
static inline void irq_chip_write_msi_msg(struct irq_data *data,



2021-12-07 07:43:01

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [patch V2 03/23] genirq/msi: Guard sysfs code

On Mon, Dec 06, 2021 at 11:27:28PM +0100, Thomas Gleixner wrote:
> No point in building unused code when CONFIG_SYSFS=n.
>
> Signed-off-by: Thomas Gleixner <[email protected]>
> Tested-by: Juergen Gross <[email protected]>
> Reviewed-by: Jason Gunthorpe <[email protected]>

Reviewed-by: Greg Kroah-Hartman <[email protected]>

Subject: [tip: irq/msi] genirq/msi: Guard sysfs code

The following commit has been merged into the irq/msi branch of tip:

Commit-ID: 1197528aaea79ed4909aba695d18fdecc5387a36
Gitweb: https://git.kernel.org/tip/1197528aaea79ed4909aba695d18fdecc5387a36
Author: Thomas Gleixner <[email protected]>
AuthorDate: Mon, 06 Dec 2021 23:27:28 +01:00
Committer: Thomas Gleixner <[email protected]>
CommitterDate: Thu, 09 Dec 2021 11:52:20 +01:00

genirq/msi: Guard sysfs code

No point in building unused code when CONFIG_SYSFS=n.

Signed-off-by: Thomas Gleixner <[email protected]>
Tested-by: Juergen Gross <[email protected]>
Reviewed-by: Jason Gunthorpe <[email protected]>
Reviewed-by: Greg Kroah-Hartman <[email protected]>
Link: https://lore.kernel.org/r/[email protected]

---
include/linux/msi.h | 10 ++++++++++
kernel/irq/msi.c | 2 ++
2 files changed, 12 insertions(+)

diff --git a/include/linux/msi.h b/include/linux/msi.h
index e616f94..d43b946 100644
--- a/include/linux/msi.h
+++ b/include/linux/msi.h
@@ -239,9 +239,19 @@ void __pci_write_msi_msg(struct msi_desc *entry, struct msi_msg *msg);
void pci_msi_mask_irq(struct irq_data *data);
void pci_msi_unmask_irq(struct irq_data *data);

+#ifdef CONFIG_SYSFS
const struct attribute_group **msi_populate_sysfs(struct device *dev);
void msi_destroy_sysfs(struct device *dev,
const struct attribute_group **msi_irq_groups);
+#else
+static inline const struct attribute_group **msi_populate_sysfs(struct device *dev)
+{
+ return NULL;
+}
+static inline void msi_destroy_sysfs(struct device *dev, const struct attribute_group **msi_irq_groups)
+{
+}
+#endif

/*
* The arch hooks to setup up msi irqs. Default functions are implemented
diff --git a/kernel/irq/msi.c b/kernel/irq/msi.c
index 7f350ae..a8a0dae 100644
--- a/kernel/irq/msi.c
+++ b/kernel/irq/msi.c
@@ -72,6 +72,7 @@ void get_cached_msi_msg(unsigned int irq, struct msi_msg *msg)
}
EXPORT_SYMBOL_GPL(get_cached_msi_msg);

+#ifdef CONFIG_SYSFS
static ssize_t msi_mode_show(struct device *dev, struct device_attribute *attr,
char *buf)
{
@@ -204,6 +205,7 @@ void msi_destroy_sysfs(struct device *dev, const struct attribute_group **msi_ir
kfree(msi_irq_groups);
}
}
+#endif

#ifdef CONFIG_GENERIC_MSI_IRQ_DOMAIN
static inline void irq_chip_write_msi_msg(struct irq_data *data,