genirq: Update stale comment for __irq_domain_add
Subsystems (2)
PATCH 1/2 genirq: Update stale comment for __irq_domain_add
Commit 1bf4ddc46c5d ("irqdomain: Introduce irq_domain_create_{linear, tree}") introduced the use of fwnode_handle to identify the interrupt controller when calling __irq_domain_add but missed updating the kernel doc parameters for the function.
Update this comment. While we are touching this code, also consolidate the declaration and assignment of of_node.
--- kernel/irq/irqdomain.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
kernel/irq/irqdomain.c +2 -4
@@ -80,7 +80,7 @@ EXPORT_SYMBOL_GPL(irq_domain_free_fwnode);/** * __irq_domain_add() - Allocate a new irq_domain data structure -* @of_node: optional device-tree node of the interrupt controller +* @fwnode: firmware node for the interrupt controller * @size: Size of linear map; 0 for radix mapping only * @hwirq_max: Maximum number of interrupts supported by controller * @direct_max: Maximum value of direct maps; Use ~0 for no limit; 0 for no
@@ -97,9 +97,7 @@ struct irq_domain *__irq_domain_add(struct fwnode_handle *fwnode, int size, void *host_data) {struct irq_domain *domain; -struct device_node *of_node; - - of_node =to_of_node (fwnode); +struct device_node *of_node =to_of_node (fwnode); domain =kzalloc_node (sizeof (*domain) + (sizeof (unsigned int ) * size),GFP_KERNEL ,of_node_to_nid (of_node));
Signature · 1 line
2.8.0.rc3
PATCH 2/2 genirq: Use firmware identifier while adding domain
Use the firmware provided identifier for the domain name.
--- kernel/irq/irqdomain.c | 4 ++++ 1 file changed, 4 insertions(+)
kernel/irq/irqdomain.c +4 -0
@@ -114,6 +114,10 @@ struct irq_domain *__irq_domain_add(struct fwnode_handle *fwnode, int size, domain->hwirq_max = hwirq_max; domain->revmap_size = size; domain->revmap_direct_max_irq = direct_max; +if (is_fwnode_irqchip (fwnode)) + domain->name = container_of(fwnode, struct irqchip_fwid, fwnode)->name; +else + domain->name =of_node_full_name (of_node);irq_domain_check_hierarchy (domain);mutex_lock (&irq_domain_mutex);
Signature · 1 line
2.8.0.rc3
Re: [PATCH 2/2] genirq: Use firmware identifier while adding domain
Quoted 12 lines · Punit Agrawal
Use the firmware provided identifier for the domain name.
Signed-off-by Punit Agrawal <[email protected]>--- kernel/irq/irqdomain.c | 4 ++++ 1 file changed, 4 insertions(+)kernel/irq/irqdomain.c +0
-0
kernel/irq/irqdomain.c struct irq_domain *__irq_domain_add(struct fwnode_handle *fwnode, int size, · line 118
Quoted 5 lines
kernel/irq/irqdomain.c +2
-0@@ -114,6 +114,10 @@ struct irq_domain *__irq_domain_add(struct fwnode_handle *fwnode, int size, domain->hwirq_max = hwirq_max; domain->revmap_size = size; domain->revmap_direct_max_irq = direct_max; +if (is_fwnode_irqchip (fwnode)) + domain->name = container_of(fwnode, struct irqchip_fwid, fwnode)->name;
So this thing worries me to no end. Look at the way irqchip_fwid is constructed:
name = kasprintf(GFP_KERNEL, "irqchip@%p", data);
You'd end-up disclosing a kernel address, which is not a very good idea.
kernel/irq/irqdomain.c struct irq_domain *__irq_domain_add(struct fwnode_handle *fwnode, int size, · line 120
Quoted 2 lines
kernel/irq/irqdomain.c +2
-0+else + domain->name =of_node_full_name (of_node);
And what if the node gets pruned (as it can happen on OpenFirmware implementations)?
kernel/irq/irqdomain.c struct irq_domain *__irq_domain_add(struct fwnode_handle *fwnode, int size, · line 123
Quoted 4 lines
kernel/irq/irqdomain.c +0
-0irq_domain_check_hierarchy (domain);mutex_lock (&irq_domain_mutex);
Thanks,
M.
Signature · 1 line
Jazz is not dead. It just smells funny...
[this has been languishing in my Inbox for months - thanks tglx for the heads up]
Quoted 9 lines · Punit Agrawal
Commit
1bf4ddc46c5d("irqdomain: Introduce irq_domain_create_{linear, tree}") introduced the use offwnode_handleto identify the interrupt controller when calling__irq_domain_addbut missed updating the kernel doc parameters for the function.Update this comment. While we are touching this code, also consolidate the declaration and assignment of
of_node.Signed-off-by Punit Agrawal <[email protected]>
M.
Signature · 1 line
Jazz is not dead. It just smells funny...
tip-bot for Punit Agrawal
merge botgenirq: Update stale comment for __irq_domain_add
Commit-ID: 545d5d657b720e9c4dc773265bb7e9d88e34b269 Gitweb: http://git.kernel.org/tip/545d5d657b720e9c4dc773265bb7e9d88e34b269 Author: Punit Agrawal <[email protected]> AuthorDate: Tue, 31 May 2016 13:56:48 +0100 Committer: Thomas Gleixner <[email protected]> CommitDate: Mon, 5 Sep 2016 17:11:10 +0200
genirq: Update stale comment for __irq_domain_add
Commit 1bf4ddc46c5d ("irqdomain: Introduce irq_domain_create_{linear, tree}") introduced the use of fwnode_handle to identify the interrupt controller when calling __irq_domain_add but missed updating the kernel doc parameters for the function.
Update this comment. While we are touching this code, also consolidate the declaration and assignment of of_node.
--- kernel/irq/irqdomain.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
kernel/irq/irqdomain.c +2 -4
@@ -80,7 +80,7 @@ EXPORT_SYMBOL_GPL(irq_domain_free_fwnode);/** * __irq_domain_add() - Allocate a new irq_domain data structure -* @of_node: optional device-tree node of the interrupt controller +* @fwnode: firmware node for the interrupt controller * @size: Size of linear map; 0 for radix mapping only * @hwirq_max: Maximum number of interrupts supported by controller * @direct_max: Maximum value of direct maps; Use ~0 for no limit; 0 for no
@@ -96,10 +96,8 @@ struct irq_domain *__irq_domain_add(struct fwnode_handle *fwnode, int size,const struct irq_domain_ops *ops, void *host_data) { + struct device_node *of_node = to_of_node(fwnode);struct irq_domain *domain; -struct device_node *of_node; - - of_node =to_of_node (fwnode); domain =kzalloc_node (sizeof (*domain) + (sizeof (unsigned int ) * size),GFP_KERNEL ,of_node_to_nid (of_node));