1
0
mirror of https://github.com/corundum/corundum.git synced 2025-01-16 08:12:53 +08:00

Fix I2C client forwarding to netdevs

This commit is contained in:
Alex Forencich 2021-12-25 01:40:08 -08:00
parent 23cd700a3f
commit 8b219d3cad
2 changed files with 10 additions and 7 deletions

View File

@ -40,7 +40,6 @@ int mqnic_create_interface(struct mqnic_dev *mdev, struct mqnic_if **interface_p
{
struct device *dev = mdev->dev;
struct mqnic_if *interface;
struct mqnic_priv *priv;
int ret = 0;
int k;
u32 desc_block_size;
@ -178,9 +177,6 @@ int mqnic_create_interface(struct mqnic_dev *mdev, struct mqnic_if **interface_p
ret = mqnic_create_netdev(interface, &interface->ndev[k], k);
if (ret)
goto fail;
priv = netdev_priv(interface->ndev[k]);
priv->mod_i2c_client = interface->mod_i2c_client;
}
return 0;

View File

@ -111,7 +111,7 @@ static int mqnic_common_probe(struct mqnic_dev *mqnic)
int ret = 0;
struct device *dev = mqnic->dev;
int k = 0;
int k = 0, l = 0;
// Read ID registers
mqnic->fw_id = ioread32(mqnic->hw_addr + MQNIC_REG_FW_ID);
@ -171,8 +171,15 @@ static int mqnic_common_probe(struct mqnic_dev *mqnic)
}
// pass module I2C clients to interface instances
for (k = 0; k < mqnic->if_count; k++)
mqnic->interface[k]->mod_i2c_client = mqnic->mod_i2c_client[k];
for (k = 0; k < mqnic->if_count; k++) {
struct mqnic_if *interface = mqnic->interface[k];
interface->mod_i2c_client = mqnic->mod_i2c_client[k];
for (l = 0; l < interface->ndev_count; l++) {
struct mqnic_priv *priv = netdev_priv(interface->ndev[l]);
priv->mod_i2c_client = mqnic->mod_i2c_client[k];
}
}
mqnic->misc_dev.minor = MISC_DYNAMIC_MINOR;
mqnic->misc_dev.name = mqnic->name;