misc: bh1770glc: queue proximity work on freezable workqueue
PATCH 1/1 misc: bh1770glc: queue proximity work on freezable workqueue
The proximity fallback work reads sensor registers after a delay. System suspend powers the sensor down without cancelling that work, while schedule_delayed_work() leaves it runnable on the non-freezable system workqueue.
Queue the fallback work on system_freezable_wq so it cannot access the powered-down sensor or its suspended I2C adapter.
--- drivers/misc/bh1770glc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/misc/bh1770glc.c +2 -2
@@ -620,8 +620,8 @@ static irqreturn_t bh1770_irq(int irq, void *data)* next expected interrupt time. */ cancel_delayed_work_sync (&chip->prox_work); -schedule_delayed_work (&chip->prox_work, -msecs_to_jiffies (rate +50 )); +queue_delayed_work (system_freezable_wq, &chip->prox_work, +msecs_to_jiffies (rate +50 )); }return IRQ_HANDLED ; }
Signature · 1 line
2.34.1
Quoted 8 lines · Jiale Yao
The proximity fallback work reads sensor registers after a delay. System suspend powers the sensor down without cancelling that work, while
schedule_delayed_work()leaves it runnable on the non-freezable system workqueue.Queue the fallback work on
system_freezable_wqso it cannot access the powered-down sensor or its suspended I2C adapter.
Quoted 22 lines
Signed-off-by Jiale Yao <[email protected]>---
drivers/misc/bh1770glc.c| 4 ++--1 file changed, 2 insertions(+), 2 deletions(-)drivers/misc/bh1770glc.c +2
-2@@ -620,8 +620,8 @@ static irqreturn_t bh1770_irq(int irq, void *data)* next expected interrupt time. */ cancel_delayed_work_sync (&chip->prox_work); -schedule_delayed_work (&chip->prox_work, -msecs_to_jiffies (rate +50 )); +queue_delayed_work (system_freezable_wq, &chip->prox_work, +msecs_to_jiffies (rate +50 )); }return IRQ_HANDLED ; }Signature · 1 line
2.34.1