From patchwork Wed Jul 9 21:21:12 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: HIMANGI SARAOGI X-Patchwork-Id: 4519941 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.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id C9C6B9F1C4 for ; Wed, 9 Jul 2014 21:21:46 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 070F920384 for ; Wed, 9 Jul 2014 21:21:46 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id BA47C200F3 for ; Wed, 9 Jul 2014 21:21:44 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id CAEBB26519B; Wed, 9 Jul 2014 23:21:42 +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=-1.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, NO_DNS_FOR_FROM, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=no version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id D35D6265158; Wed, 9 Jul 2014 23:21:31 +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 1E503265152; Wed, 9 Jul 2014 23:21:30 +0200 (CEST) Received: from mail-pa0-f43.google.com (mail-pa0-f43.google.com [209.85.220.43]) by alsa0.perex.cz (Postfix) with ESMTP id BB213265152 for ; Wed, 9 Jul 2014 23:21:21 +0200 (CEST) Received: by mail-pa0-f43.google.com with SMTP id lf10so9866536pab.2 for ; Wed, 09 Jul 2014 14:21:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:mime-version:content-type :content-disposition:user-agent; bh=F3/bDrYQZx53UaF2mAvM0ne9jN5RHLUHsYlbEJ2ucg4=; b=PLcDhr32A65/Au2eiSdhENRppHZBPdtaOoRqZPIP7eo4hLiHJjHoPJWJdD4EHv4bZN xtIUiEQmG80T55vxC5T2Efvp2LTWuWILt3VEAPXZV1a85rOEWlDqJ2+xCNPQCAOziwFT 11tibjX4mrAxtzHIojYTQohy+1qz5tdRCtEn5go8mtGdA943k/JZX01tpMTqYiV5a4tW x4+1+CPUaLXfgQJD70iNwD+UdNPbsPmBxCyjhl5tAWJH4W871UIZw1Tda5bd8plkrdkl +MJsrd5YM20QrD8yVXFwmZAz8DOjYnsQK906j/eloYjsVFPG0QwfesLGbEh07FQrPQoW KRdQ== X-Received: by 10.70.90.207 with SMTP id by15mr13193984pdb.31.1404940879586; Wed, 09 Jul 2014 14:21:19 -0700 (PDT) Received: from localhost ([182.65.208.116]) by mx.google.com with ESMTPSA id a10sm25192038pdn.90.2014.07.09.14.21.15 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Wed, 09 Jul 2014 14:21:18 -0700 (PDT) Date: Thu, 10 Jul 2014 02:51:12 +0530 From: Himangi Saraogi To: Peter Ujfalusi , Jarkko Nikula , Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , linux-omap@vger.kernel.org, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org Message-ID: <20140709212112.GA11848@himangi-Dell> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Cc: julia.lawall@lip6.fr Subject: [alsa-devel] [PATCH] ASoC: omap-dmic: use managed interfaces 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 This patch moves data allocated using clk_put and snd_soc_register_component to the corresponding managed interfaces and does away with the functions to free memory in the probe and remove functions. The probe function is no longer required and is completely removed. Signed-off-by: Himangi Saraogi Acked-by: Julia Lawall Acked-by: Peter Ujfalusi --- sound/soc/omap/omap-dmic.c | 35 ++++++++--------------------------- 1 file changed, 8 insertions(+), 27 deletions(-) diff --git a/sound/soc/omap/omap-dmic.c b/sound/soc/omap/omap-dmic.c index 6925d71..b315b27 100644 --- a/sound/soc/omap/omap-dmic.c +++ b/sound/soc/omap/omap-dmic.c @@ -466,7 +466,7 @@ static int asoc_dmic_probe(struct platform_device *pdev) mutex_init(&dmic->mutex); - dmic->fclk = clk_get(dmic->dev, "fck"); + dmic->fclk = devm_clk_get(dmic->dev, "fck"); if (IS_ERR(dmic->fclk)) { dev_err(dmic->dev, "cant get fck\n"); return -ENODEV; @@ -475,8 +475,7 @@ static int asoc_dmic_probe(struct platform_device *pdev) res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "dma"); if (!res) { dev_err(dmic->dev, "invalid dma memory resource\n"); - ret = -ENODEV; - goto err_put_clk; + return -ENODEV; } dmic->dma_data.addr = res->start + OMAP_DMIC_DATA_REG; @@ -484,34 +483,17 @@ static int asoc_dmic_probe(struct platform_device *pdev) res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "mpu"); dmic->io_base = devm_ioremap_resource(&pdev->dev, res); - if (IS_ERR(dmic->io_base)) { - ret = PTR_ERR(dmic->io_base); - goto err_put_clk; - } - + if (IS_ERR(dmic->io_base)) + return PTR_ERR(dmic->io_base); - ret = snd_soc_register_component(&pdev->dev, &omap_dmic_component, - &omap_dmic_dai, 1); + ret = devm_snd_soc_register_component(&pdev->dev, &omap_dmic_component, + &omap_dmic_dai, 1); if (ret) - goto err_put_clk; + return ret; ret = omap_pcm_platform_register(&pdev->dev); if (ret) - goto err_put_clk; - - return 0; - -err_put_clk: - clk_put(dmic->fclk); - return ret; -} - -static int asoc_dmic_remove(struct platform_device *pdev) -{ - struct omap_dmic *dmic = platform_get_drvdata(pdev); - - snd_soc_unregister_component(&pdev->dev); - clk_put(dmic->fclk); + return ret; return 0; } @@ -529,7 +511,6 @@ static struct platform_driver asoc_dmic_driver = { .of_match_table = omap_dmic_of_match, }, .probe = asoc_dmic_probe, - .remove = asoc_dmic_remove, }; module_platform_driver(asoc_dmic_driver);