Messages in this thread | | | Subject | Re: [PATCH] net: atheros: Use dev_get_drvdata | From | Joe Perches <> | Date | Tue, 23 Jul 2019 07:17:07 -0700 |
| |
On Tue, 2019-07-23 at 21:18 +0800, Chuhong Yuan wrote: > Instead of using to_pci_dev + pci_get_drvdata, > use dev_get_drvdata to make code simpler.
unrelated trivia:
> diff --git a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c [] > @@ -2422,8 +2422,7 @@ static int atl1c_close(struct net_device *netdev) > > static int atl1c_suspend(struct device *dev) > { > - struct pci_dev *pdev = to_pci_dev(dev); > - struct net_device *netdev = pci_get_drvdata(pdev); > + struct net_device *netdev = dev_get_drvdata(dev); > struct atl1c_adapter *adapter = netdev_priv(netdev); > struct atl1c_hw *hw = &adapter->hw; > u32 wufc = adapter->wol; > @@ -2437,7 +2436,7 @@ static int atl1c_suspend(struct device *dev) > > if (wufc) > if (atl1c_phy_to_ps_link(hw) != 0) > - dev_dbg(&pdev->dev, "phy power saving failed"); > + dev_dbg(dev, "phy power saving failed");
These and similar uses could/should use netdev_dbg
netdev_dbg(netdev, "phy power saving failed\n");
with the terminating newline too
> diff --git a/drivers/net/ethernet/atheros/atlx/atl1.c b/drivers/net/ethernet/atheros/atlx/atl1.c [] > @@ -2780,7 +2779,7 @@ static int atl1_suspend(struct device *dev) > val = atl1_get_speed_and_duplex(hw, &speed, &duplex); > if (val) { > if (netif_msg_ifdown(adapter)) > - dev_printk(KERN_DEBUG, &pdev->dev, > + dev_printk(KERN_DEBUG, dev, > "error getting speed/duplex\n");
netdev_printk(KERN_DEBUG, netdev, etc...);
| |