Skip to content

Commit

Permalink
sfc-falcon: Use dev_get_drvdata where possible
Browse files Browse the repository at this point in the history
Instead of using to_pci_dev + pci_get_drvdata,
use dev_get_drvdata to make code simpler.

Signed-off-by: Chuhong Yuan <hslester96@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Chuhong Yuan authored and David S. Miller committed Jul 24, 2019
1 parent 3e03a8b commit 8f75ec1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions drivers/net/ethernet/sfc/falcon/efx.c
Original file line number Diff line number Diff line change
Expand Up @@ -2256,7 +2256,7 @@ static struct notifier_block ef4_netdev_notifier = {
static ssize_t
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);
}
static DEVICE_ATTR(phy_type, 0444, show_phy_type, NULL);
Expand Down Expand Up @@ -2999,7 +2999,7 @@ static int ef4_pci_probe(struct pci_dev *pci_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();

Expand All @@ -3020,7 +3020,7 @@ static int ef4_pm_freeze(struct device *dev)
static int ef4_pm_thaw(struct device *dev)
{
int rc;
struct ef4_nic *efx = pci_get_drvdata(to_pci_dev(dev));
struct ef4_nic *efx = dev_get_drvdata(dev);

rtnl_lock();

Expand Down
4 changes: 2 additions & 2 deletions drivers/net/ethernet/sfc/falcon/falcon_boards.c
Original file line number Diff line number Diff line change
Expand Up @@ -357,15 +357,15 @@ static int sfe4001_poweron(struct ef4_nic *efx)
static ssize_t show_phy_flash_cfg(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_mode & PHY_MODE_SPECIAL));
}

static ssize_t set_phy_flash_cfg(struct device *dev,
struct device_attribute *attr,
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;
int err;

Expand Down

0 comments on commit 8f75ec1

Please sign in to comment.