From patchwork Thu Jan 24 10:11:07 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tushar Behera X-Patchwork-Id: 14262 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 17A2F23F02 for ; Thu, 24 Jan 2013 10:20:16 +0000 (UTC) Received: from mail-vc0-f170.google.com (mail-vc0-f170.google.com [209.85.220.170]) by fiordland.canonical.com (Postfix) with ESMTP id B86B9A1867D for ; Thu, 24 Jan 2013 10:20:15 +0000 (UTC) Received: by mail-vc0-f170.google.com with SMTP id p16so1255477vcq.1 for ; Thu, 24 Jan 2013 02:20:15 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:x-forwarded-to:x-forwarded-for:delivered-to:x-received :received-spf:x-received:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references:x-gm-message-state; bh=6J7rDTWj7EdEymss0IJHPQ7aliT51zXhKCqHuErjxWg=; b=QyICcX4JY+24qAk3wjt+7HQU3GtvHKa7aeboBH/FUnb9zFLa6UUENPM+mGEVROCmmG 8QH+cf0y8XwsICUk74jbEg5H/7FrcxjemPLJkfZfBQhmgBoOLaivi/HWg1kBV8Ja3heJ GkIEJZn6U8WAtjgPlnoW2TG32udwY1fSrb541noEoWiZNg7cTwe48mze3qXf2QIiugTC u2b+G032YAeqn4Z4GrPGf2H+djS53JI/j4xLtcvHNHkyfELDgASN9gTUClKZQzs8val1 KcPPDyKSbcseCj8nF339xEVFB1TMINLjjIU3xu/hAhHPg5ZHRdu//ADjysZzxfCKPsOc EatQ== X-Received: by 10.52.16.6 with SMTP id b6mr1153853vdd.40.1359022815214; Thu, 24 Jan 2013 02:20:15 -0800 (PST) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.58.145.101 with SMTP id st5csp56441veb; Thu, 24 Jan 2013 02:20:14 -0800 (PST) X-Received: by 10.66.89.199 with SMTP id bq7mr3382792pab.26.1359022814198; Thu, 24 Jan 2013 02:20:14 -0800 (PST) Received: from mail-da0-f53.google.com (mail-da0-f53.google.com [209.85.210.53]) by mx.google.com with ESMTPS id r2si23843022paz.32.2013.01.24.02.20.13 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 24 Jan 2013 02:20:14 -0800 (PST) Received-SPF: neutral (google.com: 209.85.210.53 is neither permitted nor denied by best guess record for domain of tushar.behera@linaro.org) client-ip=209.85.210.53; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.210.53 is neither permitted nor denied by best guess record for domain of tushar.behera@linaro.org) smtp.mail=tushar.behera@linaro.org Received: by mail-da0-f53.google.com with SMTP id x6so4177216dac.40 for ; Thu, 24 Jan 2013 02:20:13 -0800 (PST) X-Received: by 10.66.88.6 with SMTP id bc6mr3467709pab.5.1359022813825; Thu, 24 Jan 2013 02:20:13 -0800 (PST) Received: from localhost.localdomain ([115.113.119.130]) by mx.google.com with ESMTPS id ho4sm14625980pbc.54.2013.01.24.02.20.09 (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 24 Jan 2013 02:20:12 -0800 (PST) From: Tushar Behera To: linux-kernel@vger.kernel.org, linux-i2c@vger.kernel.org, linux-samsung-soc@vger.kernel.org Cc: w.sang@pengutronix.de, kgene.kim@samsung.com, patches@linaro.org Subject: [PATCH V3 2/4] i2c: s3c2410: Convert to use devm_* APIs Date: Thu, 24 Jan 2013 15:41:07 +0530 Message-Id: <1359022269-12593-3-git-send-email-tushar.behera@linaro.org> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1359022269-12593-1-git-send-email-tushar.behera@linaro.org> References: <1359022269-12593-1-git-send-email-tushar.behera@linaro.org> X-Gm-Message-State: ALoCoQn9ksjMz4VYukKiaI225kVAsOtGZxTiT70K83pkza+OasTjnaZYMfcZjoA4UNw0rwMvTgUO i2c-s3c2410 driver is modified to use devm_clk_get() and devm_request_irq(). This also simplifies the return path in driver's probe. Signed-off-by: Tushar Behera --- Changes since V2: * Rebased on v3.8-rc4. devm_request_and_ioremap implementaion has already been merged. Changes since V1: * devm_request_mem_region and devm_ioremap calls were replaced by devm_request_and_ioremap() call. * All devm_* related modifications (earlier patches 2-5) were merged to a single patch. drivers/i2c/busses/i2c-s3c2410.c | 16 +++++----------- 1 files changed, 5 insertions(+), 11 deletions(-) diff --git a/drivers/i2c/busses/i2c-s3c2410.c b/drivers/i2c/busses/i2c-s3c2410.c index b7ca1f4..4b6cc13 100644 --- a/drivers/i2c/busses/i2c-s3c2410.c +++ b/drivers/i2c/busses/i2c-s3c2410.c @@ -1022,7 +1022,7 @@ static int s3c24xx_i2c_probe(struct platform_device *pdev) /* find the clock and enable it */ i2c->dev = &pdev->dev; - i2c->clk = clk_get(&pdev->dev, "i2c"); + i2c->clk = devm_clk_get(&pdev->dev, "i2c"); if (IS_ERR(i2c->clk)) { dev_err(&pdev->dev, "cannot get clock\n"); return -ENOENT; @@ -1044,7 +1044,7 @@ static int s3c24xx_i2c_probe(struct platform_device *pdev) i2c->regs = devm_request_and_ioremap(&pdev->dev, res); if (i2c->regs == NULL) { - dev_err(&pdev->dev, "cannot map IO\n"); + dev_err(&pdev->dev, "cannot request and map IO\n"); ret = -ENXIO; goto err_clk; } @@ -1084,8 +1084,8 @@ static int s3c24xx_i2c_probe(struct platform_device *pdev) goto err_clk; } - ret = request_irq(i2c->irq, s3c24xx_i2c_irq, 0, - dev_name(&pdev->dev), i2c); + ret = devm_request_irq(&pdev->dev, i2c->irq, s3c24xx_i2c_irq, 0, + dev_name(&pdev->dev), i2c); if (ret != 0) { dev_err(&pdev->dev, "cannot claim IRQ %d\n", i2c->irq); @@ -1095,7 +1095,7 @@ static int s3c24xx_i2c_probe(struct platform_device *pdev) ret = s3c24xx_i2c_register_cpufreq(i2c); if (ret < 0) { dev_err(&pdev->dev, "failed to register cpufreq notifier\n"); - goto err_irq; + goto err_clk; } /* Note, previous versions of the driver used i2c_add_adapter() @@ -1126,12 +1126,8 @@ static int s3c24xx_i2c_probe(struct platform_device *pdev) err_cpufreq: s3c24xx_i2c_deregister_cpufreq(i2c); - err_irq: - free_irq(i2c->irq, i2c); - err_clk: clk_disable_unprepare(i2c->clk); - clk_put(i2c->clk); return ret; } @@ -1150,10 +1146,8 @@ static int s3c24xx_i2c_remove(struct platform_device *pdev) s3c24xx_i2c_deregister_cpufreq(i2c); i2c_del_adapter(&i2c->adap); - free_irq(i2c->irq, i2c); clk_disable_unprepare(i2c->clk); - clk_put(i2c->clk); if (pdev->dev.of_node && IS_ERR(i2c->pctrl)) s3c24xx_i2c_dt_gpio_free(i2c);