Skip to contentSkip to conversation

drm/imx: Switch to irq_domain_create_linear()

PATCH Applied Jiri Slaby (SUSE) 3 participants 6 messages Jul 8 – Jul 15

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 drm/imx: Switch to irq_domain_create_linear()

irq_domain_add_linear() is going away as being obsolete now. Switch to the preferred irq_domain_create_linear(). That differs in the first
parameter: It takes more generic struct fwnode_handle instead of struct device_node. Therefore, of_fwnode_handle() is added around the parameter.

Note some of the users can likely use dev->fwnode directly instead of indirect of_fwnode_handle(dev->of_node). But dev->fwnode is not guaranteed to be set for all, so this has to be investigated on case to case basis (by people who can actually test with the HW).

---
Cc: Maarten Lankhorst <[email protected]>
Cc: Maxime Ripard <[email protected]>
Cc: Thomas Zimmermann <[email protected]>
Cc: David Airlie <[email protected]>
Cc: Simona Vetter <[email protected]>
Cc: Frank Li <[email protected]>
Cc: Sascha Hauer <[email protected]>
Cc: Pengutronix Kernel Team <[email protected]>
Cc: Fabio Estevam <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]

---
 drivers/gpu/drm/imx/dc/dc-ic.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/imx/dc/dc-ic.c +1 -1
index a270ae4030cd..d8aa46ee6a7a 100644
@@ -174,7 +174,7 @@ static int dc_ic_probe(struct platform_device *pdev)
 		regmap_write(data->regs, USERINTERRUPTMASK(i), 0xffffffff);
 	}
 
-	data->domain = irq_domain_add_linear(dev->of_node, IRQ_COUNT,
+	data->domain = irq_domain_create_linear(of_fwnode_handle(dev->of_node), IRQ_COUNT,
 					     &irq_generic_chip_ops, data);
 	if (!data->domain) {
 		dev_err(dev, "failed to create IRQ domain\n");
Signature · 1 line
2.55.0
#1 lore raw

PATCH 2/2 drm/imx: include dc-drv.h to avoid sparse warning

sparse (build with C=1) warns:
drivers/gpu/drm/imx/dc/dc-ic.c:273:24: warning: symbol 'dc_ic_driver' was not declared. Should it be static?

And it is right. Include dc-drv.h which declares the struct. This ensures the types of both match.

---
Cc: Maarten Lankhorst <[email protected]>
Cc: Maxime Ripard <[email protected]>
Cc: Thomas Zimmermann <[email protected]>
Cc: David Airlie <[email protected]>
Cc: Simona Vetter <[email protected]>
Cc: Frank Li <[email protected]>
Cc: Sascha Hauer <[email protected]>
Cc: Pengutronix Kernel Team <[email protected]>
Cc: Fabio Estevam <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]

---
 drivers/gpu/drm/imx/dc/dc-ic.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/gpu/drm/imx/dc/dc-ic.c +2 -0
index d8aa46ee6a7a..0f2fc7aecf31 100644
@@ -14,6 +14,8 @@
 #include <linux/pm_runtime.h>
 #include <linux/regmap.h>
 
+#include "dc-drv.h"
+
 #define USERINTERRUPTMASK(n)	(0x8 + 4 * (n))
 #define INTERRUPTENABLE(n)	(0x10 + 4 * (n))
 #define INTERRUPTPRESET(n)	(0x18 + 4 * (n))
Signature · 1 line
2.55.0
#2 lore raw

Re: [PATCH 2/2] drm/imx: include dc-drv.h to avoid sparse warning

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Pre-existing issues:
- [High] The use of pm_sleep_ptr() discards runtime PM callbacks when CONFIG_PM is enabled but CONFIG_PM_SLEEP is disabled, leading to a kernel oops on probe. --

--- Patch [2]: [PATCH 2/2] drm/imx: include dc-drv.h to avoid sparse warning --- commit 92fb37945f1af608d237fde0454ddaa90bee5644
Author: Jiri Slaby (SUSE) <[email protected]>

drm/imx: include dc-drv.h to avoid sparse warning

This commit adds an include of dc-drv.h in dc-ic.c to fix a sparse warning. The warning indicated that dc_ic_driver was not declared.

Quoted 12 lines
drivers/gpu/drm/imx/dc/dc-ic.c +2 -0
index d8aa46ee6a7a0..0f2fc7aecf31f 100644
@@ -14,6 +14,8 @@
 #include <linux/pm_runtime.h>
 #include <linux/regmap.h>
 
+#include "dc-drv.h"
+
 #define USERINTERRUPTMASK(n)	(0x8 + 4 * (n))
 #define INTERRUPTENABLE(n)	(0x10 + 4 * (n))

[ ... ]

drivers/gpu/drm/imx/dc/dc-ic.c:dc_ic_driver {
	.probe = dc_ic_probe,
	.remove = dc_ic_remove,
	.driver = {
		.name = "imx8-dc-intc",
		.suppress_bind_attrs = true,
		.of_match_table	= dc_ic_dt_ids,
		.pm = pm_sleep_ptr(&dc_ic_pm_ops),
	},
};

[Severity: High]
This isn't a bug introduced by this patch, but can using pm_sleep_ptr() here cause a kernel oops on probe?

If the kernel is configured with CONFIG_PM=y but CONFIG_PM_SLEEP=n, pm_sleep_ptr() evaluates to NULL, dropping the entire PM operations structure including the runtime PM callbacks set by RUNTIME_PM_OPS().

During device probe, pm_runtime_resume_and_get() would execute successfully since the device lacks PM callbacks. As a result, dc_ic_runtime_resume() is skipped and the AXI clock (clk_axi) is never enabled.

The probe function then calls regmap_write() to mask and clear interrupts. Does accessing memory-mapped registers over an unclocked AXI bus trigger a synchronous external bus abort? Should this use pm_ptr() instead?

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=2
maintainer Reviewed-by on v1 2/2
#3 lore raw

Re: [PATCH 2/2] drm/imx: include dc-drv.h to avoid sparse warning

In reply to Jiri Slaby (SUSE)
Quoted 21 lines · Jiri Slaby (SUSE)

sparse (build with C=1) warns:
drivers/gpu/drm/imx/dc/dc-ic.c:273:24: warning: symbol 'dc_ic_driver' was not declared. Should it be static?

And it is right. Include dc-drv.h which declares the struct. This ensures the types of both match.

---
Cc: Maarten Lankhorst <[email protected]>
Cc: Maxime Ripard <[email protected]>
Cc: Thomas Zimmermann <[email protected]>
Cc: David Airlie <[email protected]>
Cc: Simona Vetter <[email protected]>
Cc: Frank Li <[email protected]>
Cc: Sascha Hauer <[email protected]>
Cc: Pengutronix Kernel Team <[email protected]>
Cc: Fabio Estevam <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]

Quoted 3 lines
---
 drivers/gpu/drm/imx/dc/dc-ic.c | 2 ++
 1 file changed, 2 insertions(+)

Thanks.

maintainer Acked-by on v1 1/2
#4 lore raw
In reply to Jiri Slaby (SUSE)
Quoted 36 lines · Jiri Slaby (SUSE)

irq_domain_add_linear() is going away as being obsolete now. Switch to the preferred irq_domain_create_linear(). That differs in the first
parameter: It takes more generic struct fwnode_handle instead of struct device_node. Therefore, of_fwnode_handle() is added around the parameter.

Note some of the users can likely use dev->fwnode directly instead of indirect of_fwnode_handle(dev->of_node). But dev->fwnode is not guaranteed to be set for all, so this has to be investigated on case to case basis (by people who can actually test with the HW).

---
Cc: Maarten Lankhorst <[email protected]>
Cc: Maxime Ripard <[email protected]>
Cc: Thomas Zimmermann <[email protected]>
Cc: David Airlie <[email protected]>
Cc: Simona Vetter <[email protected]>
Cc: Frank Li <[email protected]>
Cc: Sascha Hauer <[email protected]>
Cc: Pengutronix Kernel Team <[email protected]>
Cc: Fabio Estevam <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]

---
 drivers/gpu/drm/imx/dc/dc-ic.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/imx/dc/dc-ic.c +0 -0
index a270ae4030cd..d8aa46ee6a7a 100644

drivers/gpu/drm/imx/dc/dc-ic.c static int dc_ic_probe(struct platform_device *pdev) · line 178

Quoted 6 lines
drivers/gpu/drm/imx/dc/dc-ic.c +1 -1
@@ -174,7 +174,7 @@ static int dc_ic_probe(struct platform_device *pdev)
 		regmap_write(data->regs, USERINTERRUPTMASK(i), 0xffffffff);
 	}
 
-	data->domain = irq_domain_add_linear(dev->of_node, IRQ_COUNT,
+	data->domain = irq_domain_create_linear(of_fwnode_handle(dev->of_node), IRQ_COUNT,
 					     &irq_generic_chip_ops, data);

'./scripts/checkpatch.pl --strict' complaints:
CHECK: Alignment should match open parenthesis
#34: FILE: drivers/gpu/drm/imx/dc/dc-ic.c:178:
+ data->domain = irq_domain_create_linear(of_fwnode_handle(dev->of_node), IRQ_COUNT,
&irq_generic_chip_ops, data);

Quoted 5 lines
drivers/gpu/drm/imx/dc/dc-ic.c +0 -0
 	if (!data->domain) {
 		dev_err(dev, "failed to create IRQ domain\n");
Signature · 1 line
2.55.0
Signature · 2 lines
Regards,
Liu Ying
maintainer Applied
#5 lore raw
In reply to Jiri Slaby (SUSE)
Quoted 6 lines · Jiri Slaby (SUSE)

irq_domain_add_linear() is going away as being obsolete now. Switch to the preferred irq_domain_create_linear(). That differs in the first
parameter: It takes more generic struct fwnode_handle instead of struct device_node. Therefore, of_fwnode_handle() is added around the parameter.

Quoted 6 lines

Note some of the users can likely use dev->fwnode directly instead of indirect of_fwnode_handle(dev->of_node). But dev->fwnode is not guaranteed to be set for all, so this has to be investigated on case to case basis (by people who can actually test with the HW).

[...]

Fixed a complaint from 'checkpatch.pl --strict' for patch 1/2.

Applied to misc/kernel.git (drm-misc-next), thanks!

[1/2] drm/imx: Switch to irq_domain_create_linear()

      commit: d91748f683693be386fa127b7ec25d2a366b88b9
[2/2] drm/imx: include dc-drv.h to avoid sparse warning
      commit: 68952f1b00736f91867939f50d7b78c08126caad
Signature · 2 lines
Regards,
Liu Ying