On 9 February 2015 at 09:57, Peter Chen <peter.chen@xxxxxxxxxxxxx> wrote: >> >> +static int hi6220_phy_probe(struct platform_device *pdev) >> >> +{ >> >> + struct hi6220_priv *priv; >> >> + struct usb_otg *otg; >> >> + struct device_node *np = pdev->dev.of_node; >> >> + int ret, irq; >> >> + >> >> + priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); >> >> + if (!priv) >> >> + return -ENOMEM; >> >> + >> >> + otg = devm_kzalloc(&pdev->dev, sizeof(*otg), GFP_KERNEL); >> >> + if (!otg) >> >> + return -ENOMEM; >> >> + >> >> + priv->phy.dev = &pdev->dev; >> >> + priv->phy.otg = otg; >> >> + priv->phy.label = "hi6220"; >> >> + platform_set_drvdata(pdev, priv); >> >> + otg->set_peripheral = mv_otg_set_peripheral; >> >> + >> >> + priv->gpio_vbus_det = of_get_named_gpio(np, "hisilicon,gpio_vbus_det", 0); >> >> + if (priv->gpio_vbus_det == -EPROBE_DEFER) >> >> + return -EPROBE_DEFER; >> >> + if (!gpio_is_valid(priv->gpio_vbus_det)) { >> >> + dev_err(&pdev->dev, "invalid gpio %d\n", priv->gpio_vbus_det); >> >> + return -ENODEV; >> >> + } >> >> + >> >> + priv->gpio_id_det = of_get_named_gpio(np, "hisilicon,gpio_id_det", 0); >> >> + if (priv->gpio_id_det == -EPROBE_DEFER) >> >> + return -EPROBE_DEFER; >> >> + if (!gpio_is_valid(priv->gpio_id_det)) { >> >> + dev_err(&pdev->dev, "invalid gpio %d\n", priv->gpio_id_det); >> >> + return -ENODEV; >> >> + } >> >> + >> >> + priv->reg = syscon_regmap_lookup_by_phandle(pdev->dev.of_node, >> >> + "hisilicon,peripheral-syscon"); >> >> + if (IS_ERR(priv->reg)) >> >> + priv->reg = NULL; >> > >> > You may differentiate -ENODEV and other errors, for other errors, you >> > can show an error, and return directly. >> >> Here I want to set this property as optional, in case other platform >> do not need this property. >> So phy_setup also add protection if (priv->reg == NULL) return; >> > > If syscon_regmap_lookup_by_phandle returns -EPROBE_DEFER, you may want > to try later. > It should not. syscon is postcore_initcall(syscon_init); Thanks -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html