Commit 3e03a8ba authored by Chuhong Yuan's avatar Chuhong Yuan Committed by David S. Miller

sfc: 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>
Acked-by: default avatarEdward Cree <ecree@solarflare.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent dfa56f83
...@@ -508,7 +508,7 @@ static ssize_t efx_ef10_show_link_control_flag(struct device *dev, ...@@ -508,7 +508,7 @@ static ssize_t efx_ef10_show_link_control_flag(struct device *dev,
struct device_attribute *attr, struct device_attribute *attr,
char *buf) char *buf)
{ {
struct efx_nic *efx = pci_get_drvdata(to_pci_dev(dev)); struct efx_nic *efx = dev_get_drvdata(dev);
return sprintf(buf, "%d\n", return sprintf(buf, "%d\n",
((efx->mcdi->fn_flags) & ((efx->mcdi->fn_flags) &
...@@ -520,7 +520,7 @@ static ssize_t efx_ef10_show_primary_flag(struct device *dev, ...@@ -520,7 +520,7 @@ static ssize_t efx_ef10_show_primary_flag(struct device *dev,
struct device_attribute *attr, struct device_attribute *attr,
char *buf) char *buf)
{ {
struct efx_nic *efx = pci_get_drvdata(to_pci_dev(dev)); struct efx_nic *efx = dev_get_drvdata(dev);
return sprintf(buf, "%d\n", return sprintf(buf, "%d\n",
((efx->mcdi->fn_flags) & ((efx->mcdi->fn_flags) &
......
...@@ -2517,7 +2517,7 @@ static struct notifier_block efx_netdev_notifier = { ...@@ -2517,7 +2517,7 @@ static struct notifier_block efx_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 efx_nic *efx = pci_get_drvdata(to_pci_dev(dev)); struct efx_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);
...@@ -2526,7 +2526,7 @@ static DEVICE_ATTR(phy_type, 0444, show_phy_type, NULL); ...@@ -2526,7 +2526,7 @@ static DEVICE_ATTR(phy_type, 0444, show_phy_type, NULL);
static ssize_t show_mcdi_log(struct device *dev, struct device_attribute *attr, static ssize_t show_mcdi_log(struct device *dev, struct device_attribute *attr,
char *buf) char *buf)
{ {
struct efx_nic *efx = pci_get_drvdata(to_pci_dev(dev)); struct efx_nic *efx = dev_get_drvdata(dev);
struct efx_mcdi_iface *mcdi = efx_mcdi(efx); struct efx_mcdi_iface *mcdi = efx_mcdi(efx);
return scnprintf(buf, PAGE_SIZE, "%d\n", mcdi->logging_enabled); return scnprintf(buf, PAGE_SIZE, "%d\n", mcdi->logging_enabled);
...@@ -2534,7 +2534,7 @@ static ssize_t show_mcdi_log(struct device *dev, struct device_attribute *attr, ...@@ -2534,7 +2534,7 @@ static ssize_t show_mcdi_log(struct device *dev, struct device_attribute *attr,
static ssize_t set_mcdi_log(struct device *dev, struct device_attribute *attr, static ssize_t set_mcdi_log(struct device *dev, struct device_attribute *attr,
const char *buf, size_t count) const char *buf, size_t count)
{ {
struct efx_nic *efx = pci_get_drvdata(to_pci_dev(dev)); struct efx_nic *efx = dev_get_drvdata(dev);
struct efx_mcdi_iface *mcdi = efx_mcdi(efx); struct efx_mcdi_iface *mcdi = efx_mcdi(efx);
bool enable = count > 0 && *buf != '0'; bool enable = count > 0 && *buf != '0';
...@@ -3654,7 +3654,7 @@ static int efx_pci_sriov_configure(struct pci_dev *dev, int num_vfs) ...@@ -3654,7 +3654,7 @@ static int efx_pci_sriov_configure(struct pci_dev *dev, int num_vfs)
static int efx_pm_freeze(struct device *dev) static int efx_pm_freeze(struct device *dev)
{ {
struct efx_nic *efx = pci_get_drvdata(to_pci_dev(dev)); struct efx_nic *efx = dev_get_drvdata(dev);
rtnl_lock(); rtnl_lock();
...@@ -3675,7 +3675,7 @@ static int efx_pm_freeze(struct device *dev) ...@@ -3675,7 +3675,7 @@ static int efx_pm_freeze(struct device *dev)
static int efx_pm_thaw(struct device *dev) static int efx_pm_thaw(struct device *dev)
{ {
int rc; int rc;
struct efx_nic *efx = pci_get_drvdata(to_pci_dev(dev)); struct efx_nic *efx = dev_get_drvdata(dev);
rtnl_lock(); rtnl_lock();
......
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