From patchwork Tue Jun 7 18:22:29 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Hilman X-Patchwork-Id: 858952 X-Patchwork-Delegate: khilman@deeprootsystems.com Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p57IMNOv013695 for ; Tue, 7 Jun 2011 18:22:24 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757820Ab1FGSWV (ORCPT ); Tue, 7 Jun 2011 14:22:21 -0400 Received: from na3sys009aog108.obsmtp.com ([74.125.149.199]:47340 "EHLO na3sys009aog108.obsmtp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755348Ab1FGSWV (ORCPT ); Tue, 7 Jun 2011 14:22:21 -0400 Received: from mail-px0-f176.google.com ([209.85.212.176]) (using TLSv1) by na3sys009aob108.postini.com ([74.125.148.12]) with SMTP ID DSNKTe5sXBYUMP2nEw4txYexIe9xuStTUc8n@postini.com; Tue, 07 Jun 2011 11:22:21 PDT Received: by pxi11 with SMTP id 11so3243785pxi.21 for ; Tue, 07 Jun 2011 11:22:18 -0700 (PDT) Received: by 10.68.31.34 with SMTP id x2mr360098pbh.153.1307470938414; Tue, 07 Jun 2011 11:22:18 -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 k9sm471929pbc.86.2011.06.07.11.22.17 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 07 Jun 2011 11:22:17 -0700 (PDT) From: Kevin Hilman To: Ben Dooks Cc: linux-i2c@vger.kernel.org, linux-omap@vger.kernel.org, Rajendra Nayak , linux-arm-kernel@lists.infradead.org Subject: [PATCH 1/3] I2C: OMAP: remove unneccesary use of pdev Date: Tue, 7 Jun 2011 11:22:29 -0700 Message-Id: <1307470951-22801-2-git-send-email-khilman@ti.com> X-Mailer: git-send-email 1.7.4 In-Reply-To: <1307470951-22801-1-git-send-email-khilman@ti.com> References: <1307470951-22801-1-git-send-email-khilman@ti.com> Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Tue, 07 Jun 2011 18:22:24 +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 --- 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 d53cd61..8633488 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 */ @@ -822,11 +816,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; @@ -1048,7 +1040,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;