Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit becb6bbf authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "net: stmmac: cleanup and free the nodes and gpios setup in probe"

parents 07ced40c 15a75380
Loading
Loading
Loading
Loading
+27 −0
Original line number Diff line number Diff line
@@ -1522,6 +1522,20 @@ static int ethqos_create_debugfs(struct qcom_ethqos *ethqos)
	return -ENOMEM;
}

static int ethqos_cleanup_debugfs(struct qcom_ethqos *ethqos)
{
	if (!ethqos) {
		ETHQOSERR("Null Param");
		return -ENODEV;
	}

	debugfs_remove_recursive(ethqos->debugfs_dir);
	ethqos->debugfs_dir = NULL;

	ETHQOSDBG("debugfs Deleted Successfully");
	return 0;
}

static int qcom_ethqos_probe(struct platform_device *pdev)
{
	struct device_node *np = pdev->dev.of_node;
@@ -1704,6 +1718,11 @@ static int qcom_ethqos_remove(struct platform_device *pdev)
	struct qcom_ethqos *ethqos;
	int ret;

	if (of_device_is_compatible(pdev->dev.of_node, "qcom,emac-smmu-embedded")) {
		of_platform_depopulate(&pdev->dev);
		return 0;
	}

	ethqos = get_stmmac_bsp_priv(&pdev->dev);
	if (!ethqos)
		return -ENODEV;
@@ -1717,9 +1736,17 @@ static int qcom_ethqos_remove(struct platform_device *pdev)
	if (phy_intr_en)
		cancel_work_sync(&ethqos->emac_phy_work);

	if (ethqos->emac_ver == EMAC_HW_v2_3_2_RG)
		ethqos_remove_pps_dev(ethqos);

	ethqos_cleanup_debugfs(ethqos);
	ethqos_free_gpios(ethqos);
	emac_emb_smmu_exit();
	ethqos_disable_regulators(ethqos);

	platform_set_drvdata(pdev, NULL);
	of_platform_depopulate(&pdev->dev);

	return ret;
}

+1 −0
Original line number Diff line number Diff line
@@ -247,6 +247,7 @@ int create_pps_interrupt_device_node(dev_t *pps_dev_t,
				     struct cdev **pps_cdev,
				     struct class **pps_class,
				     char *pps_dev_node_name);
int ethqos_remove_pps_dev(struct qcom_ethqos *ethqos);
bool qcom_ethqos_is_phy_link_up(struct qcom_ethqos *ethqos);
void *qcom_ethqos_get_priv(struct qcom_ethqos *ethqos);

+14 −0
Original line number Diff line number Diff line
@@ -453,3 +453,17 @@ int create_pps_interrupt_device_node(dev_t *pps_dev_t,
alloc_chrdev1_region_fail:
		return ret;
}

int ethqos_remove_pps_dev(struct qcom_ethqos *ethqos)
{
	device_destroy(ethqos->avb_class_a_class, ethqos->avb_class_a_dev_t);
	class_destroy(ethqos->avb_class_a_class);
	cdev_del(ethqos->avb_class_a_cdev);
	unregister_chrdev_region(ethqos->avb_class_a_dev_t, 1);

	device_destroy(ethqos->avb_class_b_class, ethqos->avb_class_b_dev_t);
	class_destroy(ethqos->avb_class_b_class);
	cdev_del(ethqos->avb_class_b_cdev);
	unregister_chrdev_region(ethqos->avb_class_b_dev_t, 1);
	return 0;
}