diff mbox

[RFC] msm:rpm-smd:change msm_rpm_smd_work method

Message ID 35FD53F367049845BC99AC72306C23D103D6DB491612@CNBJMBX05.corpusers.net (mailing list archive)
State Deferred
Headers show

Commit Message

Wang, Yalin Sept. 17, 2014, 2:05 a.m. UTC
this change msm_rpm_smd_work method to let it
run not as a forever loop, this can improve some
performance, because if the work_struct callback run
forever, it will hold the work thread forever, and other
work_struct can use it, it is not suitable for performance.

Change-Id: Ic99b36f8a3720b2bdfe45e4263a69f3d58c47cd1
Signed-off-by: Yalin Wang <yalin.wang@sonymobile.com>
---
 arch/arm/mach-msm/rpm-smd.c | 30 ++++++++++++------------------
 1 file changed, 12 insertions(+), 18 deletions(-)

Comments

Bjorn Andersson Sept. 17, 2014, 4:49 p.m. UTC | #1
On Tue, Sep 16, 2014 at 7:05 PM, Wang, Yalin <Yalin.Wang@sonymobile.com> wrote:
[..]
> diff --git a/arch/arm/mach-msm/rpm-smd.c b/arch/arm/mach-msm/rpm-smd.c

Hi Yalin,

This file does not exist in mainline and this is not the forum for
sending patches to codeaurora.
Also note that your commit messages may not include "Change-id" when
sending to LKML.

Regards,
Bjorn
--
To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Wang, Yalin Sept. 18, 2014, 1:48 a.m. UTC | #2
Hi Bjorn,

I see,
Thanks for your kind remind :)

-----Original Message-----
On Tue, Sep 16, 2014 at 7:05 PM, Wang, Yalin <Yalin.Wang@sonymobile.com> wrote:
[..]
> diff --git a/arch/arm/mach-msm/rpm-smd.c b/arch/arm/mach-msm/rpm-smd.c


Hi Yalin,

This file does not exist in mainline and this is not the forum for sending patches to codeaurora.
Also note that your commit messages may not include "Change-id" when sending to LKML.

Regards,
Bjorn
diff mbox

Patch

diff --git a/arch/arm/mach-msm/rpm-smd.c b/arch/arm/mach-msm/rpm-smd.c
index 2a01a36..243463d 100644
--- a/arch/arm/mach-msm/rpm-smd.c
+++ b/arch/arm/mach-msm/rpm-smd.c
@@ -464,8 +464,6 @@  struct msm_rpm_ack_msg {
 
 LIST_HEAD(msm_rpm_ack_list);
 
-static DECLARE_COMPLETION(data_ready);
-
 static void msm_rpm_notify_sleep_chain(struct rpm_message_header *hdr,
 		struct msm_rpm_kvp_data *kvp)
 {
@@ -654,7 +652,7 @@  static void msm_rpm_notify(void *data, unsigned event)
 
 	switch (event) {
 	case SMD_EVENT_DATA:
-		complete(&data_ready);
+		queue_work(msm_rpm_smd_wq, &msm_rpm_data.work);
 		break;
 	case SMD_EVENT_OPEN:
 		complete(&pdata->smd_open);
@@ -849,19 +847,15 @@  static void msm_rpm_smd_work(struct work_struct *work)
 	int errno;
 	char buf[MAX_ERR_BUFFER_SIZE] = {0};
 
-	while (1) {
-		wait_for_completion(&data_ready);
-
-		spin_lock(&msm_rpm_data.smd_lock_read);
-		while (smd_is_pkt_avail(msm_rpm_data.ch_info)) {
-			if (msm_rpm_read_smd_data(buf))
-				break;
-			msg_id = msm_rpm_get_msg_id_from_ack(buf);
-			errno = msm_rpm_get_error_from_ack(buf);
-			msm_rpm_process_ack(msg_id, errno);
-		}
-		spin_unlock(&msm_rpm_data.smd_lock_read);
+	spin_lock(&msm_rpm_data.smd_lock_read);
+	while (smd_is_pkt_avail(msm_rpm_data.ch_info)) {
+		if (msm_rpm_read_smd_data(buf))
+			break;
+		msg_id = msm_rpm_get_msg_id_from_ack(buf);
+		errno = msm_rpm_get_error_from_ack(buf);
+		msm_rpm_process_ack(msg_id, errno);
 	}
+	spin_unlock(&msm_rpm_data.smd_lock_read);
 }
 
 static void msm_rpm_log_request(struct msm_rpm_request *cdata)
@@ -1237,7 +1231,7 @@  wait_ack_cleanup:
 	spin_unlock_irqrestore(&msm_rpm_data.smd_lock_read, flags);
 
 	if (smd_is_pkt_avail(msm_rpm_data.ch_info))
-		complete(&data_ready);
+		queue_work(msm_rpm_smd_wq, &msm_rpm_data.work);
 	return rc;
 }
 EXPORT_SYMBOL(msm_rpm_wait_for_ack_noirq);
@@ -1385,10 +1379,10 @@  static int __devinit msm_rpm_dev_probe(struct platform_device *pdev)
 
 	if (!standalone) {
 		msm_rpm_smd_wq = alloc_workqueue("rpm-smd",
-				WQ_UNBOUND | WQ_MEM_RECLAIM | WQ_HIGHPRI, 1);
+				WQ_UNBOUND | WQ_MEM_RECLAIM |
+				WQ_HIGHPRI | WQ_NON_REENTRANT, 1);
 		if (!msm_rpm_smd_wq)
 			return -EINVAL;
-		queue_work(msm_rpm_smd_wq, &msm_rpm_data.work);
 	}
 
 	of_platform_populate(pdev->dev.of_node, NULL, NULL, &pdev->dev);