Re: [PATCH net-next V2 2/5] net: lan743x: Add support to software-nodes for sfp

From: Raju Lakkaraju
Date: Thu Sep 12 2024 - 02:37:18 EST


Hi Christophe,

The 09/11/2024 18:54, Christophe JAILLET wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
>
> Le 11/09/2024 à 18:10, Raju Lakkaraju a écrit :
> > Register software nodes and define the device properties.
> > software-node contains following properties.
> > - gpio pin details
> > - i2c bus information
> > - sfp signals
> > - phylink mode
> >
> > Signed-off-by: Raju Lakkaraju <Raju.Lakkaraju@xxxxxxxxxxxxx>
>
> Hi,
>
> ...
>
> > +static int pci1xxxx_i2c_adapter_get(struct lan743x_adapter *adapter)
> > +{
> > + struct pci1xxxx_i2c *i2c_drvdata;
> > +
> > + i2c_drvdata = pci1xxxx_perif_drvdata_get(adapter, PCI1XXXX_PERIF_I2C_ID);
> > + if (!i2c_drvdata)
> > + return -EPROBE_DEFER;
> > +
> > + adapter->i2c_adap = &i2c_drvdata->adap;
> > + snprintf(adapter->nodes->i2c_name, sizeof(adapter->nodes->i2c_name),
> > + adapter->i2c_adap->name);
>
> strscpy() ?
>

Accepted. I will fix.
Here snprintf( ) does not take any format string, we can use strscpy( ).

> > + netif_dbg(adapter, drv, adapter->netdev, "Found %s\n",
> > + adapter->i2c_adap->name);
> > +
> > + return 0;
> > +}
> > +
> > +static int pci1xxxx_gpio_dev_get(struct lan743x_adapter *adapter)
> > +{
> > + struct aux_bus_device *aux_bus;
> > + struct device *gpio_dev;
> > +
> > + aux_bus = pci1xxxx_perif_drvdata_get(adapter, PCI1XXXX_PERIF_GPIO_ID);
> > + if (!aux_bus)
> > + return -EPROBE_DEFER;
> > +
> > + gpio_dev = &aux_bus->aux_device_wrapper[1]->aux_dev.dev;
> > + snprintf(adapter->nodes->gpio_name, sizeof(adapter->nodes->gpio_name),
> > + dev_name(gpio_dev));
>
> strscpy() ?
>

Accepted. I will fix.

> > + netif_dbg(adapter, drv, adapter->netdev, "Found %s\n",
> > + adapter->i2c_adap->name);
> > +
> > + return 0;
> > +}
> > +
> > +static int pci1xxxx_gpio_dev_get(struct lan743x_adapter *adapter)
> > +{
> > + struct aux_bus_device *aux_bus;
> > + struct device *gpio_dev;
> > +
> > + aux_bus = pci1xxxx_perif_drvdata_get(adapter, PCI1XXXX_PERIF_GPIO_ID);
> > + if (!aux_bus)
> > + return -EPROBE_DEFER;
> > +
> > + gpio_dev = &aux_bus->aux_device_wrapper[1]->aux_dev.dev;
> > + snprintf(adapter->nodes->gpio_name, sizeof(adapter->nodes->gpio_name),
> > + dev_name(gpio_dev));
>
> strscpy() ?

Accepted. I will fix.

> > + netif_dbg(adapter, drv, adapter->netdev, "Found %s\n",
> > + adapter->i2c_adap->name);
> > +
> > + return 0;
> > +}
> > +
> > +static int pci1xxxx_gpio_dev_get(struct lan743x_adapter *adapter)
> > +{
> > + struct aux_bus_device *aux_bus;
> > + struct device *gpio_dev;
> > +
> > + aux_bus = pci1xxxx_perif_drvdata_get(adapter, PCI1XXXX_PERIF_GPIO_ID);
> > + if (!aux_bus)
> > + return -EPROBE_DEFER;
> > +
> > + gpio_dev = &aux_bus->aux_device_wrapper[1]->aux_dev.dev;
> > + snprintf(adapter->nodes->gpio_name, sizeof(adapter->nodes->gpio_name),
> > + dev_name(gpio_dev));
>
> strscpy() ?
> > + netif_dbg(adapter, drv, adapter->netdev, "Found %s\n",
> > + adapter->nodes->gpio_name);
> > + return 0;
> > +}
> > +
>
> ...

--
Thanks,
Raju