From patchwork Fri Sep 27 08:27:41 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "\(Exiting\) Baolin Wang" X-Patchwork-Id: 174605 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp3180436ill; Fri, 27 Sep 2019 01:28:11 -0700 (PDT) X-Google-Smtp-Source: APXvYqz5b8Vb1lmSD5L6C/+YGMTqy4jJEkSnKcYX0uLcCMNWYTl0Kgg4S4h9UR1RxtMRfq5qfy1R X-Received: by 2002:a50:f0d4:: with SMTP id a20mr3206924edm.149.1569572891332; Fri, 27 Sep 2019 01:28:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569572891; cv=none; d=google.com; s=arc-20160816; b=cAcRYFlN8L8H7n0/DdUzxesFtwPeAqUAPu7E6GNOx91ZcBE58pne3VOZd2tcMlNy5+ shzH4qSVcuEwnJuvFjO50MKgrzBTm5PjDPRt7n+3WGz8KFOczUJDgNYFaz6gPMzg934E CU65kqtp9a5DKuZd3LEbRQiIyuu8me4nsWBO+5dElrDtx3NqlBwXpZNYMpAF028V6DPw 4O3S+7V6to18kew8xF8OF7wnY8LpW/6ZPzz480Gdt/m51sVaYPk60+hI178lnM21Ib1S E6GVKvchSMNzecfcBdshHlJOGRi+5lQb1LY6M6G3Y+zsx7Krybl8FWSgMP82m96hVwjC v4Og== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature; bh=kup3jsm2T4Dp1CMpcneLGkz+TmvPB+cIre+Bt8N3oes=; b=ZJ6DXYWXtcuqiEz6c5UWnOQA4ii8iyv7y6nO3TTtF5S50sLj3o/a3f78efn1WgZvPs UItmP/Htb0EriqrWrjMXd5bCmoPjs2NrLpYF0hFxH2fQOLSBGAixqigyR5vsJkExMx8b xdZkWpCtstOZ77ANHkeuGUpBEGom4FW8tE547e+K8zcHMpyXPjAFtOHGNFHNmM+o0z/f b+E9aCITwH7Kx0BaHbxsVMWGPBFXYYuAGnUoBqZ4U6t0vajW1AKuo/203LpfvRg/iSWp n7FGwxWu0hcuXJ8dgD/Ua41Yn/uYNCFfXKiYlPw7mqZ92m+SHX5dQ42iQdeo7ydOs2Xn gqOA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=rpICZtHU; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-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. [209.132.180.67]) by mx.google.com with ESMTP id q1si1155113edj.354.2019.09.27.01.28.11; Fri, 27 Sep 2019 01:28:11 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=rpICZtHU; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-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 S1727102AbfI0I2K (ORCPT + 26 others); Fri, 27 Sep 2019 04:28:10 -0400 Received: from mail-pl1-f195.google.com ([209.85.214.195]:39827 "EHLO mail-pl1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726730AbfI0I2J (ORCPT ); Fri, 27 Sep 2019 04:28:09 -0400 Received: by mail-pl1-f195.google.com with SMTP id s17so785588plp.6 for ; Fri, 27 Sep 2019 01:28:09 -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 :in-reply-to:references; bh=kup3jsm2T4Dp1CMpcneLGkz+TmvPB+cIre+Bt8N3oes=; b=rpICZtHUVuixBVO9d63gc3dXlVxb5YYThUJCocG9ApQJYbNo/LxFKtQU5BHzYCzDwc wCoL5g5ttpMFs/gbhX3z9ojugOa2fWlQFa7Rd0LuJWQlT+IQe4lH4qxsWUOIMVSwqUXT uTT4JjV0ZBtr/GFzstQh90Zi5rpxlUijH+SZbUin3I289fbhcDde8eQaG1MamGu5F0NA wl2mgKMeTLY+dmDZmccS56NY/VpJT6knhUULKFmcsBQ6XqF6r8Wdez3brkUpGhmQgTpU HxHA3lwnbreMfHFCPN3M+6mSIcAEFwH/l6t4MELLMgZMOTXY+TMC3qRQLibaDWs44W2H c71w== 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:in-reply-to:references; bh=kup3jsm2T4Dp1CMpcneLGkz+TmvPB+cIre+Bt8N3oes=; b=gBIgyGdIER0Wgsg54B6PhXEkdz+kExg2vtU1+iHjbDvKC/h9aafTJF35Q2t7BCr5qI icJqNve5wZBUkYmnt7oNXwe2HazzjQdBqg7vnpSBueNhD6EAuA4DxLv9ADQdaNiQm5Dd naI7qh+qUS/YDsWwuQ7gWql32+cUAG6LWl/+TqGVj3miAQusU8UGZqKu5fkOoX6SK7HJ /IZMBQMaTT+g6lWoknm91gnsmvOOtwamdQLED8KfAzSXxMk3vp8VzMFrAx4/6+cb86zP IOD4KODTzwTcb6jusvVBR3OS5YcpaDzRjyvlxygANtYZNwuAByxPXPa2G3h1BEoWxvmZ C9JA== X-Gm-Message-State: APjAAAV1YMMvCuNBKK+eO1zJoh60QBeeGrWDUuA77R9LJPpI+WDUgftB kekCnUPmKIbpNkfdZr/N8MgJ9w== X-Received: by 2002:a17:902:a985:: with SMTP id bh5mr3242251plb.107.1569572889229; Fri, 27 Sep 2019 01:28:09 -0700 (PDT) Received: from baolinwangubtpc.spreadtrum.com ([117.18.48.82]) by smtp.gmail.com with ESMTPSA id 6sm2043521pfa.162.2019.09.27.01.28.06 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 27 Sep 2019 01:28:08 -0700 (PDT) From: Baolin Wang To: linus.walleij@linaro.org, ohad@wizery.com, bjorn.andersson@linaro.org Cc: baolin.wang@linaro.org, linux-arm-kernel@lists.infradead.org, linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/3] hwspinlock: u8500_hsem: Change to use devm_platform_ioremap_resource() Date: Fri, 27 Sep 2019 16:27:41 +0800 Message-Id: X-Mailer: git-send-email 1.7.9.5 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use the new helper that wraps the calls to platform_get_resource() and devm_ioremap_resource() together, which can simpify the code. Signed-off-by: Baolin Wang --- drivers/hwspinlock/u8500_hsem.c | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) -- 1.7.9.5 Reviewed-by: Linus Walleij diff --git a/drivers/hwspinlock/u8500_hsem.c b/drivers/hwspinlock/u8500_hsem.c index 572ca79..c247a87 100644 --- a/drivers/hwspinlock/u8500_hsem.c +++ b/drivers/hwspinlock/u8500_hsem.c @@ -88,7 +88,6 @@ static int u8500_hsem_probe(struct platform_device *pdev) struct hwspinlock_pdata *pdata = pdev->dev.platform_data; struct hwspinlock_device *bank; struct hwspinlock *hwlock; - struct resource *res; void __iomem *io_base; int i, ret, num_locks = U8500_MAX_SEMAPHORE; ulong val; @@ -96,13 +95,9 @@ static int u8500_hsem_probe(struct platform_device *pdev) if (!pdata) return -ENODEV; - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!res) - return -ENODEV; - - io_base = ioremap(res->start, resource_size(res)); - if (!io_base) - return -ENOMEM; + io_base = devm_platform_ioremap_resource(pdev, 0); + if (IS_ERR(io_base)) + return PTR_ERR(io_base); /* make sure protocol 1 is selected */ val = readl(io_base + HSEM_CTRL_REG); @@ -112,10 +107,8 @@ static int u8500_hsem_probe(struct platform_device *pdev) writel(0xFFFF, io_base + HSEM_ICRALL); bank = kzalloc(struct_size(bank, lock, num_locks), GFP_KERNEL); - if (!bank) { - ret = -ENOMEM; - goto iounmap_base; - } + if (!bank) + return -ENOMEM; platform_set_drvdata(pdev, bank); @@ -135,8 +128,6 @@ static int u8500_hsem_probe(struct platform_device *pdev) reg_fail: pm_runtime_disable(&pdev->dev); kfree(bank); -iounmap_base: - iounmap(io_base); return ret; } @@ -156,7 +147,6 @@ static int u8500_hsem_remove(struct platform_device *pdev) } pm_runtime_disable(&pdev->dev); - iounmap(io_base); kfree(bank); return 0;