Skip to content

Commit e9df6eb

Browse files
committed
genirq/chip: Change irq_chip_pm_put() return type to void
The irq_chip_pm_put() return value is only used in __irq_do_set_handler() to trigger a WARN_ON() if it is negative, but doing so is not useful because irq_chip_pm_put() simply passes the pm_runtime_put() return value to its callers. Returning an error code from pm_runtime_put() merely means that it has not queued up a work item to check whether or not the device can be suspended and there are many perfectly valid situations in which that can happen, like after writing "on" to the devices' runtime PM "control" attribute in sysfs for one example. For this reason, modify irq_chip_pm_put() to discard the pm_runtime_put() return value, change its return type to void, and drop the WARN_ON() around the irq_chip_pm_put() invocation from __irq_do_set_handler(). Also update the irq_chip_pm_put() kerneldoc comment to be more accurate. This will facilitate a planned change of the pm_runtime_put() return type to void in the future. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Reviewed-by: Thomas Gleixner <tglx@kernel.org> Link: https://patch.msgid.link/5075294.31r3eYUQgx@rafael.j.wysocki
1 parent bf91b35 commit e9df6eb

2 files changed

Lines changed: 12 additions & 12 deletions

File tree

include/linux/irq.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -658,7 +658,7 @@ extern void handle_fasteoi_nmi(struct irq_desc *desc);
658658

659659
extern int irq_chip_compose_msi_msg(struct irq_data *data, struct msi_msg *msg);
660660
extern int irq_chip_pm_get(struct irq_data *data);
661-
extern int irq_chip_pm_put(struct irq_data *data);
661+
extern void irq_chip_pm_put(struct irq_data *data);
662662
#ifdef CONFIG_IRQ_DOMAIN_HIERARCHY
663663
extern void handle_fasteoi_ack_irq(struct irq_desc *desc);
664664
extern void handle_fasteoi_mask_irq(struct irq_desc *desc);

kernel/irq/chip.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -974,7 +974,7 @@ __irq_do_set_handler(struct irq_desc *desc, irq_flow_handler_t handle,
974974
irq_state_set_disabled(desc);
975975
if (is_chained) {
976976
desc->action = NULL;
977-
WARN_ON(irq_chip_pm_put(irq_desc_get_irq_data(desc)));
977+
irq_chip_pm_put(irq_desc_get_irq_data(desc));
978978
}
979979
desc->depth = 1;
980980
}
@@ -1530,20 +1530,20 @@ int irq_chip_pm_get(struct irq_data *data)
15301530
}
15311531

15321532
/**
1533-
* irq_chip_pm_put - Disable power for an IRQ chip
1533+
* irq_chip_pm_put - Drop a PM reference on an IRQ chip
15341534
* @data: Pointer to interrupt specific data
15351535
*
1536-
* Disable the power to the IRQ chip referenced by the interrupt data
1537-
* structure, belongs. Note that power will only be disabled, once this
1538-
* function has been called for all IRQs that have called irq_chip_pm_get().
1536+
* Drop a power management reference, acquired via irq_chip_pm_get(), on the IRQ
1537+
* chip represented by the interrupt data structure.
1538+
*
1539+
* Note that this will not disable power to the IRQ chip until this function
1540+
* has been called for all IRQs that have called irq_chip_pm_get() and it may
1541+
* not disable power at all (if user space prevents that, for example).
15391542
*/
1540-
int irq_chip_pm_put(struct irq_data *data)
1543+
void irq_chip_pm_put(struct irq_data *data)
15411544
{
15421545
struct device *dev = irq_get_pm_device(data);
1543-
int retval = 0;
1544-
1545-
if (IS_ENABLED(CONFIG_PM) && dev)
1546-
retval = pm_runtime_put(dev);
15471546

1548-
return (retval < 0) ? retval : 0;
1547+
if (dev)
1548+
pm_runtime_put(dev);
15491549
}

0 commit comments

Comments
 (0)