Commit 8f75ec1a authored by Chuhong Yuan's avatar Chuhong Yuan Committed by David S. Miller

sfc-falcon: Use dev_get_drvdata where possible

Instead of using to_pci_dev + pci_get_drvdata,
use dev_get_drvdata to make code simpler.
Signed-off-by: default avatarChuhong Yuan <hslester96@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 3e03a8ba
...@@ -2256,7 +2256,7 @@ static struct notifier_block ef4_netdev_notifier = { ...@@ -2256,7 +2256,7 @@ static struct notifier_block ef4_netdev_notifier = {
static ssize_t static ssize_t
show_phy_type(struct device *dev, struct device_attribute *attr, char *buf) show_phy_type(struct device *dev, struct device_attribute *attr, char *buf)
{ {
struct ef4_nic *efx = pci_get_drvdata(to_pci_dev(dev)); struct ef4_nic *efx = dev_get_drvdata(dev);
return sprintf(buf, "%d\n", efx->phy_type); return sprintf(buf, "%d\n", efx->phy_type);
} }
static DEVICE_ATTR(phy_type, 0444, show_phy_type, NULL); static DEVICE_ATTR(phy_type, 0444, show_phy_type, NULL);
...@@ -2999,7 +2999,7 @@ static int ef4_pci_probe(struct pci_dev *pci_dev, ...@@ -2999,7 +2999,7 @@ static int ef4_pci_probe(struct pci_dev *pci_dev,
static int ef4_pm_freeze(struct device *dev) static int ef4_pm_freeze(struct device *dev)
{ {
struct ef4_nic *efx = pci_get_drvdata(to_pci_dev(dev)); struct ef4_nic *efx = dev_get_drvdata(dev);
rtnl_lock(); rtnl_lock();
...@@ -3020,7 +3020,7 @@ static int ef4_pm_freeze(struct device *dev) ...@@ -3020,7 +3020,7 @@ static int ef4_pm_freeze(struct device *dev)
static int ef4_pm_thaw(struct device *dev) static int ef4_pm_thaw(struct device *dev)
{ {
int rc; int rc;
struct ef4_nic *efx = pci_get_drvdata(to_pci_dev(dev)); struct ef4_nic *efx = dev_get_drvdata(dev);
rtnl_lock(); rtnl_lock();
......
...@@ -357,7 +357,7 @@ static int sfe4001_poweron(struct ef4_nic *efx) ...@@ -357,7 +357,7 @@ static int sfe4001_poweron(struct ef4_nic *efx)
static ssize_t show_phy_flash_cfg(struct device *dev, static ssize_t show_phy_flash_cfg(struct device *dev,
struct device_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
{ {
struct ef4_nic *efx = pci_get_drvdata(to_pci_dev(dev)); struct ef4_nic *efx = dev_get_drvdata(dev);
return sprintf(buf, "%d\n", !!(efx->phy_mode & PHY_MODE_SPECIAL)); return sprintf(buf, "%d\n", !!(efx->phy_mode & PHY_MODE_SPECIAL));
} }
...@@ -365,7 +365,7 @@ static ssize_t set_phy_flash_cfg(struct device *dev, ...@@ -365,7 +365,7 @@ static ssize_t set_phy_flash_cfg(struct device *dev,
struct device_attribute *attr, struct device_attribute *attr,
const char *buf, size_t count) const char *buf, size_t count)
{ {
struct ef4_nic *efx = pci_get_drvdata(to_pci_dev(dev)); struct ef4_nic *efx = dev_get_drvdata(dev);
enum ef4_phy_mode old_mode, new_mode; enum ef4_phy_mode old_mode, new_mode;
int err; int err;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment