irqchip/riscv-imsic: Use the global config for ACPI fwnode lookup
Subsystems (3)
PATCH v2 1/1 irqchip/riscv-imsic: Use the global config for ACPI fwnode lookup
The IMSIC firmware node is already available through the global configuration, so the separate ACPI fwnode pointer duplicates that state.
---
Changes in v2:
- Store the global configuration pointer locally to avoid calling imsic_get_global_config() twice in imsic_acpi_get_fwnode().
drivers/irqchip/irq-riscv-imsic-early.c | 9 +-------- include/linux/irqchip/riscv-imsic.h | 8 +++++++- 2 files changed, 8 insertions(+), 9 deletions(-)
drivers/irqchip/irq-riscv-imsic-early.c +1 -8
@@ -248,17 +248,10 @@ IRQCHIP_DECLARE(riscv_imsic, "riscv,imsics", imsic_early_dt_init);#ifdef CONFIG_ACPI -static struct fwnode_handle *imsic_acpi_fwnode; - -struct fwnode_handle *imsic_acpi_get_fwnode (struct device *dev) -{ -return imsic_acpi_fwnode; -} -EXPORT_SYMBOL_GPL (imsic_acpi_get_fwnode); -static int __init imsic_early_acpi_init (union acpi_subtable_headers *header,const unsigned long end) { +struct fwnode_handle *imsic_acpi_fwnode;struct acpi_madt_imsic *imsic = (struct acpi_madt_imsic *)header;int rc;
include/linux/irqchip/riscv-imsic.h +7 -1
@@ -96,7 +96,13 @@ static inline const struct imsic_global_config *imsic_get_global_config(void)#if IS_ENABLED (CONFIG_ACPI ) &&IS_ENABLED (CONFIG_RISCV_IMSIC )int imsic_platform_acpi_probe (struct fwnode_handle *fwnode); -struct fwnode_handle *imsic_acpi_get_fwnode (struct device *dev); + +static inline struct fwnode_handle *imsic_acpi_get_fwnode (struct device *dev) +{ +const struct imsic_global_config *global =imsic_get_global_config (); + +return global ? global->fwnode :NULL ; +}#else static inline struct fwnode_handle *imsic_acpi_get_fwnode (struct device *dev) {return NULL ; }#endif
Signature · 1 line
2.47.3
Quoted 5 lines · Shankar C
The IMSIC firmware node is already available through the global configuration, so the separate ACPI fwnode pointer duplicates that state.
I think "Already” is a bit misleading here and the commit message
needs to describe the change in the
imperative mood. Something like below would be a better commit message.
Use the fwnode exposed by the global configuration in commit ff6f8cd2919b ("irqchip/riscv-imsic: Expose the fwnode via the global config"). Remove the separate ACPI fwnode pointer to avoid duplicating the reference.
Quoted 43 lines
Signed-off-by Shankar C <[email protected]>---
Changes in v2:
- Store the global configuration pointer locally to avoid callingimsic_get_global_config()twice inimsic_acpi_get_fwnode().drivers/irqchip/irq-riscv-imsic-early.c | 9 +-------- include/linux/irqchip/riscv-imsic.h | 8 +++++++- 2 files changed, 8 insertions(+), 9 deletions(-)drivers/irqchip/irq-riscv-imsic-early.c +1
-8@@ -248,17 +248,10 @@ IRQCHIP_DECLARE(riscv_imsic, "riscv,imsics", imsic_early_dt_init);#ifdef CONFIG_ACPI -static struct fwnode_handle *imsic_acpi_fwnode; - -struct fwnode_handle *imsic_acpi_get_fwnode (struct device *dev) -{ -return imsic_acpi_fwnode; -} -EXPORT_SYMBOL_GPL (imsic_acpi_get_fwnode); -static int __init imsic_early_acpi_init (union acpi_subtable_headers *header,const unsigned long end) { +struct fwnode_handle *imsic_acpi_fwnode;struct acpi_madt_imsic *imsic = (struct acpi_madt_imsic *)header;int rc;include/linux/irqchip/riscv-imsic.h +0
-1@@ -96,7 +96,13 @@ static inline const struct imsic_global_config *imsic_get_global_config(void)#if IS_ENABLED (CONFIG_ACPI ) &&IS_ENABLED (CONFIG_RISCV_IMSIC )int imsic_platform_acpi_probe (struct fwnode_handle *fwnode); -struct fwnode_handle *imsic_acpi_get_fwnode (struct device *dev);
include/linux/irqchip/riscv-imsic.h static inline const struct imsic_global_config *imsic_get_global_config(void) · line 108
Quoted 10 lines
include/linux/irqchip/riscv-imsic.h +7
-0+ +static inline struct fwnode_handle *imsic_acpi_get_fwnode (struct device *dev) +{ +const struct imsic_global_config *global =imsic_get_global_config (); + +return global ? global->fwnode :NULL ; +}#else static inline struct fwnode_handle *imsic_acpi_get_fwnode (struct device *dev) {return NULL ; }#endif
Otherwise, LGTM.
Quoted 6 lines · Shankar C
The IMSIC firmware node is already available through the global configuration, so the separate ACPI fwnode pointer duplicates that state.
Signed-off-by Shankar C <[email protected]>
LGTM.
Regards,
Anup
Quoted 54 lines
---
Changes in v2:
- Store the global configuration pointer locally to avoid callingimsic_get_global_config()twice inimsic_acpi_get_fwnode().drivers/irqchip/irq-riscv-imsic-early.c | 9 +-------- include/linux/irqchip/riscv-imsic.h | 8 +++++++- 2 files changed, 8 insertions(+), 9 deletions(-)drivers/irqchip/irq-riscv-imsic-early.c +1
-8@@ -248,17 +248,10 @@ IRQCHIP_DECLARE(riscv_imsic, "riscv,imsics", imsic_early_dt_init);#ifdef CONFIG_ACPI -static struct fwnode_handle *imsic_acpi_fwnode; - -struct fwnode_handle *imsic_acpi_get_fwnode (struct device *dev) -{ -return imsic_acpi_fwnode; -} -EXPORT_SYMBOL_GPL (imsic_acpi_get_fwnode); -static int __init imsic_early_acpi_init (union acpi_subtable_headers *header,const unsigned long end) { +struct fwnode_handle *imsic_acpi_fwnode;struct acpi_madt_imsic *imsic = (struct acpi_madt_imsic *)header;int rc;include/linux/irqchip/riscv-imsic.h +7
-2@@ -96,7 +96,13 @@ static inline const struct imsic_global_config *imsic_get_global_config(void)#if IS_ENABLED (CONFIG_ACPI ) &&IS_ENABLED (CONFIG_RISCV_IMSIC )int imsic_platform_acpi_probe (struct fwnode_handle *fwnode); -struct fwnode_handle *imsic_acpi_get_fwnode (struct device *dev); + +static inline struct fwnode_handle *imsic_acpi_get_fwnode (struct device *dev) +{ +const struct imsic_global_config *global =imsic_get_global_config (); + +return global ? global->fwnode :NULL ; +}#else static inline struct fwnode_handle *imsic_acpi_get_fwnode (struct device *dev) {return NULL ; }#endif --2.47.3