@@ -1446,52 +1446,27 @@ int msi_domain_alloc_irqs_all_locked(struct device *dev, unsigned int domid, int
1446
1446
return msi_domain_alloc_locked (dev , & ctrl );
1447
1447
}
1448
1448
1449
- /**
1450
- * msi_domain_alloc_irq_at - Allocate an interrupt from a MSI interrupt domain at
1451
- * a given index - or at the next free index
1452
- *
1453
- * @dev: Pointer to device struct of the device for which the interrupts
1454
- * are allocated
1455
- * @domid: Id of the interrupt domain to operate on
1456
- * @index: Index for allocation. If @index == %MSI_ANY_INDEX the allocation
1457
- * uses the next free index.
1458
- * @affdesc: Optional pointer to an interrupt affinity descriptor structure
1459
- * @icookie: Optional pointer to a domain specific per instance cookie. If
1460
- * non-NULL the content of the cookie is stored in msi_desc::data.
1461
- * Must be NULL for MSI-X allocations
1462
- *
1463
- * This requires a MSI interrupt domain which lets the core code manage the
1464
- * MSI descriptors.
1465
- *
1466
- * Return: struct msi_map
1467
- *
1468
- * On success msi_map::index contains the allocated index number and
1469
- * msi_map::virq the corresponding Linux interrupt number
1470
- *
1471
- * On failure msi_map::index contains the error code and msi_map::virq
1472
- * is %0.
1473
- */
1474
- struct msi_map msi_domain_alloc_irq_at (struct device * dev , unsigned int domid , unsigned int index ,
1475
- const struct irq_affinity_desc * affdesc ,
1476
- union msi_instance_cookie * icookie )
1449
+ static struct msi_map __msi_domain_alloc_irq_at (struct device * dev , unsigned int domid ,
1450
+ unsigned int index ,
1451
+ const struct irq_affinity_desc * affdesc ,
1452
+ union msi_instance_cookie * icookie )
1477
1453
{
1478
1454
struct msi_ctrl ctrl = { .domid = domid , .nirqs = 1 , };
1479
1455
struct irq_domain * domain ;
1480
1456
struct msi_map map = { };
1481
1457
struct msi_desc * desc ;
1482
1458
int ret ;
1483
1459
1484
- msi_lock_descs (dev );
1485
1460
domain = msi_get_device_domain (dev , domid );
1486
1461
if (!domain ) {
1487
1462
map .index = - ENODEV ;
1488
- goto unlock ;
1463
+ return map ;
1489
1464
}
1490
1465
1491
1466
desc = msi_alloc_desc (dev , 1 , affdesc );
1492
1467
if (!desc ) {
1493
1468
map .index = - ENOMEM ;
1494
- goto unlock ;
1469
+ return map ;
1495
1470
}
1496
1471
1497
1472
if (icookie )
@@ -1500,7 +1475,7 @@ struct msi_map msi_domain_alloc_irq_at(struct device *dev, unsigned int domid, u
1500
1475
ret = msi_insert_desc (dev , desc , domid , index );
1501
1476
if (ret ) {
1502
1477
map .index = ret ;
1503
- goto unlock ;
1478
+ return map ;
1504
1479
}
1505
1480
1506
1481
ctrl .first = ctrl .last = desc -> msi_index ;
@@ -1513,7 +1488,42 @@ struct msi_map msi_domain_alloc_irq_at(struct device *dev, unsigned int domid, u
1513
1488
map .index = desc -> msi_index ;
1514
1489
map .virq = desc -> irq ;
1515
1490
}
1516
- unlock :
1491
+ return map ;
1492
+ }
1493
+
1494
+ /**
1495
+ * msi_domain_alloc_irq_at - Allocate an interrupt from a MSI interrupt domain at
1496
+ * a given index - or at the next free index
1497
+ *
1498
+ * @dev: Pointer to device struct of the device for which the interrupts
1499
+ * are allocated
1500
+ * @domid: Id of the interrupt domain to operate on
1501
+ * @index: Index for allocation. If @index == %MSI_ANY_INDEX the allocation
1502
+ * uses the next free index.
1503
+ * @affdesc: Optional pointer to an interrupt affinity descriptor structure
1504
+ * @icookie: Optional pointer to a domain specific per instance cookie. If
1505
+ * non-NULL the content of the cookie is stored in msi_desc::data.
1506
+ * Must be NULL for MSI-X allocations
1507
+ *
1508
+ * This requires a MSI interrupt domain which lets the core code manage the
1509
+ * MSI descriptors.
1510
+ *
1511
+ * Return: struct msi_map
1512
+ *
1513
+ * On success msi_map::index contains the allocated index number and
1514
+ * msi_map::virq the corresponding Linux interrupt number
1515
+ *
1516
+ * On failure msi_map::index contains the error code and msi_map::virq
1517
+ * is %0.
1518
+ */
1519
+ struct msi_map msi_domain_alloc_irq_at (struct device * dev , unsigned int domid , unsigned int index ,
1520
+ const struct irq_affinity_desc * affdesc ,
1521
+ union msi_instance_cookie * icookie )
1522
+ {
1523
+ struct msi_map map ;
1524
+
1525
+ msi_lock_descs (dev );
1526
+ map = __msi_domain_alloc_irq_at (dev , domid , index , affdesc , icookie );
1517
1527
msi_unlock_descs (dev );
1518
1528
return map ;
1519
1529
}
0 commit comments