From patchwork Thu Jun 8 10:12:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AngeloGioacchino Del Regno X-Patchwork-Id: 104910 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp174435vqr; Thu, 8 Jun 2023 03:20:39 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4vCK3z0JDFsgGnRC5O57vO+L9yARANoBxTM7T1cT1R5ewn9sps8qHIc8WQ/ZjIsfLkYenA X-Received: by 2002:a67:ee51:0:b0:43d:c0d5:ed27 with SMTP id g17-20020a67ee51000000b0043dc0d5ed27mr977177vsp.32.1686219638796; Thu, 08 Jun 2023 03:20:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686219638; cv=none; d=google.com; s=arc-20160816; b=jKxvUYE1ByPKTJuDbWkL+PimgvGLr91qlv9/jQOO7ZoEnAfDihujnWoxsn+SxQ22dP 1OGwJhTA6HDUvKtC3zbAObTCH25VXVGLIdGcYYoOSBbT0lspzty0o6W7+ADnW7vd92qc NYeEjivB/eDyiObF2WIv8RCeRIijqY6Vb/P028EFdj7clYqlkqK6kTNlk8KhEB9KZ5Dn BpD2l9QuiK5PPBbFgwm6W7TrSM/0ihiIcrx+ruEd8FVdh2dC/smSP3qmKLPFzYdafztW 6tZzAhB/GOMuqGRDDeCR5k2UFfCu/eoUUwEvFRB5zRvX67o/TgCsJfKZr58En7h01o+D Z5RA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=gzhcPdnfla27Zc1fgVm6wF09Wk50X/GSq+k/6lW0Ty8=; b=urryw/U3D4cRVFuLYUggqmS5sDHEwAwtq8FA9t5bqyQjQgHIY2X9RtzN/MNnyJn6YK AwXw2nwVJlxCzwZDVRasRtRPWckuRy223YMErkQ5YZtMRQeRY0h3/x7wop6vpQoqca+j n2MthW6cBJt02CUXONc260K9zNE3xdhmKjGJkK1+CjQoAQ3xE5U4S0q1MqsQeYRqEQ+4 ch6IxG2FrjyiH0cx6kB4RGm8Z95nmkjqtlABOR8SDO2ogjbIzNOUSZG0sSZ1ayV3SSdu fc8wpy3XYgmJZ1LRdNd33D1XASHntkvUauwK+gm51Um3Ifx2bpPyLVB/zVPuVlHluLqy DChQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=EWE1G3ex; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v3-20020a655c43000000b00543ed7b1396si761912pgr.627.2023.06.08.03.20.26; Thu, 08 Jun 2023 03:20:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=EWE1G3ex; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235761AbjFHKMW (ORCPT + 99 others); Thu, 8 Jun 2023 06:12:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35800 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235661AbjFHKMS (ORCPT ); Thu, 8 Jun 2023 06:12:18 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BBE512700 for ; Thu, 8 Jun 2023 03:12:15 -0700 (PDT) Received: from IcarusMOD.eternityproject.eu (unknown [IPv6:2001:b07:2ed:14ed:a962:cd4d:a84:1eab]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: kholk11) by madras.collabora.co.uk (Postfix) with ESMTPSA id CF2BD6606F15; Thu, 8 Jun 2023 11:12:13 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1686219134; bh=isK4CGNELBlWRVqlqiMyoiqJNOrso00n3+sFHCSv6Fs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EWE1G3exT9dMqXh46ixdS/QSrqY3n5H1InzjQQgpc5YUD+M8hWBUqsI18WHn0jydQ CP4SiWKfUi/CgDEkVzR4KK5pCBUihcRW3X/XTzr2d8twlEsOcpaNOxcKwMWFKj1or6 L/qQ3sGl5UBesg6PJeKq4XjrGB2peba0eX9WQ67NeCcRVs24lkt7vaIlWiPm2gLmz+ +Hy5gFOV8VPApBbCqAGIy1zWYjes8KEcFGN7mL9BJvb9QcY/kJiemGE9fSpdfKi0P7 ogCIHMzDPr67jcIJioIlA4OKbc9OLMMoeNevRx3KINCADt6Ul6AsMJykwGsg+2GklN ZX52SnAn2o5rw== From: AngeloGioacchino Del Regno To: chunkuang.hu@kernel.org Cc: p.zabel@pengutronix.de, airlied@gmail.com, daniel@ffwll.ch, matthias.bgg@gmail.com, angelogioacchino.delregno@collabora.com, dri-devel@lists.freedesktop.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kernel@collabora.com Subject: [PATCH 1/3] drm/mediatek: Use devm_platform_get_and_ioremap_resource() Date: Thu, 8 Jun 2023 12:12:07 +0200 Message-Id: <20230608101209.126499-2-angelogioacchino.delregno@collabora.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230608101209.126499-1-angelogioacchino.delregno@collabora.com> References: <20230608101209.126499-1-angelogioacchino.delregno@collabora.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768129443538180431?= X-GMAIL-MSGID: =?utf-8?q?1768129443538180431?= Instead of open coding calls to platform_get_resource() followed by devm_ioremap_resource(), perform a single call to the helper devm_platform_get_and_ioremap_resource(). This commit brings no functional changes. Signed-off-by: AngeloGioacchino Del Regno Reviewed-by: Alexandre Mergnat --- drivers/gpu/drm/mediatek/mtk_cec.c | 3 +-- drivers/gpu/drm/mediatek/mtk_disp_aal.c | 3 +-- drivers/gpu/drm/mediatek/mtk_disp_ccorr.c | 3 +-- drivers/gpu/drm/mediatek/mtk_disp_color.c | 3 +-- drivers/gpu/drm/mediatek/mtk_disp_gamma.c | 3 +-- drivers/gpu/drm/mediatek/mtk_disp_merge.c | 3 +-- drivers/gpu/drm/mediatek/mtk_disp_ovl.c | 3 +-- drivers/gpu/drm/mediatek/mtk_disp_rdma.c | 3 +-- drivers/gpu/drm/mediatek/mtk_dsi.c | 3 +-- drivers/gpu/drm/mediatek/mtk_hdmi.c | 3 +-- drivers/gpu/drm/mediatek/mtk_hdmi_ddc.c | 3 +-- drivers/gpu/drm/mediatek/mtk_mdp_rdma.c | 3 +-- 12 files changed, 12 insertions(+), 24 deletions(-) diff --git a/drivers/gpu/drm/mediatek/mtk_cec.c b/drivers/gpu/drm/mediatek/mtk_cec.c index b640bc0559e7..5136aada9023 100644 --- a/drivers/gpu/drm/mediatek/mtk_cec.c +++ b/drivers/gpu/drm/mediatek/mtk_cec.c @@ -195,8 +195,7 @@ static int mtk_cec_probe(struct platform_device *pdev) platform_set_drvdata(pdev, cec); spin_lock_init(&cec->lock); - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - cec->regs = devm_ioremap_resource(dev, res); + cec->regs = devm_platform_get_and_ioremap_resource(pdev, 0, &res); if (IS_ERR(cec->regs)) { ret = PTR_ERR(cec->regs); dev_err(dev, "Failed to ioremap cec: %d\n", ret); diff --git a/drivers/gpu/drm/mediatek/mtk_disp_aal.c b/drivers/gpu/drm/mediatek/mtk_disp_aal.c index 8ddf7a97e583..68485c09ad8f 100644 --- a/drivers/gpu/drm/mediatek/mtk_disp_aal.c +++ b/drivers/gpu/drm/mediatek/mtk_disp_aal.c @@ -117,8 +117,7 @@ static int mtk_disp_aal_probe(struct platform_device *pdev) return PTR_ERR(priv->clk); } - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - priv->regs = devm_ioremap_resource(dev, res); + priv->regs = devm_platform_get_and_ioremap_resource(pdev, 0, &res); if (IS_ERR(priv->regs)) { dev_err(dev, "failed to ioremap aal\n"); return PTR_ERR(priv->regs); diff --git a/drivers/gpu/drm/mediatek/mtk_disp_ccorr.c b/drivers/gpu/drm/mediatek/mtk_disp_ccorr.c index 1773379b2439..ae243e7db9b2 100644 --- a/drivers/gpu/drm/mediatek/mtk_disp_ccorr.c +++ b/drivers/gpu/drm/mediatek/mtk_disp_ccorr.c @@ -172,8 +172,7 @@ static int mtk_disp_ccorr_probe(struct platform_device *pdev) return PTR_ERR(priv->clk); } - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - priv->regs = devm_ioremap_resource(dev, res); + priv->regs = devm_platform_get_and_ioremap_resource(pdev, 0, &res); if (IS_ERR(priv->regs)) { dev_err(dev, "failed to ioremap ccorr\n"); return PTR_ERR(priv->regs); diff --git a/drivers/gpu/drm/mediatek/mtk_disp_color.c b/drivers/gpu/drm/mediatek/mtk_disp_color.c index cac9206079e7..4ec37e20ade9 100644 --- a/drivers/gpu/drm/mediatek/mtk_disp_color.c +++ b/drivers/gpu/drm/mediatek/mtk_disp_color.c @@ -110,8 +110,7 @@ static int mtk_disp_color_probe(struct platform_device *pdev) return PTR_ERR(priv->clk); } - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - priv->regs = devm_ioremap_resource(dev, res); + priv->regs = devm_platform_get_and_ioremap_resource(pdev, 0, &res); if (IS_ERR(priv->regs)) { dev_err(dev, "failed to ioremap color\n"); return PTR_ERR(priv->regs); diff --git a/drivers/gpu/drm/mediatek/mtk_disp_gamma.c b/drivers/gpu/drm/mediatek/mtk_disp_gamma.c index bd530e603264..cf9262aa4f89 100644 --- a/drivers/gpu/drm/mediatek/mtk_disp_gamma.c +++ b/drivers/gpu/drm/mediatek/mtk_disp_gamma.c @@ -276,8 +276,7 @@ static int mtk_disp_gamma_probe(struct platform_device *pdev) return PTR_ERR(priv->clk); } - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - priv->regs = devm_ioremap_resource(dev, res); + priv->regs = devm_platform_get_and_ioremap_resource(pdev, 0, &res); if (IS_ERR(priv->regs)) { dev_err(dev, "failed to ioremap gamma\n"); return PTR_ERR(priv->regs); diff --git a/drivers/gpu/drm/mediatek/mtk_disp_merge.c b/drivers/gpu/drm/mediatek/mtk_disp_merge.c index 6428b6203ffe..f1dfa6dfd967 100644 --- a/drivers/gpu/drm/mediatek/mtk_disp_merge.c +++ b/drivers/gpu/drm/mediatek/mtk_disp_merge.c @@ -250,8 +250,7 @@ static int mtk_disp_merge_probe(struct platform_device *pdev) if (!priv) return -ENOMEM; - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - priv->regs = devm_ioremap_resource(dev, res); + priv->regs = devm_platform_get_and_ioremap_resource(pdev, 0, &res); if (IS_ERR(priv->regs)) { dev_err(dev, "failed to ioremap merge\n"); return PTR_ERR(priv->regs); diff --git a/drivers/gpu/drm/mediatek/mtk_disp_ovl.c b/drivers/gpu/drm/mediatek/mtk_disp_ovl.c index 8f52cc1f3fba..a0b0a1eb91c9 100644 --- a/drivers/gpu/drm/mediatek/mtk_disp_ovl.c +++ b/drivers/gpu/drm/mediatek/mtk_disp_ovl.c @@ -529,8 +529,7 @@ static int mtk_disp_ovl_probe(struct platform_device *pdev) return PTR_ERR(priv->clk); } - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - priv->regs = devm_ioremap_resource(dev, res); + priv->regs = devm_platform_get_and_ioremap_resource(pdev, 0, &res); if (IS_ERR(priv->regs)) { dev_err(dev, "failed to ioremap ovl\n"); return PTR_ERR(priv->regs); diff --git a/drivers/gpu/drm/mediatek/mtk_disp_rdma.c b/drivers/gpu/drm/mediatek/mtk_disp_rdma.c index d4df17ad600a..7106c05127b1 100644 --- a/drivers/gpu/drm/mediatek/mtk_disp_rdma.c +++ b/drivers/gpu/drm/mediatek/mtk_disp_rdma.c @@ -332,8 +332,7 @@ static int mtk_disp_rdma_probe(struct platform_device *pdev) return PTR_ERR(priv->clk); } - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - priv->regs = devm_ioremap_resource(dev, res); + priv->regs = devm_platform_get_and_ioremap_resource(pdev, 0, &res); if (IS_ERR(priv->regs)) { dev_err(dev, "failed to ioremap rdma\n"); return PTR_ERR(priv->regs); diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/mtk_dsi.c index 19e2b042c9d5..fb6f45165e95 100644 --- a/drivers/gpu/drm/mediatek/mtk_dsi.c +++ b/drivers/gpu/drm/mediatek/mtk_dsi.c @@ -1113,8 +1113,7 @@ static int mtk_dsi_probe(struct platform_device *pdev) goto err_unregister_host; } - regs = platform_get_resource(pdev, IORESOURCE_MEM, 0); - dsi->regs = devm_ioremap_resource(dev, regs); + dsi->regs = devm_platform_get_and_ioremap_resource(pdev, 0, ®s); if (IS_ERR(dsi->regs)) { ret = PTR_ERR(dsi->regs); dev_err(dev, "Failed to ioremap memory: %d\n", ret); diff --git a/drivers/gpu/drm/mediatek/mtk_hdmi.c b/drivers/gpu/drm/mediatek/mtk_hdmi.c index 0a8e0a13f516..0c784db9978b 100644 --- a/drivers/gpu/drm/mediatek/mtk_hdmi.c +++ b/drivers/gpu/drm/mediatek/mtk_hdmi.c @@ -1474,8 +1474,7 @@ static int mtk_hdmi_dt_parse_pdata(struct mtk_hdmi *hdmi, } hdmi->sys_regmap = regmap; - mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); - hdmi->regs = devm_ioremap_resource(dev, mem); + hdmi->regs = devm_platform_get_and_ioremap_resource(pdev, 0, &mem); if (IS_ERR(hdmi->regs)) { ret = PTR_ERR(hdmi->regs); goto put_device; diff --git a/drivers/gpu/drm/mediatek/mtk_hdmi_ddc.c b/drivers/gpu/drm/mediatek/mtk_hdmi_ddc.c index 4d39ea0a05ca..dfd1f07b39f0 100644 --- a/drivers/gpu/drm/mediatek/mtk_hdmi_ddc.c +++ b/drivers/gpu/drm/mediatek/mtk_hdmi_ddc.c @@ -284,8 +284,7 @@ static int mtk_hdmi_ddc_probe(struct platform_device *pdev) return PTR_ERR(ddc->clk); } - mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); - ddc->regs = devm_ioremap_resource(&pdev->dev, mem); + ddc->regs = devm_platform_get_and_ioremap_resource(pdev, 0, &mem); if (IS_ERR(ddc->regs)) return PTR_ERR(ddc->regs); diff --git a/drivers/gpu/drm/mediatek/mtk_mdp_rdma.c b/drivers/gpu/drm/mediatek/mtk_mdp_rdma.c index e06db6e56b5f..4eac4cbc0764 100644 --- a/drivers/gpu/drm/mediatek/mtk_mdp_rdma.c +++ b/drivers/gpu/drm/mediatek/mtk_mdp_rdma.c @@ -285,8 +285,7 @@ static int mtk_mdp_rdma_probe(struct platform_device *pdev) if (!priv) return -ENOMEM; - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - priv->regs = devm_ioremap_resource(dev, res); + priv->regs = devm_platform_get_and_ioremap_resource(pdev, 0, &res); if (IS_ERR(priv->regs)) { dev_err(dev, "failed to ioremap rdma\n"); return PTR_ERR(priv->regs); From patchwork Thu Jun 8 10:12:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AngeloGioacchino Del Regno X-Patchwork-Id: 104911 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp174938vqr; Thu, 8 Jun 2023 03:21:49 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6dMxpmp+v7B+h5vJ6//A9Pb+Qdhe3VtBBVFcJHgWmuvawEVpC5gzLWll4t2zLbecyD7fwH X-Received: by 2002:a17:90b:2353:b0:24b:c580:1ab8 with SMTP id ms19-20020a17090b235300b0024bc5801ab8mr3184509pjb.40.1686219709391; Thu, 08 Jun 2023 03:21:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686219709; cv=none; d=google.com; s=arc-20160816; b=Yp9c4bXuW9krlBv6VmEuwLEmG4/VXKCEVRz/F+QUc8dRLMLvIpsatlrdqg5izMfgUJ JOArTWtcBKwPtSRCZ7RjhlArGOZ5c+uKS+Vy7VEVE/aW6NaE+IJzn/MuBiGQsVCjECWI xpwaiS4u6fOZND1NqDxtOyR+WHjxUIBiU81iw46k0+CmZ3Bm5VbSF91+eODwWJDe0Sw9 0r1cQCEjp+gQJNmIX/YuqrPScOTcx6uX1yDNvQQvwnG5yYuCeq/I0u4w5cEv/2/pNFrG M4jhWbbKKiaPO0KQ8gHxuiT8BPTDvxEkrVDfUDMF+LVQ7qWuC4QxVB3NgcCPcuTkJ8Dj WQzg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=QwU4Yy2v5A3FvMHzUxxdv/YqS1ipj5kRPlE/wXr82KE=; b=GYX3J88xjmo1YpQiNpS+yK48Sm43jVnQQu4SqhVULcfVHy4q8ekyDBhtobiQlJW3GQ trBeIuEpoe/3e7JjfBKVyNGS6dji0Ydd4kBHoozXyr0MYnterQ2PoUEdhvS7VYeSiDJ+ jNTKbUgcumGk+NCw4c+9N+pX57xZ6NdwH/Klr83k95ougEP5aedva6JCTdm3Q+mxAE7W RoWeGjW5+fqDEg0+rigutUYdXvXyPaIcX193dc18+vczCcoSekyVjzYaZnVbDjBZOLNd ctEj4ZsYyYO/B4QxWO8aqT3MOBSLGkSIzPzD26Zrr38k/NYNzAQQhj4bPBw23P4a2Eld 1wSg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=QVev5YC6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g8-20020a1709026b4800b001ae40e07fb0si877550plt.216.2023.06.08.03.21.36; Thu, 08 Jun 2023 03:21:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=QVev5YC6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235957AbjFHKMb (ORCPT + 99 others); Thu, 8 Jun 2023 06:12:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35830 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235211AbjFHKMU (ORCPT ); Thu, 8 Jun 2023 06:12:20 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e5ab]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8E17A211C for ; Thu, 8 Jun 2023 03:12:16 -0700 (PDT) Received: from IcarusMOD.eternityproject.eu (unknown [IPv6:2001:b07:2ed:14ed:a962:cd4d:a84:1eab]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: kholk11) by madras.collabora.co.uk (Postfix) with ESMTPSA id A19A96606F1F; Thu, 8 Jun 2023 11:12:14 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1686219135; bh=hfkPe8EHWYLLULwDG2dGD1W50zVPVESCwNbNmJR4tFk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QVev5YC6kJG4UkbaKYgK8IdQArsU4agGq0mjg2dMV5r392arS5Q1w6QBcyoxhAOuw GsITRuBfPEFOOxkrgkQxV96Aa1IROQrNvqLlNOjcSNkqHG8lZAskHTrj4ACgo0xkue TUJDSQSlTE4LXLvViTuo5GLpzyBxow3xc3w1xccSnbaD7mIk718Q9vPtlg2jwgJu0U rY+eE5d1MlbkXHdk1OG5HPW9RdNlub8/cwkJX9TGMz6Ws62WoDPhIK9FAqp8VJqdFh jy/2qmuU9FVIKl3XpGKgCDkjO2h5nv1cQUng5w0EB1eUPy77z50bOxLdBQQwChL2ML g76QzPhAI6/oA== From: AngeloGioacchino Del Regno To: chunkuang.hu@kernel.org Cc: p.zabel@pengutronix.de, airlied@gmail.com, daniel@ffwll.ch, matthias.bgg@gmail.com, angelogioacchino.delregno@collabora.com, dri-devel@lists.freedesktop.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kernel@collabora.com Subject: [PATCH 2/3] drm/mediatek: Use dev_err_probe() in probe functions Date: Thu, 8 Jun 2023 12:12:08 +0200 Message-Id: <20230608101209.126499-3-angelogioacchino.delregno@collabora.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230608101209.126499-1-angelogioacchino.delregno@collabora.com> References: <20230608101209.126499-1-angelogioacchino.delregno@collabora.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768129518035358964?= X-GMAIL-MSGID: =?utf-8?q?1768129518035358964?= Convert all instances of dev_err() -> return to dev_err_probe() and where it makes sense to, change instances of `return ret` at the end of probe functions to `return 0`, as errors are returned earlier. Signed-off-by: AngeloGioacchino Del Regno Reviewed-by: Alexandre Mergnat Reviewed-by: CK Hu --- drivers/gpu/drm/mediatek/mtk_cec.c | 26 +++++------------ drivers/gpu/drm/mediatek/mtk_disp_aal.c | 16 ++++------ drivers/gpu/drm/mediatek/mtk_disp_ccorr.c | 16 ++++------ drivers/gpu/drm/mediatek/mtk_disp_color.c | 17 +++++------ drivers/gpu/drm/mediatek/mtk_disp_gamma.c | 16 ++++------ drivers/gpu/drm/mediatek/mtk_disp_merge.c | 25 +++++++--------- drivers/gpu/drm/mediatek/mtk_disp_ovl.c | 23 ++++++--------- .../gpu/drm/mediatek/mtk_disp_ovl_adaptor.c | 6 ++-- drivers/gpu/drm/mediatek/mtk_disp_rdma.c | 29 +++++++------------ drivers/gpu/drm/mediatek/mtk_dsi.c | 18 +++++------- drivers/gpu/drm/mediatek/mtk_ethdr.c | 18 +++++------- drivers/gpu/drm/mediatek/mtk_hdmi.c | 14 +++------ drivers/gpu/drm/mediatek/mtk_hdmi_ddc.c | 12 +++----- drivers/gpu/drm/mediatek/mtk_mdp_rdma.c | 18 +++++------- 14 files changed, 96 insertions(+), 158 deletions(-) diff --git a/drivers/gpu/drm/mediatek/mtk_cec.c b/drivers/gpu/drm/mediatek/mtk_cec.c index 5136aada9023..f12ee86c2b74 100644 --- a/drivers/gpu/drm/mediatek/mtk_cec.c +++ b/drivers/gpu/drm/mediatek/mtk_cec.c @@ -196,18 +196,12 @@ static int mtk_cec_probe(struct platform_device *pdev) spin_lock_init(&cec->lock); cec->regs = devm_platform_get_and_ioremap_resource(pdev, 0, &res); - if (IS_ERR(cec->regs)) { - ret = PTR_ERR(cec->regs); - dev_err(dev, "Failed to ioremap cec: %d\n", ret); - return ret; - } + if (IS_ERR(cec->regs)) + return dev_err_probe(dev, PTR_ERR(cec->regs), "Failed to ioremap cec\n"); cec->clk = devm_clk_get(dev, NULL); - if (IS_ERR(cec->clk)) { - ret = PTR_ERR(cec->clk); - dev_err(dev, "Failed to get cec clock: %d\n", ret); - return ret; - } + if (IS_ERR(cec->clk)) + return dev_err_probe(dev, PTR_ERR(cec->clk), "Failed to get cec clock\n"); cec->irq = platform_get_irq(pdev, 0); if (cec->irq < 0) @@ -217,16 +211,12 @@ static int mtk_cec_probe(struct platform_device *pdev) mtk_cec_htplg_isr_thread, IRQF_SHARED | IRQF_TRIGGER_LOW | IRQF_ONESHOT, "hdmi hpd", dev); - if (ret) { - dev_err(dev, "Failed to register cec irq: %d\n", ret); - return ret; - } + if (ret) + return dev_err_probe(dev, ret, "Failed to register cec irq\n"); ret = clk_prepare_enable(cec->clk); - if (ret) { - dev_err(dev, "Failed to enable cec clock: %d\n", ret); - return ret; - } + if (ret) + return dev_err_probe(dev, ret, "Failed to enable cec clock\n"); mtk_cec_htplg_irq_init(cec); mtk_cec_htplg_irq_enable(cec); diff --git a/drivers/gpu/drm/mediatek/mtk_disp_aal.c b/drivers/gpu/drm/mediatek/mtk_disp_aal.c index 68485c09ad8f..17a4d4a3b040 100644 --- a/drivers/gpu/drm/mediatek/mtk_disp_aal.c +++ b/drivers/gpu/drm/mediatek/mtk_disp_aal.c @@ -112,16 +112,12 @@ static int mtk_disp_aal_probe(struct platform_device *pdev) return -ENOMEM; priv->clk = devm_clk_get(dev, NULL); - if (IS_ERR(priv->clk)) { - dev_err(dev, "failed to get aal clk\n"); - return PTR_ERR(priv->clk); - } + if (IS_ERR(priv->clk)) + return dev_err_probe(dev, PTR_ERR(priv->clk), "failed to get aal clk\n"); priv->regs = devm_platform_get_and_ioremap_resource(pdev, 0, &res); - if (IS_ERR(priv->regs)) { - dev_err(dev, "failed to ioremap aal\n"); - return PTR_ERR(priv->regs); - } + if (IS_ERR(priv->regs)) + return dev_err_probe(dev, PTR_ERR(priv->regs), "failed to ioremap aal\n"); #if IS_REACHABLE(CONFIG_MTK_CMDQ) ret = cmdq_dev_get_client_reg(dev, &priv->cmdq_reg, 0); @@ -134,9 +130,9 @@ static int mtk_disp_aal_probe(struct platform_device *pdev) ret = component_add(dev, &mtk_disp_aal_component_ops); if (ret) - dev_err(dev, "Failed to add component: %d\n", ret); + return dev_err_probe(dev, ret, "Failed to add component\n"); - return ret; + return 0; } static int mtk_disp_aal_remove(struct platform_device *pdev) diff --git a/drivers/gpu/drm/mediatek/mtk_disp_ccorr.c b/drivers/gpu/drm/mediatek/mtk_disp_ccorr.c index ae243e7db9b2..3f4bf7319f17 100644 --- a/drivers/gpu/drm/mediatek/mtk_disp_ccorr.c +++ b/drivers/gpu/drm/mediatek/mtk_disp_ccorr.c @@ -167,16 +167,12 @@ static int mtk_disp_ccorr_probe(struct platform_device *pdev) return -ENOMEM; priv->clk = devm_clk_get(dev, NULL); - if (IS_ERR(priv->clk)) { - dev_err(dev, "failed to get ccorr clk\n"); - return PTR_ERR(priv->clk); - } + if (IS_ERR(priv->clk)) + return dev_err_probe(dev, PTR_ERR(priv->clk), "failed to get ccorr clk\n"); priv->regs = devm_platform_get_and_ioremap_resource(pdev, 0, &res); - if (IS_ERR(priv->regs)) { - dev_err(dev, "failed to ioremap ccorr\n"); - return PTR_ERR(priv->regs); - } + if (IS_ERR(priv->regs)) + return dev_err_probe(dev, PTR_ERR(priv->regs), "failed to ioremap ccorr\n"); #if IS_REACHABLE(CONFIG_MTK_CMDQ) ret = cmdq_dev_get_client_reg(dev, &priv->cmdq_reg, 0); @@ -189,9 +185,9 @@ static int mtk_disp_ccorr_probe(struct platform_device *pdev) ret = component_add(dev, &mtk_disp_ccorr_component_ops); if (ret) - dev_err(dev, "Failed to add component: %d\n", ret); + return dev_err_probe(dev, ret, "Failed to add component\n"); - return ret; + return 0; } static int mtk_disp_ccorr_remove(struct platform_device *pdev) diff --git a/drivers/gpu/drm/mediatek/mtk_disp_color.c b/drivers/gpu/drm/mediatek/mtk_disp_color.c index 4ec37e20ade9..b188d3393f99 100644 --- a/drivers/gpu/drm/mediatek/mtk_disp_color.c +++ b/drivers/gpu/drm/mediatek/mtk_disp_color.c @@ -105,16 +105,13 @@ static int mtk_disp_color_probe(struct platform_device *pdev) return -ENOMEM; priv->clk = devm_clk_get(dev, NULL); - if (IS_ERR(priv->clk)) { - dev_err(dev, "failed to get color clk\n"); - return PTR_ERR(priv->clk); - } + if (IS_ERR(priv->clk)) + return dev_err_probe(dev, PTR_ERR(priv->clk), "failed to get color clk\n"); priv->regs = devm_platform_get_and_ioremap_resource(pdev, 0, &res); - if (IS_ERR(priv->regs)) { - dev_err(dev, "failed to ioremap color\n"); - return PTR_ERR(priv->regs); - } + if (IS_ERR(priv->regs)) + return dev_err_probe(dev, PTR_ERR(priv->regs), "failed to ioremap color\n"); + #if IS_REACHABLE(CONFIG_MTK_CMDQ) ret = cmdq_dev_get_client_reg(dev, &priv->cmdq_reg, 0); if (ret) @@ -126,9 +123,9 @@ static int mtk_disp_color_probe(struct platform_device *pdev) ret = component_add(dev, &mtk_disp_color_component_ops); if (ret) - dev_err(dev, "Failed to add component: %d\n", ret); + return dev_err_probe(dev, ret, "Failed to add component\n"); - return ret; + return 0; } static int mtk_disp_color_remove(struct platform_device *pdev) diff --git a/drivers/gpu/drm/mediatek/mtk_disp_gamma.c b/drivers/gpu/drm/mediatek/mtk_disp_gamma.c index cf9262aa4f89..1bf709bac0cf 100644 --- a/drivers/gpu/drm/mediatek/mtk_disp_gamma.c +++ b/drivers/gpu/drm/mediatek/mtk_disp_gamma.c @@ -271,16 +271,12 @@ static int mtk_disp_gamma_probe(struct platform_device *pdev) return -ENOMEM; priv->clk = devm_clk_get(dev, NULL); - if (IS_ERR(priv->clk)) { - dev_err(dev, "failed to get gamma clk\n"); - return PTR_ERR(priv->clk); - } + if (IS_ERR(priv->clk)) + return dev_err_probe(dev, PTR_ERR(priv->clk), "failed to get gamma clk\n"); priv->regs = devm_platform_get_and_ioremap_resource(pdev, 0, &res); - if (IS_ERR(priv->regs)) { - dev_err(dev, "failed to ioremap gamma\n"); - return PTR_ERR(priv->regs); - } + if (IS_ERR(priv->regs)) + return dev_err_probe(dev, PTR_ERR(priv->regs), "failed to ioremap gamma\n"); #if IS_REACHABLE(CONFIG_MTK_CMDQ) ret = cmdq_dev_get_client_reg(dev, &priv->cmdq_reg, 0); @@ -293,9 +289,9 @@ static int mtk_disp_gamma_probe(struct platform_device *pdev) ret = component_add(dev, &mtk_disp_gamma_component_ops); if (ret) - dev_err(dev, "Failed to add component: %d\n", ret); + return dev_err_probe(dev, ret, "Failed to add component\n"); - return ret; + return 0; } static int mtk_disp_gamma_remove(struct platform_device *pdev) diff --git a/drivers/gpu/drm/mediatek/mtk_disp_merge.c b/drivers/gpu/drm/mediatek/mtk_disp_merge.c index f1dfa6dfd967..60e0b4e70978 100644 --- a/drivers/gpu/drm/mediatek/mtk_disp_merge.c +++ b/drivers/gpu/drm/mediatek/mtk_disp_merge.c @@ -251,22 +251,17 @@ static int mtk_disp_merge_probe(struct platform_device *pdev) return -ENOMEM; priv->regs = devm_platform_get_and_ioremap_resource(pdev, 0, &res); - if (IS_ERR(priv->regs)) { - dev_err(dev, "failed to ioremap merge\n"); - return PTR_ERR(priv->regs); - } + if (IS_ERR(priv->regs)) + return dev_err_probe(dev, PTR_ERR(priv->regs), "failed to ioremap merge\n"); priv->clk = devm_clk_get(dev, NULL); - if (IS_ERR(priv->clk)) { - dev_err(dev, "failed to get merge clk\n"); - return PTR_ERR(priv->clk); - } + if (IS_ERR(priv->clk)) + return dev_err_probe(dev, PTR_ERR(priv->clk), "failed to get merge clock\n"); priv->async_clk = devm_clk_get_optional(dev, "merge_async"); - if (IS_ERR(priv->async_clk)) { - dev_err(dev, "failed to get merge async clock\n"); - return PTR_ERR(priv->async_clk); - } + if (IS_ERR(priv->async_clk)) + return dev_err_probe(dev, PTR_ERR(priv->async_clk), + "failed to get merge_async clock\n"); if (priv->async_clk) { priv->reset_ctl = devm_reset_control_get_optional_exclusive(dev, NULL); @@ -288,10 +283,10 @@ static int mtk_disp_merge_probe(struct platform_device *pdev) platform_set_drvdata(pdev, priv); ret = component_add(dev, &mtk_disp_merge_component_ops); - if (ret != 0) - dev_err(dev, "Failed to add component: %d\n", ret); + if (ret) + return dev_err_probe(dev, ret, "Failed to add component\n"); - return ret; + return 0; } static int mtk_disp_merge_remove(struct platform_device *pdev) diff --git a/drivers/gpu/drm/mediatek/mtk_disp_ovl.c b/drivers/gpu/drm/mediatek/mtk_disp_ovl.c index a0b0a1eb91c9..4c00e42ef0a8 100644 --- a/drivers/gpu/drm/mediatek/mtk_disp_ovl.c +++ b/drivers/gpu/drm/mediatek/mtk_disp_ovl.c @@ -524,16 +524,13 @@ static int mtk_disp_ovl_probe(struct platform_device *pdev) return irq; priv->clk = devm_clk_get(dev, NULL); - if (IS_ERR(priv->clk)) { - dev_err(dev, "failed to get ovl clk\n"); - return PTR_ERR(priv->clk); - } + if (IS_ERR(priv->clk)) + return dev_err_probe(dev, PTR_ERR(priv->clk), "failed to get ovl clk\n"); priv->regs = devm_platform_get_and_ioremap_resource(pdev, 0, &res); - if (IS_ERR(priv->regs)) { - dev_err(dev, "failed to ioremap ovl\n"); - return PTR_ERR(priv->regs); - } + if (IS_ERR(priv->regs)) + return dev_err_probe(dev, PTR_ERR(priv->regs), "failed to ioremap ovl\n"); + #if IS_REACHABLE(CONFIG_MTK_CMDQ) ret = cmdq_dev_get_client_reg(dev, &priv->cmdq_reg, 0); if (ret) @@ -545,20 +542,18 @@ static int mtk_disp_ovl_probe(struct platform_device *pdev) ret = devm_request_irq(dev, irq, mtk_disp_ovl_irq_handler, IRQF_TRIGGER_NONE, dev_name(dev), priv); - if (ret < 0) { - dev_err(dev, "Failed to request irq %d: %d\n", irq, ret); - return ret; - } + if (ret < 0) + return dev_err_probe(dev, ret, "Failed to request irq %d\n", irq); pm_runtime_enable(dev); ret = component_add(dev, &mtk_disp_ovl_component_ops); if (ret) { pm_runtime_disable(dev); - dev_err(dev, "Failed to add component: %d\n", ret); + return dev_err_probe(dev, ret, "Failed to add component\n"); } - return ret; + return 0; } static int mtk_disp_ovl_remove(struct platform_device *pdev) diff --git a/drivers/gpu/drm/mediatek/mtk_disp_ovl_adaptor.c b/drivers/gpu/drm/mediatek/mtk_disp_ovl_adaptor.c index c0a38f5217ee..1993b688befa 100644 --- a/drivers/gpu/drm/mediatek/mtk_disp_ovl_adaptor.c +++ b/drivers/gpu/drm/mediatek/mtk_disp_ovl_adaptor.c @@ -522,12 +522,12 @@ static int mtk_disp_ovl_adaptor_probe(struct platform_device *pdev) pm_runtime_enable(dev); ret = component_add(dev, &mtk_disp_ovl_adaptor_comp_ops); - if (ret != 0) { + if (ret) { pm_runtime_disable(dev); - dev_err(dev, "Failed to add component: %d\n", ret); + return dev_err_probe(dev, ret, "Failed to add component\n"); } - return ret; + return 0; } static int mtk_disp_ovl_adaptor_remove(struct platform_device *pdev) diff --git a/drivers/gpu/drm/mediatek/mtk_disp_rdma.c b/drivers/gpu/drm/mediatek/mtk_disp_rdma.c index 7106c05127b1..307be35b59fc 100644 --- a/drivers/gpu/drm/mediatek/mtk_disp_rdma.c +++ b/drivers/gpu/drm/mediatek/mtk_disp_rdma.c @@ -327,16 +327,13 @@ static int mtk_disp_rdma_probe(struct platform_device *pdev) return irq; priv->clk = devm_clk_get(dev, NULL); - if (IS_ERR(priv->clk)) { - dev_err(dev, "failed to get rdma clk\n"); - return PTR_ERR(priv->clk); - } + if (IS_ERR(priv->clk)) + return dev_err_probe(dev, PTR_ERR(priv->clk), "failed to get rdma clk\n"); priv->regs = devm_platform_get_and_ioremap_resource(pdev, 0, &res); - if (IS_ERR(priv->regs)) { - dev_err(dev, "failed to ioremap rdma\n"); - return PTR_ERR(priv->regs); - } + if (IS_ERR(priv->regs)) + return dev_err_probe(dev, PTR_ERR(priv->regs), "failed to ioremap rdma\n"); + #if IS_REACHABLE(CONFIG_MTK_CMDQ) ret = cmdq_dev_get_client_reg(dev, &priv->cmdq_reg, 0); if (ret) @@ -347,10 +344,8 @@ static int mtk_disp_rdma_probe(struct platform_device *pdev) ret = of_property_read_u32(dev->of_node, "mediatek,rdma-fifo-size", &priv->fifo_size); - if (ret) { - dev_err(dev, "Failed to get rdma fifo size\n"); - return ret; - } + if (ret) + return dev_err_probe(dev, ret, "Failed to get rdma fifo size\n"); } /* Disable and clear pending interrupts */ @@ -359,10 +354,8 @@ static int mtk_disp_rdma_probe(struct platform_device *pdev) ret = devm_request_irq(dev, irq, mtk_disp_rdma_irq_handler, IRQF_TRIGGER_NONE, dev_name(dev), priv); - if (ret < 0) { - dev_err(dev, "Failed to request irq %d: %d\n", irq, ret); - return ret; - } + if (ret < 0) + return dev_err_probe(dev, ret, "Failed to request irq %d\n", irq); priv->data = of_device_get_match_data(dev); @@ -373,10 +366,10 @@ static int mtk_disp_rdma_probe(struct platform_device *pdev) ret = component_add(dev, &mtk_disp_rdma_component_ops); if (ret) { pm_runtime_disable(dev); - dev_err(dev, "Failed to add component: %d\n", ret); + return dev_err_probe(dev, ret, "Failed to add component\n"); } - return ret; + return 0; } static int mtk_disp_rdma_remove(struct platform_device *pdev) diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/mtk_dsi.c index fb6f45165e95..fc8149e0ae3d 100644 --- a/drivers/gpu/drm/mediatek/mtk_dsi.c +++ b/drivers/gpu/drm/mediatek/mtk_dsi.c @@ -1081,10 +1081,8 @@ static int mtk_dsi_probe(struct platform_device *pdev) dsi->host.ops = &mtk_dsi_ops; dsi->host.dev = dev; ret = mipi_dsi_host_register(&dsi->host); - if (ret < 0) { - dev_err(dev, "failed to register DSI host: %d\n", ret); - return ret; - } + if (ret < 0) + return dev_err_probe(dev, ret, "failed to register DSI host\n"); dsi->driver_data = of_device_get_match_data(dev); @@ -1092,8 +1090,7 @@ static int mtk_dsi_probe(struct platform_device *pdev) if (IS_ERR(dsi->engine_clk)) { ret = PTR_ERR(dsi->engine_clk); - if (ret != -EPROBE_DEFER) - dev_err(dev, "Failed to get engine clock: %d\n", ret); + dev_err_probe(dev, ret, "Failed to get engine clock\n"); goto err_unregister_host; } @@ -1101,29 +1098,28 @@ static int mtk_dsi_probe(struct platform_device *pdev) if (IS_ERR(dsi->digital_clk)) { ret = PTR_ERR(dsi->digital_clk); - if (ret != -EPROBE_DEFER) - dev_err(dev, "Failed to get digital clock: %d\n", ret); + dev_err_probe(dev, ret, "Failed to get digital clock\n"); goto err_unregister_host; } dsi->hs_clk = devm_clk_get(dev, "hs"); if (IS_ERR(dsi->hs_clk)) { ret = PTR_ERR(dsi->hs_clk); - dev_err(dev, "Failed to get hs clock: %d\n", ret); + dev_err_probe(dev, ret, "Failed to get hs clock\n"); goto err_unregister_host; } dsi->regs = devm_platform_get_and_ioremap_resource(pdev, 0, ®s); if (IS_ERR(dsi->regs)) { ret = PTR_ERR(dsi->regs); - dev_err(dev, "Failed to ioremap memory: %d\n", ret); + dev_err_probe(dev, ret, "Failed to ioremap memory\n"); goto err_unregister_host; } dsi->phy = devm_phy_get(dev, "dphy"); if (IS_ERR(dsi->phy)) { ret = PTR_ERR(dsi->phy); - dev_err(dev, "Failed to get MIPI-DPHY: %d\n", ret); + dev_err_probe(dev, ret, "Failed to get MIPI-DPHY\n"); goto err_unregister_host; } diff --git a/drivers/gpu/drm/mediatek/mtk_ethdr.c b/drivers/gpu/drm/mediatek/mtk_ethdr.c index 73dc4da3ba3b..4a5bd5bb9d6e 100644 --- a/drivers/gpu/drm/mediatek/mtk_ethdr.c +++ b/drivers/gpu/drm/mediatek/mtk_ethdr.c @@ -325,25 +325,23 @@ static int mtk_ethdr_probe(struct platform_device *pdev) if (priv->irq) { ret = devm_request_irq(dev, priv->irq, mtk_ethdr_irq_handler, IRQF_TRIGGER_NONE, dev_name(dev), priv); - if (ret < 0) { - dev_err(dev, "Failed to request irq %d: %d\n", priv->irq, ret); - return ret; - } + if (ret < 0) + return dev_err_probe(dev, ret, "Failed to request irq %d\n", + priv->irq); } priv->reset_ctl = devm_reset_control_array_get_optional_exclusive(dev); - if (IS_ERR(priv->reset_ctl)) { - dev_err_probe(dev, PTR_ERR(priv->reset_ctl), "cannot get ethdr reset control\n"); - return PTR_ERR(priv->reset_ctl); - } + if (IS_ERR(priv->reset_ctl)) + return dev_err_probe(dev, PTR_ERR(priv->reset_ctl), + "cannot get ethdr reset control\n"); platform_set_drvdata(pdev, priv); ret = component_add(dev, &mtk_ethdr_component_ops); if (ret) - dev_notice(dev, "Failed to add component: %d\n", ret); + return dev_err_probe(dev, ret, "Failed to add component\n"); - return ret; + return 0; } static int mtk_ethdr_remove(struct platform_device *pdev) diff --git a/drivers/gpu/drm/mediatek/mtk_hdmi.c b/drivers/gpu/drm/mediatek/mtk_hdmi.c index 0c784db9978b..7066c70d7eaf 100644 --- a/drivers/gpu/drm/mediatek/mtk_hdmi.c +++ b/drivers/gpu/drm/mediatek/mtk_hdmi.c @@ -1432,19 +1432,13 @@ static int mtk_hdmi_dt_parse_pdata(struct mtk_hdmi *hdmi, int ret; ret = mtk_hdmi_get_all_clk(hdmi, np); - if (ret) { - if (ret != -EPROBE_DEFER) - dev_err(dev, "Failed to get clocks: %d\n", ret); - - return ret; - } + if (ret) + return dev_err_probe(dev, ret, "Failed to get clocks\n"); /* The CEC module handles HDMI hotplug detection */ cec_np = of_get_compatible_child(np->parent, "mediatek,mt8173-cec"); - if (!cec_np) { - dev_err(dev, "Failed to find CEC node\n"); - return -EINVAL; - } + if (!cec_np) + return dev_err_probe(dev, -EINVAL, "Failed to find CEC node\n"); cec_pdev = of_find_device_by_node(cec_np); if (!cec_pdev) { diff --git a/drivers/gpu/drm/mediatek/mtk_hdmi_ddc.c b/drivers/gpu/drm/mediatek/mtk_hdmi_ddc.c index dfd1f07b39f0..e4bfef13e0e5 100644 --- a/drivers/gpu/drm/mediatek/mtk_hdmi_ddc.c +++ b/drivers/gpu/drm/mediatek/mtk_hdmi_ddc.c @@ -279,20 +279,16 @@ static int mtk_hdmi_ddc_probe(struct platform_device *pdev) return -ENOMEM; ddc->clk = devm_clk_get(dev, "ddc-i2c"); - if (IS_ERR(ddc->clk)) { - dev_err(dev, "get ddc_clk failed: %p ,\n", ddc->clk); - return PTR_ERR(ddc->clk); - } + if (IS_ERR(ddc->clk)) + return dev_err_probe(dev, PTR_ERR(ddc->clk), "get ddc_clk failed\n"); ddc->regs = devm_platform_get_and_ioremap_resource(pdev, 0, &mem); if (IS_ERR(ddc->regs)) return PTR_ERR(ddc->regs); ret = clk_prepare_enable(ddc->clk); - if (ret) { - dev_err(dev, "enable ddc clk failed!\n"); - return ret; - } + if (ret) + return dev_err_probe(dev, ret, "enable ddc clk failed!\n"); strscpy(ddc->adap.name, "mediatek-hdmi-ddc", sizeof(ddc->adap.name)); ddc->adap.owner = THIS_MODULE; diff --git a/drivers/gpu/drm/mediatek/mtk_mdp_rdma.c b/drivers/gpu/drm/mediatek/mtk_mdp_rdma.c index 4eac4cbc0764..ed519b5a3273 100644 --- a/drivers/gpu/drm/mediatek/mtk_mdp_rdma.c +++ b/drivers/gpu/drm/mediatek/mtk_mdp_rdma.c @@ -286,16 +286,12 @@ static int mtk_mdp_rdma_probe(struct platform_device *pdev) return -ENOMEM; priv->regs = devm_platform_get_and_ioremap_resource(pdev, 0, &res); - if (IS_ERR(priv->regs)) { - dev_err(dev, "failed to ioremap rdma\n"); - return PTR_ERR(priv->regs); - } + if (IS_ERR(priv->regs)) + return dev_err_probe(dev, PTR_ERR(priv->regs), "failed to ioremap rdma\n"); priv->clk = devm_clk_get(dev, NULL); - if (IS_ERR(priv->clk)) { - dev_err(dev, "failed to get rdma clk\n"); - return PTR_ERR(priv->clk); - } + if (IS_ERR(priv->clk)) + return dev_err_probe(dev, PTR_ERR(priv->clk), "failed to get rdma clk\n"); #if IS_REACHABLE(CONFIG_MTK_CMDQ) ret = cmdq_dev_get_client_reg(dev, &priv->cmdq_reg, 0); @@ -307,11 +303,11 @@ static int mtk_mdp_rdma_probe(struct platform_device *pdev) pm_runtime_enable(dev); ret = component_add(dev, &mtk_mdp_rdma_component_ops); - if (ret != 0) { + if (ret) { pm_runtime_disable(dev); - dev_err(dev, "Failed to add component: %d\n", ret); + return dev_err_probe(dev, ret, "Failed to add component\n"); } - return ret; + return 0; } static int mtk_mdp_rdma_remove(struct platform_device *pdev) From patchwork Thu Jun 8 10:12:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AngeloGioacchino Del Regno X-Patchwork-Id: 104917 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp180154vqr; Thu, 8 Jun 2023 03:32:34 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4bBuJv9CYyhrjMWE5RGVtu3UE1rWN/gdtXnVNKBFWMGqGLMSr+1v5dktATQqe6pAwQZ3V1 X-Received: by 2002:a05:6a00:a06:b0:64f:aea5:7b49 with SMTP id p6-20020a056a000a0600b0064faea57b49mr5853845pfh.17.1686220353736; Thu, 08 Jun 2023 03:32:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686220353; cv=none; d=google.com; s=arc-20160816; b=XNP9yFmpr1zDoJkq8756mjx7qQgEMWLTHHZS1t/lau2I3KJaOf8N/xfZg0b5YZoKU5 aGz0jLZn8tC3xv+G4+/Od31SmWklX+WtK/VBI9+MwYMEkvGtCCL/CGpQ/FdZ7aHRWbVn 6aJrC7qWSKADKUCVQqOwHITu3skEQpLcZMcMtgb1Ow+Nk3QRk76xydfToFomtLHoiw0j UQBrkbVxKL73aOx8mg0Vd6kb3yVkEdTADaHlY7Mdt9OqXYyIAHK33jGc9fXUS3W4wLX/ 4CDGv6FofpNBEc+m2k27w+lJO4ybVDFemcBwV/QK8Z/7pgirgPgiDKQaIWVgusxeO9zq aMIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=sahAcymEAWqAnhBAr/X0vmwAwyPK+3VayAyx6MCEh78=; b=VK/PV/OnNJivuhh0iXrBx/gPP13w854UqjxtEWO/PIPG66kZcM7bRJztPraiA+mQFu Pq3Ktm8oJj6AHIMgWxsc4lq2aZV7uOJ3/B/BaGTQB+BurmDOSpX+RWBIQXzc3rwgGe+F qK3N8uUlA/crULUx48bxtpHRFlc5ujvoWDA8xRhfghoTQq5zZ0FyndFket5cpz0wginV RYGi0evXKXz97DXUG4/khyB+tqzONaOa7TOAJLiGelMug6PzFIaB3CbpSja/sBkVDh26 jLnB+IVAPWJuzgH0vxMvccWBduhqn+cnFZtN/unpEvy3tNUZfybAn6H8Iqch63kt1vvw I4Wg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b="E29PLG/T"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k19-20020a628413000000b0064d47205f47si691895pfd.21.2023.06.08.03.32.20; Thu, 08 Jun 2023 03:32:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b="E29PLG/T"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235698AbjFHKM2 (ORCPT + 99 others); Thu, 8 Jun 2023 06:12:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35814 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235755AbjFHKMS (ORCPT ); Thu, 8 Jun 2023 06:12:18 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e5ab]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4EB071FE9 for ; Thu, 8 Jun 2023 03:12:17 -0700 (PDT) Received: from IcarusMOD.eternityproject.eu (unknown [IPv6:2001:b07:2ed:14ed:a962:cd4d:a84:1eab]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: kholk11) by madras.collabora.co.uk (Postfix) with ESMTPSA id 71D4E6606F1A; Thu, 8 Jun 2023 11:12:15 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1686219136; bh=GF4tnzCtxsr9pdT5eSOLmXcycHAMUaVktq69YdpqlWg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=E29PLG/Tj1opqJNtGeFTedq78BigBGJIcADohPpl9ZRpudFoszPwXsWSDTV5lM0Kv j+QQFw5bR7W44IW9Y7cPpEc0XSDJJbbKeFInwunr4XtKULug914RAv4RtxLXcPhk2k K1ES4eZ0h0Kayu3bsvMtfYXRQgt32Y7ZIUKBgWh13JHDbj7IdXISbRiv9tvm3YC6Dk cxS2Sq56DztBFW2+7ZS0/pOc+M7Pz2y6zeuhBl4XB8RqSMiJI21IodfPoIgfRCex/N r4oRj7T1yA3B28K1LlYka+mCw5HsGFSplBNWZM5ONI+kmv/HrlHgbLHqkHbumg+dbs a4350tnuOQXDA== From: AngeloGioacchino Del Regno To: chunkuang.hu@kernel.org Cc: p.zabel@pengutronix.de, airlied@gmail.com, daniel@ffwll.ch, matthias.bgg@gmail.com, angelogioacchino.delregno@collabora.com, dri-devel@lists.freedesktop.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kernel@collabora.com Subject: [PATCH 3/3] drm/mediatek: Use devm variant for pm_runtime_enable() when possible Date: Thu, 8 Jun 2023 12:12:09 +0200 Message-Id: <20230608101209.126499-4-angelogioacchino.delregno@collabora.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230608101209.126499-1-angelogioacchino.delregno@collabora.com> References: <20230608101209.126499-1-angelogioacchino.delregno@collabora.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768130193519651634?= X-GMAIL-MSGID: =?utf-8?q?1768130193519651634?= Simplify the error path of return functions and drop the call to pm_runtime_disable() in remove functions by switching to devm_pm_runtime_enable() where possible. Signed-off-by: AngeloGioacchino Del Regno Reviewed-by: Alexandre Mergnat Reviewed-by: CK Hu --- drivers/gpu/drm/mediatek/mtk_disp_ovl_adaptor.c | 9 ++++----- drivers/gpu/drm/mediatek/mtk_disp_rdma.c | 11 ++++------- drivers/gpu/drm/mediatek/mtk_mdp_rdma.c | 10 +++++----- 3 files changed, 13 insertions(+), 17 deletions(-) diff --git a/drivers/gpu/drm/mediatek/mtk_disp_ovl_adaptor.c b/drivers/gpu/drm/mediatek/mtk_disp_ovl_adaptor.c index 1993b688befa..14e8ad6c78c3 100644 --- a/drivers/gpu/drm/mediatek/mtk_disp_ovl_adaptor.c +++ b/drivers/gpu/drm/mediatek/mtk_disp_ovl_adaptor.c @@ -519,13 +519,13 @@ static int mtk_disp_ovl_adaptor_probe(struct platform_device *pdev) component_master_add_with_match(dev, &mtk_disp_ovl_adaptor_master_ops, match); - pm_runtime_enable(dev); + ret = devm_pm_runtime_enable(dev); + if (ret) + return ret; ret = component_add(dev, &mtk_disp_ovl_adaptor_comp_ops); - if (ret) { - pm_runtime_disable(dev); + if (ret) return dev_err_probe(dev, ret, "Failed to add component\n"); - } return 0; } @@ -533,7 +533,6 @@ static int mtk_disp_ovl_adaptor_probe(struct platform_device *pdev) static int mtk_disp_ovl_adaptor_remove(struct platform_device *pdev) { component_master_del(&pdev->dev, &mtk_disp_ovl_adaptor_master_ops); - pm_runtime_disable(&pdev->dev); return 0; } diff --git a/drivers/gpu/drm/mediatek/mtk_disp_rdma.c b/drivers/gpu/drm/mediatek/mtk_disp_rdma.c index 307be35b59fc..5e90b6d593f5 100644 --- a/drivers/gpu/drm/mediatek/mtk_disp_rdma.c +++ b/drivers/gpu/drm/mediatek/mtk_disp_rdma.c @@ -361,13 +361,13 @@ static int mtk_disp_rdma_probe(struct platform_device *pdev) platform_set_drvdata(pdev, priv); - pm_runtime_enable(dev); + ret = devm_pm_runtime_enable(dev); + if (ret) + return ret; ret = component_add(dev, &mtk_disp_rdma_component_ops); - if (ret) { - pm_runtime_disable(dev); + if (ret) return dev_err_probe(dev, ret, "Failed to add component\n"); - } return 0; } @@ -375,9 +375,6 @@ static int mtk_disp_rdma_probe(struct platform_device *pdev) static int mtk_disp_rdma_remove(struct platform_device *pdev) { component_del(&pdev->dev, &mtk_disp_rdma_component_ops); - - pm_runtime_disable(&pdev->dev); - return 0; } diff --git a/drivers/gpu/drm/mediatek/mtk_mdp_rdma.c b/drivers/gpu/drm/mediatek/mtk_mdp_rdma.c index ed519b5a3273..93ef05ec9720 100644 --- a/drivers/gpu/drm/mediatek/mtk_mdp_rdma.c +++ b/drivers/gpu/drm/mediatek/mtk_mdp_rdma.c @@ -300,20 +300,20 @@ static int mtk_mdp_rdma_probe(struct platform_device *pdev) #endif platform_set_drvdata(pdev, priv); - pm_runtime_enable(dev); + ret = devm_pm_runtime_enable(dev); + if (ret) + return ret; ret = component_add(dev, &mtk_mdp_rdma_component_ops); - if (ret) { - pm_runtime_disable(dev); + if (ret) return dev_err_probe(dev, ret, "Failed to add component\n"); - } + return 0; } static int mtk_mdp_rdma_remove(struct platform_device *pdev) { component_del(&pdev->dev, &mtk_mdp_rdma_component_ops); - pm_runtime_disable(&pdev->dev); return 0; }