Subject: Re: [PATCH iwl-next v3 3/3] ixgbe: Cleanup after type convertion

From: Simon Horman <[email-masked]>
Date: Fri, 19 Jan 2024 16:02:19 +0000

On Thu, Jan 18, 2024 at 02:43:32PM +0100, Jedrzej Jagielski wrote:
> Clean up code where touched during type convertion by the patch
> 8035560dbfaf. Rearrange to fix reverse Christmas tree.
> 
> Suggested-by: Tony Nguyen <[email-masked]>
> Signed-off-by: Jedrzej Jagielski <[email-masked]>

...

> @@ -771,12 +771,12 @@ static int ixgbe_setup_mac_link_82599(struct ixgbe_hw *hw,
>  				      ixgbe_link_speed speed,
>  				      bool autoneg_wait_to_complete)
>  {
> -	bool autoneg = false;
> -	int status;
> -	u32 pma_pmd_1g, link_mode, links_reg, i;
> -	u32 autoc2 = IXGBE_READ_REG(hw, IXGBE_AUTOC2);
>  	u32 pma_pmd_10g_serial = autoc2 & IXGBE_AUTOC2_10G_SERIAL_PMA_PMD_MASK;
>  	ixgbe_link_speed link_capabilities = IXGBE_LINK_SPEED_UNKNOWN;
> +	u32 autoc2 = IXGBE_READ_REG(hw, IXGBE_AUTOC2);
> +	u32 pma_pmd_1g, link_mode, links_reg, i;
> +	bool autoneg = false;
> +	int status;

Hi Jedrzej,

In the new arrangement above autoc2 is used before it is declared.
Perhaps this could be:

	ixgbe_link_speed link_capabilities = IXGBE_LINK_SPEED_UNKNOWN;
	u32 autoc2 = IXGBE_READ_REG(hw, IXGBE_AUTOC2);
	u32 pma_pmd_1g, link_mode, links_reg, i;
	u32 pma_pmd_10g_serial;
	bool autoneg = false;
	int status;

	...

	pma_pmd_10g_serial = autoc2 & IXGBE_AUTOC2_10G_SERIAL_PMA_PMD_MASK;

>  
>  	/* holds the value of AUTOC register at this current point in time */
>  	u32 current_autoc = IXGBE_READ_REG(hw, IXGBE_AUTOC);

...