Subject: Re: [PATCH net-next] net: dsa: sja1105: Print the reset reason

From: Andrew Lunn <[email-masked]>
Date: Wed, 13 Nov 2019 04:53:21 +0100

On Tue, Nov 12, 2019 at 11:22:00PM +0200, Vladimir Oltean wrote:
> Sometimes it can be quite opaque even for me why the driver decided to
> reset the switch. So instead of adding dump_stack() calls each time for
> debugging, just add a reset reason to sja1105_static_config_reload
> calls which gets printed to the console.

> +int sja1105_static_config_reload(struct sja1105_private *priv,
> +				 enum sja1105_reset_reason reason)
>  {
>  	struct ptp_system_timestamp ptp_sts_before;
>  	struct ptp_system_timestamp ptp_sts_after;
> @@ -1405,6 +1413,10 @@ int sja1105_static_config_reload(struct sja1105_private *priv)
>  out_unlock_ptp:
>  	mutex_unlock(&priv->ptp_data.lock);
>  
> +	dev_info(priv->ds->dev,
> +		 "Reset switch and programmed static config. Reason: %s\n",
> +		 sja1105_reset_reasons[reason]);

If this is for debugging, maybe dev_dbg() would be better?

   Andrew