Skip to content

Commit 8d52af6

Browse files
Tomas Winklergregkh
authored andcommitted
mei: speed up the power down flow
When mei driver is powering down due to suspend or shutdown it will iterate over the mei client bus and disconnect each client device attached in turn. The power down flow consist of the link rest, which causes all clients get disconnected at once, hence the individual disconnection can be omitted and significantly reduce power down flow. Signed-off-by: Tomas Winkler <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 2fc1024 commit 8d52af6

File tree

4 files changed

+17
-5
lines changed

4 files changed

+17
-5
lines changed

drivers/misc/mei/bus.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -543,14 +543,20 @@ int mei_cldev_disable(struct mei_cl_device *cldev)
543543
mutex_lock(&bus->device_lock);
544544

545545
if (!mei_cl_is_connected(cl)) {
546-
dev_dbg(bus->dev, "Already disconnected");
546+
dev_dbg(bus->dev, "Already disconnected\n");
547+
err = 0;
548+
goto out;
549+
}
550+
551+
if (bus->dev_state == MEI_DEV_POWER_DOWN) {
552+
dev_dbg(bus->dev, "Device is powering down don't botther with disconnection\n");
547553
err = 0;
548554
goto out;
549555
}
550556

551557
err = mei_cl_disconnect(cl);
552558
if (err < 0)
553-
dev_err(bus->dev, "Could not disconnect from the ME client");
559+
dev_err(bus->dev, "Could not disconnect from the ME client\n");
554560

555561
out:
556562
/* Flush queues and remove any pending read */

drivers/misc/mei/hw-me.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1260,7 +1260,9 @@ irqreturn_t mei_me_irq_thread_handler(int irq, void *dev_id)
12601260
if (rets == -ENODATA)
12611261
break;
12621262

1263-
if (rets && dev->dev_state != MEI_DEV_RESETTING) {
1263+
if (rets &&
1264+
(dev->dev_state != MEI_DEV_RESETTING ||
1265+
dev->dev_state != MEI_DEV_POWER_DOWN)) {
12641266
dev_err(dev->dev, "mei_irq_read_handler ret = %d.\n",
12651267
rets);
12661268
schedule_work(&dev->reset_work);

drivers/misc/mei/hw-txe.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1127,7 +1127,9 @@ irqreturn_t mei_txe_irq_thread_handler(int irq, void *dev_id)
11271127
if (test_and_clear_bit(TXE_INTR_OUT_DB_BIT, &hw->intr_cause)) {
11281128
/* Read from TXE */
11291129
rets = mei_irq_read_handler(dev, &cmpl_list, &slots);
1130-
if (rets && dev->dev_state != MEI_DEV_RESETTING) {
1130+
if (rets &&
1131+
(dev->dev_state != MEI_DEV_RESETTING ||
1132+
dev->dev_state != MEI_DEV_POWER_DOWN)) {
11311133
dev_err(dev->dev,
11321134
"mei_irq_read_handler ret = %d.\n", rets);
11331135

drivers/misc/mei/init.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,9 @@ void mei_stop(struct mei_device *dev)
310310
{
311311
dev_dbg(dev->dev, "stopping the device.\n");
312312

313+
mutex_lock(&dev->device_lock);
314+
dev->dev_state = MEI_DEV_POWER_DOWN;
315+
mutex_unlock(&dev->device_lock);
313316
mei_cl_bus_remove_devices(dev);
314317

315318
mei_cancel_work(dev);
@@ -319,7 +322,6 @@ void mei_stop(struct mei_device *dev)
319322

320323
mutex_lock(&dev->device_lock);
321324

322-
dev->dev_state = MEI_DEV_POWER_DOWN;
323325
mei_reset(dev);
324326
/* move device to disabled state unconditionally */
325327
dev->dev_state = MEI_DEV_DISABLED;

0 commit comments

Comments
 (0)