Skip to content

Commit 3632f42

Browse files
committed
Merge tag 'pm-6.5-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
Pull power management fixes from Rafael Wysocki: "Fix the arming of wakeup IRQs in the generic wakeup IRQ code (wakeirq), drop unused functions from it and fix up a driver using it and trying to work around the IRQ arming issue in a questionable way (Johan Hovold)" * tag 'pm-6.5-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: serial: qcom-geni: drop bogus runtime pm state update PM: sleep: wakeirq: drop unused enable helpers PM: sleep: wakeirq: fix wake irq arming
2 parents 2f4effd + 4dd8752 commit 3632f42

File tree

4 files changed

+9
-70
lines changed

4 files changed

+9
-70
lines changed

drivers/base/power/power.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ extern u64 pm_runtime_active_time(struct device *dev);
2929
#define WAKE_IRQ_DEDICATED_MASK (WAKE_IRQ_DEDICATED_ALLOCATED | \
3030
WAKE_IRQ_DEDICATED_MANAGED | \
3131
WAKE_IRQ_DEDICATED_REVERSE)
32+
#define WAKE_IRQ_DEDICATED_ENABLED BIT(3)
3233

3334
struct wake_irq {
3435
struct device *dev;

drivers/base/power/wakeirq.c

Lines changed: 8 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,6 @@ static int __dev_pm_set_dedicated_wake_irq(struct device *dev, int irq, unsigned
194194
return err;
195195
}
196196

197-
198197
/**
199198
* dev_pm_set_dedicated_wake_irq - Request a dedicated wake-up interrupt
200199
* @dev: Device entry
@@ -206,11 +205,6 @@ static int __dev_pm_set_dedicated_wake_irq(struct device *dev, int irq, unsigned
206205
* Sets up a threaded interrupt handler for a device that has
207206
* a dedicated wake-up interrupt in addition to the device IO
208207
* interrupt.
209-
*
210-
* The interrupt starts disabled, and needs to be managed for
211-
* the device by the bus code or the device driver using
212-
* dev_pm_enable_wake_irq*() and dev_pm_disable_wake_irq*()
213-
* functions.
214208
*/
215209
int dev_pm_set_dedicated_wake_irq(struct device *dev, int irq)
216210
{
@@ -232,56 +226,13 @@ EXPORT_SYMBOL_GPL(dev_pm_set_dedicated_wake_irq);
232226
* the status of WAKE_IRQ_DEDICATED_REVERSE to tell rpm_suspend()
233227
* to enable dedicated wake-up interrupt after running the runtime suspend
234228
* callback for @dev.
235-
*
236-
* The interrupt starts disabled, and needs to be managed for
237-
* the device by the bus code or the device driver using
238-
* dev_pm_enable_wake_irq*() and dev_pm_disable_wake_irq*()
239-
* functions.
240229
*/
241230
int dev_pm_set_dedicated_wake_irq_reverse(struct device *dev, int irq)
242231
{
243232
return __dev_pm_set_dedicated_wake_irq(dev, irq, WAKE_IRQ_DEDICATED_REVERSE);
244233
}
245234
EXPORT_SYMBOL_GPL(dev_pm_set_dedicated_wake_irq_reverse);
246235

247-
/**
248-
* dev_pm_enable_wake_irq - Enable device wake-up interrupt
249-
* @dev: Device
250-
*
251-
* Optionally called from the bus code or the device driver for
252-
* runtime_resume() to override the PM runtime core managed wake-up
253-
* interrupt handling to enable the wake-up interrupt.
254-
*
255-
* Note that for runtime_suspend()) the wake-up interrupts
256-
* should be unconditionally enabled unlike for suspend()
257-
* that is conditional.
258-
*/
259-
void dev_pm_enable_wake_irq(struct device *dev)
260-
{
261-
struct wake_irq *wirq = dev->power.wakeirq;
262-
263-
if (wirq && (wirq->status & WAKE_IRQ_DEDICATED_ALLOCATED))
264-
enable_irq(wirq->irq);
265-
}
266-
EXPORT_SYMBOL_GPL(dev_pm_enable_wake_irq);
267-
268-
/**
269-
* dev_pm_disable_wake_irq - Disable device wake-up interrupt
270-
* @dev: Device
271-
*
272-
* Optionally called from the bus code or the device driver for
273-
* runtime_suspend() to override the PM runtime core managed wake-up
274-
* interrupt handling to disable the wake-up interrupt.
275-
*/
276-
void dev_pm_disable_wake_irq(struct device *dev)
277-
{
278-
struct wake_irq *wirq = dev->power.wakeirq;
279-
280-
if (wirq && (wirq->status & WAKE_IRQ_DEDICATED_ALLOCATED))
281-
disable_irq_nosync(wirq->irq);
282-
}
283-
EXPORT_SYMBOL_GPL(dev_pm_disable_wake_irq);
284-
285236
/**
286237
* dev_pm_enable_wake_irq_check - Checks and enables wake-up interrupt
287238
* @dev: Device
@@ -314,8 +265,10 @@ void dev_pm_enable_wake_irq_check(struct device *dev,
314265
return;
315266

316267
enable:
317-
if (!can_change_status || !(wirq->status & WAKE_IRQ_DEDICATED_REVERSE))
268+
if (!can_change_status || !(wirq->status & WAKE_IRQ_DEDICATED_REVERSE)) {
318269
enable_irq(wirq->irq);
270+
wirq->status |= WAKE_IRQ_DEDICATED_ENABLED;
271+
}
319272
}
320273

321274
/**
@@ -336,8 +289,10 @@ void dev_pm_disable_wake_irq_check(struct device *dev, bool cond_disable)
336289
if (cond_disable && (wirq->status & WAKE_IRQ_DEDICATED_REVERSE))
337290
return;
338291

339-
if (wirq->status & WAKE_IRQ_DEDICATED_MANAGED)
292+
if (wirq->status & WAKE_IRQ_DEDICATED_MANAGED) {
293+
wirq->status &= ~WAKE_IRQ_DEDICATED_ENABLED;
340294
disable_irq_nosync(wirq->irq);
295+
}
341296
}
342297

343298
/**
@@ -376,7 +331,7 @@ void dev_pm_arm_wake_irq(struct wake_irq *wirq)
376331

377332
if (device_may_wakeup(wirq->dev)) {
378333
if (wirq->status & WAKE_IRQ_DEDICATED_ALLOCATED &&
379-
!pm_runtime_status_suspended(wirq->dev))
334+
!(wirq->status & WAKE_IRQ_DEDICATED_ENABLED))
380335
enable_irq(wirq->irq);
381336

382337
enable_irq_wake(wirq->irq);
@@ -399,7 +354,7 @@ void dev_pm_disarm_wake_irq(struct wake_irq *wirq)
399354
disable_irq_wake(wirq->irq);
400355

401356
if (wirq->status & WAKE_IRQ_DEDICATED_ALLOCATED &&
402-
!pm_runtime_status_suspended(wirq->dev))
357+
!(wirq->status & WAKE_IRQ_DEDICATED_ENABLED))
403358
disable_irq_nosync(wirq->irq);
404359
}
405360
}

drivers/tty/serial/qcom_geni_serial.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1681,13 +1681,6 @@ static int qcom_geni_serial_probe(struct platform_device *pdev)
16811681
if (ret)
16821682
return ret;
16831683

1684-
/*
1685-
* Set pm_runtime status as ACTIVE so that wakeup_irq gets
1686-
* enabled/disabled from dev_pm_arm_wake_irq during system
1687-
* suspend/resume respectively.
1688-
*/
1689-
pm_runtime_set_active(&pdev->dev);
1690-
16911684
if (port->wakeup_irq > 0) {
16921685
device_init_wakeup(&pdev->dev, true);
16931686
ret = dev_pm_set_dedicated_wake_irq(&pdev->dev,

include/linux/pm_wakeirq.h

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ extern int dev_pm_set_wake_irq(struct device *dev, int irq);
1010
extern int dev_pm_set_dedicated_wake_irq(struct device *dev, int irq);
1111
extern int dev_pm_set_dedicated_wake_irq_reverse(struct device *dev, int irq);
1212
extern void dev_pm_clear_wake_irq(struct device *dev);
13-
extern void dev_pm_enable_wake_irq(struct device *dev);
14-
extern void dev_pm_disable_wake_irq(struct device *dev);
1513

1614
#else /* !CONFIG_PM */
1715

@@ -34,13 +32,5 @@ static inline void dev_pm_clear_wake_irq(struct device *dev)
3432
{
3533
}
3634

37-
static inline void dev_pm_enable_wake_irq(struct device *dev)
38-
{
39-
}
40-
41-
static inline void dev_pm_disable_wake_irq(struct device *dev)
42-
{
43-
}
44-
4535
#endif /* CONFIG_PM */
4636
#endif /* _LINUX_PM_WAKEIRQ_H */

0 commit comments

Comments
 (0)