@@ -1107,7 +1107,7 @@ static int gpiochip_hierarchy_irq_domain_alloc(struct irq_domain *d,
11071107 irq_hw_number_t hwirq ;
11081108 unsigned int type = IRQ_TYPE_NONE ;
11091109 struct irq_fwspec * fwspec = data ;
1110- void * parent_arg ;
1110+ union gpio_irq_fwspec gpio_parent_fwspec = {} ;
11111111 unsigned int parent_hwirq ;
11121112 unsigned int parent_type ;
11131113 struct gpio_irq_chip * girq = & gc -> irq ;
@@ -1147,14 +1147,15 @@ static int gpiochip_hierarchy_irq_domain_alloc(struct irq_domain *d,
11471147 irq_set_probe (irq );
11481148
11491149 /* This parent only handles asserted level IRQs */
1150- parent_arg = girq -> populate_parent_alloc_arg (gc , parent_hwirq , parent_type );
1151- if (!parent_arg )
1152- return - ENOMEM ;
1150+ ret = girq -> populate_parent_alloc_arg (gc , & gpio_parent_fwspec ,
1151+ parent_hwirq , parent_type );
1152+ if (ret )
1153+ return ret ;
11531154
11541155 chip_dbg (gc , "alloc_irqs_parent for %d parent hwirq %d\n" ,
11551156 irq , parent_hwirq );
11561157 irq_set_lockdep_class (irq , gc -> irq .lock_key , gc -> irq .request_key );
1157- ret = irq_domain_alloc_irqs_parent (d , irq , 1 , parent_arg );
1158+ ret = irq_domain_alloc_irqs_parent (d , irq , 1 , & gpio_parent_fwspec );
11581159 /*
11591160 * If the parent irqdomain is msi, the interrupts have already
11601161 * been allocated, so the EEXIST is good.
@@ -1166,7 +1167,6 @@ static int gpiochip_hierarchy_irq_domain_alloc(struct irq_domain *d,
11661167 "failed to allocate parent hwirq %d for hwirq %lu\n" ,
11671168 parent_hwirq , hwirq );
11681169
1169- kfree (parent_arg );
11701170 return ret ;
11711171}
11721172
@@ -1230,34 +1230,28 @@ static bool gpiochip_hierarchy_is_hierarchical(struct gpio_chip *gc)
12301230 return !!gc -> irq .parent_domain ;
12311231}
12321232
1233- void * gpiochip_populate_parent_fwspec_twocell (struct gpio_chip * gc ,
1234- unsigned int parent_hwirq ,
1235- unsigned int parent_type )
1233+ int gpiochip_populate_parent_fwspec_twocell (struct gpio_chip * gc ,
1234+ union gpio_irq_fwspec * gfwspec ,
1235+ unsigned int parent_hwirq ,
1236+ unsigned int parent_type )
12361237{
1237- struct irq_fwspec * fwspec ;
1238-
1239- fwspec = kmalloc (sizeof (* fwspec ), GFP_KERNEL );
1240- if (!fwspec )
1241- return NULL ;
1238+ struct irq_fwspec * fwspec = & gfwspec -> fwspec ;
12421239
12431240 fwspec -> fwnode = gc -> irq .parent_domain -> fwnode ;
12441241 fwspec -> param_count = 2 ;
12451242 fwspec -> param [0 ] = parent_hwirq ;
12461243 fwspec -> param [1 ] = parent_type ;
12471244
1248- return fwspec ;
1245+ return 0 ;
12491246}
12501247EXPORT_SYMBOL_GPL (gpiochip_populate_parent_fwspec_twocell );
12511248
1252- void * gpiochip_populate_parent_fwspec_fourcell (struct gpio_chip * gc ,
1253- unsigned int parent_hwirq ,
1254- unsigned int parent_type )
1249+ int gpiochip_populate_parent_fwspec_fourcell (struct gpio_chip * gc ,
1250+ union gpio_irq_fwspec * gfwspec ,
1251+ unsigned int parent_hwirq ,
1252+ unsigned int parent_type )
12551253{
1256- struct irq_fwspec * fwspec ;
1257-
1258- fwspec = kmalloc (sizeof (* fwspec ), GFP_KERNEL );
1259- if (!fwspec )
1260- return NULL ;
1254+ struct irq_fwspec * fwspec = & gfwspec -> fwspec ;
12611255
12621256 fwspec -> fwnode = gc -> irq .parent_domain -> fwnode ;
12631257 fwspec -> param_count = 4 ;
@@ -1266,7 +1260,7 @@ void *gpiochip_populate_parent_fwspec_fourcell(struct gpio_chip *gc,
12661260 fwspec -> param [2 ] = 0 ;
12671261 fwspec -> param [3 ] = parent_type ;
12681262
1269- return fwspec ;
1263+ return 0 ;
12701264}
12711265EXPORT_SYMBOL_GPL (gpiochip_populate_parent_fwspec_fourcell );
12721266
0 commit comments