diff options
author | Kevin Hilman <khilman@ti.com> | 2011-05-17 10:31:37 -0400 |
---|---|---|
committer | Ben Dooks <ben-linux@fluff.org> | 2011-10-29 04:37:09 -0400 |
commit | 7f4b08eeeedd90d97c8c581d048074e0c2643bec (patch) | |
tree | 898c44704d8c05bcb9c19e60b5ccf042cd89babd /drivers/i2c | |
parent | cb28e5823588cc357865cc0eab2afeec90e1f057 (diff) |
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: Felipe Balbi <balbi@ti.com>
Signed-off-by: Kevin Hilman <khilman@ti.com>
Diffstat (limited to 'drivers/i2c')
-rw-r--r-- | 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 5df938ff0e9..cddb29c1531 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) | |||
267 | 267 | ||
268 | static void omap_i2c_unidle(struct omap_i2c_dev *dev) | 268 | static void omap_i2c_unidle(struct omap_i2c_dev *dev) |
269 | { | 269 | { |
270 | struct platform_device *pdev; | ||
271 | struct omap_i2c_bus_platform_data *pdata; | 270 | struct omap_i2c_bus_platform_data *pdata; |
272 | 271 | ||
273 | WARN_ON(!dev->idle); | 272 | WARN_ON(!dev->idle); |
274 | 273 | ||
275 | pdev = to_platform_device(dev->dev); | 274 | pdata = dev->dev->platform_data; |
276 | pdata = pdev->dev.platform_data; | ||
277 | 275 | ||
278 | pm_runtime_get_sync(&pdev->dev); | 276 | pm_runtime_get_sync(dev->dev); |
279 | 277 | ||
280 | if (pdata->flags & OMAP_I2C_FLAG_RESET_REGS_POSTIDLE) { | 278 | if (pdata->flags & OMAP_I2C_FLAG_RESET_REGS_POSTIDLE) { |
281 | omap_i2c_write_reg(dev, OMAP_I2C_CON_REG, 0); | 279 | 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 | 297 | ||
300 | static void omap_i2c_idle(struct omap_i2c_dev *dev) | 298 | static void omap_i2c_idle(struct omap_i2c_dev *dev) |
301 | { | 299 | { |
302 | struct platform_device *pdev; | ||
303 | struct omap_i2c_bus_platform_data *pdata; | 300 | struct omap_i2c_bus_platform_data *pdata; |
304 | u16 iv; | 301 | u16 iv; |
305 | 302 | ||
306 | WARN_ON(dev->idle); | 303 | WARN_ON(dev->idle); |
307 | 304 | ||
308 | pdev = to_platform_device(dev->dev); | 305 | pdata = dev->dev->platform_data; |
309 | pdata = pdev->dev.platform_data; | ||
310 | 306 | ||
311 | dev->iestate = omap_i2c_read_reg(dev, OMAP_I2C_IE_REG); | 307 | dev->iestate = omap_i2c_read_reg(dev, OMAP_I2C_IE_REG); |
312 | if (pdata->rev == OMAP_I2C_IP_VERSION_2) | 308 | if (pdata->rev == OMAP_I2C_IP_VERSION_2) |
@@ -324,7 +320,7 @@ static void omap_i2c_idle(struct omap_i2c_dev *dev) | |||
324 | } | 320 | } |
325 | dev->idle = 1; | 321 | dev->idle = 1; |
326 | 322 | ||
327 | pm_runtime_put_sync(&pdev->dev); | 323 | pm_runtime_put_sync(dev->dev); |
328 | } | 324 | } |
329 | 325 | ||
330 | static int omap_i2c_init(struct omap_i2c_dev *dev) | 326 | 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 | unsigned long timeout; | 331 | unsigned long timeout; |
336 | unsigned long internal_clk = 0; | 332 | unsigned long internal_clk = 0; |
337 | struct clk *fclk; | 333 | struct clk *fclk; |
338 | struct platform_device *pdev; | ||
339 | struct omap_i2c_bus_platform_data *pdata; | 334 | struct omap_i2c_bus_platform_data *pdata; |
340 | 335 | ||
341 | pdev = to_platform_device(dev->dev); | 336 | pdata = dev->dev->platform_data; |
342 | pdata = pdev->dev.platform_data; | ||
343 | 337 | ||
344 | if (dev->rev >= OMAP_I2C_OMAP1_REV_2) { | 338 | if (dev->rev >= OMAP_I2C_OMAP1_REV_2) { |
345 | /* Disable I2C controller before soft reset */ | 339 | /* Disable I2C controller before soft reset */ |
@@ -821,11 +815,9 @@ omap_i2c_isr(int this_irq, void *dev_id) | |||
821 | u16 bits; | 815 | u16 bits; |
822 | u16 stat, w; | 816 | u16 stat, w; |
823 | int err, count = 0; | 817 | int err, count = 0; |
824 | struct platform_device *pdev; | ||
825 | struct omap_i2c_bus_platform_data *pdata; | 818 | struct omap_i2c_bus_platform_data *pdata; |
826 | 819 | ||
827 | pdev = to_platform_device(dev->dev); | 820 | pdata = dev->dev->platform_data; |
828 | pdata = pdev->dev.platform_data; | ||
829 | 821 | ||
830 | if (dev->idle) | 822 | if (dev->idle) |
831 | return IRQ_NONE; | 823 | return IRQ_NONE; |
@@ -1047,7 +1039,7 @@ omap_i2c_probe(struct platform_device *pdev) | |||
1047 | else | 1039 | else |
1048 | dev->regs = (u8 *)reg_map_ip_v1; | 1040 | dev->regs = (u8 *)reg_map_ip_v1; |
1049 | 1041 | ||
1050 | pm_runtime_enable(&pdev->dev); | 1042 | pm_runtime_enable(dev->dev); |
1051 | omap_i2c_unidle(dev); | 1043 | omap_i2c_unidle(dev); |
1052 | 1044 | ||
1053 | dev->rev = omap_i2c_read_reg(dev, OMAP_I2C_REV_REG) & 0xff; | 1045 | dev->rev = omap_i2c_read_reg(dev, OMAP_I2C_REV_REG) & 0xff; |