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

From: Christophe JAILLET
Date: Wed Sep 11 2024 - 12:55:22 EST


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() ?

+ 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;
+}
+

...