Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1445873
| From | Philippe Reynes <tremyfr@gmail.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH 1/2] net: ethernet: marvell: pxa168_eth: use phydev from struct net_device |
| Date | 2016-07-19 00:10 +0200 |
| Message-ID | <rWoTE-3Fq-29@gated-at.bofh.it> (permalink) |
| References | <rW1X3-5S0-5@gated-at.bofh.it> <rWdOy-4To-11@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
Hi,
On 18/07/16 12:14, Sergei Shtylyov wrote:
> Hello.
>
> On 7/18/2016 12:30 AM, Philippe Reynes wrote:
>
>> The private structure contain a pointer to phydev, but the structure
>> net_device already contain such pointer. So we can remove the pointer
>> phydev in the private structure, and update the driver to use the
>> one contained in struct net_device.
>>
>> Signed-off-by: Philippe Reynes<tremyfr@gmail.com>
>> ---
>> drivers/net/ethernet/marvell/pxa168_eth.c | 36 +++++++++++++----------------
>> 1 files changed, 16 insertions(+), 20 deletions(-)
>>
>> diff --git a/drivers/net/ethernet/marvell/pxa168_eth.c b/drivers/net/ethernet/marvell/pxa168_eth.c
>> index 54d5154..d466326 100644
>> --- a/drivers/net/ethernet/marvell/pxa168_eth.c
>> +++ b/drivers/net/ethernet/marvell/pxa168_eth.c
> [...]
>> @@ -973,16 +972,17 @@ static int pxa168_init_phy(struct net_device *dev)
>> {
>> struct pxa168_eth_private *pep = netdev_priv(dev);
>> struct ethtool_cmd cmd;
>> + struct phy_device *phy = NULL;
>
> Initializer not really needed.
You're right, the first line using phy is an assign, so it's not really usefull.
>> int err;
>>
>> - if (pep->phy)
>> + if (dev->phydev)
>> return 0;
>>
>> - pep->phy = mdiobus_scan(pep->smi_bus, pep->phy_addr);
>> - if (IS_ERR(pep->phy))
>> - return PTR_ERR(pep->phy);
>> + phy = mdiobus_scan(pep->smi_bus, pep->phy_addr);
>> + if (IS_ERR(phy))
>> + return PTR_ERR(phy);
>>
>> - err = phy_connect_direct(dev, pep->phy, pxa168_eth_adjust_link,
>> + err = phy_connect_direct(dev, phy, pxa168_eth_adjust_link,
>> pep->phy_intf);
>> if (err)
>> return err;
>
> Hm, where do you assign 'dev->phydev'?
dev-> phydev is assigned in phy_connect_direct. In fact, phy_connect_direct call
phy_attach_direct, and this last function assign phydev to dev->phydev.
> [...]
>
> MBR, Sergei
>
Regards,
Philippe
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
[PATCH 1/2] net: ethernet: marvell: pxa168_eth: use phydev from struct net_device Philippe Reynes <tremyfr@gmail.com> - 2016-07-17 23:40 +0200
Re: [PATCH 1/2] net: ethernet: marvell: pxa168_eth: use phydev from struct net_device David Miller <davem@davemloft.net> - 2016-07-18 08:30 +0200
Re: [PATCH 1/2] net: ethernet: marvell: pxa168_eth: use phydev from struct net_device Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> - 2016-07-18 12:20 +0200
Re: [PATCH 1/2] net: ethernet: marvell: pxa168_eth: use phydev from struct net_device Philippe Reynes <tremyfr@gmail.com> - 2016-07-19 00:10 +0200
csiph-web