From patchwork Fri Jun 14 20:37:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 10996803 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 D4060112C for ; Fri, 14 Jun 2019 20:42:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C44C128733 for ; Fri, 14 Jun 2019 20:42:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B89A42876E; Fri, 14 Jun 2019 20:42:30 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 19FE928733 for ; Fri, 14 Jun 2019 20:42:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.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=XLXXvj7n3hXQt+SIwTC2uh6ev9+CHz7+tlatL4dMT7I=; b=NR5IFme7S3DYiQ kpOv4TAi+sAm36C42UYxz3L+jniJ+Zu8fb5v7jUikI746w6f34ZMd+wtcbjt/uI3Giq+lxw2gTqy3 gbY23vLJEOfVwg2nJN+q0TQWoJEWwOxR2t48MSFVItqmYzhkKn9oIHODeNxISfNoRd5OlVoX9g4YW BkG3zUgmAU7F5bgiE6VVmlsQR+3fxJs9/ZoRyGVSrmZMeweL4PE8H7cwPNqRTQYlUHX5AENqZ+Tux vLmtxBTrj+rK18AcrUmNfjpXqWmGZXtzVAIgH1FWkRWXH3YCwDtr520gHF6mhoxNEMfhTd5fC9UPC deDUDDky+XIFOtoWeJWg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hbt1o-0001iB-RN; Fri, 14 Jun 2019 20:42:28 +0000 Received: from mail-pl1-x641.google.com ([2607:f8b0:4864:20::641]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hbsws-0004Kc-6M for linux-arm-kernel@lists.infradead.org; Fri, 14 Jun 2019 20:37:34 +0000 Received: by mail-pl1-x641.google.com with SMTP id a93so1454539pla.7 for ; Fri, 14 Jun 2019 13:37:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Xc2tEV/bPIimEWuq/mx6XQl4uW5E/9HmwBDqWANEBLQ=; b=f+xML+VchGG9yvxavXjNsjNVbK3VAFrVVcq6kWal4BvttG0orUQbFLW2olqgj7BMzy +G7z0QsC9mySDJXmWmhC1V4p5CHk3tZWZJj8CjbNwgDyIoLBSveQC5b6e6/iYESAFrgo B3JUcipxuBLgYl0hkupxbWFA7XeDaeSE05pCI= 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=Xc2tEV/bPIimEWuq/mx6XQl4uW5E/9HmwBDqWANEBLQ=; b=rX2DVSu1hUKHMSUpfaBo4dPxJLIr1tGGj2oOLkdiX5H+E0N9S7ElDHMzA21giD5ywM bWknMSmKNcI5MZaIqLSvQgOvelRqFcTMCxA+tAVtjB3sTh5zjod7a06h+gNEJUNK5W2S z6XF2n21wO5q+wpAAyA25/4jku83hf1Xet3x8WtWoI+MFkG+d3OaCnjLyJZktaHfJz0n AAaj18XJ1XURwTlgY7EBTN7u0qYeSxzDIF+6qXMdr11d29XR81ZvqBOz0dkXsa6TYrdL J7cOHbTTCYJagXj9w0iAJItdN7fHowxiTl63ThY/x4RULDY4DpXS8tIZGHt+gdg+XoGX FFmA== X-Gm-Message-State: APjAAAUvpXYl0uLFy4rJ5o65ki3xgqQ/G+ga6cGd3CpYsgtViVV9fITK 4AQU3gqi9mdpY70JFUS8XlyGAQ== X-Google-Smtp-Source: APXvYqzGtL2Jtymma+e1JFXRy/AlOyyMqpctXtRvu9IkvOp5322GgCYlv2vgbvWRfDVD3ZikBHfDrg== X-Received: by 2002:a17:902:2ae6:: with SMTP id j93mr97791257plb.130.1560544641087; Fri, 14 Jun 2019 13:37:21 -0700 (PDT) Received: from smtp.gmail.com ([2620:15c:202:1:fa53:7765:582b:82b9]) by smtp.gmail.com with ESMTPSA id x5sm3673187pjp.21.2019.06.14.13.37.20 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 14 Jun 2019 13:37:20 -0700 (PDT) From: Stephen Boyd To: Dan Williams Subject: [PATCH v2 2/5] soc: qcom: cmd-db: Migrate to devm_memremap_reserved_mem() Date: Fri, 14 Jun 2019 13:37:14 -0700 Message-Id: <20190614203717.75479-3-swboyd@chromium.org> X-Mailer: git-send-email 2.22.0.410.gd8fdbe21b5-goog In-Reply-To: <20190614203717.75479-1-swboyd@chromium.org> References: <20190614203717.75479-1-swboyd@chromium.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190614_133722_246719_32F95633 X-CRM114-Status: GOOD ( 12.92 ) 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: devicetree@vger.kernel.org, linux-arm-msm@vger.kernel.org, Will Deacon , linux-kernel@vger.kernel.org, Evan Green , Bjorn Andersson , Rob Herring , Andy Gross , Catalin Marinas , 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 X-Virus-Scanned: ClamAV using ClamSMTP This gets rid of some duplicate code, and also makes the reserved memory region show up as 'cmd-db' memory in /proc/iomem. Cc: Evan Green Cc: Rob Herring Cc: Bjorn Andersson Cc: Andy Gross Cc: Will Deacon Cc: Catalin Marinas Cc: Dan Williams Reviewed-by: Bjorn Andersson Signed-off-by: Stephen Boyd --- drivers/soc/qcom/cmd-db.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/drivers/soc/qcom/cmd-db.c b/drivers/soc/qcom/cmd-db.c index f6c3d17b05c7..10a34d26b753 100644 --- a/drivers/soc/qcom/cmd-db.c +++ b/drivers/soc/qcom/cmd-db.c @@ -238,18 +238,11 @@ EXPORT_SYMBOL(cmd_db_read_slave_id); static int cmd_db_dev_probe(struct platform_device *pdev) { - struct reserved_mem *rmem; int ret = 0; - rmem = of_reserved_mem_lookup(pdev->dev.of_node); - if (!rmem) { - dev_err(&pdev->dev, "failed to acquire memory region\n"); - return -EINVAL; - } - - cmd_db_header = memremap(rmem->base, rmem->size, MEMREMAP_WB); - if (!cmd_db_header) { - ret = -ENOMEM; + cmd_db_header = devm_memremap_reserved_mem(&pdev->dev, MEMREMAP_WB); + if (IS_ERR(cmd_db_header)) { + ret = PTR_ERR(cmd_db_header); cmd_db_header = NULL; return ret; }