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  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date:   Mon, 14 Sep 2020 18:32:59 +0300
From:   Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To:     Florian Fainelli <f.fainelli@...il.com>,
        Heiner Kallweit <hkallweit1@...il.com>, netdev@...r.kernel.org,
        Russell King <linux@...linux.org.uk>,
        David Miller <davem@...emloft.net>
Cc:     Andrew Lunn <andrew@...n.ch>
Subject: Re: [PATCH net-next v2] net: phy: leds: Deduplicate link LED trigger
 registration

On Wed, Aug 26, 2020 at 06:22:23PM +0300, Andy Shevchenko wrote:
> Refactor phy_led_trigger_register() and deduplicate its functionality
> when registering LED trigger for link.

Is it good enough now?

> Signed-off-by: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
> Reviewed-by: Andrew Lunn <andrew@...n.ch>
> ---
> v2: fixed build error (lkp, David)
>  drivers/net/phy/phy_led_triggers.c | 15 +++++----------
>  1 file changed, 5 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/net/phy/phy_led_triggers.c b/drivers/net/phy/phy_led_triggers.c
> index 59a94e07e7c5..08a3e9ea4102 100644
> --- a/drivers/net/phy/phy_led_triggers.c
> +++ b/drivers/net/phy/phy_led_triggers.c
> @@ -66,11 +66,11 @@ static void phy_led_trigger_format_name(struct phy_device *phy, char *buf,
>  
>  static int phy_led_trigger_register(struct phy_device *phy,
>  				    struct phy_led_trigger *plt,
> -				    unsigned int speed)
> +				    unsigned int speed,
> +				    const char *suffix)
>  {
>  	plt->speed = speed;
> -	phy_led_trigger_format_name(phy, plt->name, sizeof(plt->name),
> -				    phy_speed_to_str(speed));
> +	phy_led_trigger_format_name(phy, plt->name, sizeof(plt->name), suffix);
>  	plt->trigger.name = plt->name;
>  
>  	return led_trigger_register(&plt->trigger);
> @@ -99,12 +99,7 @@ int phy_led_triggers_register(struct phy_device *phy)
>  		goto out_clear;
>  	}
>  
> -	phy_led_trigger_format_name(phy, phy->led_link_trigger->name,
> -				    sizeof(phy->led_link_trigger->name),
> -				    "link");
> -	phy->led_link_trigger->trigger.name = phy->led_link_trigger->name;
> -
> -	err = led_trigger_register(&phy->led_link_trigger->trigger);
> +	err = phy_led_trigger_register(phy, phy->led_link_trigger, 0, "link");
>  	if (err)
>  		goto out_free_link;
>  
> @@ -119,7 +114,7 @@ int phy_led_triggers_register(struct phy_device *phy)
>  
>  	for (i = 0; i < phy->phy_num_led_triggers; i++) {
>  		err = phy_led_trigger_register(phy, &phy->phy_led_triggers[i],
> -					       speeds[i]);
> +					       speeds[i], phy_speed_to_str(speeds[i]));
>  		if (err)
>  			goto out_unreg;
>  	}
> -- 
> 2.28.0
> 

-- 
With Best Regards,
Andy Shevchenko


Powered by blists - more mailing lists