Skip to contentSkip to conversation

mei: add POWERING_DOWN into device state print

PATCH New Tomas Winkler 1 participant 2 messages Dec 23, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 mei: add POWERING_DOWN into device state print

From: Alexander Usyskin <[email protected]>

The POWERING_DOWN state string was missing from
the device states list, add it.

---
 drivers/misc/mei/init.c | 1 +
 1 file changed, 1 insertion(+)
drivers/misc/mei/init.c +1 -0
index 5c8cb679b997..f79076c67256 100644
@@ -24,6 +24,7 @@ const char *mei_dev_state_str(int state)
 	MEI_DEV_STATE(ENABLED);
 	MEI_DEV_STATE(RESETTING);
 	MEI_DEV_STATE(DISABLED);
+	MEI_DEV_STATE(POWERING_DOWN);
 	MEI_DEV_STATE(POWER_DOWN);
 	MEI_DEV_STATE(POWER_UP);
 	default:
Signature · 1 line
2.31.1
#1 lore raw

PATCH 2/2 mei: cleanup status before client dma setup call

From: Alexander Usyskin <[email protected]>

The upper layer may retry call to mei_cl_dma_alloc_and_map(), in that case the client status may be non-zero after the previous call and the wait condition will be true immediately.
Set cl->status to zero to allow waiting for an actual result from the firmware.

---
 drivers/misc/mei/client.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/misc/mei/client.c +4 -0
index 96f4e59c32a5..22be86a205bf 100644
@@ -2327,6 +2327,8 @@ int mei_cl_dma_alloc_and_map(struct mei_cl *cl, const struct file *fp,
 		list_move_tail(&cb->list, &dev->ctrl_rd_list);
 	}
 
+	cl->status = 0;
+
 	mutex_unlock(&dev->device_lock);
 	wait_event_timeout(cl->wait,
 			   cl->dma_mapped || cl->status,
@@ -2404,6 +2406,8 @@ int mei_cl_dma_unmap(struct mei_cl *cl, const struct file *fp)
 		list_move_tail(&cb->list, &dev->ctrl_rd_list);
 	}
 
+	cl->status = 0;
+
 	mutex_unlock(&dev->device_lock);
 	wait_event_timeout(cl->wait,
 			   !cl->dma_mapped || cl->status,
Signature · 1 line
2.31.1