Re: [PATCH 8/42] drivers/net/ixgbe: Adjust confusing if indentation

From: Jeff Kirsher
Date: Thu Aug 05 2010 - 17:10:54 EST


On Thu, Aug 5, 2010 at 13:19, Julia Lawall <julia@xxxxxxx> wrote:
> From: Julia Lawall <julia@xxxxxxx>
>
> Both ifs and assignments to autoc seem similar enough that they are both
> put in the if branch indicated by their indentation.
>
> The semantic match that finds this problem is as follows:
> (http://coccinelle.lip6.fr/)
>
> // <smpl>
> @r disable braces4@
> position p1,p2;
> statement S1,S2;
> @@
>
> (
> if (...) { ... }
> |
> if (...) S1@p1 S2@p2
> )
>
> @script:python@
> p1 << r.p1;
> p2 << r.p2;
> @@
>
> if (p1[0].column == p2[0].column):
> Âcocci.print_main("branch",p1)
> Âcocci.print_secs("after",p2)
> // </smpl>
>
> Signed-off-by: Julia Lawall <julia@xxxxxxx>
>
> ---
> This changes the semantics and might be the wrong fix. ÂNot tested.
>
> Âdrivers/net/ixgbe/ixgbe_82599.c | Â Â3 ++-
> Â1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/ixgbe/ixgbe_82599.c b/drivers/net/ixgbe/ixgbe_82599.c
> index 3e06a61..a5fcdce 100644
> --- a/drivers/net/ixgbe/ixgbe_82599.c
> +++ b/drivers/net/ixgbe/ixgbe_82599.c
> @@ -766,12 +766,13 @@ s32 ixgbe_setup_mac_link_82599(struct ixgbe_hw *hw,
> Â Â Â Â Â Âlink_mode == IXGBE_AUTOC_LMS_KX4_KX_KR_SGMII) {
> Â Â Â Â Â Â Â Â/* Set KX4/KX/KR support according to speed requested */
> Â Â Â Â Â Â Â Âautoc &= ~(IXGBE_AUTOC_KX4_KX_SUPP_MASK | IXGBE_AUTOC_KR_SUPP);
> - Â Â Â Â Â Â Â if (speed & IXGBE_LINK_SPEED_10GB_FULL)
> + Â Â Â Â Â Â Â if (speed & IXGBE_LINK_SPEED_10GB_FULL) {
> Â Â Â Â Â Â Â Â Â Â Â Âif (orig_autoc & IXGBE_AUTOC_KX4_SUPP)
> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Âautoc |= IXGBE_AUTOC_KX4_SUPP;
> Â Â Â Â Â Â Â Â Â Â Â Âif ((orig_autoc & IXGBE_AUTOC_KR_SUPP) &&
> Â Â Â Â Â Â Â Â Â Â Â Â Â Â(hw->phy.smart_speed_active == false))
> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Âautoc |= IXGBE_AUTOC_KR_SUPP;
> + Â Â Â Â Â Â Â }
> Â Â Â Â Â Â Â Âif (speed & IXGBE_LINK_SPEED_1GB_FULL)
> Â Â Â Â Â Â Â Â Â Â Â Âautoc |= IXGBE_AUTOC_KX_SUPP;
> Â Â Â Â} else if ((pma_pmd_1g == IXGBE_AUTOC_1G_SFI) &&

Thanks Julia, I ave added the path to my queue.

--
Cheers,
Jeff
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/