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: <a9086c2f-9d15-b3d0-9809-44385d6281ff@gmail.com>
Date:   Wed, 13 Feb 2019 20:08:48 -0800
From:   Florian Fainelli <f.fainelli@...il.com>
To:     Jian Shen <shenjian15@...wei.com>, andrew@...n.ch,
        hkallweit1@...il.com, davem@...emloft.net
Cc:     netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
        linuxarm@...wei.com
Subject: Re: [PATCH net-next 2/2] net: hns3: add fixup handle for hns3 driver



On 2/13/2019 8:31 PM, Jian Shen wrote:
> The default led configuration of marvell 88E1510 is not fit
> for hns3 driver, this patch fixes it.
> 
> Signed-off-by: Jian Shen <shenjian15@...wei.com>
> ---
>  .../net/ethernet/hisilicon/hns3/hns3pf/hclge_mdio.c   | 19 +++++++++++++++++++
>  1 file changed, 19 insertions(+)
> 
> diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mdio.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mdio.c
> index 84f2878..4c8346e 100644
> --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mdio.c
> +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mdio.c
> @@ -2,6 +2,7 @@
>  // Copyright (c) 2016-2017 Hisilicon Limited.
>  
>  #include <linux/etherdevice.h>
> +#include <linux/marvell_phy.h>
>  #include <linux/kernel.h>
>  
>  #include "hclge_cmd.h"
> @@ -125,6 +126,13 @@ static int hclge_mdio_read(struct mii_bus *bus, int phyid, int regnum)
>  	return le16_to_cpu(mdio_cmd->data_rd);
>  }
>  
> +static int hclge_phy_marvell_fixup(struct phy_device *phydev)
> +{
> +	phydev->dev_flags |= MARVELL_PHY_M1510_HNS3_LEDS;
> +
> +	return 0;
> +}
> +
>  int hclge_mac_mdio_config(struct hclge_dev *hdev)
>  {
>  	struct hclge_mac *mac = &hdev->hw.mac;
> @@ -168,6 +176,15 @@ int hclge_mac_mdio_config(struct hclge_dev *hdev)
>  	mac->phydev = phydev;
>  	mac->mdio_bus = mdio_bus;
>  
> +	/* register the PHY board fixup (for Marvell 88E1510) */
> +	ret = phy_register_fixup_for_uid(MARVELL_PHY_ID_88E1510,
> +					 MARVELL_PHY_ID_MASK,
> +					 hclge_phy_marvell_fixup);
> +	/* we can live without it, so just issue a warning */
> +	if (ret)
> +		dev_warn(&hdev->pdev->dev,
> +			 "Cannot register PHY board fixup\n");

You don't need to register a fixup for passing your flags, you can do
that at the time you attach to the PHY:

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/linux/phy.h#n945


> +
>  	return 0;
>  }
>  
> @@ -240,6 +257,8 @@ void hclge_mac_disconnect_phy(struct hnae3_handle *handle)
>  	if (!phydev)
>  		return;
>  
> +	phy_unregister_fixup_for_uid(MARVELL_PHY_ID_88E1510,
> +				     MARVELL_PHY_ID_MASK);
>  	phy_disconnect(phydev);
>  }
>  
> 

-- 
Florian

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ