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: 2461891 Return-Path: X-Original-To: patchwork-davinci@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from comal.ext.ti.com (comal.ext.ti.com [198.47.26.152]) by patchwork1.kernel.org (Postfix) with ESMTP id AE57F3FCA5 for ; Thu, 18 Apr 2013 17:17:59 +0000 (UTC) Received: from dflxv15.itg.ti.com ([128.247.5.124]) by comal.ext.ti.com (8.13.7/8.13.7) with ESMTP id r3IHDxxi019243; Thu, 18 Apr 2013 12:13:59 -0500 Received: from DFLE73.ent.ti.com (dfle73.ent.ti.com [128.247.5.110]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id r3IHDxuJ010099; Thu, 18 Apr 2013 12:13:59 -0500 Received: from dlelxv24.itg.ti.com (172.17.1.199) by DFLE73.ent.ti.com (128.247.5.110) with Microsoft SMTP Server id 14.2.342.3; Thu, 18 Apr 2013 12:13:58 -0500 Received: from linux.omap.com (dlelxs01.itg.ti.com [157.170.227.31]) by dlelxv24.itg.ti.com (8.13.8/8.13.8) with ESMTP id r3IHDwRS001116; Thu, 18 Apr 2013 12:13:58 -0500 Received: from linux.omap.com (localhost [127.0.0.1]) by linux.omap.com (Postfix) with ESMTP id 22D9180627; Thu, 18 Apr 2013 12:13:58 -0500 (CDT) X-Original-To: davinci-linux-open-source@linux.davincidsp.com Delivered-To: davinci-linux-open-source@linux.davincidsp.com Received: from dflp51.itg.ti.com (dflp51.itg.ti.com [128.247.22.94]) by linux.omap.com (Postfix) with ESMTP id D9D9780626 for ; Thu, 18 Apr 2013 12:13:56 -0500 (CDT) Received: from neches.ext.ti.com (neches.ext.ti.com [192.91.81.29]) by dflp51.itg.ti.com (8.13.7/8.13.8) with ESMTP id r3IHDukn027718 for ; Thu, 18 Apr 2013 12:13:56 -0500 (CDT) Received: from mail6.bemta8.messagelabs.com (mail6.bemta8.messagelabs.com [216.82.243.55]) by neches.ext.ti.com (8.13.7/8.13.7) with ESMTP id r3IHDte1021339 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 18 Apr 2013 12:13:56 -0500 Received: from [216.82.242.147:8873] by server-11.bemta-8.messagelabs.com id 51/2D-14229-3D920715; Thu, 18 Apr 2013 17:13:55 +0000 X-Env-Sender: wsa@the-dreams.de X-Msg-Ref: server-8.tower-95.messagelabs.com!1366305233!19855075!1 X-Originating-IP: [89.238.76.85] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 6.8.6.1; banners=-,-,- X-VirusChecked: Checked Received: (qmail 15236 invoked from network); 18 Apr 2013 17:13:54 -0000 Received: from sauhun.de (HELO pokefinder.org) (89.238.76.85) by server-8.tower-95.messagelabs.com with AES256-SHA encrypted SMTP; 18 Apr 2013 17:13:54 -0000 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: 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> CC: , Wolfram Sang , Viresh Kumar , Andy Shevchenko , Mika Westerberg X-BeenThere: davinci-linux-open-source@linux.davincidsp.com X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: Errors-To: davinci-linux-open-source-bounces@linux.davincidsp.com 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;