From patchwork Mon Aug 24 08:52:30 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Axel Lin X-Patchwork-Id: 7061971 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 434E49F305 for ; Mon, 24 Aug 2015 08:52:56 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 77ACD20607 for ; Mon, 24 Aug 2015 08:52:55 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 1BD0D20390 for ; Mon, 24 Aug 2015 08:52:53 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id F1BC8260699; Mon, 24 Aug 2015 10:52:51 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id 83627260609; Mon, 24 Aug 2015 10:52:44 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id C9A7826063A; Mon, 24 Aug 2015 10:52:42 +0200 (CEST) Received: from mail-pd0-f169.google.com (mail-pd0-f169.google.com [209.85.192.169]) by alsa0.perex.cz (Postfix) with ESMTP id 9FEB3260471 for ; Mon, 24 Aug 2015 10:52:35 +0200 (CEST) Received: by pdob1 with SMTP id b1so51059357pdo.2 for ; Mon, 24 Aug 2015 01:52:34 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:subject:from:to:cc:date:in-reply-to :references:content-type:mime-version:content-transfer-encoding; bh=2qImA1atOpFOXTv57dNcO1fjsEenPj8YIv+z3uQIwtQ=; b=Zk76TXTuEue5o/AFQ+pr2MfJOt2Py/3RbPIwDbqwPuPxgK/Sh9bqfcZUgFmXFvDuoj O9WgFR/EVa6xuoNGia5WOvvHkHqASDvmxKgzDn4HxGdNy9mGL6M9yQS3/g4jwTk+UpoO UqMvh7y1+8/8KudtmTDvBEA94XjmKFKS013ZhwgRFvRoOLHkE079DLXLGbGplmrrlqeH CM8/L0wN5RTD5s5gj95dj8wgDmKpun8RiGD/R70hc9wqZKQZmPvPVo2D3kZqBjWvVgYT 1O8wtTr4vgu5kICsLLi3V70lzbVLeS8Jr2/otfav8YqZy8o49ycfL+iK3dVmirgurfsu 5IqA== X-Gm-Message-State: ALoCoQlLCJv7eltDyNh3++v4vDHqaYia+GWqK0c1hKiEi0lxLr/dwlCEH0KTlqDtMuCzfJKY3bBz X-Received: by 10.70.132.36 with SMTP id or4mr43522282pdb.29.1440406354783; Mon, 24 Aug 2015 01:52:34 -0700 (PDT) Received: from phoenix (118-167-22-34.dynamic.hinet.net. [118.167.22.34]) by smtp.gmail.com with ESMTPSA id v9sm16524935pdn.69.2015.08.24.01.52.32 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 24 Aug 2015 01:52:33 -0700 (PDT) Message-ID: <1440406350.27868.5.camel@ingics.com> From: Axel Lin To: Mark Brown Date: Mon, 24 Aug 2015 16:52:30 +0800 In-Reply-To: <1440406056.27868.0.camel@ingics.com> References: <1440406056.27868.0.camel@ingics.com> X-Mailer: Evolution 3.12.10-0ubuntu1~14.10.1 Mime-Version: 1.0 Cc: alsa-devel@alsa-project.org, Kuninori Morimoto , Liam Girdwood , Jyri Sarha , Peter Ujfalusi , Thomas =?ISO-8859-1?Q?Niederpr=FCm?= Subject: [alsa-devel] [PATCH 3/3] ASoC: SPEAr: Convert to use devm_ioremap_resource X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP Use devm_ioremap_resource() instead of open code. Signed-off-by: Axel Lin --- sound/soc/spear/spdif_in.c | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/sound/soc/spear/spdif_in.c b/sound/soc/spear/spdif_in.c index a402860..977a078 100644 --- a/sound/soc/spear/spdif_in.c +++ b/sound/soc/spear/spdif_in.c @@ -203,35 +203,25 @@ static int spdif_in_probe(struct platform_device *pdev) struct spdif_in_dev *host; struct spear_spdif_platform_data *pdata; struct resource *res, *res_fifo; + void __iomem *io_base; int ret; res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!res) - return -EINVAL; + io_base = devm_ioremap_resource(&pdev->dev, res); + if (IS_ERR(io_base)) + return PTR_ERR(io_base); res_fifo = platform_get_resource(pdev, IORESOURCE_IO, 0); if (!res_fifo) return -EINVAL; - if (!devm_request_mem_region(&pdev->dev, res->start, - resource_size(res), pdev->name)) { - dev_warn(&pdev->dev, "Failed to get memory resourse\n"); - return -ENOENT; - } - host = devm_kzalloc(&pdev->dev, sizeof(*host), GFP_KERNEL); if (!host) { dev_warn(&pdev->dev, "kzalloc fail\n"); return -ENOMEM; } - host->io_base = devm_ioremap(&pdev->dev, res->start, - resource_size(res)); - if (!host->io_base) { - dev_warn(&pdev->dev, "ioremap failed\n"); - return -ENOMEM; - } - + host->io_base = io_base; host->irq = platform_get_irq(pdev, 0); if (host->irq < 0) return -EINVAL;