@@ -31,14 +31,12 @@ struct xgene_msi_group {
3131};
3232
3333struct xgene_msi {
34- struct device_node * node ;
3534 struct irq_domain * inner_domain ;
3635 u64 msi_addr ;
3736 void __iomem * msi_regs ;
3837 unsigned long * bitmap ;
3938 struct mutex bitmap_lock ;
4039 struct xgene_msi_group * msi_groups ;
41- int num_cpus ;
4240};
4341
4442/* Global data */
@@ -147,7 +145,7 @@ static void xgene_compose_msi_msg(struct irq_data *data, struct msi_msg *msg)
147145 */
148146static int hwirq_to_cpu (unsigned long hwirq )
149147{
150- return (hwirq % xgene_msi_ctrl . num_cpus );
148+ return (hwirq % num_possible_cpus () );
151149}
152150
153151static unsigned long hwirq_to_canonical_hwirq (unsigned long hwirq )
@@ -186,9 +184,9 @@ static int xgene_irq_domain_alloc(struct irq_domain *domain, unsigned int virq,
186184 mutex_lock (& msi -> bitmap_lock );
187185
188186 msi_irq = bitmap_find_next_zero_area (msi -> bitmap , NR_MSI_VEC , 0 ,
189- msi -> num_cpus , 0 );
187+ num_possible_cpus () , 0 );
190188 if (msi_irq < NR_MSI_VEC )
191- bitmap_set (msi -> bitmap , msi_irq , msi -> num_cpus );
189+ bitmap_set (msi -> bitmap , msi_irq , num_possible_cpus () );
192190 else
193191 msi_irq = - ENOSPC ;
194192
@@ -214,7 +212,7 @@ static void xgene_irq_domain_free(struct irq_domain *domain,
214212 mutex_lock (& msi -> bitmap_lock );
215213
216214 hwirq = hwirq_to_canonical_hwirq (d -> hwirq );
217- bitmap_clear (msi -> bitmap , hwirq , msi -> num_cpus );
215+ bitmap_clear (msi -> bitmap , hwirq , num_possible_cpus () );
218216
219217 mutex_unlock (& msi -> bitmap_lock );
220218
@@ -235,10 +233,11 @@ static const struct msi_parent_ops xgene_msi_parent_ops = {
235233 .init_dev_msi_info = msi_lib_init_dev_msi_info ,
236234};
237235
238- static int xgene_allocate_domains (struct xgene_msi * msi )
236+ static int xgene_allocate_domains (struct device_node * node ,
237+ struct xgene_msi * msi )
239238{
240239 struct irq_domain_info info = {
241- .fwnode = of_fwnode_handle (msi -> node ),
240+ .fwnode = of_fwnode_handle (node ),
242241 .ops = & xgene_msi_domain_ops ,
243242 .size = NR_MSI_VEC ,
244243 .host_data = msi ,
@@ -358,7 +357,7 @@ static int xgene_msi_hwirq_alloc(unsigned int cpu)
358357 int i ;
359358 int err ;
360359
361- for (i = cpu ; i < NR_HW_IRQS ; i += msi -> num_cpus ) {
360+ for (i = cpu ; i < NR_HW_IRQS ; i += num_possible_cpus () ) {
362361 msi_group = & msi -> msi_groups [i ];
363362
364363 /*
@@ -386,7 +385,7 @@ static int xgene_msi_hwirq_free(unsigned int cpu)
386385 struct xgene_msi_group * msi_group ;
387386 int i ;
388387
389- for (i = cpu ; i < NR_HW_IRQS ; i += msi -> num_cpus ) {
388+ for (i = cpu ; i < NR_HW_IRQS ; i += num_possible_cpus () ) {
390389 msi_group = & msi -> msi_groups [i ];
391390 irq_set_chained_handler_and_data (msi_group -> gic_irq , NULL ,
392391 NULL );
@@ -417,16 +416,14 @@ static int xgene_msi_probe(struct platform_device *pdev)
417416 goto error ;
418417 }
419418 xgene_msi -> msi_addr = res -> start ;
420- xgene_msi -> node = pdev -> dev .of_node ;
421- xgene_msi -> num_cpus = num_possible_cpus ();
422419
423420 rc = xgene_msi_init_allocator (xgene_msi );
424421 if (rc ) {
425422 dev_err (& pdev -> dev , "Error allocating MSI bitmap\n" );
426423 goto error ;
427424 }
428425
429- rc = xgene_allocate_domains (xgene_msi );
426+ rc = xgene_allocate_domains (dev_of_node ( & pdev -> dev ), xgene_msi );
430427 if (rc ) {
431428 dev_err (& pdev -> dev , "Failed to allocate MSI domain\n" );
432429 goto error ;
0 commit comments