From: Simon Horman <simon.horman@corigine.com>
To: yunchuan <yunchuan@nfschina.com>
Cc: mostrows@earthlink.net, davem@davemloft.net, edumazet@google.com,
kuba@kernel.org, pabeni@redhat.com, xeb@mail.ru,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
kernel-janitors@vger.kernel.org
Subject: Re: [PATCH net-next v2 03/10] net: ppp: Remove unnecessary (void*) conversions
Date: Thu, 13 Jul 2023 09:41:29 +0100 [thread overview]
Message-ID: <ZK+4udwfawcJq5qC@corigine.com> (raw)
In-Reply-To: <284c0843-b749-00c8-95bc-6a0b220d9421@nfschina.com>
On Wed, Jul 12, 2023 at 09:44:40AM +0800, yunchuan wrote:
> On 2023/7/12 01:50, Simon Horman wrote:
> > > - struct sock *sk = (struct sock *)chan->private;
> > > + struct sock *sk = chan->private;
> > > struct pppox_sock *po = pppox_sk(sk);
> > > struct net_device *dev = po->pppoe_dev;
> > Hi,
> >
> > Please don't break reverse xmas tree ordering - longest line to shortest -
> > of local variable declarations in Networking code.
>
> Hi,
>
> This can't be reversed because it depends on the first declaration.
> Should I change it like this?
>
> - struct sock *sk = (struct sock *)chan->private;
> - struct pppox_sock *po = pppox_sk(sk);
> + struct pppox_sock *po = pppox_sk(chan->private);
> struct net_device *dev = po->pppoe_dev;
> + struct sock *sk = chan->private;
>
> But this seems to be bad. As the advice of Andrew[1] and Dan[2]:
>
> "
>
> When dealing with existing broken reverse Christmas tree, please don't
> make it worse with a change. But actually fixing it should be in a
> different patch.
>
> We want patches to be obviously correct. By removing the cast and
> moving variables around, it is less obvious it is correct, than having
> two patches.
>
> "
Thanks, I agree this is a good approach.
next prev parent reply other threads:[~2023-07-13 8:44 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-10 6:40 [PATCH net-next v2 03/10] net: ppp: Remove unnecessary (void*) conversions Su Hui
2023-07-11 17:50 ` Simon Horman
2023-07-12 1:44 ` yunchuan
2023-07-13 8:41 ` Simon Horman [this message]
2023-07-14 9:07 ` Guillaume Nault
2023-07-17 1:33 ` yunchuan
2023-07-17 13:21 ` Guillaume Nault
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZK+4udwfawcJq5qC@corigine.com \
--to=simon.horman@corigine.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mostrows@earthlink.net \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=xeb@mail.ru \
--cc=yunchuan@nfschina.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox