All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH net-next v2] net: phy: leds: Deduplicate link LED trigger registration
       [not found] <20200826152223.56508-1-andriy.shevchenko@linux.intel.com>
@ 2020-09-14 15:32 ` Andy Shevchenko
  0 siblings, 0 replies; only message in thread
From: Andy Shevchenko @ 2020-09-14 15:32 UTC (permalink / raw
  To: Florian Fainelli, Heiner Kallweit, netdev, Russell King,
	David Miller
  Cc: Andrew Lunn

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@linux.intel.com>
> Reviewed-by: Andrew Lunn <andrew@lunn.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



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-09-14 16:39 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20200826152223.56508-1-andriy.shevchenko@linux.intel.com>
2020-09-14 15:32 ` [PATCH net-next v2] net: phy: leds: Deduplicate link LED trigger registration Andy Shevchenko

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.