146
146
147
147
struct nwl_msi { /* MSI information */
148
148
struct irq_domain * msi_domain ;
149
- unsigned long * bitmap ;
149
+ DECLARE_BITMAP ( bitmap , INT_PCI_MSI_NR ) ;
150
150
struct irq_domain * dev_domain ;
151
151
struct mutex lock ; /* protect bitmap variable */
152
152
int irq_msi0 ;
@@ -335,12 +335,10 @@ static void nwl_pcie_leg_handler(struct irq_desc *desc)
335
335
336
336
static void nwl_pcie_handle_msi_irq (struct nwl_pcie * pcie , u32 status_reg )
337
337
{
338
- struct nwl_msi * msi ;
338
+ struct nwl_msi * msi = & pcie -> msi ;
339
339
unsigned long status ;
340
340
u32 bit ;
341
341
342
- msi = & pcie -> msi ;
343
-
344
342
while ((status = nwl_bridge_readl (pcie , status_reg )) != 0 ) {
345
343
for_each_set_bit (bit , & status , 32 ) {
346
344
nwl_bridge_writel (pcie , 1 << bit , status_reg );
@@ -560,30 +558,21 @@ static int nwl_pcie_enable_msi(struct nwl_pcie *pcie)
560
558
struct nwl_msi * msi = & pcie -> msi ;
561
559
unsigned long base ;
562
560
int ret ;
563
- int size = BITS_TO_LONGS (INT_PCI_MSI_NR ) * sizeof (long );
564
561
565
562
mutex_init (& msi -> lock );
566
563
567
- msi -> bitmap = kzalloc (size , GFP_KERNEL );
568
- if (!msi -> bitmap )
569
- return - ENOMEM ;
570
-
571
564
/* Get msi_1 IRQ number */
572
565
msi -> irq_msi1 = platform_get_irq_byname (pdev , "msi1" );
573
- if (msi -> irq_msi1 < 0 ) {
574
- ret = - EINVAL ;
575
- goto err ;
576
- }
566
+ if (msi -> irq_msi1 < 0 )
567
+ return - EINVAL ;
577
568
578
569
irq_set_chained_handler_and_data (msi -> irq_msi1 ,
579
570
nwl_pcie_msi_handler_high , pcie );
580
571
581
572
/* Get msi_0 IRQ number */
582
573
msi -> irq_msi0 = platform_get_irq_byname (pdev , "msi0" );
583
- if (msi -> irq_msi0 < 0 ) {
584
- ret = - EINVAL ;
585
- goto err ;
586
- }
574
+ if (msi -> irq_msi0 < 0 )
575
+ return - EINVAL ;
587
576
588
577
irq_set_chained_handler_and_data (msi -> irq_msi0 ,
589
578
nwl_pcie_msi_handler_low , pcie );
@@ -592,8 +581,7 @@ static int nwl_pcie_enable_msi(struct nwl_pcie *pcie)
592
581
ret = nwl_bridge_readl (pcie , I_MSII_CAPABILITIES ) & MSII_PRESENT ;
593
582
if (!ret ) {
594
583
dev_err (dev , "MSI not present\n" );
595
- ret = - EIO ;
596
- goto err ;
584
+ return - EIO ;
597
585
}
598
586
599
587
/* Enable MSII */
@@ -632,10 +620,6 @@ static int nwl_pcie_enable_msi(struct nwl_pcie *pcie)
632
620
nwl_bridge_writel (pcie , MSGF_MSI_SR_LO_MASK , MSGF_MSI_MASK_LO );
633
621
634
622
return 0 ;
635
- err :
636
- kfree (msi -> bitmap );
637
- msi -> bitmap = NULL ;
638
- return ret ;
639
623
}
640
624
641
625
static int nwl_pcie_bridge_init (struct nwl_pcie * pcie )
0 commit comments