Skip to content

Resolve inconsistent cell name for IRQ type in device trees #79356

@jan-kiszka

Description

@jan-kiszka

Introduction

Let's consolidate over a single name to describe the IRQ type in interrupt controller bindings.

Problem description

There are currently 7 interrupt controller bindings using "sense" as cell name to describe the IRQ type and 6 using "flags". Drivers that shall be used with different controllers may be forced to look after both cell names - or fail to do that, see e.g.

(DT_INST_IRQ(n, sense)), \

This is a source of subtle problems.

Proposed change

I have no strong preference about a unified name. We can either pick one of the two or maybe even rename them all to type so that using IRQ_TYPE_* constants for it feels more natural. I'm happy to write a PR for any of such renamings.

Future bindings should then be forced to use the new name for the flags/sense/type cell.

Dependencies

None.

Concerns and Unresolved Questions

See above: decision about the name is needed.

Alternatives

Applying lots of changes like this:

diff --git a/drivers/serial/uart_ns16550.c b/drivers/serial/uart_ns16550.c
index a46dc34aad7..8e1b39e436e 100644
--- a/drivers/serial/uart_ns16550.c
+++ b/drivers/serial/uart_ns16550.c
@@ -1787,9 +1787,12 @@ static const struct uart_driver_api uart_ns16550_driver_api = {
 };
 
 #define UART_NS16550_IRQ_FLAGS(n) \
-	COND_CODE_1(DT_INST_IRQ_HAS_CELL(n, sense),                           \
-		    (DT_INST_IRQ(n, sense)),                                  \
-		    (0))
+	(COND_CODE_1(DT_INST_IRQ_HAS_CELL(n, flags),                          \
+		     (DT_INST_IRQ(n, flags)),                                 \
+		     (0)) |                                                   \
+	 COND_CODE_1(DT_INST_IRQ_HAS_CELL(n, sense),                          \
+		     (DT_INST_IRQ(n, sense)),                                 \
+		     (0)))
 
 /* IO-port or MMIO based UART */
 #define UART_NS16550_IRQ_CONFIG(n)                                            \

One could also provide some common macro for that, of course, but all that would look strange.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions