Skip to content

Commit c836e5a

Browse files
committed
genirq/chip: Rework irq_set_msi_desc_off()
Use the new guards to get and lock the interrupt descriptor and tidy up the code. Fixup the kernel doc comment while at it. No functional change. Signed-off-by: Thomas Gleixner <[email protected]> Acked-by: Peter Zijlstra (Intel) <[email protected]> Link: https://lore.kernel.org/all/[email protected]
1 parent 321a0fd commit c836e5a

File tree

1 file changed

+17
-21
lines changed

1 file changed

+17
-21
lines changed

kernel/irq/chip.c

Lines changed: 17 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -84,34 +84,30 @@ int irq_set_handler_data(unsigned int irq, void *data)
8484
EXPORT_SYMBOL(irq_set_handler_data);
8585

8686
/**
87-
* irq_set_msi_desc_off - set MSI descriptor data for an irq at offset
88-
* @irq_base: Interrupt number base
89-
* @irq_offset: Interrupt number offset
90-
* @entry: Pointer to MSI descriptor data
87+
* irq_set_msi_desc_off - set MSI descriptor data for an irq at offset
88+
* @irq_base: Interrupt number base
89+
* @irq_offset: Interrupt number offset
90+
* @entry: Pointer to MSI descriptor data
9191
*
92-
* Set the MSI descriptor entry for an irq at offset
92+
* Set the MSI descriptor entry for an irq at offset
9393
*/
94-
int irq_set_msi_desc_off(unsigned int irq_base, unsigned int irq_offset,
95-
struct msi_desc *entry)
94+
int irq_set_msi_desc_off(unsigned int irq_base, unsigned int irq_offset, struct msi_desc *entry)
9695
{
97-
unsigned long flags;
98-
struct irq_desc *desc = irq_get_desc_lock(irq_base + irq_offset, &flags, IRQ_GET_DESC_CHECK_GLOBAL);
99-
100-
if (!desc)
101-
return -EINVAL;
102-
desc->irq_common_data.msi_desc = entry;
103-
if (entry && !irq_offset)
104-
entry->irq = irq_base;
105-
irq_put_desc_unlock(desc, flags);
106-
return 0;
96+
scoped_irqdesc_get_and_lock(irq_base + irq_offset, IRQ_GET_DESC_CHECK_GLOBAL) {
97+
scoped_irqdesc->irq_common_data.msi_desc = entry;
98+
if (entry && !irq_offset)
99+
entry->irq = irq_base;
100+
return 0;
101+
}
102+
return -EINVAL;
107103
}
108104

109105
/**
110-
* irq_set_msi_desc - set MSI descriptor data for an irq
111-
* @irq: Interrupt number
112-
* @entry: Pointer to MSI descriptor data
106+
* irq_set_msi_desc - set MSI descriptor data for an irq
107+
* @irq: Interrupt number
108+
* @entry: Pointer to MSI descriptor data
113109
*
114-
* Set the MSI descriptor entry for an irq
110+
* Set the MSI descriptor entry for an irq
115111
*/
116112
int irq_set_msi_desc(unsigned int irq, struct msi_desc *entry)
117113
{

0 commit comments

Comments
 (0)