From patchwork Mon Nov 5 20:45:14 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabio Estevam X-Patchwork-Id: 10669105 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 55A541709 for ; Mon, 5 Nov 2018 20:45:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 363A229ECA for ; Mon, 5 Nov 2018 20:45:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 26C2929ECF; Mon, 5 Nov 2018 20:45:02 +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 D08AF29ECA for ; Mon, 5 Nov 2018 20:45:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730223AbeKFGGa (ORCPT ); Tue, 6 Nov 2018 01:06:30 -0500 Received: from mail-qt1-f193.google.com ([209.85.160.193]:38788 "EHLO mail-qt1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726578AbeKFGG3 (ORCPT ); Tue, 6 Nov 2018 01:06:29 -0500 Received: by mail-qt1-f193.google.com with SMTP id p17so195482qtl.5 for ; Mon, 05 Nov 2018 12:44:59 -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=ITVinCpJ0nxkpVqDKZheu/1dfB+KYQpYOIkcu7o5Mas=; b=OyzfnKExC1LiHVgngXRuRXVJ6nKulueZCf2DQUuVcLL5jE8glhSL0M7QtkgubrNT1w wgyMb1xGFriun5LGUiN4IGMF5k+NJm45LEcSFzkCKmrmWPdnweEIR9vYW5sjetUpCNtH PLU9EgNf1FZIiV/4ETT58dGsdv0tc8Jf39zxWZ8oQSCX8ARAqIM+mgFpA0g5UQvOZfDD s61y3ZmiGhS2V0SaBUmbw6KVVPhY9V/XyWla2/L6iKKDKXgewTP8IWu4S2fpTEF2uniD r3v2rNB3OTe7fNtEdfOhHzI/dGvIWW80QVCn3Z/s4irivkkFUnGT3s9IfYgA7upzvIZ0 DRCQ== 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=ITVinCpJ0nxkpVqDKZheu/1dfB+KYQpYOIkcu7o5Mas=; b=jz/PP61azBr70A6BLuzlX7BDM03LVCRclLl2g00Wo5dAAyiDVHww/uTKYrNV1YSwg0 v2I2zh9jeKtGsUKCSJDlRhhZxOXcsqIdgvRlXfJf8ZhcOATv7cqr/Q/PbIU56xl793Sj k6gDk15ol51Gtz09pHA9zmNMHRcGUwIRrlbctYe+lVi//bGEEiDLaQHc68kS5xbDgwLC WX8QCrC7+OXOZ4wjIes2Kkx87+lVtnoYkjlujuwzWIdPsGg7TV42rTdu09P19Z8q/jlW /K4Osz1Dg/tkqs7gbp7Ewx8FyzcNB1FDMrfhS251m2SmUKdYxliVwyjg9F6GNfvcUkSP 1KNA== X-Gm-Message-State: AGRZ1gKCZYU5qYOeEKsscBtTLXS+vZWIwcZE5YWKKEC243neGqEDjKXS ybx7kfd4zdn5iaE7yeA6Eza7B/9+ X-Google-Smtp-Source: AJdET5cDfFCSYmJzMtweYfFhh1G9g0ZtlnLsObue2NzdhbR+nhP4v/CnP5MW9iaxejSRVRmUahALOg== X-Received: by 2002:a0c:be8d:: with SMTP id n13mr23023348qvi.143.1541450699314; Mon, 05 Nov 2018 12:44:59 -0800 (PST) Received: from localhost.localdomain ([201.82.144.36]) by smtp.gmail.com with ESMTPSA id 5sm10167968qkv.93.2018.11.05.12.44.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 05 Nov 2018 12:44:58 -0800 (PST) From: Fabio Estevam To: p.zabel@pengutronix.de Cc: mchehab@kernel.org, linux-media@vger.kernel.org, Fabio Estevam Subject: [PATCH v2 1/3] media: imx-pxp: Check the return value from clk_prepare_enable() Date: Mon, 5 Nov 2018 18:45:14 -0200 Message-Id: <1541450716-25523-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 v1: - Properly enumerate the series 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 Mon Nov 5 20:45:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabio Estevam X-Patchwork-Id: 10669107 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 5771B15E9 for ; Mon, 5 Nov 2018 20:45:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3B98629ECA for ; Mon, 5 Nov 2018 20:45:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2FB7129ECF; Mon, 5 Nov 2018 20:45:04 +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 D70A329ECA for ; Mon, 5 Nov 2018 20:45:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730320AbeKFGGc (ORCPT ); Tue, 6 Nov 2018 01:06:32 -0500 Received: from mail-qt1-f194.google.com ([209.85.160.194]:46780 "EHLO mail-qt1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726578AbeKFGGb (ORCPT ); Tue, 6 Nov 2018 01:06:31 -0500 Received: by mail-qt1-f194.google.com with SMTP id c16-v6so195056qtj.13 for ; Mon, 05 Nov 2018 12:45:02 -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=W8Vc2+YtQUyOVlZNPknB2FNIZjEuSAnPCA2X4hMTs98=; b=SKcpykmFhgy0YIuRiE0DnXWIMRKRbSWqNlBeFLLMlUs/uLUUSa/nmv1Tb/Rtcer2vj IL21JRxkWZO+Qzys19dJQcrGwxnzb/pzCNokNWxhl9tTDznCGxwBudI+uBekHfUDS6U+ R3N7+AAGRwaCOksKzJiUOTmzp2L2av2LZ3ADHP0TLt9YyEd5eLhfQl+SLHjdbmpSGWhp OQ1ZsVDow3n8tM0xcOqQVuyhiksXbQbgHN7eTEmmjXgdIeSKIyFD+SD3m5SMxQ441r5K 9J+MhacudG97xoelH+g83hzCsiOozfamoqobIt6ZDiuTr61IcU2cJrvD5LfSYnT1/6ZO WlTg== 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=W8Vc2+YtQUyOVlZNPknB2FNIZjEuSAnPCA2X4hMTs98=; b=Y0GCEuE17hgIEhs9vbrF8irijsVFbZkS6hF32iZS9Bvp0MUb6qG7bsOtaZcFwhwqz3 giSd0GJF6mR73k5EmEV9Oh+XKjTDm2eBBhj7XEa7vBFOBHOU8Ij9fvY2SRlNTdmSArc+ sHcxAhktWhIpA1mniorMwihXwrl2qcLWa2bURf3qUcubnLOfovBylf0IDEmiK4HX1k3C qEaZC0DBHUs1A5vduFbggNYrDUxyWTaFq2OqdSjYZrG7uRmK6HF2G7A2/z5AdrfaguT9 KxL6Db/I9pjliameNlBjAD09P8zQDXZa4FUZSJSjL/uu3vnEKpvEIj4n9q8h8jrVD/TZ sj7Q== X-Gm-Message-State: AGRZ1gLFLeCoGWYkIuTAEjIthJ9k6ShtmclXSyVYD97cjD7qx8/lS7Jq IGi88+2FgAZNxvEMYT9FWqQ= X-Google-Smtp-Source: AJdET5f6bGRsy2VPXdyWdzByCglS8pTuzgaxNJpCH1d/KEFajoLSJJP6VX6rZCHe5kfv98d8o3VIvw== X-Received: by 2002:a0c:f184:: with SMTP id m4mr17242046qvl.178.1541450701429; Mon, 05 Nov 2018 12:45:01 -0800 (PST) Received: from localhost.localdomain ([201.82.144.36]) by smtp.gmail.com with ESMTPSA id 5sm10167968qkv.93.2018.11.05.12.44.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 05 Nov 2018 12:45:00 -0800 (PST) From: Fabio Estevam To: p.zabel@pengutronix.de Cc: mchehab@kernel.org, linux-media@vger.kernel.org, Fabio Estevam Subject: [PATCH v2 2/3] media: imx-pxp: Check for pxp_soft_reset() error Date: Mon, 5 Nov 2018 18:45:15 -0200 Message-Id: <1541450716-25523-2-git-send-email-festevam@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1541450716-25523-1-git-send-email-festevam@gmail.com> References: <1541450716-25523-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 v1: - None 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..b3700b8 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) + return ret; spin_lock_init(&dev->irqlock); From patchwork Mon Nov 5 20:45:16 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabio Estevam X-Patchwork-Id: 10669109 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 0A9BC15E9 for ; Mon, 5 Nov 2018 20:45:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E30FA29ECA for ; Mon, 5 Nov 2018 20:45:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D7A0529ECF; Mon, 5 Nov 2018 20:45:06 +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 86A1229ECA for ; Mon, 5 Nov 2018 20:45:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730324AbeKFGGe (ORCPT ); Tue, 6 Nov 2018 01:06:34 -0500 Received: from mail-qt1-f193.google.com ([209.85.160.193]:42802 "EHLO mail-qt1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726578AbeKFGGe (ORCPT ); Tue, 6 Nov 2018 01:06:34 -0500 Received: by mail-qt1-f193.google.com with SMTP id z20-v6so193170qti.9 for ; Mon, 05 Nov 2018 12:45:04 -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=snYpUzaN7gsQsYEFLrXEZxhrhmYrBqVktQ9ekgI3g0o=; b=ApflcW/eTDZOWw3rgRzIyGrOSjcwguFPOs9mAU0SMGWZ41eNGEkNL4TcOi1lvxLJWp NaNPJdu8AGtwbHY6M3udLkYoBpABoOiD89e5P4HzFO+kZa8f6wfUkguQtgf3+Zaa96qA 7eGHgnatrQkz2bLvLabihWXhuVQcvW07As8JWehhBZ/LR/Rf7QBx2JBd2PSAK9HwuwvO HtHuWAbdXhYjqt4tuxSSO4oOhW7YGm7/efoC9Uxq9NAyOoneOHwPEahVGwkJxS+PQFFb bm2CV9a07p+hmGYC87MwFSsvT+MPUU0H5x2EYRb7rA4EqYsZEmOkYAVM4lQMQwlXbLqS WteA== 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=snYpUzaN7gsQsYEFLrXEZxhrhmYrBqVktQ9ekgI3g0o=; b=IEKQuRyODZMReSKA1ZJ6OVJVhQxQZptcFrclJp1OBH5CTOnCGbPo8U+FyquRSWJzGy LGB/byTMqwBvBE5ytWV84cj6YKSubpmKmZ0sJSI6TZCjs9ZHzz6OMgnupdVUBgJKZa9F 3kNO/YA9P8vX2WuIJ3AZmhkcbBrfxIdUhv8whBSzAipPr5QkdESuvmtbxwCCVQtpgaOl 1JSrqFs68H3KLwJBLMoIyVmJpTtl7PTySJW7MvGM9jNiwKDYdouGVUfqOuNaomPTY4p2 4C31gjlSoHxs4cUez9taGVmBS/9KePwSaimp0Zi5YYIPrgJqndos0WTApsO/SufYwlj5 4I5w== X-Gm-Message-State: AGRZ1gJ6mr1RbSYbS+a1TbtiPlXn7wrWbOUgbtJbCWK1asBIU0FYfLBK HizvZQaT0IQEvLh6wx0892A= X-Google-Smtp-Source: AJdET5dIoxl1bkxRoQ+EGQwSDFlkoXGMQFOwn4n9vk7XLy2uKvqr05PIvfPmOwdLGQrUReNxF+HRBg== X-Received: by 2002:a0c:aa84:: with SMTP id f4mr22927480qvb.243.1541450703708; Mon, 05 Nov 2018 12:45:03 -0800 (PST) Received: from localhost.localdomain ([201.82.144.36]) by smtp.gmail.com with ESMTPSA id 5sm10167968qkv.93.2018.11.05.12.45.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 05 Nov 2018 12:45:03 -0800 (PST) From: Fabio Estevam To: p.zabel@pengutronix.de Cc: mchehab@kernel.org, linux-media@vger.kernel.org, Fabio Estevam Subject: [PATCH v2 3/3] media: imx-pxp: Improve pxp_soft_reset() error message Date: Mon, 5 Nov 2018 18:45:16 -0200 Message-Id: <1541450716-25523-3-git-send-email-festevam@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1541450716-25523-1-git-send-email-festevam@gmail.com> References: <1541450716-25523-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 v1: - Newly introduced in this version 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 b3700b8..1b765c9 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); return ret; + } spin_lock_init(&dev->irqlock);