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

Commit dbc98635 authored by Heikki Krogerus's avatar Heikki Krogerus Committed by Kishon Vijay Abraham I
Browse files

phy: remove the old lookup method



The users of the old method are now converted to the new one.

Signed-off-by: default avatarHeikki Krogerus <heikki.krogerus@linux.intel.com>
[ kishon@ti.com : made phy-berlin-usb.c and phy-miphy28lp.c to use the updated
		  devm_phy_create API.]
Signed-off-by: default avatarKishon Vijay Abraham I <kishon@ti.com>
parent 61211b1b
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -117,7 +117,7 @@ static int bcm_kona_usb2_probe(struct platform_device *pdev)

	platform_set_drvdata(pdev, phy);

	gphy = devm_phy_create(dev, NULL, &ops, NULL);
	gphy = devm_phy_create(dev, NULL, &ops);
	if (IS_ERR(gphy))
		return PTR_ERR(gphy);

+1 −1
Original line number Diff line number Diff line
@@ -249,7 +249,7 @@ static int phy_berlin_sata_probe(struct platform_device *pdev)
		if (!phy_desc)
			return -ENOMEM;

		phy = devm_phy_create(dev, NULL, &phy_berlin_sata_ops, NULL);
		phy = devm_phy_create(dev, NULL, &phy_berlin_sata_ops);
		if (IS_ERR(phy)) {
			dev_err(dev, "failed to create PHY %d\n", phy_id);
			return PTR_ERR(phy);
+1 −2
Original line number Diff line number Diff line
@@ -192,8 +192,7 @@ static int phy_berlin_usb_probe(struct platform_device *pdev)

	priv->pll_divider = *((u32 *)match->data);

	priv->phy = devm_phy_create(&pdev->dev, NULL, &phy_berlin_usb_ops,
				    NULL);
	priv->phy = devm_phy_create(&pdev->dev, NULL, &phy_berlin_usb_ops);
	if (IS_ERR(priv->phy)) {
		dev_err(&pdev->dev, "failed to create PHY\n");
		return PTR_ERR(priv->phy);
+4 −45
Original line number Diff line number Diff line
@@ -55,36 +55,6 @@ static int devm_phy_match(struct device *dev, void *res, void *match_data)
	return res == match_data;
}

static struct phy *phy_lookup(struct device *device, const char *port)
{
	unsigned int count;
	struct phy *phy;
	struct device *dev;
	struct phy_consumer *consumers;
	struct class_dev_iter iter;

	class_dev_iter_init(&iter, phy_class, NULL, NULL);
	while ((dev = class_dev_iter_next(&iter))) {
		phy = to_phy(dev);

		if (!phy->init_data)
			continue;
		count = phy->init_data->num_consumers;
		consumers = phy->init_data->consumers;
		while (count--) {
			if (!strcmp(consumers->dev_name, dev_name(device)) &&
					!strcmp(consumers->port, port)) {
				class_dev_iter_exit(&iter);
				return phy;
			}
			consumers++;
		}
	}

	class_dev_iter_exit(&iter);
	return ERR_PTR(-ENODEV);
}

/**
 * phy_create_lookup() - allocate and register PHY/device association
 * @phy: the phy of the association
@@ -148,7 +118,6 @@ static struct phy *phy_find(struct device *dev, const char *con_id)
{
	const char *dev_id = dev_name(dev);
	struct phy_lookup *p, *pl = NULL;
	struct phy *phy;

	mutex_lock(&phy_provider_mutex);
	list_for_each_entry(p, &phys, node)
@@ -158,12 +127,7 @@ static struct phy *phy_find(struct device *dev, const char *con_id)
		}
	mutex_unlock(&phy_provider_mutex);

	phy = pl ? pl->phy : ERR_PTR(-ENODEV);

	/* fall-back to the old lookup method for now */
	if (IS_ERR(phy))
		phy = phy_lookup(dev, con_id);
	return phy;
	return pl ? pl->phy : ERR_PTR(-ENODEV);
}

static struct phy_provider *of_phy_provider_lookup(struct device_node *node)
@@ -662,13 +626,11 @@ EXPORT_SYMBOL_GPL(devm_of_phy_get);
 * @dev: device that is creating the new phy
 * @node: device node of the phy
 * @ops: function pointers for performing phy operations
 * @init_data: contains the list of PHY consumers or NULL
 *
 * Called to create a phy using phy framework.
 */
struct phy *phy_create(struct device *dev, struct device_node *node,
		       const struct phy_ops *ops,
		       struct phy_init_data *init_data)
		       const struct phy_ops *ops)
{
	int ret;
	int id;
@@ -706,7 +668,6 @@ struct phy *phy_create(struct device *dev, struct device_node *node,
	phy->dev.of_node = node ?: dev->of_node;
	phy->id = id;
	phy->ops = ops;
	phy->init_data = init_data;

	ret = dev_set_name(&phy->dev, "phy-%s.%d", dev_name(dev), id);
	if (ret)
@@ -741,7 +702,6 @@ EXPORT_SYMBOL_GPL(phy_create);
 * @dev: device that is creating the new phy
 * @node: device node of the phy
 * @ops: function pointers for performing phy operations
 * @init_data: contains the list of PHY consumers or NULL
 *
 * Creates a new PHY device adding it to the PHY class.
 * While at that, it also associates the device with the phy using devres.
@@ -749,8 +709,7 @@ EXPORT_SYMBOL_GPL(phy_create);
 * then, devres data is freed.
 */
struct phy *devm_phy_create(struct device *dev, struct device_node *node,
			    const struct phy_ops *ops,
			    struct phy_init_data *init_data)
			    const struct phy_ops *ops)
{
	struct phy **ptr, *phy;

@@ -758,7 +717,7 @@ struct phy *devm_phy_create(struct device *dev, struct device_node *node,
	if (!ptr)
		return ERR_PTR(-ENOMEM);

	phy = phy_create(dev, node, ops, init_data);
	phy = phy_create(dev, node, ops);
	if (!IS_ERR(phy)) {
		*ptr = phy;
		devres_add(dev, ptr);
+1 −1
Original line number Diff line number Diff line
@@ -112,7 +112,7 @@ static int exynos_dp_video_phy_probe(struct platform_device *pdev)
	match = of_match_node(exynos_dp_video_phy_of_match, dev->of_node);
	state->drvdata = match->data;

	phy = devm_phy_create(dev, NULL, &exynos_dp_video_phy_ops, NULL);
	phy = devm_phy_create(dev, NULL, &exynos_dp_video_phy_ops);
	if (IS_ERR(phy)) {
		dev_err(dev, "failed to create Display Port PHY\n");
		return PTR_ERR(phy);
Loading