From patchwork Tue Jan 20 05:23:50 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Mc Guire X-Patchwork-Id: 5664031 Return-Path: X-Original-To: patchwork-linux-samsung-soc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 35DF79F2ED for ; Tue, 20 Jan 2015 05:32:39 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 626B1203AF for ; Tue, 20 Jan 2015 05:32:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6BF6C203AD for ; Tue, 20 Jan 2015 05:32:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750775AbbATFcf (ORCPT ); Tue, 20 Jan 2015 00:32:35 -0500 Received: from www.osadl.org ([62.245.132.105]:50602 "EHLO www.osadl.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750704AbbATFce (ORCPT ); Tue, 20 Jan 2015 00:32:34 -0500 Received: from debian.hofr.at (92-243-35-153.adsl.nanet.at [92.243.35.153] (may be forged)) by www.osadl.org (8.13.8/8.13.8/OSADL-2007092901) with ESMTP id t0K5Vd8b002012; Tue, 20 Jan 2015 06:31:40 +0100 From: Nicholas Mc Guire To: Inki Dae Cc: Donghwa Lee , Kyungmin Park , Jean-Christophe Plagniol-Villard , Tomi Valkeinen , Kukjin Kim , linux-fbdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, Nicholas Mc Guire Subject: [PATCH] video: treat signal like timeout as failure Date: Tue, 20 Jan 2015 06:23:50 +0100 Message-Id: <1421731430-13207-1-git-send-email-der.herr@hofr.at> X-Mailer: git-send-email 1.7.10.4 X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP if(!wait_for_completion_interruptible_timeout(...)) only handles the timeout case - this patch adds handling the signal case the same as timeout and cleans up. Signed-off-by: Nicholas Mc Guire --- Only the timeout case was being handled, return of 0 in wait_for_completion_interruptible_timeout, the signal case (-ERESTARTSYS) was treated just like the case of successful completion, which is most likely not reasonable. Note that exynos_mipi_dsi_wr_data/exynos_mipi_dsi_rd_data return values are not checked at the call sites in s6e8ax0.c (cmd_read/cmd_write)! This patch simply treats the signal case the same way as the timeout case, by releasing locks and returning 0 - which might not be the right thing to do - this needs a review by someone knowing the details of this driver. Patch is against 3.19.0-rc5 -next-20150119 Patch was only compile-tested with exynos_defconfig drivers/video/fbdev/exynos/exynos_mipi_dsi_common.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/drivers/video/fbdev/exynos/exynos_mipi_dsi_common.c b/drivers/video/fbdev/exynos/exynos_mipi_dsi_common.c index 2358a2f..55a7a45 100644 --- a/drivers/video/fbdev/exynos/exynos_mipi_dsi_common.c +++ b/drivers/video/fbdev/exynos/exynos_mipi_dsi_common.c @@ -157,6 +157,7 @@ int exynos_mipi_dsi_wr_data(struct mipi_dsim_device *dsim, unsigned int data_id, const unsigned char *data0, unsigned int data_size) { unsigned int check_rx_ack = 0; + long timeout; if (dsim->state == DSIM_STATE_ULPS) { dev_err(dsim->dev, "state is ULPS.\n"); @@ -244,9 +245,11 @@ int exynos_mipi_dsi_wr_data(struct mipi_dsim_device *dsim, unsigned int data_id, exynos_mipi_dsi_wr_tx_header(dsim, data_id, data_size & 0xff, (data_size & 0xff00) >> 8); - if (!wait_for_completion_interruptible_timeout(&dsim_wr_comp, - MIPI_FIFO_TIMEOUT)) { - dev_warn(dsim->dev, "command write timeout.\n"); + timeout = wait_for_completion_interruptible_timeout( + &dsim_wr_comp, MIPI_FIFO_TIMEOUT); + if (timeout <= 0) { + dev_warn(dsim->dev, + "command write timed-out/interrupted.\n"); mutex_unlock(&dsim->lock); return -EAGAIN; } @@ -345,6 +348,7 @@ int exynos_mipi_dsi_rd_data(struct mipi_dsim_device *dsim, unsigned int data_id, unsigned int rx_data, rcv_pkt, i; u8 response = 0; u16 rxsize; + long timeout; if (dsim->state == DSIM_STATE_ULPS) { dev_err(dsim->dev, "state is ULPS.\n"); @@ -380,9 +384,10 @@ int exynos_mipi_dsi_rd_data(struct mipi_dsim_device *dsim, unsigned int data_id, return -EINVAL; } - if (!wait_for_completion_interruptible_timeout(&dsim_rd_comp, - MIPI_FIFO_TIMEOUT)) { - pr_err("RX done interrupt timeout\n"); + timeout = wait_for_completion_interruptible_timeout(&dsim_rd_comp, + MIPI_FIFO_TIMEOUT); + if (timeout <= 0) { + pr_err("RX done interrupt timeout/interrupted\n"); mutex_unlock(&dsim->lock); return 0; }