Message ID | 20210511124330.891694-1-andrew@lunn.ch (mailing list archive) |
---|---|
State | Changes Requested |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | net: forcedeth: Give bot handlers a helping hand understanding the code | expand |
Context | Check | Description |
---|---|---|
netdev/cover_letter | success | Link |
netdev/fixes_present | success | Link |
netdev/patch_count | success | Link |
netdev/tree_selection | success | Guessed tree name to be net-next |
netdev/subject_prefix | warning | Target tree name not specified in the subject |
netdev/cc_maintainers | warning | 3 maintainers not CCed: rain.1986.08.12@gmail.com davem@davemloft.net zyjzyj2000@gmail.com |
netdev/source_inline | success | Was 0 now: 0 |
netdev/verify_signedoff | success | Link |
netdev/module_param | success | Was 0 now: 0 |
netdev/build_32bit | success | Errors and warnings before: 1 this patch: 1 |
netdev/kdoc | success | Errors and warnings before: 0 this patch: 0 |
netdev/verify_fixes | success | Link |
netdev/checkpatch | success | total: 0 errors, 0 warnings, 0 checks, 9 lines checked |
netdev/build_allmodconfig_warn | success | Errors and warnings before: 1 this patch: 1 |
netdev/header_inline | success | Link |
On 2021/5/11 20:43, Andrew Lunn wrote: > Bots handlers repeatedly fail to understand nv_update_linkspeed() and > submit patches unoptimizing it for the human reader. Add a comment to > try to prevent this in the future. > > Signed-off-by: Andrew Lunn <andrew@lunn.ch> > --- > drivers/net/ethernet/nvidia/forcedeth.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/drivers/net/ethernet/nvidia/forcedeth.c b/drivers/net/ethernet/nvidia/forcedeth.c > index 8724d6a9ed02..0822b28f3b6a 100644 > --- a/drivers/net/ethernet/nvidia/forcedeth.c > +++ b/drivers/net/ethernet/nvidia/forcedeth.c > @@ -3475,6 +3475,9 @@ static int nv_update_linkspeed(struct net_device *dev) > newls = NVREG_LINKSPEED_FORCE|NVREG_LINKSPEED_10; > newdup = 0; > } else { > + /* Default to the same as 10/Half if we cannot > + * determine anything else. > + */ I think it would be better to remove the if branch above and then add comments here. Otherwise, it becomes more and more redundant. > newls = NVREG_LINKSPEED_FORCE|NVREG_LINKSPEED_10; > newdup = 0; > } >
On Tue, May 11, 2021 at 09:48:11PM +0800, Leizhen (ThunderTown) wrote: > > > On 2021/5/11 20:43, Andrew Lunn wrote: > > Bots handlers repeatedly fail to understand nv_update_linkspeed() and > > submit patches unoptimizing it for the human reader. Add a comment to > > try to prevent this in the future. > > > > Signed-off-by: Andrew Lunn <andrew@lunn.ch> > > --- > > drivers/net/ethernet/nvidia/forcedeth.c | 3 +++ > > 1 file changed, 3 insertions(+) > > > > diff --git a/drivers/net/ethernet/nvidia/forcedeth.c b/drivers/net/ethernet/nvidia/forcedeth.c > > index 8724d6a9ed02..0822b28f3b6a 100644 > > --- a/drivers/net/ethernet/nvidia/forcedeth.c > > +++ b/drivers/net/ethernet/nvidia/forcedeth.c > > @@ -3475,6 +3475,9 @@ static int nv_update_linkspeed(struct net_device *dev) > > newls = NVREG_LINKSPEED_FORCE|NVREG_LINKSPEED_10; > > newdup = 0; > > } else { > > + /* Default to the same as 10/Half if we cannot > > + * determine anything else. > > + */ > I think it would be better to remove the if branch above and then add comments here. > Otherwise, it becomes more and more redundant. I kind of agree with you. However, we have seen at least four times, that bots and their master are incapable of understanding this code and try to unoptimize its readabilty/understandability. So we need to add redundancy so hopefully the masters of these bots will understand this code, see that it is correct, and leave it alone. The other option is to work on the bot. Look at all the cases it got it wrong, the code is in fact correct, but the bot could not see why. Figure out the common pattern for why it got it wrong, and fix the bot. Or we can also add tools to aid the master. We know the bot gets it wrong sometimes. The master also seems to get it wrong, and blindly changes the code without understanding it. The maintainers then reject it. That rejection is logged, it is available in lore. A tool which can search lore for a similar patch which has been rejected before seems like it would be useful for all bots. It would cut down on wasted time of bot masters generating wrong patches and maintainers rejecting them. Andrew
diff --git a/drivers/net/ethernet/nvidia/forcedeth.c b/drivers/net/ethernet/nvidia/forcedeth.c index 8724d6a9ed02..0822b28f3b6a 100644 --- a/drivers/net/ethernet/nvidia/forcedeth.c +++ b/drivers/net/ethernet/nvidia/forcedeth.c @@ -3475,6 +3475,9 @@ static int nv_update_linkspeed(struct net_device *dev) newls = NVREG_LINKSPEED_FORCE|NVREG_LINKSPEED_10; newdup = 0; } else { + /* Default to the same as 10/Half if we cannot + * determine anything else. + */ newls = NVREG_LINKSPEED_FORCE|NVREG_LINKSPEED_10; newdup = 0; }
Bots handlers repeatedly fail to understand nv_update_linkspeed() and submit patches unoptimizing it for the human reader. Add a comment to try to prevent this in the future. Signed-off-by: Andrew Lunn <andrew@lunn.ch> --- drivers/net/ethernet/nvidia/forcedeth.c | 3 +++ 1 file changed, 3 insertions(+)