Skip to contentSkip to conversation

misc: bh1770glc: queue proximity work on freezable workqueue

PATCH In review Jiale Yao 2 participants 2 messages Oct 16 – Oct 17 Char and misc drivers

lore
Share & tools
lore

Jiale Yao

author
#0 lore raw

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
index 98fc5970b2bb..3411947d9283 100644
@@ -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
#1 lore raw
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_wq so it cannot access the powered-down sensor or its suspended I2C adapter.

Fixes 190420ab34ab ("drivers/misc: driver for bh1770glc / sfh7770 ALS and proximity sensor")
Quoted 22 lines

---
drivers/misc/bh1770glc.c | 4 ++--

1 file changed, 2 insertions(+), 2 deletions(-)
drivers/misc/bh1770glc.c +2 -2
index 98fc5970b2bb..3411947d9283 100644
@@ -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