Message ID | 20190723111110.11121-1-hslester96@gmail.com |
---|---|
State | Accepted |
Headers | show |
Series | i2c: busses: Use dev_get_drvdata where possible | expand |
On Tue, 23 Jul 2019 19:11:10 +0800, Chuhong Yuan wrote: > Instead of using to_pci_dev + pci_get_drvdata, > use dev_get_drvdata to make code simpler. > > Signed-off-by: Chuhong Yuan <hslester96@gmail.com> > --- > drivers/i2c/busses/i2c-designware-pcidrv.c | 6 ++---- > drivers/i2c/busses/i2c-i801.c | 3 +-- > 2 files changed, 3 insertions(+), 6 deletions(-) > (...) Looks good to me, thanks. Reviewed-by: Jean Delvare <jdelvare@suse.de>
On 7/23/19 9:34 PM, Jean Delvare wrote: > On Tue, 23 Jul 2019 19:11:10 +0800, Chuhong Yuan wrote: >> Instead of using to_pci_dev + pci_get_drvdata, >> use dev_get_drvdata to make code simpler. >> >> Signed-off-by: Chuhong Yuan <hslester96@gmail.com> >> --- >> drivers/i2c/busses/i2c-designware-pcidrv.c | 6 ++---- >> drivers/i2c/busses/i2c-i801.c | 3 +-- >> 2 files changed, 3 insertions(+), 6 deletions(-) >> (...) > > Looks good to me, thanks. > > Reviewed-by: Jean Delvare <jdelvare@suse.de> > For the i2c-designware-pcidrv.c Acked-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
diff --git a/drivers/i2c/busses/i2c-designware-pcidrv.c b/drivers/i2c/busses/i2c-designware-pcidrv.c index 76810deb2de6..7d2e6959679c 100644 --- a/drivers/i2c/busses/i2c-designware-pcidrv.c +++ b/drivers/i2c/busses/i2c-designware-pcidrv.c @@ -173,8 +173,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 = to_pci_dev(dev); - struct dw_i2c_dev *i_dev = pci_get_drvdata(pdev); + struct dw_i2c_dev *i_dev = dev_get_drvdata(dev); i_dev->suspended = true; i_dev->disable(i_dev); @@ -184,8 +183,7 @@ static int i2c_dw_pci_suspend(struct device *dev) static int i2c_dw_pci_resume(struct device *dev) { - struct pci_dev *pdev = to_pci_dev(dev); - struct dw_i2c_dev *i_dev = pci_get_drvdata(pdev); + struct dw_i2c_dev *i_dev = dev_get_drvdata(dev); int ret; ret = i_dev->init(i_dev); diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c index f2956936c3f2..a6469978e735 100644 --- a/drivers/i2c/busses/i2c-i801.c +++ b/drivers/i2c/busses/i2c-i801.c @@ -1912,8 +1912,7 @@ static int i801_suspend(struct device *dev) static int i801_resume(struct device *dev) { - struct pci_dev *pci_dev = to_pci_dev(dev); - struct i801_priv *priv = pci_get_drvdata(pci_dev); + struct i801_priv *priv = dev_get_drvdata(dev); i801_enable_host_notify(&priv->adapter);
Instead of using to_pci_dev + pci_get_drvdata, use dev_get_drvdata to make code simpler. Signed-off-by: Chuhong Yuan <hslester96@gmail.com> --- drivers/i2c/busses/i2c-designware-pcidrv.c | 6 ++---- drivers/i2c/busses/i2c-i801.c | 3 +-- 2 files changed, 3 insertions(+), 6 deletions(-)