linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 32/42] drivers/net/bnx2x: Adjust confusing if indentation
@ 2010-08-05 20:26 Julia Lawall
  2010-08-06  7:07 ` Dan Carpenter
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Julia Lawall @ 2010-08-05 20:26 UTC (permalink / raw)
  To: Eilon Greenstein, netdev, linux-kernel, kernel-janitors

From: Julia Lawall <julia@diku.dk>

Outdent the code following the if.

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@diku.dk>

---
This patch doesn't change the semantics of the code.  But it might not be
what is intended.

 drivers/net/bnx2x/bnx2x_link.c |   10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/net/bnx2x/bnx2x_link.c b/drivers/net/bnx2x/bnx2x_link.c
index 0383e30..0fa0991 100644
--- a/drivers/net/bnx2x/bnx2x_link.c
+++ b/drivers/net/bnx2x/bnx2x_link.c
@@ -1254,11 +1254,11 @@ static void bnx2x_set_autoneg(struct link_params *params,
 		    PORT_HW_CFG_SPEED_CAPABILITY_D0_1G)
 			reg_val |= MDIO_CL73_IEEEB1_AN_ADV2_ADVR_1000M_KX;
 
-			CL45_WR_OVER_CL22(bp, params->port,
-					      params->phy_addr,
-					      MDIO_REG_BANK_CL73_IEEEB1,
-					      MDIO_CL73_IEEEB1_AN_ADV2,
-				      reg_val);
+		CL45_WR_OVER_CL22(bp, params->port,
+				      params->phy_addr,
+				      MDIO_REG_BANK_CL73_IEEEB1,
+				      MDIO_CL73_IEEEB1_AN_ADV2,
+			      reg_val);
 
 		/* CL73 Autoneg Enabled */
 		reg_val = MDIO_CL73_IEEEB0_CL73_AN_CONTROL_AN_EN;

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 32/42] drivers/net/bnx2x: Adjust confusing if indentation
  2010-08-05 20:26 [PATCH 32/42] drivers/net/bnx2x: Adjust confusing if indentation Julia Lawall
@ 2010-08-06  7:07 ` Dan Carpenter
  2010-08-08 19:14   ` Eilon Greenstein
  2010-08-08 19:13 ` Eilon Greenstein
  2010-08-17  8:49 ` David Miller
  2 siblings, 1 reply; 5+ messages in thread
From: Dan Carpenter @ 2010-08-06  7:07 UTC (permalink / raw)
  To: Julia Lawall; +Cc: Eilon Greenstein, netdev, linux-kernel, kernel-janitors

On Thu, Aug 05, 2010 at 10:26:38PM +0200, Julia Lawall wrote:
> ---
> This patch doesn't change the semantics of the code.  But it might not be
> what is intended.
> 

I think there may have been some if statements which were removed before
the code was merged into the kernel?  Here is another one from that same
function.  Someone can roll this in with your patch.

regards,
dan carpenter

diff --git a/drivers/net/bnx2x/bnx2x_link.c b/drivers/net/bnx2x/bnx2x_link.c
index 0fa0991..ca0e435 100644
--- a/drivers/net/bnx2x/bnx2x_link.c
+++ b/drivers/net/bnx2x/bnx2x_link.c
@@ -1242,11 +1242,11 @@ static void bnx2x_set_autoneg(struct link_params *params,
 			MDIO_CL73_USERB0_CL73_BAM_CTRL1_BAM_NP_AFTER_BP_EN);
 
 		/* Advertise CL73 link speeds */
-			CL45_RD_OVER_CL22(bp, params->port,
-					      params->phy_addr,
-					      MDIO_REG_BANK_CL73_IEEEB1,
-					      MDIO_CL73_IEEEB1_AN_ADV2,
-					      &reg_val);
+		CL45_RD_OVER_CL22(bp, params->port,
+				      params->phy_addr,
+				      MDIO_REG_BANK_CL73_IEEEB1,
+				      MDIO_CL73_IEEEB1_AN_ADV2,
+				      &reg_val);
 		if (params->speed_cap_mask &
 		    PORT_HW_CFG_SPEED_CAPABILITY_D0_10G)
 			reg_val |= MDIO_CL73_IEEEB1_AN_ADV2_ADVR_10G_KX4;

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 32/42] drivers/net/bnx2x: Adjust confusing if indentation
  2010-08-05 20:26 [PATCH 32/42] drivers/net/bnx2x: Adjust confusing if indentation Julia Lawall
  2010-08-06  7:07 ` Dan Carpenter
@ 2010-08-08 19:13 ` Eilon Greenstein
  2010-08-17  8:49 ` David Miller
  2 siblings, 0 replies; 5+ messages in thread
From: Eilon Greenstein @ 2010-08-08 19:13 UTC (permalink / raw)
  To: Julia Lawall; +Cc: netdev, linux-kernel, kernel-janitors, yanivr

On Thu, 2010-08-05 at 13:26 -0700, Julia Lawall wrote:
> From: Julia Lawall <julia@diku.dk>
> 
> Outdent the code following the if.
> 
> 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@diku.dk>

Acked-by: Eilon Greenstein <eilong@broadcom.com>
> ---
> This patch doesn't change the semantics of the code.  But it might not be
> what is intended.

This is indeed just bad alignment, thanks for the fix




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 32/42] drivers/net/bnx2x: Adjust confusing if indentation
  2010-08-06  7:07 ` Dan Carpenter
@ 2010-08-08 19:14   ` Eilon Greenstein
  0 siblings, 0 replies; 5+ messages in thread
From: Eilon Greenstein @ 2010-08-08 19:14 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: Julia Lawall, netdev, linux-kernel, kernel-janitors, yanivr

On Fri, 2010-08-06 at 00:07 -0700, Dan Carpenter wrote:
> On Thu, Aug 05, 2010 at 10:26:38PM +0200, Julia Lawall wrote:
> > ---
> > This patch doesn't change the semantics of the code.  But it might not be
> > what is intended.
> > 
> 
> I think there may have been some if statements which were removed before
> the code was merged into the kernel?  Here is another one from that same
> function.  Someone can roll this in with your patch.
> 

Thanks Dan. We will send a more complete patch series for this file once
net-next is open again.



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 32/42] drivers/net/bnx2x: Adjust confusing if indentation
  2010-08-05 20:26 [PATCH 32/42] drivers/net/bnx2x: Adjust confusing if indentation Julia Lawall
  2010-08-06  7:07 ` Dan Carpenter
  2010-08-08 19:13 ` Eilon Greenstein
@ 2010-08-17  8:49 ` David Miller
  2 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2010-08-17  8:49 UTC (permalink / raw)
  To: julia; +Cc: eilong, netdev, linux-kernel, kernel-janitors


Applied.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2010-08-17  8:49 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-08-05 20:26 [PATCH 32/42] drivers/net/bnx2x: Adjust confusing if indentation Julia Lawall
2010-08-06  7:07 ` Dan Carpenter
2010-08-08 19:14   ` Eilon Greenstein
2010-08-08 19:13 ` Eilon Greenstein
2010-08-17  8:49 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).