Commit 7f4b08ee authored by Kevin Hilman's avatar Kevin Hilman Committed by Ben Dooks

I2C: OMAP: remove unneccesary use of pdev

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.
Reviewed-by: default avatarFelipe Balbi <balbi@ti.com>
Signed-off-by: default avatarKevin Hilman <khilman@ti.com>
parent cb28e582
...@@ -267,15 +267,13 @@ static inline u16 omap_i2c_read_reg(struct omap_i2c_dev *i2c_dev, int reg) ...@@ -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) static void omap_i2c_unidle(struct omap_i2c_dev *dev)
{ {
struct platform_device *pdev;
struct omap_i2c_bus_platform_data *pdata; struct omap_i2c_bus_platform_data *pdata;
WARN_ON(!dev->idle); WARN_ON(!dev->idle);
pdev = to_platform_device(dev->dev); pdata = dev->dev->platform_data;
pdata = pdev->dev.platform_data;
pm_runtime_get_sync(&pdev->dev); pm_runtime_get_sync(dev->dev);
if (pdata->flags & OMAP_I2C_FLAG_RESET_REGS_POSTIDLE) { if (pdata->flags & OMAP_I2C_FLAG_RESET_REGS_POSTIDLE) {
omap_i2c_write_reg(dev, OMAP_I2C_CON_REG, 0); omap_i2c_write_reg(dev, OMAP_I2C_CON_REG, 0);
...@@ -299,14 +297,12 @@ static void omap_i2c_unidle(struct omap_i2c_dev *dev) ...@@ -299,14 +297,12 @@ static void omap_i2c_unidle(struct omap_i2c_dev *dev)
static void omap_i2c_idle(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; struct omap_i2c_bus_platform_data *pdata;
u16 iv; u16 iv;
WARN_ON(dev->idle); WARN_ON(dev->idle);
pdev = to_platform_device(dev->dev); pdata = dev->dev->platform_data;
pdata = pdev->dev.platform_data;
dev->iestate = omap_i2c_read_reg(dev, OMAP_I2C_IE_REG); dev->iestate = omap_i2c_read_reg(dev, OMAP_I2C_IE_REG);
if (pdata->rev == OMAP_I2C_IP_VERSION_2) if (pdata->rev == OMAP_I2C_IP_VERSION_2)
...@@ -324,7 +320,7 @@ static void omap_i2c_idle(struct omap_i2c_dev *dev) ...@@ -324,7 +320,7 @@ static void omap_i2c_idle(struct omap_i2c_dev *dev)
} }
dev->idle = 1; 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) static int omap_i2c_init(struct omap_i2c_dev *dev)
...@@ -335,11 +331,9 @@ 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 timeout;
unsigned long internal_clk = 0; unsigned long internal_clk = 0;
struct clk *fclk; struct clk *fclk;
struct platform_device *pdev;
struct omap_i2c_bus_platform_data *pdata; struct omap_i2c_bus_platform_data *pdata;
pdev = to_platform_device(dev->dev); pdata = dev->dev->platform_data;
pdata = pdev->dev.platform_data;
if (dev->rev >= OMAP_I2C_OMAP1_REV_2) { if (dev->rev >= OMAP_I2C_OMAP1_REV_2) {
/* Disable I2C controller before soft reset */ /* Disable I2C controller before soft reset */
...@@ -821,11 +815,9 @@ omap_i2c_isr(int this_irq, void *dev_id) ...@@ -821,11 +815,9 @@ omap_i2c_isr(int this_irq, void *dev_id)
u16 bits; u16 bits;
u16 stat, w; u16 stat, w;
int err, count = 0; int err, count = 0;
struct platform_device *pdev;
struct omap_i2c_bus_platform_data *pdata; struct omap_i2c_bus_platform_data *pdata;
pdev = to_platform_device(dev->dev); pdata = dev->dev->platform_data;
pdata = pdev->dev.platform_data;
if (dev->idle) if (dev->idle)
return IRQ_NONE; return IRQ_NONE;
...@@ -1047,7 +1039,7 @@ omap_i2c_probe(struct platform_device *pdev) ...@@ -1047,7 +1039,7 @@ omap_i2c_probe(struct platform_device *pdev)
else else
dev->regs = (u8 *)reg_map_ip_v1; dev->regs = (u8 *)reg_map_ip_v1;
pm_runtime_enable(&pdev->dev); pm_runtime_enable(dev->dev);
omap_i2c_unidle(dev); omap_i2c_unidle(dev);
dev->rev = omap_i2c_read_reg(dev, OMAP_I2C_REV_REG) & 0xff; dev->rev = omap_i2c_read_reg(dev, OMAP_I2C_REV_REG) & 0xff;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment