Skip to content

Commit 858e65a

Browse files
committed
irqdomain: Add device pointer to irq_domain_info and msi_domain_info
Add device pointer to irq_domain_info and msi_domain_info, so that the device can be specified at domain creation time. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Nam Cao <namcao@linutronix.de> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Link: https://lore.kernel.org/all/943e52403b20cf13c320d55bd4446b4562466aab.1750860131.git.namcao@linutronix.de
1 parent 41a5f82 commit 858e65a

4 files changed

Lines changed: 7 additions & 1 deletion

File tree

include/linux/irqdomain.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,7 @@ struct irq_domain_chip_generic_info;
279279
* domains are added using same fwnode
280280
* @ops: Domain operation callbacks
281281
* @host_data: Controller private data pointer
282+
* @dev: Device which creates the domain
282283
* @dgc_info: Geneneric chip information structure pointer used to
283284
* create generic chips for the domain if not NULL.
284285
* @init: Function called when the domain is created.
@@ -298,6 +299,7 @@ struct irq_domain_info {
298299
const char *name_suffix;
299300
const struct irq_domain_ops *ops;
300301
void *host_data;
302+
struct device *dev;
301303
#ifdef CONFIG_IRQ_DOMAIN_HIERARCHY
302304
/**
303305
* @parent: Pointer to the parent irq domain used in a hierarchy domain

include/linux/msi.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -488,6 +488,7 @@ struct msi_domain_ops {
488488
* gets initialized to the maximum software index limit
489489
* by the domain creation code.
490490
* @ops: The callback data structure
491+
* @dev: Device which creates the domain
491492
* @chip: Optional: associated interrupt chip
492493
* @chip_data: Optional: associated interrupt chip data
493494
* @handler: Optional: associated interrupt flow handler
@@ -501,6 +502,7 @@ struct msi_domain_info {
501502
enum irq_domain_bus_token bus_token;
502503
unsigned int hwsize;
503504
struct msi_domain_ops *ops;
505+
struct device *dev;
504506
struct irq_chip *chip;
505507
void *chip_data;
506508
irq_flow_handler_t handler;

kernel/irq/irqdomain.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,7 @@ static struct irq_domain *__irq_domain_instantiate(const struct irq_domain_info
317317

318318
domain->flags |= info->domain_flags;
319319
domain->exit = info->exit;
320+
domain->dev = info->dev;
320321

321322
#ifdef CONFIG_IRQ_DOMAIN_HIERARCHY
322323
if (info->parent) {

kernel/irq/msi.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -889,6 +889,7 @@ static struct irq_domain *__msi_create_irq_domain(struct fwnode_handle *fwnode,
889889

890890
if (domain) {
891891
irq_domain_update_bus_token(domain, info->bus_token);
892+
domain->dev = info->dev;
892893
if (info->flags & MSI_FLAG_PARENT_PM_DEV)
893894
domain->pm_dev = parent->pm_dev;
894895
}
@@ -1051,6 +1052,7 @@ bool msi_create_device_irq_domain(struct device *dev, unsigned int domid,
10511052
bundle->info.data = domain_data;
10521053
bundle->info.chip_data = chip_data;
10531054
bundle->info.alloc_data = &bundle->alloc_info;
1055+
bundle->info.dev = dev;
10541056

10551057
pops = parent->msi_parent_ops;
10561058
snprintf(bundle->name, sizeof(bundle->name), "%s%s-%s",
@@ -1089,7 +1091,6 @@ bool msi_create_device_irq_domain(struct device *dev, unsigned int domid,
10891091
if (!domain)
10901092
return false;
10911093

1092-
domain->dev = dev;
10931094
dev->msi.data->__domains[domid].domain = domain;
10941095

10951096
if (msi_domain_prepare_irqs(domain, dev, hwsize, &bundle->alloc_info)) {

0 commit comments

Comments
 (0)