From patchwork Mon Jul 22 11:02:55 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sachin Kamat X-Patchwork-Id: 18508 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-yh0-f72.google.com (mail-yh0-f72.google.com [209.85.213.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id AF90125E1F for ; Mon, 22 Jul 2013 11:19:22 +0000 (UTC) Received: by mail-yh0-f72.google.com with SMTP id z20sf249627yhz.3 for ; Mon, 22 Jul 2013 04:19:22 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-beenthere:x-forwarded-to:x-forwarded-for :delivered-to:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references:x-gm-message-state:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-google-group-id:list-post:list-help:list-archive:list-unsubscribe; bh=UOW+DMkng+sXiDqBdIxJ0vea/mfePjumJLJNw5136tk=; b=GVdnJMk9kQX01eg1UJcnwMLwg1z5iEyBCcUh82ooV/yVSr8noHvME0Y6ooEF1uk8AF gf21N6pbP/9c5JQagC7a/mxKDMd1M5KlO5EuknxizwQpbsLrOHoJvTzYSV72WSP/SOaY 92dVLVpg9NPuwUTXd2xQyvpCfPcyE3bZfVrmf8ptYyueynN1vJlDvjGvwfgV0F/1rzcC vqT0BT1jHqcUHAd9KBBc27Q/lIQxFxbEHlZgBY3+Q35c3TE6lRcadFD01QeFx9JYMtwi 0s6ek8D7TPWznUV/0qmkIGddmwTXfURzT3hN+YTLobqwTcJeuRgMfZUeaNWabI/Kr+1W ybnA== X-Received: by 10.236.113.77 with SMTP id z53mr9730389yhg.47.1374491962395; Mon, 22 Jul 2013 04:19:22 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.50.228 with SMTP id f4ls2643654qeo.29.gmail; Mon, 22 Jul 2013 04:19:22 -0700 (PDT) X-Received: by 10.221.36.4 with SMTP id sy4mr9338047vcb.11.1374491962283; Mon, 22 Jul 2013 04:19:22 -0700 (PDT) Received: from mail-vc0-f170.google.com (mail-vc0-f170.google.com [209.85.220.170]) by mx.google.com with ESMTPS id fp17si6905247vcb.39.2013.07.22.04.19.22 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 22 Jul 2013 04:19:22 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.170 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.170; Received: by mail-vc0-f170.google.com with SMTP id hv10so2003731vcb.29 for ; Mon, 22 Jul 2013 04:19:22 -0700 (PDT) X-Received: by 10.52.77.5 with SMTP id o5mr7677434vdw.46.1374491962202; Mon, 22 Jul 2013 04:19:22 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.58.165.8 with SMTP id yu8csp50161veb; Mon, 22 Jul 2013 04:19:21 -0700 (PDT) X-Received: by 10.68.196.134 with SMTP id im6mr30129641pbc.110.1374491961366; Mon, 22 Jul 2013 04:19:21 -0700 (PDT) Received: from mail-pa0-f53.google.com (mail-pa0-f53.google.com [209.85.220.53]) by mx.google.com with ESMTPS id gk2si18482349pbb.169.2013.07.22.04.19.20 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 22 Jul 2013 04:19:21 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.53 is neither permitted nor denied by best guess record for domain of sachin.kamat@linaro.org) client-ip=209.85.220.53; Received: by mail-pa0-f53.google.com with SMTP id lb1so140925pab.40 for ; Mon, 22 Jul 2013 04:19:20 -0700 (PDT) X-Received: by 10.68.189.8 with SMTP id ge8mr1304169pbc.160.1374491960911; Mon, 22 Jul 2013 04:19:20 -0700 (PDT) Received: from linaro.sisodomain.com ([115.113.119.130]) by mx.google.com with ESMTPSA id ry2sm35249515pbc.41.2013.07.22.04.19.15 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 22 Jul 2013 04:19:20 -0700 (PDT) From: Sachin Kamat To: linux-iio@vger.kernel.org Cc: jic23@cam.ac.uk, jic23@kernel.org, sachin.kamat@linaro.org, patches@linaro.org, Naveen Krishna Chatradhi Subject: [PATCH 2/8] iio: exynos_adc: Use devm_iio_device_alloc Date: Mon, 22 Jul 2013 16:32:55 +0530 Message-Id: <1374490981-24373-3-git-send-email-sachin.kamat@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1374490981-24373-1-git-send-email-sachin.kamat@linaro.org> References: <1374490981-24373-1-git-send-email-sachin.kamat@linaro.org> X-Gm-Message-State: ALoCoQn8reaoLdX6u4zw9KZF1EBRE/5JGilT4WLyklgL7W7XRTlshsc6tk/1tyd3STzEOH4sigRZ X-Original-Sender: sachin.kamat@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.170 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Using devm_iio_device_alloc makes code simpler. Signed-off-by: Sachin Kamat Cc: Naveen Krishna Chatradhi --- drivers/iio/adc/exynos_adc.c | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/drivers/iio/adc/exynos_adc.c b/drivers/iio/adc/exynos_adc.c index 9809fc9..d25b262 100644 --- a/drivers/iio/adc/exynos_adc.c +++ b/drivers/iio/adc/exynos_adc.c @@ -33,6 +33,7 @@ #include #include #include +#include #include #include @@ -261,7 +262,7 @@ static int exynos_adc_probe(struct platform_device *pdev) if (!np) return ret; - indio_dev = iio_device_alloc(sizeof(struct exynos_adc)); + indio_dev = devm_iio_device_alloc(&pdev->dev, sizeof(struct exynos_adc)); if (!indio_dev) { dev_err(&pdev->dev, "failed allocating iio device\n"); return -ENOMEM; @@ -271,23 +272,18 @@ static int exynos_adc_probe(struct platform_device *pdev) mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); info->regs = devm_ioremap_resource(&pdev->dev, mem); - if (IS_ERR(info->regs)) { - ret = PTR_ERR(info->regs); - goto err_iio; - } + if (IS_ERR(info->regs)) + return PTR_ERR(info->regs); mem = platform_get_resource(pdev, IORESOURCE_MEM, 1); info->enable_reg = devm_ioremap_resource(&pdev->dev, mem); - if (IS_ERR(info->enable_reg)) { - ret = PTR_ERR(info->enable_reg); - goto err_iio; - } + if (IS_ERR(info->enable_reg)) + return PTR_ERR(info->enable_reg); irq = platform_get_irq(pdev, 0); if (irq < 0) { dev_err(&pdev->dev, "no irq resource?\n"); - ret = irq; - goto err_iio; + return irq; } info->irq = irq; @@ -299,7 +295,7 @@ static int exynos_adc_probe(struct platform_device *pdev) if (ret < 0) { dev_err(&pdev->dev, "failed requesting irq, irq = %d\n", info->irq); - goto err_iio; + return ret; } writel(1, info->enable_reg); @@ -365,8 +361,6 @@ err_iio_dev: iio_device_unregister(indio_dev); err_irq: free_irq(info->irq, info); -err_iio: - iio_device_free(indio_dev); return ret; } @@ -382,7 +376,6 @@ static int exynos_adc_remove(struct platform_device *pdev) writel(0, info->enable_reg); iio_device_unregister(indio_dev); free_irq(info->irq, info); - iio_device_free(indio_dev); return 0; }