@@ -1446,52 +1446,27 @@ int msi_domain_alloc_irqs_all_locked(struct device *dev, unsigned int domid, int
14461446 return msi_domain_alloc_locked (dev , & ctrl );
14471447}
14481448
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 )
14771453{
14781454 struct msi_ctrl ctrl = { .domid = domid , .nirqs = 1 , };
14791455 struct irq_domain * domain ;
14801456 struct msi_map map = { };
14811457 struct msi_desc * desc ;
14821458 int ret ;
14831459
1484- msi_lock_descs (dev );
14851460 domain = msi_get_device_domain (dev , domid );
14861461 if (!domain ) {
14871462 map .index = - ENODEV ;
1488- goto unlock ;
1463+ return map ;
14891464 }
14901465
14911466 desc = msi_alloc_desc (dev , 1 , affdesc );
14921467 if (!desc ) {
14931468 map .index = - ENOMEM ;
1494- goto unlock ;
1469+ return map ;
14951470 }
14961471
14971472 if (icookie )
@@ -1500,7 +1475,7 @@ struct msi_map msi_domain_alloc_irq_at(struct device *dev, unsigned int domid, u
15001475 ret = msi_insert_desc (dev , desc , domid , index );
15011476 if (ret ) {
15021477 map .index = ret ;
1503- goto unlock ;
1478+ return map ;
15041479 }
15051480
15061481 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
15131488 map .index = desc -> msi_index ;
15141489 map .virq = desc -> irq ;
15151490 }
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 );
15171527 msi_unlock_descs (dev );
15181528 return map ;
15191529}
0 commit comments