diff mbox series

[net-next,v2,05/18] net: dsa: mv88e6xxx: remove redundant check in mv88e6xxx_port_vlan()

Message ID 20220412105830.3495846-6-jakobkoschel@gmail.com (mailing list archive)
State Handled Elsewhere, archived
Headers show
Series Remove use of list iterator after loop body | expand

Commit Message

Jakob Koschel April 12, 2022, 10:58 a.m. UTC
We know that "dev > dst->last_switch" in the "else" block.
In other words, that "dev - dst->last_switch" is > 0.

dsa_port_bridge_num_get(dp) can be 0, but the check
"if (bridge_num + dst->last_switch != dev) continue", rewritten as
"if (bridge_num != dev - dst->last_switch) continue", aka
"if (bridge_num != something which cannot be 0) continue",
makes it redundant to have the extra "if (!bridge_num) continue" logic,
since a bridge_num of zero would have been skipped anyway.

Signed-off-by: Jakob Koschel <jakobkoschel@gmail.com>
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
---
 drivers/net/dsa/mv88e6xxx/chip.c | 3 ---
 1 file changed, 3 deletions(-)

Comments

Russell King (Oracle) April 12, 2022, 11:27 a.m. UTC | #1
On Tue, Apr 12, 2022 at 12:58:17PM +0200, Jakob Koschel wrote:
> We know that "dev > dst->last_switch" in the "else" block.
> In other words, that "dev - dst->last_switch" is > 0.
> 
> dsa_port_bridge_num_get(dp) can be 0, but the check
> "if (bridge_num + dst->last_switch != dev) continue", rewritten as
> "if (bridge_num != dev - dst->last_switch) continue", aka
> "if (bridge_num != something which cannot be 0) continue",
> makes it redundant to have the extra "if (!bridge_num) continue" logic,
> since a bridge_num of zero would have been skipped anyway.
> 
> Signed-off-by: Jakob Koschel <jakobkoschel@gmail.com>
> Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>

Isn't this Vladimir's patch?

If so, it should be commited as Vladimir as the author, and Vladimir's
sign-off should appear before yours. When sending out such patches,
there should be a From: line for Vladimir as the first line in the body
of the patch email.

The same goes for the next mv88e6xxx patch in this series - I think
both of these are the patches Vladimir sent in his email:

https://lore.kernel.org/r/20220408123101.p33jpynhqo67hebe@skbuf

Thanks.
Jakob Koschel April 12, 2022, 11:37 a.m. UTC | #2
> On 12. Apr 2022, at 13:27, Russell King (Oracle) <linux@armlinux.org.uk> wrote:
> 
> On Tue, Apr 12, 2022 at 12:58:17PM +0200, Jakob Koschel wrote:
>> We know that "dev > dst->last_switch" in the "else" block.
>> In other words, that "dev - dst->last_switch" is > 0.
>> 
>> dsa_port_bridge_num_get(dp) can be 0, but the check
>> "if (bridge_num + dst->last_switch != dev) continue", rewritten as
>> "if (bridge_num != dev - dst->last_switch) continue", aka
>> "if (bridge_num != something which cannot be 0) continue",
>> makes it redundant to have the extra "if (!bridge_num) continue" logic,
>> since a bridge_num of zero would have been skipped anyway.
>> 
>> Signed-off-by: Jakob Koschel <jakobkoschel@gmail.com>
>> Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
> 
> Isn't this Vladimir's patch?
> 
> If so, it should be commited as Vladimir as the author, and Vladimir's
> sign-off should appear before yours. When sending out such patches,
> there should be a From: line for Vladimir as the first line in the body
> of the patch email.

yes, you are right. I wasn't sure on how to send those commits, but
I guess if I just set the commit author correctly it should be fine.

regarding the order: I thought I did it correctly doing bottom up but
I confused the order, wasn't on purpose. Sorry about that.

I'll resend after verifying all the authors and sign-offs are correct.

> 
> The same goes for the next mv88e6xxx patch in this series - I think
> both of these are the patches Vladimir sent in his email:
> 
> https://lore.kernel.org/r/20220408123101.p33jpynhqo67hebe@skbuf
> 
> Thanks.
> 
> -- 
> RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
> FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!

Thanks for pointing it out!
Jakob
Paolo Abeni April 12, 2022, 12:56 p.m. UTC | #3
On Tue, 2022-04-12 at 13:37 +0200, Jakob Koschel wrote:
> 
> > On 12. Apr 2022, at 13:27, Russell King (Oracle) <linux@armlinux.org.uk> wrote:
> > 
> > On Tue, Apr 12, 2022 at 12:58:17PM +0200, Jakob Koschel wrote:
> > > We know that "dev > dst->last_switch" in the "else" block.
> > > In other words, that "dev - dst->last_switch" is > 0.
> > > 
> > > dsa_port_bridge_num_get(dp) can be 0, but the check
> > > "if (bridge_num + dst->last_switch != dev) continue", rewritten as
> > > "if (bridge_num != dev - dst->last_switch) continue", aka
> > > "if (bridge_num != something which cannot be 0) continue",
> > > makes it redundant to have the extra "if (!bridge_num) continue" logic,
> > > since a bridge_num of zero would have been skipped anyway.
> > > 
> > > Signed-off-by: Jakob Koschel <jakobkoschel@gmail.com>
> > > Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
> > 
> > Isn't this Vladimir's patch?
> > 
> > If so, it should be commited as Vladimir as the author, and Vladimir's
> > sign-off should appear before yours. When sending out such patches,
> > there should be a From: line for Vladimir as the first line in the body
> > of the patch email.
> 
> yes, you are right. I wasn't sure on how to send those commits, but
> I guess if I just set the commit author correctly it should be fine.
> 
> regarding the order: I thought I did it correctly doing bottom up but
> I confused the order, wasn't on purpose. Sorry about that.
> 
> I'll resend after verifying all the authors and sign-offs are correct.

whoops, too late...

Please, do wait at least 24h before reposting, as pointed out in the
documentation:

https://elixir.bootlin.com/linux/v5.18-rc2/source/Documentation/process/maintainer-netdev.rst#L148

Thanks,

Paolo
diff mbox series

Patch

diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c
index 64f4fdd02902..b3aa0e5bc842 100644
--- a/drivers/net/dsa/mv88e6xxx/chip.c
+++ b/drivers/net/dsa/mv88e6xxx/chip.c
@@ -1404,9 +1404,6 @@  static u16 mv88e6xxx_port_vlan(struct mv88e6xxx_chip *chip, int dev, int port)
 		list_for_each_entry(dp, &dst->ports, list) {
 			unsigned int bridge_num = dsa_port_bridge_num_get(dp);
 
-			if (!bridge_num)
-				continue;
-
 			if (bridge_num + dst->last_switch != dev)
 				continue;