Skip to contentSkip to conversation

mei: cancel driver workers only after client devices were removed

PATCH New Tomas Winkler 1 participant 5 messages Oct 13, 2015

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

PATCH 1/5 mei: cancel driver workers only after client devices were removed

In process of client devices removal from the bus there still might be communication between a driver and the mei device hence we need to cancel supporting workers only after all the client devices were removed.

---
 drivers/misc/mei/init.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/misc/mei/init.c +2 -2
index e374661652cd..3edafc8d3ad4 100644
@@ -329,10 +329,10 @@ void mei_stop(struct mei_device *dev)
 {
 	dev_dbg(dev->dev, "stopping the device.\n");
 
-	mei_cancel_work(dev);
-
 	mei_cl_bus_remove_devices(dev);
 
+	mei_cancel_work(dev);
+
 	mutex_lock(&dev->device_lock);
 
 	mei_wd_stop(dev);
Signature · 1 line
2.4.3
#1 lore raw

PATCH 2/5 mei: keep the device awake during reads in chunks

From: Alexander Usyskin <[email protected]>

Long messages are read in chunks, to prevent trashing runtime pm between the reading of the chunks we call pm_runtime_mark_last_busy() on non-final chunk message as the next chunk of the same message will be received immediately in the next interrupt with high probablity.

---
 drivers/misc/mei/interrupt.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/misc/mei/interrupt.c +4 -0
index c418d7888994..64b568a0268d 100644
@@ -21,6 +21,7 @@
 #include <linux/fs.h>
 #include <linux/jiffies.h>
 #include <linux/slab.h>
+#include <linux/pm_runtime.h>
 
 #include <linux/mei.h>
 
@@ -147,6 +148,9 @@ int mei_cl_irq_read_msg(struct mei_cl *cl,
 		cb->read_time = jiffies;
 		cl_dbg(dev, cl, "completed read length = %lu\n", cb->buf_idx);
 		list_move_tail(&cb->list, &complete_list->list);
+	} else {
+		pm_runtime_mark_last_busy(dev->dev);
+		pm_request_autosuspend(dev->dev);
 	}
 
 out:
Signature · 1 line
2.4.3
#2 lore raw

PATCH 3/5 mei: fix the KDoc formating

In reply to Tomas Winkler

From: Alexander Usyskin <[email protected]>

KDoc function section start with double start: /** instead of /*

---
 drivers/misc/mei/hbm.c     |  6 +++---
 drivers/misc/mei/mei_dev.h | 17 +++++++++--------
 2 files changed, 12 insertions(+), 11 deletions(-)
drivers/misc/mei/hbm.c +3 -3
index 6d7c188fb65c..e7b7aad0999b 100644
@@ -281,7 +281,7 @@ int mei_hbm_start_req(struct mei_device *dev)
 	return 0;
 }
 
-/*
+/**
  * mei_hbm_enum_clients_req - sends enumeration client request message.
  *
  * @dev: the device structure
@@ -314,7 +314,7 @@ static int mei_hbm_enum_clients_req(struct mei_device *dev)
 	return 0;
 }
 
-/*
+/**
  * mei_hbm_me_cl_add - add new me client to the list
  *
  * @dev: the device structure
@@ -569,7 +569,7 @@ static int mei_hbm_prop_req(struct mei_device *dev)
 	return 0;
 }
 
-/*
+/**
  * mei_hbm_pg - sends pg command
  *
  * @dev: the device structure
drivers/misc/mei/mei_dev.h +9 -8
index 0f87dffa6be1..fc7728bb84b1 100644
@@ -275,32 +275,33 @@ struct mei_cl {
 	struct mei_cl_device *cldev;
 };
 
-/** struct mei_hw_ops
+/**
+ * struct mei_hw_ops - hw specific ops
  *
  * @host_is_ready    : query for host readiness
-
+ *
  * @hw_is_ready      : query if hw is ready
  * @hw_reset         : reset hw
  * @hw_start         : start hw after reset
  * @hw_config        : configure hw
-
+ *
  * @fw_status        : get fw status registers
  * @pg_state         : power gating state of the device
  * @pg_in_transition : is device now in pg transition
  * @pg_is_enabled    : is power gating enabled
-
+ *
  * @intr_clear       : clear pending interrupts
  * @intr_enable      : enable interrupts
  * @intr_disable     : disable interrupts
-
+ *
  * @hbuf_free_slots  : query for write buffer empty slots
  * @hbuf_is_ready    : query if write buffer is empty
  * @hbuf_max_len     : query for write buffer max len
-
+ *
  * @write            : write a message to FW
-
+ *
  * @rdbuf_full_slots : query how many slots are filled
-
+ *
  * @read_hdr         : get first 4 bytes (header)
  * @read             : read a buffer from the FW
  */
Signature · 1 line
2.4.3
#3 lore raw

PATCH 4/5 mei: bus: fix c&p issue in the kdoc

In reply to Tomas Winkler

s/send/receive/
The buffer in the receive function is
not used for sending

---
 drivers/misc/mei/bus.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/misc/mei/bus.c +2 -2
index 832085207a7f..160e084ae800 100644
@@ -91,7 +91,7 @@ out:
  * __mei_cl_recv - internal client receive (read)
  *
  * @cl: host client
- * @buf: buffer to send
+ * @buf: buffer to receive
  * @length: buffer length
  *
  * Return: read size in bytes of < 0 on error
@@ -188,7 +188,7 @@ EXPORT_SYMBOL_GPL(mei_cldev_send);
  * mei_cldev_recv - client receive (read)
  *
  * @cldev: me client device
- * @buf: buffer to send
+ * @buf: buffer to receive
  * @length: buffer length
  *
  * Return: read size in bytes of < 0 on error
Signature · 1 line
2.4.3
#4 lore raw

PATCH 5/5 mei: amthif: Do not compare bool to 0/1

In reply to Tomas Winkler

From: Alexander Usyskin <[email protected]>

Spotted by coccicheck:
drivers/misc/mei/amthif.c:479:5-26: WARNING: Comparison of bool to 0/1

---
 drivers/misc/mei/amthif.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/misc/mei/amthif.c +1 -1
index 1e42781592d8..cd0403f09267 100644
@@ -458,7 +458,7 @@ void mei_amthif_complete(struct mei_device *dev, struct mei_cl_cb *cb)
 		return;
 	}
 
-	if (dev->iamthif_canceled != 1) {
+	if (!dev->iamthif_canceled) {
 		dev->iamthif_state = MEI_IAMTHIF_READ_COMPLETE;
 		dev->iamthif_stall_timer = 0;
 		list_add_tail(&cb->list, &dev->amthif_rd_complete_list.list);
Signature · 1 line
2.4.3