lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <282e6918adc670dc5667006f646664342c8bdef8.camel@perches.com>
Date:   Tue, 23 Jul 2019 07:17:07 -0700
From:   Joe Perches <joe@...ches.com>
To:     Chuhong Yuan <hslester96@...il.com>
Cc:     Jay Cliburn <jcliburn@...il.com>,
        Chris Snook <chris.snook@...il.com>,
        "David S . Miller" <davem@...emloft.net>, netdev@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] net: atheros: Use dev_get_drvdata

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...);


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ