Re: [PATCH v1 2/3] usb: ehci-platform: Use devm_of_phy_get_by_index

From: Alan Stern
Date: Thu Apr 02 2015 - 10:21:54 EST


On Wed, 1 Apr 2015, Arun Ramamurthy wrote:

> Getting phys by index instead of phy names so that we do
> not have to create a naming scheme when multiple phys
> are present
>
> Signed-off-by: Arun Ramamurthy <arun.ramamurthy@xxxxxxxxxxxx>
> Reviewed-by: Ray Jui <rjui@xxxxxxxxxxxx>
> Reviewed-by: Scott Branden <sbranden@xxxxxxxxxxxx>


> @@ -204,36 +197,23 @@ static int ehci_platform_probe(struct platform_device *dev)
>
> priv->num_phys = of_count_phandle_with_args(dev->dev.of_node,
> "phys", "#phy-cells");
> - priv->num_phys = priv->num_phys > 0 ? priv->num_phys : 1;
>
> - priv->phys = devm_kcalloc(&dev->dev, priv->num_phys,
> - sizeof(struct phy *), GFP_KERNEL);
> - if (!priv->phys)
> - return -ENOMEM;
> + if (priv->num_phys > 0) {
> + priv->phys = devm_kcalloc(&dev->dev, priv->num_phys,
> + sizeof(struct phy *), GFP_KERNEL);
> + if (!priv->phys)
> + return -ENOMEM;
> + } else
> + priv->num_phys = 0;

This last line isn't needed. A negative value for priv->num_phys will
work just as well as 0.

> + priv->phys[phy_num] = devm_of_phy_get_by_index(&dev->dev
> + , dev->dev.of_node
> + , phy_num);

What's with the funny placement of the commas? Are you trying to avoid
breaking the 80-column rule? It should look like this:

priv->phys[phy_num] = devm_of_phy_get_by_index(
&dev->dev, dev->dev.of_node, phy_num);

When you fix this, you can add:

Acked-by: Alan Stern <stern@xxxxxxxxxxxxxxxxxxx>

The same comments apply to your 3/3 patch.

Alan Stern

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/