[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Tue, 16 May 2023 10:38:53 +0800
From: Jiawen Wu <jiawenwu@...stnetic.com>
To: <andy.shevchenko@...il.com>
Cc: <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@...linux.org.uk>,
<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
> > +static int txgbe_gpio_init(struct txgbe *txgbe)
> > +{
> > + 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;
should I split the line, or put the long line abruptly there?
> > + gc = devm_kzalloc(dev, sizeof(*gc), GFP_KERNEL);
> > + if (!gc)
> > + return -ENOMEM;
> > +
> > + gc->label = devm_kasprintf(dev, GFP_KERNEL, "txgbe_gpio-%x",
> > + (wx->pdev->bus->number << 8) | wx->pdev->devfn);
> > + gc->base = -1;
> > + gc->ngpio = 6;
> > + gc->owner = THIS_MODULE;
> > + gc->parent = dev;
> > + gc->fwnode = software_node_fwnode(txgbe->nodes.group[SWNODE_GPIO]);
>
> Looking at the I²C case, I'm wondering if gpio-regmap can be used for this piece.
I can access this GPIO region directly, do I really need to use regmap?
Powered by blists - more mailing lists