From patchwork Mon Aug 24 08:47:36 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Axel Lin X-Patchwork-Id: 7061831 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 7AD8F9F305 for ; Mon, 24 Aug 2015 08:47:57 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 93447201B4 for ; Mon, 24 Aug 2015 08:47:56 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 97A8720211 for ; Mon, 24 Aug 2015 08:47:54 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 2C02726065C; Mon, 24 Aug 2015 10:47:53 +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 1A78D26063A; Mon, 24 Aug 2015 10:47:51 +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 09A48260653; Mon, 24 Aug 2015 10:47:49 +0200 (CEST) Received: from mail-pa0-f42.google.com (mail-pa0-f42.google.com [209.85.220.42]) by alsa0.perex.cz (Postfix) with ESMTP id A51BF260471 for ; Mon, 24 Aug 2015 10:47:42 +0200 (CEST) Received: by pabzx8 with SMTP id zx8so1812168pab.1 for ; Mon, 24 Aug 2015 01:47:41 -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:content-type :mime-version:content-transfer-encoding; bh=AgN3oVXT03e3+E1bpsWlOO9EtJGBL4lOwEA5iklCj6g=; b=MEFcs8NMxwPlK6lTHIMFudFh3Z4EVTN9t7yABwH7HXSGYFWzoJzspH7Mwpol+xzHFk 7/O0TOTDt6h/805FauYjcKyzd/LD142U7V3i1oTIjIjZGih/XSLIVRFr6I0EdAxoX4v0 6FDYYFpeT5NR7L9tUEAWn0IRPnwxkHUlxxAtGXzVqMey+WPumOVfgRg83r8j/YEU35VE ZrOKFyr4ySo5U1QhflARR1Q7Fv1DykgcYO1H+jzAFDXZw5jgiHqQ2+jGe0lvA8tqbiQE WUm7Wgb5LM1feinBizp8KvOvjFATI+FP5orjeF9kwRWJRhBa9Nt7e8QaWqe5jIeXz+NM Veag== X-Gm-Message-State: ALoCoQlp587rAou4InOILxmiswXqNuyYPxM8LHNIUs+lwiqIZf2/XLESbl4hzpE9zA/AOAegTua6 X-Received: by 10.66.100.168 with SMTP id ez8mr43008231pab.142.1440406060740; Mon, 24 Aug 2015 01:47:40 -0700 (PDT) Received: from phoenix (118-167-22-34.dynamic.hinet.net. [118.167.22.34]) by smtp.gmail.com with ESMTPSA id vw6sm14459256pab.14.2015.08.24.01.47.38 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 24 Aug 2015 01:47:39 -0700 (PDT) Message-ID: <1440406056.27868.0.camel@ingics.com> From: Axel Lin To: Mark Brown Date: Mon, 24 Aug 2015 16:47:36 +0800 X-Mailer: Evolution 3.12.10-0ubuntu1~14.10.1 Mime-Version: 1.0 Cc: Vipin Kumar , alsa-devel@alsa-project.org, Liam Girdwood , Jyri Sarha , "Hebbar, Gururaja" , Peter Ujfalusi , Thomas =?ISO-8859-1?Q?Niederpr=FCm?= Subject: [alsa-devel] [PATCH 1/3] ASoC: davinci: 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 Acked-by: Peter Ujfalusi --- sound/soc/davinci/davinci-i2s.c | 25 ++++++------------------- sound/soc/davinci/davinci-mcasp.c | 18 ++++-------------- 2 files changed, 10 insertions(+), 33 deletions(-) diff --git a/sound/soc/davinci/davinci-i2s.c b/sound/soc/davinci/davinci-i2s.c index 56cb4d9..ec98548 100644 --- a/sound/soc/davinci/davinci-i2s.c +++ b/sound/soc/davinci/davinci-i2s.c @@ -651,23 +651,15 @@ static const struct snd_soc_component_driver davinci_i2s_component = { static int davinci_i2s_probe(struct platform_device *pdev) { struct davinci_mcbsp_dev *dev; - struct resource *mem, *ioarea, *res; + struct resource *mem, *res; + void __iomem *io_base; int *dma; int ret; mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!mem) { - dev_err(&pdev->dev, "no mem resource?\n"); - return -ENODEV; - } - - ioarea = devm_request_mem_region(&pdev->dev, mem->start, - resource_size(mem), - pdev->name); - if (!ioarea) { - dev_err(&pdev->dev, "McBSP region already claimed\n"); - return -EBUSY; - } + io_base = devm_ioremap_resource(&pdev->dev, mem); + if (IS_ERR(io_base)) + return PTR_ERR(io_base); dev = devm_kzalloc(&pdev->dev, sizeof(struct davinci_mcbsp_dev), GFP_KERNEL); @@ -679,12 +671,7 @@ static int davinci_i2s_probe(struct platform_device *pdev) return -ENODEV; clk_enable(dev->clk); - dev->base = devm_ioremap(&pdev->dev, mem->start, resource_size(mem)); - if (!dev->base) { - dev_err(&pdev->dev, "ioremap failed\n"); - ret = -ENOMEM; - goto err_release_clk; - } + dev->base = io_base; dev->dma_data[SNDRV_PCM_STREAM_PLAYBACK].addr = (dma_addr_t)(mem->start + DAVINCI_MCBSP_DXR_REG); diff --git a/sound/soc/davinci/davinci-mcasp.c b/sound/soc/davinci/davinci-mcasp.c index b960e62..add6bb9 100644 --- a/sound/soc/davinci/davinci-mcasp.c +++ b/sound/soc/davinci/davinci-mcasp.c @@ -1613,7 +1613,7 @@ static int davinci_mcasp_get_dma_type(struct davinci_mcasp *mcasp) static int davinci_mcasp_probe(struct platform_device *pdev) { struct snd_dmaengine_dai_dma_data *dma_data; - struct resource *mem, *ioarea, *res, *dat; + struct resource *mem, *res, *dat; struct davinci_mcasp_pdata *pdata; struct davinci_mcasp *mcasp; char *irq_name; @@ -1648,22 +1648,12 @@ static int davinci_mcasp_probe(struct platform_device *pdev) } } - ioarea = devm_request_mem_region(&pdev->dev, mem->start, - resource_size(mem), pdev->name); - if (!ioarea) { - dev_err(&pdev->dev, "Audio region already claimed\n"); - return -EBUSY; - } + mcasp->base = devm_ioremap_resource(&pdev->dev, mem); + if (IS_ERR(mcasp->base)) + return PTR_ERR(mcasp->base); pm_runtime_enable(&pdev->dev); - mcasp->base = devm_ioremap(&pdev->dev, mem->start, resource_size(mem)); - if (!mcasp->base) { - dev_err(&pdev->dev, "ioremap failed\n"); - ret = -ENOMEM; - goto err; - } - mcasp->op_mode = pdata->op_mode; /* sanity check for tdm slots parameter */ if (mcasp->op_mode == DAVINCI_MCASP_IIS_MODE) {