Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 52324953 authored by Ujwal Patel's avatar Ujwal Patel
Browse files

msm: mdss: remove interruptible timeout waits



Currently display driver contexts are not utilizing interruptible
wake-ups while using wait_for_completion_interruptible_timeout. This
can lead to incorrect context wake-up and un-predictable outcome. Since
there is already a timeout attached to these kind of context sleeps, it
is safe to replace them with wait_for_completion_timeout.

Change-Id: Ia528debf34aef0acdda2bea1219a128c200c3651
Signed-off-by: default avatarUjwal Patel <ujwalp@codeaurora.org>
parent 03ccedbc
Loading
Loading
Loading
Loading
+3 −3
Original line number Original line Diff line number Diff line
/* Copyright (c) 2007, 2013 The Linux Foundation. All rights reserved.
/* Copyright (c) 2007, 2013-2014 The Linux Foundation. All rights reserved.
 * Copyright (C) 2007 Google Incorporated
 * Copyright (C) 2007 Google Incorporated
 *
 *
 * This software is licensed under the terms of the GNU General Public
 * This software is licensed under the terms of the GNU General Public
@@ -283,7 +283,7 @@ int mdp3_ppp_pipe_wait(void)
	spin_unlock_irqrestore(&ppp_stat->ppp_lock, flag);
	spin_unlock_irqrestore(&ppp_stat->ppp_lock, flag);


	if (wait) {
	if (wait) {
		ret = wait_for_completion_interruptible_timeout(
		ret = wait_for_completion_timeout(
		   &ppp_stat->ppp_comp, 5 * HZ);
		   &ppp_stat->ppp_comp, 5 * HZ);
		if (!ret)
		if (!ret)
			pr_err("%s: Timed out waiting for the MDP.\n",
			pr_err("%s: Timed out waiting for the MDP.\n",
@@ -1099,7 +1099,7 @@ int mdp3_ppp_parse_req(void __user *p,
	while (req_q->count >= MDP3_PPP_MAX_LIST_REQ) {
	while (req_q->count >= MDP3_PPP_MAX_LIST_REQ) {
		ppp_stat->wait_for_pop = true;
		ppp_stat->wait_for_pop = true;
		mutex_unlock(&ppp_stat->req_mutex);
		mutex_unlock(&ppp_stat->req_mutex);
		rc = wait_for_completion_interruptible_timeout(
		rc = wait_for_completion_timeout(
		   &ppp_stat->pop_q_comp, 5 * HZ);
		   &ppp_stat->pop_q_comp, 5 * HZ);
		if (rc == 0) {
		if (rc == 0) {
			/* This will only occur if there is serious problem */
			/* This will only occur if there is serious problem */
+4 −4
Original line number Original line Diff line number Diff line
@@ -2,7 +2,7 @@
 * Core MDSS framebuffer driver.
 * Core MDSS framebuffer driver.
 *
 *
 * Copyright (C) 2007 Google Incorporated
 * Copyright (C) 2007 Google Incorporated
 * Copyright (c) 2008-2013, The Linux Foundation. All rights reserved.
 * Copyright (c) 2008-2014, The Linux Foundation. All rights reserved.
 *
 *
 * This software is licensed under the terms of the GNU General Public
 * This software is licensed under the terms of the GNU General Public
 * License version 2, as published by the Free Software Foundation, and
 * License version 2, as published by the Free Software Foundation, and
@@ -124,7 +124,7 @@ static int mdss_fb_notify_update(struct msm_fb_data_type *mfd,


	if (notify == NOTIFY_UPDATE_START) {
	if (notify == NOTIFY_UPDATE_START) {
		INIT_COMPLETION(mfd->update.comp);
		INIT_COMPLETION(mfd->update.comp);
		ret = wait_for_completion_interruptible_timeout(
		ret = wait_for_completion_timeout(
						&mfd->update.comp, 4 * HZ);
						&mfd->update.comp, 4 * HZ);
		to_user = (unsigned int)mfd->update.value;
		to_user = (unsigned int)mfd->update.value;
		if (mfd->update.type == NOTIFY_TYPE_SUSPEND) {
		if (mfd->update.type == NOTIFY_TYPE_SUSPEND) {
@@ -133,13 +133,13 @@ static int mdss_fb_notify_update(struct msm_fb_data_type *mfd,
		}
		}
	} else if (notify == NOTIFY_UPDATE_STOP) {
	} else if (notify == NOTIFY_UPDATE_STOP) {
		INIT_COMPLETION(mfd->no_update.comp);
		INIT_COMPLETION(mfd->no_update.comp);
		ret = wait_for_completion_interruptible_timeout(
		ret = wait_for_completion_timeout(
						&mfd->no_update.comp, 4 * HZ);
						&mfd->no_update.comp, 4 * HZ);
		to_user = (unsigned int)mfd->no_update.value;
		to_user = (unsigned int)mfd->no_update.value;
	} else {
	} else {
		if (mfd->panel_power_on) {
		if (mfd->panel_power_on) {
			INIT_COMPLETION(mfd->power_off_comp);
			INIT_COMPLETION(mfd->power_off_comp);
			ret = wait_for_completion_interruptible_timeout(
			ret = wait_for_completion_timeout(
						&mfd->power_off_comp, 1 * HZ);
						&mfd->power_off_comp, 1 * HZ);
		}
		}
	}
	}
+2 −2
Original line number Original line Diff line number Diff line
/* Copyright (c) 2010-2013, The Linux Foundation. All rights reserved.
/* Copyright (c) 2010-2014, The Linux Foundation. All rights reserved.
 *
 *
 * This program is free software; you can redistribute it and/or modify
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
 * it under the terms of the GNU General Public License version 2 and
@@ -366,7 +366,7 @@ static int hdmi_cec_msg_send(struct hdmi_cec_ctrl *cec_ctrl,
	DSS_REG_W(io, HDMI_CEC_CTRL, BIT(0) | BIT(1) |
	DSS_REG_W(io, HDMI_CEC_CTRL, BIT(0) | BIT(1) |
		((msg->frame_size & 0x1F) << 4) | BIT(9));
		((msg->frame_size & 0x1F) << 4) | BIT(9));


	if (!wait_for_completion_interruptible_timeout(
	if (!wait_for_completion_timeout(
		&cec_ctrl->cec_msg_wr_done, HZ)) {
		&cec_ctrl->cec_msg_wr_done, HZ)) {
		DEV_ERR("%s: timedout", __func__);
		DEV_ERR("%s: timedout", __func__);
		hdmi_cec_dump_msg(cec_ctrl, msg);
		hdmi_cec_dump_msg(cec_ctrl, msg);
+2 −2
Original line number Original line Diff line number Diff line
/* Copyright (c) 2010-2013 The Linux Foundation. All rights reserved.
/* Copyright (c) 2010-2014 The Linux Foundation. All rights reserved.
 *
 *
 * This program is free software; you can redistribute it and/or modify
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
 * it under the terms of the GNU General Public License version 2 and
@@ -520,7 +520,7 @@ static int hdmi_hdcp_authentication_part1(struct hdmi_hdcp_ctrl *hdcp_ctrl)
	/* Write R0' to HDCP registers and check to see if it is a match */
	/* Write R0' to HDCP registers and check to see if it is a match */
	INIT_COMPLETION(hdcp_ctrl->r0_checked);
	INIT_COMPLETION(hdcp_ctrl->r0_checked);
	DSS_REG_W(io, HDMI_HDCP_RCVPORT_DATA2_0, (((u32)buf[1]) << 8) | buf[0]);
	DSS_REG_W(io, HDMI_HDCP_RCVPORT_DATA2_0, (((u32)buf[1]) << 8) | buf[0]);
	timeout_count = wait_for_completion_interruptible_timeout(
	timeout_count = wait_for_completion_timeout(
		&hdcp_ctrl->r0_checked, HZ*2);
		&hdcp_ctrl->r0_checked, HZ*2);
	link0_status = DSS_REG_R(io, HDMI_HDCP_LINK0_STATUS);
	link0_status = DSS_REG_R(io, HDMI_HDCP_LINK0_STATUS);
	is_match = link0_status & BIT(12);
	is_match = link0_status & BIT(12);
+3 −3
Original line number Original line Diff line number Diff line
/* Copyright (c) 2010-2013, The Linux Foundation. All rights reserved.
/* Copyright (c) 2010-2014, The Linux Foundation. All rights reserved.
 *
 *
 * This program is free software; you can redistribute it and/or modify
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
 * it under the terms of the GNU General Public License version 2 and
@@ -2544,7 +2544,7 @@ static int hdmi_tx_power_on(struct mdss_panel_data *panel_data)
	flush_work(&hdmi_ctrl->power_off_work);
	flush_work(&hdmi_ctrl->power_off_work);


	if (hdmi_ctrl->pdata.primary) {
	if (hdmi_ctrl->pdata.primary) {
		timeout = wait_for_completion_interruptible_timeout(
		timeout = wait_for_completion_timeout(
			&hdmi_ctrl->hpd_done, HZ);
			&hdmi_ctrl->hpd_done, HZ);
		if (!timeout) {
		if (!timeout) {
			DEV_ERR("%s: cable connection hasn't happened yet\n",
			DEV_ERR("%s: cable connection hasn't happened yet\n",
@@ -3011,7 +3011,7 @@ static int hdmi_tx_panel_event_handler(struct mdss_panel_data *panel_data,
			u32 timeout;
			u32 timeout;
			hdmi_ctrl->panel_suspend = false;
			hdmi_ctrl->panel_suspend = false;


			timeout = wait_for_completion_interruptible_timeout(
			timeout = wait_for_completion_timeout(
				&hdmi_ctrl->hpd_done, HZ/10);
				&hdmi_ctrl->hpd_done, HZ/10);
			if (!timeout & !hdmi_ctrl->hpd_state) {
			if (!timeout & !hdmi_ctrl->hpd_state) {
				DEV_INFO("%s: cable removed during suspend\n",
				DEV_INFO("%s: cable removed during suspend\n",
Loading