[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZGNbb2Oe9aLIT04p@shell.armlinux.org.uk>
Date: Tue, 16 May 2023 11:31:11 +0100
From: "Russell King (Oracle)" <linux@...linux.org.uk>
To: Paolo Abeni <pabeni@...hat.com>
Cc: Andy Shevchenko <andy.shevchenko@...il.com>,
Jiawen Wu <jiawenwu@...stnetic.com>, netdev@...r.kernel.org,
jarkko.nikula@...ux.intel.com, andriy.shevchenko@...ux.intel.com,
mika.westerberg@...ux.intel.com, jsd@...ihalf.com,
Jose.Abreu@...opsys.com, andrew@...n.ch, hkallweit1@...il.com,
linux-i2c@...r.kernel.org, linux-gpio@...r.kernel.org,
mengyuanlou@...-swift.com
Subject: Re: [PATCH net-next v8 6/9] net: txgbe: Support GPIO to SFP socket
On Tue, May 16, 2023 at 11:39:08AM +0200, Paolo Abeni wrote:
> On Tue, 2023-05-16 at 10:12 +0300, Andy Shevchenko wrote:
> > On Tue, May 16, 2023 at 5:39 AM Jiawen Wu <jiawenwu@...stnetic.com> wrote:
> >
> > ...
> >
> > > > > + struct gpio_irq_chip *girq;
> > > > > + struct wx *wx = txgbe->wx;
> > > > > + struct gpio_chip *gc;
> > > > > + struct device *dev;
> > > > > + int ret;
> > > >
> > > > > + dev = &wx->pdev->dev;
> > > >
> > > > This can be united with the defintion above.
> > > >
> > > > struct device *dev = &wx->pdev->dev;
> > > >
> > >
> > > This is a question that I often run into, when I want to keep this order,
> > > i.e. lines longest to shortest, but the line of the pointer which get later
> > > is longer. For this example:
> > >
> > > struct wx *wx = txgbe->wx;
> > > struct device *dev = &wx->pdev->dev;
> >
> > So, we locate assignments according to the flow. I do not see an issue here.
>
> That would break the reverse x-mass tree order.
>
> > > should I split the line, or put the long line abruptly there?
> >
> > The latter is fine.
>
> This is minor, but I have to disagree. My understanding is that
> respecting the reversed x-mass tree is preferred. In case of dependent
> initialization as the above, the preferred style it the one used by
> this patch.
Meanwhile, I've been told something completely different, and therefore
I do something else, namely:
struct device *dev;
struct wx *wx;
wx = txgbe->wx;
dev = &wx->pdev->dev;
...
I've been lead to believe that this is preferred in netdev to breaking
the reverse christmas-tree due to dependent initialisations.
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!
Powered by blists - more mailing lists