From patchwork Fri Oct 1 17:43:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Andersson X-Patchwork-Id: 515085 Delivered-To: patch@linaro.org Received: by 2002:a02:606e:0:0:0:0:0 with SMTP id d46csp1020339jaf; Fri, 1 Oct 2021 10:42:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz9fcwbu4M1FVbSBNM3v7WRbzAN5u/gyZCM6OiZK1v4N9tzq9/UYJilzw5x0X04fxZVmWGs X-Received: by 2002:a17:90a:1904:: with SMTP id 4mr14627630pjg.190.1633110147393; Fri, 01 Oct 2021 10:42:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633110147; cv=none; d=google.com; s=arc-20160816; b=onf87vTSL6LUCLJgxGHNG1fDwBgnXEIH0J0lPLvDk3TtApZE8ljwOP9RAYrRE+XJBT iKTb56xFwWGllX9QCjokDSGDhbjm2TpVlPkWjylhAyATdu5DyQizu+80UHDsEtqCRaOS SAMHiuM1/WV++vPiqyZLrHSvqr6iYogX+elS2qFYwjYrgOZ5lALhGCPY6IKecLi7uHah c7xau8G1yfZ657lzeyMkTzWZcsv6RIDr2A6BRFnfDBZ0QWCR0qe7qOEjVlqMy6QAqbYm HKVhYdj185ZyDMGwGsDY3PO0Xc9Yl2JjhAaaqWdJfnVL//0/9nv8R+LflEqhes/RFuC2 lYHA== 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=fHZ78g5puTcAagNMTBHlfiD9Kb8rN2BoNZJ9C5Btpns=; b=N2EuzKn0pZfSNccCFq8zq4qH4N2/u8RTWP35mTs/zNIYVuXt3cxkZt472BxuWWBuaf hEepI2gNdRfKuAA66V+h8LT8WZRvbjfATm2CbQH4aDyuyW0iEjyMcBd4OkujuH8vws5i x1Y/meM3spOf5/8wWY2j96wC1o60YvjRi5siJQp6ZJPXuFmDO57wamANKPuI0hQnzYZ6 iS/xhcvKiWxIcg/x7msb2JeaWGf5eUOP+WNB2Xw3LBFRu1D6NChX+eAbwDWLiwFlThub Jk1kx0eDSYK8Ws+QtUm0W66XXP5vSMas31sjIMRxWS2XT/6iYAjgNZBPcwDLzzwVP82G 7nQA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=vZl6euf7; spf=pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f184si8092847pfb.67.2021.10.01.10.42.27; Fri, 01 Oct 2021 10:42:27 -0700 (PDT) Received-SPF: pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=vZl6euf7; spf=pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1355430AbhJARoE (ORCPT + 7 others); Fri, 1 Oct 2021 13:44:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42756 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354427AbhJARoC (ORCPT ); Fri, 1 Oct 2021 13:44:02 -0400 Received: from mail-oi1-x233.google.com (mail-oi1-x233.google.com [IPv6:2607:f8b0:4864:20::233]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 18B0AC0613E5 for ; Fri, 1 Oct 2021 10:42:18 -0700 (PDT) Received: by mail-oi1-x233.google.com with SMTP id s24so12342337oij.8 for ; Fri, 01 Oct 2021 10:42:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=fHZ78g5puTcAagNMTBHlfiD9Kb8rN2BoNZJ9C5Btpns=; b=vZl6euf7vMDgy/HfZaLxtxe6MvUas1MczCtWiJT8KkHgnHTjRL3SCeemb1hOwETRn6 qoVlhSc5gsYa/fGKsaKFcNyW4AASsVLTYW80xhIdGqDTptv9CYVfktclQTOtAen5zT5I li+hHfHNuRduBoqpkPJgmmeyI8Kv6QgDY9rIFCA0OZwKpLdh3Pi/rYletrVRKH4LttT1 PwgJzBl2lYDfCPhNbuZ84zmW+ic25rv+ETfLMxqnr/00oKpJ7mTAJrASEhmlvUiFw+6f uG6gL8Xkbir3FSTXO1sAQ26j3D3iXEQRSsXt/BVZC+70wgUa9LrNYQcRuAfngwMdNO98 1zBQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=fHZ78g5puTcAagNMTBHlfiD9Kb8rN2BoNZJ9C5Btpns=; b=FrhHW441e7KhdQ+Y85J9EhcqbCZeeNwsDbYTi+dkd730kf2Dgn/HcL4ExMG4GYsjgS aVjdIrlLz6+I7LhRmWy1VMOiWGbL8ShgWe70LEdCUEOvlVGobosOxPtVKn+d+x87YYpf ciUmAirp4CgvCpN1pU3Zv3JgQ30Tzz84Z8G2PHiUwO2exsc50CxLdYOB66qkKh57VxJO er1CbEGUeXPCoXKlfBmN+ISu/4YKjOz55QhLYeVorSa02RxCH+/w8mBMLDhcWnPy85VW kh0KLCm+ZRz081ZVFeSOMsjx+ylJrDvP5xA6LCNT8rL2fb75LcZrLQSDZCnTms/QQ0FQ r+1g== X-Gm-Message-State: AOAM5328S+6Tia1dhmo+98D50IsNayPVlC/yJSdPTGDWF/mPEClqjeY+ 3fTADH3ZOO1Of4T+/jO0kNusAA== X-Received: by 2002:a05:6808:2128:: with SMTP id r40mr4797532oiw.24.1633110137422; Fri, 01 Oct 2021 10:42:17 -0700 (PDT) Received: from localhost.localdomain ([2600:1700:a0:3dc8:205:1bff:fec0:b9b3]) by smtp.gmail.com with ESMTPSA id u15sm1369264oon.35.2021.10.01.10.42.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Oct 2021 10:42:16 -0700 (PDT) From: Bjorn Andersson To: Rob Clark , Sean Paul , David Airlie , Daniel Vetter , Rob Herring , Stephen Boyd , Abhinav Kumar Cc: Kuogee Hsieh , Tanmay Shah , Chandan Uddaraju , linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 3/5] drm/msm/dp: Refactor ioremap wrapper Date: Fri, 1 Oct 2021 10:43:58 -0700 Message-Id: <20211001174400.981707-4-bjorn.andersson@linaro.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20211001174400.981707-1-bjorn.andersson@linaro.org> References: <20211001174400.981707-1-bjorn.andersson@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org In order to deal with multiple memory ranges in the following commit change the ioremap wrapper to not poke directly into the dss_io_data struct. While at it, devm_ioremap_resource() already prints useful error messages on failure, so omit the unnecessary prints from the caller. Signed-off-by: Bjorn Andersson --- Changes since v2: - Switched to devm_platform_get_and_ioremap_resource() drivers/gpu/drm/msm/dp/dp_parser.c | 35 ++++++++++-------------------- drivers/gpu/drm/msm/dp/dp_parser.h | 2 +- 2 files changed, 12 insertions(+), 25 deletions(-) -- 2.29.2 diff --git a/drivers/gpu/drm/msm/dp/dp_parser.c b/drivers/gpu/drm/msm/dp/dp_parser.c index c064ced78278..c05ba1990218 100644 --- a/drivers/gpu/drm/msm/dp/dp_parser.c +++ b/drivers/gpu/drm/msm/dp/dp_parser.c @@ -19,40 +19,27 @@ static const struct dp_regulator_cfg sdm845_dp_reg_cfg = { }, }; -static int msm_dss_ioremap(struct platform_device *pdev, - struct dss_io_data *io_data) +static void __iomem *dp_ioremap(struct platform_device *pdev, int idx, size_t *len) { - struct resource *res = NULL; + struct resource *res; + void __iomem *base; - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!res) { - DRM_ERROR("%pS->%s: msm_dss_get_res failed\n", - __builtin_return_address(0), __func__); - return -ENODEV; - } - - io_data->len = (u32)resource_size(res); - io_data->base = devm_ioremap(&pdev->dev, res->start, io_data->len); - if (!io_data->base) { - DRM_ERROR("%pS->%s: ioremap failed\n", - __builtin_return_address(0), __func__); - return -EIO; - } + base = devm_platform_get_and_ioremap_resource(pdev, idx, &res); + if (!IS_ERR(base)) + *len = resource_size(res); - return 0; + return base; } static int dp_parser_ctrl_res(struct dp_parser *parser) { - int rc = 0; struct platform_device *pdev = parser->pdev; struct dp_io *io = &parser->io; + struct dss_io_data *dss = &io->dp_controller; - rc = msm_dss_ioremap(pdev, &io->dp_controller); - if (rc) { - DRM_ERROR("unable to remap dp io resources, rc=%d\n", rc); - return rc; - } + dss->base = dp_ioremap(pdev, 0, &dss->len); + if (IS_ERR(dss->base)) + return PTR_ERR(dss->base); io->phy = devm_phy_get(&pdev->dev, "dp"); if (IS_ERR(io->phy)) diff --git a/drivers/gpu/drm/msm/dp/dp_parser.h b/drivers/gpu/drm/msm/dp/dp_parser.h index 34b49628bbaf..dc62e70b1640 100644 --- a/drivers/gpu/drm/msm/dp/dp_parser.h +++ b/drivers/gpu/drm/msm/dp/dp_parser.h @@ -26,7 +26,7 @@ enum dp_pm_type { }; struct dss_io_data { - u32 len; + size_t len; void __iomem *base; };