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]
Date:	Thu, 10 Sep 2015 21:14:34 -0700
From:	Florian Fainelli <f.fainelli@...il.com>
To:	Simon Horman <horms+renesas@...ge.net.au>, netdev@...r.kernel.org,
	linux-sh@...r.kernel.org
Cc:	linux-arm-kernel@...ts.infradead.org,
	Magnus Damm <magnus.damm@...il.com>,
	Sergei Shtylyov <sergei.shtylyov@...entembedded.com>,
	Geert Uytterhoeven <geert@...ux-m68k.org>
Subject: Re: [PATCH/RFC v2 net-next 1/4] phylib: Add phy_set_max_speed helper

Le 09/10/15 19:01, Simon Horman a écrit :
> Add a helper to allow ethernet drivers to limit the speed of a phy
> (that they are attached to).
> 
> This mainly involves factoring out the business-end of
> of_set_phy_supported() and exporting a new symbol.
> 
> This code seems to be open coded in several places, in several different
> variants.
> 
> This code is envisaged this will be used in situations where setting
> the "max-speed" property is not appropriate, e.g. because the maximum
> speed is not a property of the phy hardware.

This looks good to me, one minor comment, see below:

> 
> Signed-off-by: Simon Horman <horms+renesas@...ge.net.au>
> 
> ---
> 
> v2
> * First post
> ---
>  drivers/net/phy/phy_device.c | 52 ++++++++++++++++++++++++++++----------------
>  include/linux/phy.h          |  1 +
>  2 files changed, 34 insertions(+), 19 deletions(-)
> 
> diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
> index c0f211127274..d9a020095972 100644
> --- a/drivers/net/phy/phy_device.c
> +++ b/drivers/net/phy/phy_device.c
> @@ -1205,6 +1205,37 @@ static int gen10g_resume(struct phy_device *phydev)
>  	return 0;
>  }
>  
> +static void __set_phy_supported(struct phy_device *phydev, u32 max_speed)
> +{
> +	if (!IS_ENABLED(CONFIG_OF_MDIO))
> +		return;

I think that part should be moved to of_set_phy_supported(), since your
are exporting phy_set_max_speed() which should therefore be available
regardless of whether Device Tree is used.

While you are it, it might be nice to either warn or return -ENOTSUPP if
the speed does not match 10, 100 or 1000, but that might be worth a
second patch.

Thanks!
-- 
Florian
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ