From patchwork Wed Aug 3 18:09:19 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Hilman X-Patchwork-Id: 1032182 Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by demeter1.kernel.org (8.14.4/8.14.4) with ESMTP id p73I9K04015378 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Wed, 3 Aug 2011 18:09:41 GMT Received: from canuck.infradead.org ([2001:4978:20e::1]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1QofsU-0008OM-T9; Wed, 03 Aug 2011 18:09:11 +0000 Received: from localhost ([127.0.0.1] helo=canuck.infradead.org) by canuck.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1QofsU-0005MD-4D; Wed, 03 Aug 2011 18:09:10 +0000 Received: from na3sys009aog126.obsmtp.com ([74.125.149.155]) by canuck.infradead.org with smtps (Exim 4.76 #1 (Red Hat Linux)) id 1QofsB-0005Ik-WF for linux-arm-kernel@lists.infradead.org; Wed, 03 Aug 2011 18:08:52 +0000 Received: from mail-pz0-f44.google.com ([209.85.210.44]) (using TLSv1) by na3sys009aob126.postini.com ([74.125.148.12]) with SMTP ID DSNKTjmOso+Tc1VSX4V4hV6Q7aOnJZicYj28@postini.com; Wed, 03 Aug 2011 11:08:51 PDT Received: by mail-pz0-f44.google.com with SMTP id 36so19025pzk.3 for ; Wed, 03 Aug 2011 11:08:50 -0700 (PDT) Received: by 10.142.135.19 with SMTP id i19mr4833783wfd.132.1312394929915; Wed, 03 Aug 2011 11:08:49 -0700 (PDT) Received: from localhost (c-24-19-7-36.hsd1.wa.comcast.net [24.19.7.36]) by mx.google.com with ESMTPS id v2sm1296832pbi.35.2011.08.03.11.08.48 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 03 Aug 2011 11:08:49 -0700 (PDT) From: Kevin Hilman To: Ben Dooks , linux-omap@vger.kernel.org Subject: [PATCH 1/2] I2C: OMAP: remove unneccesary use of pdev Date: Wed, 3 Aug 2011 11:09:19 -0700 Message-Id: <1312394960-21689-2-git-send-email-khilman@ti.com> X-Mailer: git-send-email 1.7.6 In-Reply-To: <1312394960-21689-1-git-send-email-khilman@ti.com> References: <1312394960-21689-1-git-send-email-khilman@ti.com> X-CRM114-Version: 20090807-BlameThorstenAndJenny ( TRE 0.7.6 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20110803_140852_258570_0FA7B45E X-CRM114-Status: GOOD ( 12.82 ) X-Spam-Score: -2.3 (--) X-Spam-Report: SpamAssassin version 3.3.1 on canuck.infradead.org summary: Content analysis details: (-2.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/, medium trust [74.125.149.155 listed in list.dnswl.org] Cc: linux-i2c@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Shubhrajyoti D X-BeenThere: linux-arm-kernel@lists.infradead.org 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: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Wed, 03 Aug 2011 18:09:41 +0000 (UTC) A pointer to the struct device associated with the i2c device is already kept in the struct omap_i2c_dev, so use omap_i2c_device to find the pointer to struct device. Signed-off-by: Kevin Hilman Reviewed-by: Felipe Balbi --- drivers/i2c/busses/i2c-omap.c | 22 +++++++--------------- 1 files changed, 7 insertions(+), 15 deletions(-) diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c index e854be0..12d0cbc 100644 --- a/drivers/i2c/busses/i2c-omap.c +++ b/drivers/i2c/busses/i2c-omap.c @@ -267,15 +267,13 @@ static inline u16 omap_i2c_read_reg(struct omap_i2c_dev *i2c_dev, int reg) static void omap_i2c_unidle(struct omap_i2c_dev *dev) { - struct platform_device *pdev; struct omap_i2c_bus_platform_data *pdata; WARN_ON(!dev->idle); - pdev = to_platform_device(dev->dev); - pdata = pdev->dev.platform_data; + pdata = dev->dev->platform_data; - pm_runtime_get_sync(&pdev->dev); + pm_runtime_get_sync(dev->dev); if (pdata->flags & OMAP_I2C_FLAG_RESET_REGS_POSTIDLE) { omap_i2c_write_reg(dev, OMAP_I2C_CON_REG, 0); @@ -299,14 +297,12 @@ static void omap_i2c_unidle(struct omap_i2c_dev *dev) static void omap_i2c_idle(struct omap_i2c_dev *dev) { - struct platform_device *pdev; struct omap_i2c_bus_platform_data *pdata; u16 iv; WARN_ON(dev->idle); - pdev = to_platform_device(dev->dev); - pdata = pdev->dev.platform_data; + pdata = dev->dev->platform_data; dev->iestate = omap_i2c_read_reg(dev, OMAP_I2C_IE_REG); if (pdata->rev == OMAP_I2C_IP_VERSION_2) @@ -324,7 +320,7 @@ static void omap_i2c_idle(struct omap_i2c_dev *dev) } dev->idle = 1; - pm_runtime_put_sync(&pdev->dev); + pm_runtime_put_sync(dev->dev); } static int omap_i2c_init(struct omap_i2c_dev *dev) @@ -335,11 +331,9 @@ static int omap_i2c_init(struct omap_i2c_dev *dev) unsigned long timeout; unsigned long internal_clk = 0; struct clk *fclk; - struct platform_device *pdev; struct omap_i2c_bus_platform_data *pdata; - pdev = to_platform_device(dev->dev); - pdata = pdev->dev.platform_data; + pdata = dev->dev->platform_data; if (dev->rev >= OMAP_I2C_OMAP1_REV_2) { /* Disable I2C controller before soft reset */ @@ -821,11 +815,9 @@ omap_i2c_isr(int this_irq, void *dev_id) u16 bits; u16 stat, w; int err, count = 0; - struct platform_device *pdev; struct omap_i2c_bus_platform_data *pdata; - pdev = to_platform_device(dev->dev); - pdata = pdev->dev.platform_data; + pdata = dev->dev->platform_data; if (dev->idle) return IRQ_NONE; @@ -1047,7 +1039,7 @@ omap_i2c_probe(struct platform_device *pdev) else dev->regs = (u8 *)reg_map_ip_v1; - pm_runtime_enable(&pdev->dev); + pm_runtime_enable(dev->dev); omap_i2c_unidle(dev); dev->rev = omap_i2c_read_reg(dev, OMAP_I2C_REV_REG) & 0xff;