diff mbox series

[v2,2/2] i2c: i801: Simplify the suspend callback

Message ID 20200901152837.77bfcaaa@endymion
State Accepted
Headers show
Series [v2,1/2] i2c: i801: Fix resume bug | expand

Commit Message

Jean Delvare Sept. 1, 2020, 1:28 p.m. UTC
We don't actually need to derive the PCI device from the device
structure, as we already have a pointer to it in our private data
structure.

Signed-off-by: Jean Delvare <jdelvare@suse.de>
---
 drivers/i2c/busses/i2c-i801.c |    5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

This makes suspend and resume mostly symmetric again :-)

Changes since v1: New.

Comments

Wolfram Sang Sept. 14, 2020, 7:03 a.m. UTC | #1
On Tue, Sep 01, 2020 at 03:28:37PM +0200, Jean Delvare wrote:
> We don't actually need to derive the PCI device from the device
> structure, as we already have a pointer to it in our private data
> structure.
> 
> Signed-off-by: Jean Delvare <jdelvare@suse.de>

To reduce dependencies, this is also applied to for-current, thanks!
diff mbox series

Patch

--- linux-5.8.orig/drivers/i2c/busses/i2c-i801.c	2020-09-01 12:37:04.226362935 +0200
+++ linux-5.8/drivers/i2c/busses/i2c-i801.c	2020-09-01 12:37:54.235979605 +0200
@@ -1958,10 +1958,9 @@  static void i801_shutdown(struct pci_dev
 #ifdef CONFIG_PM_SLEEP
 static int i801_suspend(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);
 
-	pci_write_config_byte(pci_dev, SMBHSTCFG, priv->original_hstcfg);
+	pci_write_config_byte(priv->pci_dev, SMBHSTCFG, priv->original_hstcfg);
 	return 0;
 }