From patchwork Wed Jun 24 15:06:58 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 11623497 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 45860913 for ; Wed, 24 Jun 2020 15:11:48 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C31B320656 for ; Wed, 24 Jun 2020 15:11:47 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="Nyxt4/RW"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="fDNdhuKb" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C31B320656 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=I4YOUUheVGL/z4sCF+qt9dvDF6zuHWo//0rhJS6kaGo=; b=Nyxt4/RWrt27NI/QzHBoBL8zD ky4LIO5YAQVuIz91aR3vq2vhTUzCvkMRweJaQgo2HbqGmCwnN8akXZU3UU9cTe7QI4yEWyUWyhaec FQ/WYnPLLYZaYQIhMaFlUuSCKL35zL5ys7U+NQwizTDGwI+47BKAoOI+LxX6llER+gNQfxTOydFEK 2KrGDFuOuc+ORQ+X5AGofWNxuV/+n+IfBrgJ83P/9ZJUOgNYxX8lFLBnz1whqNdfmt/N6A8T/3o0L ey/Pen8x02wEKtM9Ngr86+5A7RI71n/mINh6HgmfgkQ0wDLurcxkpdU/XSBeZfV6mOkRtH1VCsUHB Zwq8fD4rg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jo71H-0005Ej-E2; Wed, 24 Jun 2020 15:08:59 +0000 Received: from mail-wr1-x442.google.com ([2a00:1450:4864:20::442]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jo6zd-0004B9-RN for linux-arm-kernel@lists.infradead.org; Wed, 24 Jun 2020 15:07:20 +0000 Received: by mail-wr1-x442.google.com with SMTP id k6so2655868wrn.3 for ; Wed, 24 Jun 2020 08:07:17 -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=mWlJbsdlqYw5jcyMhAAPjydUuATe963bkCaEYyUu7rs=; b=fDNdhuKb0j3VVPDO8tDSy54CPULXaYK08sbKQIDy3ep1JOR9nBbVcUbCnIFZr5CSGA 3eEaUEy+1pLOj1z8WJl90MkZZFGGT9kDKYYvy3RI+KX1vuVVu04bxyv83MTjlwzOuWzF 3ZZ83AAafizu+5VZcyLjnzxd75QECfrxUTAwAfV1BnF1c01lu0M5M14g6I5rQJls58v5 STkDxI2Abl7qHAmtVyhd1iATdTFvFTyzTTPld5HJVriQgOMSNPGl/F7gMLR4eKX7QO6Q kTZFbd3qnehapxU5N/pyDV/KutSTw85dKRtaeRBtU3HYGlLQ7Pg8Gg33Pb89SizVNWQa lxnA== 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:mime-version:content-transfer-encoding; bh=mWlJbsdlqYw5jcyMhAAPjydUuATe963bkCaEYyUu7rs=; b=NeG5xs7uBxGoGDJUGfeC+jMKzV1cPeeuYo5l493NO6Cb4kH3wAhy9dAfR2CTnh7E8u QXiu/G7iywGKbo8YyGmbUUkJS5Y95Sy/nWd/VvR4TcXSandkmHSYmK5pRMSjqDsG9ki9 sLCtlvoAKbrQCV6+03bZ9dYMKUhu4K4afR1Mu9qkOSYyFPZ3dxk6ySD1ASKV3QdNCg8k SlqGMxBN3efblRjpiiMuDM76bXY+ARPodN4tqkDUNQpG2T7jrtEKMK7/abti9Q5oC77e cBg+WTlYIO50o7YkCpigJ5BK1XSTED7mDXzf4vxo1K0w4v6P3Y2PYv1wanorIwfGCDPg 8OOQ== X-Gm-Message-State: AOAM532gnfQJ6P4i1YO0WkaSdTmccZjPYjbUJJl4XBmDwp7r7NTbG7AI 67YUHet9n/DcQyDzYvwPhVRWbw== X-Google-Smtp-Source: ABdhPJy49Vio8rN9TQgC04M3RFdu5P/cZgoeUXhk9TTIv8QmZvoFN4fYe2L0VShsjN01Oh8SpVe4+A== X-Received: by 2002:adf:e4cc:: with SMTP id v12mr3692714wrm.92.1593011236167; Wed, 24 Jun 2020 08:07:16 -0700 (PDT) Received: from localhost.localdomain ([2.27.35.144]) by smtp.gmail.com with ESMTPSA id h14sm11543361wrt.36.2020.06.24.08.07.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Jun 2020 08:07:15 -0700 (PDT) From: Lee Jones To: lee.jones@linaro.org Subject: [PATCH 04/10] mfd: altera-sysmgr: Fix physical address storing hacks Date: Wed, 24 Jun 2020 16:06:58 +0100 Message-Id: <20200624150704.2729736-5-lee.jones@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200624150704.2729736-1-lee.jones@linaro.org> References: <20200624150704.2729736-1-lee.jones@linaro.org> MIME-Version: 1.0 X-Spam-Note: CRM114 invocation failed X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:442 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: stable@vger.kernel.org, Thor Thayer , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Sparse reports: drivers/mfd/altera-sysmgr.c:150:30: warning: incorrect type in assignment (different address spaces) drivers/mfd/altera-sysmgr.c:150:30: expected unsigned int [usertype] *base drivers/mfd/altera-sysmgr.c:150:30: got void [noderef] * drivers/mfd/altera-sysmgr.c:156:26: warning: incorrect type in argument 3 (different address spaces) drivers/mfd/altera-sysmgr.c:156:26: expected void [noderef] *regs drivers/mfd/altera-sysmgr.c:156:26: got unsigned int [usertype] *base It appears as though the driver data property 'resource_size_t *base' was being used to store 2 different types of addresses (physical and IO-mapped) under a single declared type. Fortunately, no value is recalled from the driver data entry, so it can be easily omitted. Instead we can use the value obtained directly from the platform resource to pass through Regmap into the call-backs to be used for the SMCC call and use a local dedicated __iomem variable for IO-remapping. Cc: Cc: Thor Thayer Signed-off-by: Lee Jones --- drivers/mfd/altera-sysmgr.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/drivers/mfd/altera-sysmgr.c b/drivers/mfd/altera-sysmgr.c index d2a13a547a3ca..83f0765f819b0 100644 --- a/drivers/mfd/altera-sysmgr.c +++ b/drivers/mfd/altera-sysmgr.c @@ -22,11 +22,9 @@ /** * struct altr_sysmgr - Altera SOCFPGA System Manager * @regmap: the regmap used for System Manager accesses. - * @base : the base address for the System Manager */ struct altr_sysmgr { struct regmap *regmap; - resource_size_t *base; }; static struct platform_driver altr_sysmgr_driver; @@ -127,6 +125,7 @@ static int sysmgr_probe(struct platform_device *pdev) struct regmap_config sysmgr_config = altr_sysmgr_regmap_cfg; struct device *dev = &pdev->dev; struct device_node *np = dev->of_node; + void __iomem *base; sysmgr = devm_kzalloc(dev, sizeof(*sysmgr), GFP_KERNEL); if (!sysmgr) @@ -139,22 +138,19 @@ static int sysmgr_probe(struct platform_device *pdev) sysmgr_config.max_register = resource_size(res) - sysmgr_config.reg_stride; if (of_device_is_compatible(np, "altr,sys-mgr-s10")) { - /* Need physical address for SMCC call */ - sysmgr->base = (resource_size_t *)res->start; sysmgr_config.reg_read = s10_protected_reg_read; sysmgr_config.reg_write = s10_protected_reg_write; - regmap = devm_regmap_init(dev, NULL, sysmgr->base, + /* Need physical address for SMCC call */ + regmap = devm_regmap_init(dev, NULL, (void *)res->start, &sysmgr_config); } else { - sysmgr->base = devm_ioremap(dev, res->start, - resource_size(res)); - if (!sysmgr->base) + base = devm_ioremap(dev, res->start, resource_size(res)); + if (!base) return -ENOMEM; sysmgr_config.max_register = res->end - res->start - 3; - regmap = devm_regmap_init_mmio(dev, sysmgr->base, - &sysmgr_config); + regmap = devm_regmap_init_mmio(dev, base, &sysmgr_config); } if (IS_ERR(regmap)) {