i2c: designware: use to_pci_dev()
authorGeliang Tang <geliangtang@163.com>
Sun, 27 Dec 2015 10:45:59 +0000 (18:45 +0800)
committerWolfram Sang <wsa@the-dreams.de>
Sun, 3 Jan 2016 18:54:00 +0000 (19:54 +0100)
Use to_pci_dev() instead of open-coding it.

Signed-off-by: Geliang Tang <geliangtang@163.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
drivers/i2c/busses/i2c-designware-pcidrv.c

index 1543d35d228dfaf9c02f9b19a3a59c82503d0870..7368be000c96038ebe612c5c492e747658471266 100644 (file)
@@ -162,7 +162,7 @@ static struct dw_pci_controller dw_pci_controllers[] = {
 #ifdef CONFIG_PM
 static int i2c_dw_pci_suspend(struct device *dev)
 {
-       struct pci_dev *pdev = container_of(dev, struct pci_dev, dev);
+       struct pci_dev *pdev = to_pci_dev(dev);
 
        i2c_dw_disable(pci_get_drvdata(pdev));
        return 0;
@@ -170,7 +170,7 @@ static int i2c_dw_pci_suspend(struct device *dev)
 
 static int i2c_dw_pci_resume(struct device *dev)
 {
-       struct pci_dev *pdev = container_of(dev, struct pci_dev, dev);
+       struct pci_dev *pdev = to_pci_dev(dev);
 
        return i2c_dw_init(pci_get_drvdata(pdev));
 }