From patchwork Tue Sep 10 16:09:00 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 11139849 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 2645E16B1 for ; Tue, 10 Sep 2019 16:09:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id F18E621019 for ; Tue, 10 Sep 2019 16:09:20 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="jB5WWGwX" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2436698AbfIJQJU (ORCPT ); Tue, 10 Sep 2019 12:09:20 -0400 Received: from mail-pf1-f196.google.com ([209.85.210.196]:41925 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2436639AbfIJQJH (ORCPT ); Tue, 10 Sep 2019 12:09:07 -0400 Received: by mail-pf1-f196.google.com with SMTP id b13so11777415pfo.8 for ; Tue, 10 Sep 2019 09:09:06 -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=jB5WWGwXXLkjLvAZdoToyHkhH94srGZ60DUbpccXHx2zP3koKdzgSTxjWRTMyUUxk6 qE2Mewj7ZGC868dmVOUcDDOjEiEAq0Da31quy/iR3ruDW7+raxlYAd5XZ2gNAoIxSTyP NwcNvTP1AJVqo7kxOWlm1+JJQoQj/vEd7L2aY= 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=FZ3s2fd7KGnT79b/HTW7UZqrilbrdcRypbHU8MRisbr+Aiaj8Ki+THPebjd4ucSake XLlHLj9/w8qu7nc7T5LgYpu+kQQ3o7E2PZCi1cV2Wa/QNKrM5Vmy86QyEZ10xrO0isUT kaijbPX1DmsConnCvCYNwtgJGsmgH5WZPP5hCKR/QU6LKoPDHVKXcCU/M0onPULtr8z7 LLkGxDROMlLvoO3gYq/EqFdBaxn4Ml5uoBtoxbrNwUgcYXeE+QsMTsxLBdaZURIBlD6f R1bO+XHGLrD5WTBsT7qvaQ8IHXCO0SVRk7K9tfXqgF4nisRxsqEZHYMTFEnVeR+XX7Mj fRaw== X-Gm-Message-State: APjAAAUEP3GA//T/LPIk3tKzd/h1hvWK0cLTlCfSEhEz7JQefJl8pSIG r3C6cXIU4+jaNEoGezx9zTT4ronDPaCl5Q== X-Google-Smtp-Source: APXvYqwQde81cPZARFYDS6NyOn+6Q4omsTP/UbXDzMG+88WgYZM8ISB0CE0RNxmhB0RjPIeWde62HA== X-Received: by 2002:a62:cd45:: with SMTP id o66mr37338117pfg.112.1568131746464; Tue, 10 Sep 2019 09:09:06 -0700 (PDT) Received: from smtp.gmail.com ([2620:15c:202:1:fa53:7765:582b:82b9]) by smtp.gmail.com with ESMTPSA id em21sm106088pjb.31.2019.09.10.09.09.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Sep 2019 09:09:06 -0700 (PDT) From: Stephen Boyd To: Dan Williams Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, Evan Green , Rob Herring , Bjorn Andersson , Andy Gross , Will Deacon , Catalin Marinas Subject: [PATCH v3 2/5] soc: qcom: cmd-db: Migrate to devm_memremap_reserved_mem() Date: Tue, 10 Sep 2019 09:09:00 -0700 Message-Id: <20190910160903.65694-3-swboyd@chromium.org> X-Mailer: git-send-email 2.23.0.162.g0b9fbb3734-goog In-Reply-To: <20190910160903.65694-1-swboyd@chromium.org> References: <20190910160903.65694-1-swboyd@chromium.org> MIME-Version: 1.0 Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org 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; }