From patchwork Tue Nov 6 10:16:03 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabio Estevam X-Patchwork-Id: 10670025 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 94458175A for ; Tue, 6 Nov 2018 10:15:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 83E642A2D5 for ; Tue, 6 Nov 2018 10:15:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 77F912A2E5; Tue, 6 Nov 2018 10:15:49 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3CF7E2A2D5 for ; Tue, 6 Nov 2018 10:15:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387776AbeKFTkR (ORCPT ); Tue, 6 Nov 2018 14:40:17 -0500 Received: from mail-qt1-f194.google.com ([209.85.160.194]:36047 "EHLO mail-qt1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387480AbeKFTkQ (ORCPT ); Tue, 6 Nov 2018 14:40:16 -0500 Received: by mail-qt1-f194.google.com with SMTP id u34-v6so1918762qth.3 for ; Tue, 06 Nov 2018 02:15:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=OIc6QTHcHgsHNHKI/MaHnphn7cUAfw1n2uh31oAL0/A=; b=DpBBuCJcZAwyNB4/DNCrD0W7vTsBA8fp3Q5CQ83sBh2GubRx9woKi7yyZfyzFai4mT DxApYoTqLP+wp1UOD/s6qa522D77HNKKeb4Pyo7qx9RyZUJqe9D7MXkjMHBSHPtIPnfa tNH+C/QwS0OqgDJRtxT49NJjJotBuPPQ+eGTEhWO0yyxBw4P5p5CE/1YlVneKQ9UH+aX 6j5YP/f8rhSiux10JUjUV7mxIH0dhr6X+zT6b8uU/pou4H4Z11lVi5hsYZ26C+gbETj4 gacbpohJrR0Af3V4Enfx6kug3XqZ32PVzOW5JEXnYHONdMKyM74B6dN5DdXugAKeGRmW nxXw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=OIc6QTHcHgsHNHKI/MaHnphn7cUAfw1n2uh31oAL0/A=; b=Zj+DYskuXPMrzkfmGPTX7gOgak8BTpD1pB/piqL7TkiHxyZauReFRPW4oi00hZDlWF mv4sn6EKHtozraDV6McwpEyIrP+ZOFMFlokNfQNhhmKp0uIzZyQtlgIWrGreUZ3IOQmH 8Nw1O9F6u+EV5HoQzXZHaz0H0/VCcyXRf5FMn2XxMrVDKc5Wi7SitUKJBs36BenX2mvB RNvGbZ/csV5Lqf/+dHbcurH9hikJxbT4GIy5dJV2vtUX94LOnChgh3vukkNWqkAluJ+d wvD87/BrwIBYrULy/Yub5RlnZVUCCccwMSkfF7EZ5v3Q35lAguWS9UWdxpxjlL5KP34d nbdQ== X-Gm-Message-State: AGRZ1gLvXhLW2I9J+CMrZ8BX4SXIRiMrA6DUBGtyYJOWy6sLLGDqAiDi lgszYduOrxDYNF1N2nXhVKY= X-Google-Smtp-Source: AJdET5eS/U8A/S19JtNhmNXzbreBYfLXj4HdRG/b7ZjeK+fDl1H2KNJ3T+NxA032IxoB7YiEzNnfTQ== X-Received: by 2002:a0c:d232:: with SMTP id m47mr25853813qvh.43.1541499346436; Tue, 06 Nov 2018 02:15:46 -0800 (PST) Received: from localhost.localdomain ([201.82.144.36]) by smtp.gmail.com with ESMTPSA id s46sm5000062qtc.63.2018.11.06.02.15.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 06 Nov 2018 02:15:45 -0800 (PST) From: Fabio Estevam To: p.zabel@pengutronix.de Cc: mchehab@kernel.org, linux-media@vger.kernel.org, Fabio Estevam Subject: [PATCH v3 1/3] media: imx-pxp: Check the return value from clk_prepare_enable() Date: Tue, 6 Nov 2018 08:16:03 -0200 Message-Id: <1541499365-10069-1-git-send-email-festevam@gmail.com> X-Mailer: git-send-email 2.7.4 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP clk_prepare_enable() may fail, so we should better check its return value and propagate it in the case of error. Signed-off-by: Fabio Estevam Reviewed-by: Philipp Zabel --- Changes since v2: - None drivers/media/platform/imx-pxp.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/media/platform/imx-pxp.c b/drivers/media/platform/imx-pxp.c index b76cd0e..27780f1 100644 --- a/drivers/media/platform/imx-pxp.c +++ b/drivers/media/platform/imx-pxp.c @@ -1666,7 +1666,10 @@ static int pxp_probe(struct platform_device *pdev) return ret; } - clk_prepare_enable(dev->clk); + ret = clk_prepare_enable(dev->clk); + if (ret < 0) + return ret; + pxp_soft_reset(dev); spin_lock_init(&dev->irqlock); From patchwork Tue Nov 6 10:16:04 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabio Estevam X-Patchwork-Id: 10670027 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1203A175A for ; Tue, 6 Nov 2018 10:15:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 02DCF2A2D5 for ; Tue, 6 Nov 2018 10:15:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EB4982A2E9; Tue, 6 Nov 2018 10:15:50 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 992022A2D5 for ; Tue, 6 Nov 2018 10:15:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387796AbeKFTkT (ORCPT ); Tue, 6 Nov 2018 14:40:19 -0500 Received: from mail-qt1-f194.google.com ([209.85.160.194]:33187 "EHLO mail-qt1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387480AbeKFTkT (ORCPT ); Tue, 6 Nov 2018 14:40:19 -0500 Received: by mail-qt1-f194.google.com with SMTP id l11so1922398qtp.0 for ; Tue, 06 Nov 2018 02:15:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=GEWFqeovu0vbvNHTOLDcyxHr31XFIa9c7Nw2vGc8WE8=; b=c28SQZptfqWw+wHd1YtaGOqn+/R/M21MhmDC9uQc/F/ZUiNQzuextZFzn3jDAryuO0 q2qujqGEhsVAjH8hDC0ctmOD8EPS0tdQoEssMeLNcNqs+sZeNBKNKemtQ+QYd3/qtXno 5SmbhczHEE3KK49ur7s/IdDt3yqtbRMaf3N6ozsXWURIhRI25oBQv4XSmswhvqX6LLN7 5CTsCPZGxJV0pFrA0wBDN8rTQIXNPgYSanuZOeVbe/0zKFuk5a3fyquh/afDDlPd49Xx ENfAIHSlMIlU+Fs2avVCgkIXB2zbiEnAsA/2TowpHfK3kDczA7WBSxo7c/UbPWs/XHBr 9JTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=GEWFqeovu0vbvNHTOLDcyxHr31XFIa9c7Nw2vGc8WE8=; b=gAzbyI84FRWaj+a4+/hGMpVgZCz48PNN86Azgiw6+dwQYbl/cJefA1pMZH46v5Xvcf Dm12HJAWr9gJLxhGJA/je2ktkqgnvvTrY+H+5f1fNaoOY1LvexdyaxwlrhDGOQjWVtpm +nj6TPq35m5ot7JFhxXTR+iqPCeCA2+VwJgzieQJdlpipQyOZBap4ASOokglm4hYaWXC WC7Rv3ccRUMfJvkzf6QcmnAWkK4kBjCmpYbr9AIWEjvE9dqyqCYM2wxEYBXKcjlzdVh8 qIbfTdnBQyXgPI+2jsPFMSilDjpkrryQqRDkph4rQUMiOe6AOqQ9DAoFS2iVRpwNSKor 5hmQ== X-Gm-Message-State: AGRZ1gKg+ZX9spIYRz7cyXK95TbIaLA4khFAhaQ9RIWbzAPDXWO3oG93 uEAN9uY1WAUEanwtQ5/hxjk= X-Google-Smtp-Source: AJdET5fO9SHQC5F4u+Grf4PHuA4esAMEbDVald3D2+vZ/gyeeXps0mvTy7+lOyv56w4Kbu3CmKTo4g== X-Received: by 2002:ac8:5411:: with SMTP id b17mr18810903qtq.259.1541499348657; Tue, 06 Nov 2018 02:15:48 -0800 (PST) Received: from localhost.localdomain ([201.82.144.36]) by smtp.gmail.com with ESMTPSA id s46sm5000062qtc.63.2018.11.06.02.15.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 06 Nov 2018 02:15:48 -0800 (PST) From: Fabio Estevam To: p.zabel@pengutronix.de Cc: mchehab@kernel.org, linux-media@vger.kernel.org, Fabio Estevam Subject: [PATCH v3 2/3] media: imx-pxp: Check for pxp_soft_reset() error Date: Tue, 6 Nov 2018 08:16:04 -0200 Message-Id: <1541499365-10069-2-git-send-email-festevam@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1541499365-10069-1-git-send-email-festevam@gmail.com> References: <1541499365-10069-1-git-send-email-festevam@gmail.com> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP pxp_soft_reset() may fail with a timeout, so it is better to propagate the error in this case. Signed-off-by: Fabio Estevam Reviewed-by: Philipp Zabel --- Changes since v2: - Jump to err_clck when pxp_soft_reset() fails. (Philipp) drivers/media/platform/imx-pxp.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/drivers/media/platform/imx-pxp.c b/drivers/media/platform/imx-pxp.c index 27780f1..986764d 100644 --- a/drivers/media/platform/imx-pxp.c +++ b/drivers/media/platform/imx-pxp.c @@ -1607,7 +1607,7 @@ static const struct v4l2_m2m_ops m2m_ops = { .job_abort = pxp_job_abort, }; -static void pxp_soft_reset(struct pxp_dev *dev) +static int pxp_soft_reset(struct pxp_dev *dev) { int ret; u32 val; @@ -1619,11 +1619,15 @@ static void pxp_soft_reset(struct pxp_dev *dev) ret = readl_poll_timeout(dev->mmio + HW_PXP_CTRL, val, val & BM_PXP_CTRL_CLKGATE, 0, 100); - if (ret < 0) + if (ret < 0) { pr_err("PXP reset timeout\n"); + return ret; + } writel(BM_PXP_CTRL_SFTRST, dev->mmio + HW_PXP_CTRL_CLR); writel(BM_PXP_CTRL_CLKGATE, dev->mmio + HW_PXP_CTRL_CLR); + + return 0; } static int pxp_probe(struct platform_device *pdev) @@ -1670,7 +1674,9 @@ static int pxp_probe(struct platform_device *pdev) if (ret < 0) return ret; - pxp_soft_reset(dev); + ret = pxp_soft_reset(dev); + if (ret < 0) + goto err_clk; spin_lock_init(&dev->irqlock); From patchwork Tue Nov 6 10:16:05 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabio Estevam X-Patchwork-Id: 10670029 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id EF41314BD for ; Tue, 6 Nov 2018 10:15:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DEB062A2D5 for ; Tue, 6 Nov 2018 10:15:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D25622A2E5; Tue, 6 Nov 2018 10:15:52 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 851D22A2D5 for ; Tue, 6 Nov 2018 10:15:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387817AbeKFTkV (ORCPT ); Tue, 6 Nov 2018 14:40:21 -0500 Received: from mail-qt1-f196.google.com ([209.85.160.196]:34248 "EHLO mail-qt1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387480AbeKFTkV (ORCPT ); Tue, 6 Nov 2018 14:40:21 -0500 Received: by mail-qt1-f196.google.com with SMTP id r14so1921393qtp.1 for ; Tue, 06 Nov 2018 02:15:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=YycuJTuE1bWW4sTAZtJqKr/p103TNJLqQUkQ8hm0sHk=; b=kLxPPemysicrhQu+FOMr28/eNiDk2KzRjbVWUJzCj7xBBX5sjpaCK2TYLzlAVdLroR c45eUz6ELqj7EOhVgg+xhY7FHMIvBr8Fz8TS1GR134QQcKlFXQM4Iv6rYkCr08zJGjl1 wFhsyLUM2XLTCXqmgA2ABW5FklhXpeiD3u6Gw1qxAFgLyucYlUkiKYIH7y/7i6dAxswI Yxw1By/gRn/2UBCe5llV+u4H6zPrakkzxGH1DD4xoQcZUabhhJrZBRvHAot7Qucx/agQ iqHPUVkThP09Mt+TRyJt4/b10SH2IE/b8MQrQzxFH8+YvFy+zhnPudW+hLkiwJ7rIM38 IhXw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=YycuJTuE1bWW4sTAZtJqKr/p103TNJLqQUkQ8hm0sHk=; b=dVFY4ah8nnrG/DWaAmX3PjEkO5gWMzJ3QXjRBXkVDuRK7eX6XjYiqLt851wcj5vzwc +OU0s2Z0dVXIBHJCB4kQNuzpMkegu6UsVKxFaHKNXmcgP2fQbcdNxyFYBp1OTODDhsVV VQmZAYZyVlqA7sLktLyEt/ueyBwhrr1/4fqe0pQ+qsTuu9BL5dQur+L4x2i8Y9XbotPO y1/3SdNhneloP5/n7dpNmQr9yT7LhzoFScdQXkRZIaJPwE+/FwZlUgsvou01+OCfWOAw M5pvrhYDFAABZej0o+bu/s3R1U1PdYcMHnErLDe4+0kpU+GpVscXOCu4g9WQ+Dez1n2q v98g== X-Gm-Message-State: AGRZ1gLGdd8kDMaUEHHTt0VqCKRjDaBP1ag0xWOxhtG0v2qA/9EFZc0p C/i3zL8BxXSyZzUzxHYJvPU= X-Google-Smtp-Source: AJdET5ffCLdW4NeScumFYCe0nPcRHSpk3dOaMbVWzzqztZlCJgwtDyKY+9VIgCz1VFlCTnd4sunHCw== X-Received: by 2002:a0c:c966:: with SMTP id v35mr25587288qvj.45.1541499350704; Tue, 06 Nov 2018 02:15:50 -0800 (PST) Received: from localhost.localdomain ([201.82.144.36]) by smtp.gmail.com with ESMTPSA id s46sm5000062qtc.63.2018.11.06.02.15.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 06 Nov 2018 02:15:50 -0800 (PST) From: Fabio Estevam To: p.zabel@pengutronix.de Cc: mchehab@kernel.org, linux-media@vger.kernel.org, Fabio Estevam Subject: [PATCH v3 3/3] media: imx-pxp: Improve pxp_soft_reset() error message Date: Tue, 6 Nov 2018 08:16:05 -0200 Message-Id: <1541499365-10069-3-git-send-email-festevam@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1541499365-10069-1-git-send-email-festevam@gmail.com> References: <1541499365-10069-1-git-send-email-festevam@gmail.com> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Improve the pxp_soft_reset() error message by moving it to the caller function, associating it with a proper device and also by displaying the error code. Signed-off-by: Fabio Estevam Reviewed-by: Philipp Zabel --- Changes since v2: - None (only rebased against the change made in 2/3) drivers/media/platform/imx-pxp.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/media/platform/imx-pxp.c b/drivers/media/platform/imx-pxp.c index 986764d..b80d206 100644 --- a/drivers/media/platform/imx-pxp.c +++ b/drivers/media/platform/imx-pxp.c @@ -1619,10 +1619,8 @@ static int pxp_soft_reset(struct pxp_dev *dev) ret = readl_poll_timeout(dev->mmio + HW_PXP_CTRL, val, val & BM_PXP_CTRL_CLKGATE, 0, 100); - if (ret < 0) { - pr_err("PXP reset timeout\n"); + if (ret < 0) return ret; - } writel(BM_PXP_CTRL_SFTRST, dev->mmio + HW_PXP_CTRL_CLR); writel(BM_PXP_CTRL_CLKGATE, dev->mmio + HW_PXP_CTRL_CLR); @@ -1675,8 +1673,10 @@ static int pxp_probe(struct platform_device *pdev) return ret; ret = pxp_soft_reset(dev); - if (ret < 0) + if (ret < 0) { + dev_err(&pdev->dev, "PXP reset timeout: %d\n", ret); goto err_clk; + } spin_lock_init(&dev->irqlock);