net: hns3: Change return type of hnae3_register_ae_dev
If hclge.ko has not been inserted, the value of ret always is zero in hnae3_register_ae_dev. If hclge.ko has been inserted, the value of ret is zero or non zero. Different execution ways have different results. It is confusing. The ae_dev which is initialized failed can be reinitialized when we remove hclge.ko and insert it again. For the case initializing client instance, it is just like the case initializing ae_dev. The main function of hnae3_register_ae_dev is adding the ae_dev to ad_dev list. Because adding ae_dev is always ok, we does not need to return any in this function. This patch changes the return type of hnae3_register_ae_dev from int to void. Signed-off-by: Fuyun Liang <liangfuyun1@huawei.com> Signed-off-by: Peng Li <lipeng321@huawei.com> Signed-off-by: Salil Mehta <salil.mehta@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
e3afa96365
commit
50fbc237b7
|
@ -203,7 +203,7 @@ EXPORT_SYMBOL(hnae3_unregister_ae_algo);
|
||||||
* @ae_dev: the AE device
|
* @ae_dev: the AE device
|
||||||
* NOTE: the duplicated name will not be checked
|
* NOTE: the duplicated name will not be checked
|
||||||
*/
|
*/
|
||||||
int hnae3_register_ae_dev(struct hnae3_ae_dev *ae_dev)
|
void hnae3_register_ae_dev(struct hnae3_ae_dev *ae_dev)
|
||||||
{
|
{
|
||||||
const struct pci_device_id *id;
|
const struct pci_device_id *id;
|
||||||
struct hnae3_ae_algo *ae_algo;
|
struct hnae3_ae_algo *ae_algo;
|
||||||
|
@ -224,7 +224,6 @@ int hnae3_register_ae_dev(struct hnae3_ae_dev *ae_dev)
|
||||||
|
|
||||||
if (!ae_dev->ops) {
|
if (!ae_dev->ops) {
|
||||||
dev_err(&ae_dev->pdev->dev, "ae_dev ops are null\n");
|
dev_err(&ae_dev->pdev->dev, "ae_dev ops are null\n");
|
||||||
ret = -EOPNOTSUPP;
|
|
||||||
goto out_err;
|
goto out_err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -251,8 +250,6 @@ int hnae3_register_ae_dev(struct hnae3_ae_dev *ae_dev)
|
||||||
|
|
||||||
out_err:
|
out_err:
|
||||||
mutex_unlock(&hnae3_common_lock);
|
mutex_unlock(&hnae3_common_lock);
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(hnae3_register_ae_dev);
|
EXPORT_SYMBOL(hnae3_register_ae_dev);
|
||||||
|
|
||||||
|
|
|
@ -515,7 +515,7 @@ struct hnae3_handle {
|
||||||
#define hnae_get_bit(origin, shift) \
|
#define hnae_get_bit(origin, shift) \
|
||||||
hnae_get_field((origin), (0x1 << (shift)), (shift))
|
hnae_get_field((origin), (0x1 << (shift)), (shift))
|
||||||
|
|
||||||
int hnae3_register_ae_dev(struct hnae3_ae_dev *ae_dev);
|
void hnae3_register_ae_dev(struct hnae3_ae_dev *ae_dev);
|
||||||
void hnae3_unregister_ae_dev(struct hnae3_ae_dev *ae_dev);
|
void hnae3_unregister_ae_dev(struct hnae3_ae_dev *ae_dev);
|
||||||
|
|
||||||
void hnae3_unregister_ae_algo(struct hnae3_ae_algo *ae_algo);
|
void hnae3_unregister_ae_algo(struct hnae3_ae_algo *ae_algo);
|
||||||
|
|
|
@ -1576,9 +1576,7 @@ static int hns3_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
|
||||||
ae_dev->dev_type = HNAE3_DEV_KNIC;
|
ae_dev->dev_type = HNAE3_DEV_KNIC;
|
||||||
pci_set_drvdata(pdev, ae_dev);
|
pci_set_drvdata(pdev, ae_dev);
|
||||||
|
|
||||||
ret = hnae3_register_ae_dev(ae_dev);
|
hnae3_register_ae_dev(ae_dev);
|
||||||
if (ret)
|
|
||||||
return ret;
|
|
||||||
|
|
||||||
if (hns3_is_phys_func(pdev) && IS_ENABLED(CONFIG_PCI_IOV))
|
if (hns3_is_phys_func(pdev) && IS_ENABLED(CONFIG_PCI_IOV))
|
||||||
hns3_enable_sriov(pdev);
|
hns3_enable_sriov(pdev);
|
||||||
|
|
Loading…
Reference in New Issue