From patchwork Thu Apr 18 17:13:36 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wolfram Sang X-Patchwork-Id: 237697 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 765B42C01FF for ; Fri, 19 Apr 2013 03:13:57 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966669Ab3DRRNz (ORCPT ); Thu, 18 Apr 2013 13:13:55 -0400 Received: from sauhun.de ([89.238.76.85]:60184 "EHLO pokefinder.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S967395Ab3DRRNy (ORCPT ); Thu, 18 Apr 2013 13:13:54 -0400 Received: from dslc-082-082-090-243.pools.arcor-ip.net ([82.82.90.243]:39167 helo=localhost) by pokefinder.org with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.69) (envelope-from ) id 1USsPA-00075W-Qk; Thu, 18 Apr 2013 19:13:53 +0200 From: Wolfram Sang To: linux-i2c@vger.kernel.org Cc: davinci-linux-open-source@linux.davincidsp.com, Mika Westerberg , Andy Shevchenko , Viresh Kumar , manishv.b@ti.com, Wolfram Sang Subject: [PATCH 1/3] i2c: davinci: drop superfluous {get|put}_device Date: Thu, 18 Apr 2013 19:13:36 +0200 Message-Id: <1366305218-22817-2-git-send-email-wsa@the-dreams.de> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1366305218-22817-1-git-send-email-wsa@the-dreams.de> References: <1366305218-22817-1-git-send-email-wsa@the-dreams.de> Sender: linux-i2c-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-i2c@vger.kernel.org Driver core already takes care of refcounting, no need to do this on driver level again. Signed-off-by: Wolfram Sang Tested-by: Sekhar Nori --- drivers/i2c/busses/i2c-davinci.c | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/drivers/i2c/busses/i2c-davinci.c b/drivers/i2c/busses/i2c-davinci.c index c01edac..cf20e06 100644 --- a/drivers/i2c/busses/i2c-davinci.c +++ b/drivers/i2c/busses/i2c-davinci.c @@ -670,7 +670,7 @@ static int davinci_i2c_probe(struct platform_device *pdev) #ifdef CONFIG_CPU_FREQ init_completion(&dev->xfr_complete); #endif - dev->dev = get_device(&pdev->dev); + dev->dev = &pdev->dev; dev->irq = irq->start; dev->pdata = dev->dev->platform_data; platform_set_drvdata(pdev, dev); @@ -680,10 +680,9 @@ static int davinci_i2c_probe(struct platform_device *pdev) dev->pdata = devm_kzalloc(&pdev->dev, sizeof(struct davinci_i2c_platform_data), GFP_KERNEL); - if (!dev->pdata) { - r = -ENOMEM; - goto err_free_mem; - } + if (!dev->pdata) + return -ENOMEM; + memcpy(dev->pdata, &davinci_i2c_platform_data_default, sizeof(struct davinci_i2c_platform_data)); if (!of_property_read_u32(pdev->dev.of_node, "clock-frequency", @@ -694,10 +693,8 @@ static int davinci_i2c_probe(struct platform_device *pdev) } dev->clk = devm_clk_get(&pdev->dev, NULL); - if (IS_ERR(dev->clk)) { - r = -ENODEV; - goto err_free_mem; - } + if (IS_ERR(dev->clk)) + return -ENODEV; clk_prepare_enable(dev->clk); dev->base = devm_ioremap_resource(&pdev->dev, mem); @@ -744,9 +741,6 @@ static int davinci_i2c_probe(struct platform_device *pdev) err_unuse_clocks: clk_disable_unprepare(dev->clk); dev->clk = NULL; -err_free_mem: - put_device(&pdev->dev); - return r; } @@ -757,7 +751,6 @@ static int davinci_i2c_remove(struct platform_device *pdev) i2c_davinci_cpufreq_deregister(dev); i2c_del_adapter(&dev->adapter); - put_device(&pdev->dev); clk_disable_unprepare(dev->clk); dev->clk = NULL;