diff options
author | Marc Kleine-Budde <mkl@pengutronix.de> | 2020-12-12 18:55:18 +0100 |
---|---|---|
committer | Marc Kleine-Budde <mkl@pengutronix.de> | 2020-12-14 14:24:17 +0100 |
commit | c6b734892420f00fdc3c49b8c1029aa5bf0790b9 (patch) | |
tree | c57d6bfdb77983fe9ee006a098a28a11658608f0 /drivers/net/can/m_can/m_can_pci.c | |
parent | ac33ffd3e2b037fe68683b48dadd1cef4a969993 (diff) | |
download | linux-c6b734892420f00fdc3c49b8c1029aa5bf0790b9.tar.gz linux-c6b734892420f00fdc3c49b8c1029aa5bf0790b9.tar.bz2 linux-c6b734892420f00fdc3c49b8c1029aa5bf0790b9.zip |
can: m_can: use struct m_can_classdev as drvdata
The m_can driver's suspend and resume functions (m_can_class_suspend() and
m_can_class_resume()) make use of dev_get_drvdata() and assume that the drvdata
is a pointer to the struct net_device.
With upcoming conversion of the tcan4x5x driver to pm_runtime this assumption
is no longer valid. As the suspend and resume functions actually need a struct
m_can_classdev pointer, change the m_can_platform and the m_can_pci driver to
hold a pointer to struct m_can_classdev instead, as the tcan4x5x driver already
does.
Link: https://lore.kernel.org/r/20201212175518.139651-8-mkl@pengutronix.de
Reviewed-by: Sean Nyekjaer <sean@geanix.com>
Reviewed-by: Dan Murphy <dmurphy@ti.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Diffstat (limited to 'drivers/net/can/m_can/m_can_pci.c')
-rw-r--r-- | drivers/net/can/m_can/m_can_pci.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/net/can/m_can/m_can_pci.c b/drivers/net/can/m_can/m_can_pci.c index ebfbef25e3f9..128808605c3f 100644 --- a/drivers/net/can/m_can/m_can_pci.c +++ b/drivers/net/can/m_can/m_can_pci.c @@ -115,7 +115,7 @@ static int m_can_pci_probe(struct pci_dev *pci, const struct pci_device_id *id) mcan_class->can.clock.freq = id->driver_data; mcan_class->ops = &m_can_pci_ops; - pci_set_drvdata(pci, mcan_class->net); + pci_set_drvdata(pci, mcan_class); ret = m_can_class_register(mcan_class); if (ret) @@ -138,8 +138,7 @@ err: static void m_can_pci_remove(struct pci_dev *pci) { - struct net_device *dev = pci_get_drvdata(pci); - struct m_can_classdev *mcan_class = netdev_priv(dev); + struct m_can_classdev *mcan_class = pci_get_drvdata(pci); struct m_can_pci_priv *priv = cdev_to_priv(mcan_class); pm_runtime_forbid(&pci->dev); |