Message ID | 20250111185412.183939-1-krzysztof.kozlowski@linaro.org (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | USB: dwc3: Use syscon_regmap_lookup_by_phandle_args | expand |
Hi, On Sat, Jan 11, 2025, Krzysztof Kozlowski wrote: > Use syscon_regmap_lookup_by_phandle_args() which is a wrapper over > syscon_regmap_lookup_by_phandle() combined with getting the syscon > argument. Except simpler code this annotates within one line that given > phandle has arguments, so grepping for code would be easier. > > Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> > --- > drivers/usb/dwc3/dwc3-am62.c | 11 ++--------- > 1 file changed, 2 insertions(+), 9 deletions(-) > > diff --git a/drivers/usb/dwc3/dwc3-am62.c b/drivers/usb/dwc3/dwc3-am62.c > index fa2c4c08711c..9db8f3ca493d 100644 > --- a/drivers/usb/dwc3/dwc3-am62.c > +++ b/drivers/usb/dwc3/dwc3-am62.c > @@ -153,11 +153,11 @@ static int phy_syscon_pll_refclk(struct dwc3_am62 *am62) > { > struct device *dev = am62->dev; > struct device_node *node = dev->of_node; > - struct of_phandle_args args; > struct regmap *syscon; > int ret; > > - syscon = syscon_regmap_lookup_by_phandle(node, "ti,syscon-phy-pll-refclk"); > + syscon = syscon_regmap_lookup_by_phandle_args(node, "ti,syscon-phy-pll-refclk", > + 1, &am62->offset); > if (IS_ERR(syscon)) { > dev_err(dev, "unable to get ti,syscon-phy-pll-refclk regmap\n"); > return PTR_ERR(syscon); > @@ -165,13 +165,6 @@ static int phy_syscon_pll_refclk(struct dwc3_am62 *am62) > > am62->syscon = syscon; > > - ret = of_parse_phandle_with_fixed_args(node, "ti,syscon-phy-pll-refclk", 1, > - 0, &args); > - if (ret) > - return ret; > - > - am62->offset = args.args[0]; > - > /* Core voltage. PHY_CORE_VOLTAGE bit Recommended to be 0 always */ > ret = regmap_update_bits(am62->syscon, am62->offset, PHY_CORE_VOLTAGE_MASK, 0); > if (ret) { > -- > 2.43.0 > Please rebase against Greg's usb-testing branch. This may cause merge conflict against this fix: https://lore.kernel.org/linux-usb/20250110023050.k2d62xjmdtascmol@synopsys.com/T/#t Thanks, Thinh
diff --git a/drivers/usb/dwc3/dwc3-am62.c b/drivers/usb/dwc3/dwc3-am62.c index fa2c4c08711c..9db8f3ca493d 100644 --- a/drivers/usb/dwc3/dwc3-am62.c +++ b/drivers/usb/dwc3/dwc3-am62.c @@ -153,11 +153,11 @@ static int phy_syscon_pll_refclk(struct dwc3_am62 *am62) { struct device *dev = am62->dev; struct device_node *node = dev->of_node; - struct of_phandle_args args; struct regmap *syscon; int ret; - syscon = syscon_regmap_lookup_by_phandle(node, "ti,syscon-phy-pll-refclk"); + syscon = syscon_regmap_lookup_by_phandle_args(node, "ti,syscon-phy-pll-refclk", + 1, &am62->offset); if (IS_ERR(syscon)) { dev_err(dev, "unable to get ti,syscon-phy-pll-refclk regmap\n"); return PTR_ERR(syscon); @@ -165,13 +165,6 @@ static int phy_syscon_pll_refclk(struct dwc3_am62 *am62) am62->syscon = syscon; - ret = of_parse_phandle_with_fixed_args(node, "ti,syscon-phy-pll-refclk", 1, - 0, &args); - if (ret) - return ret; - - am62->offset = args.args[0]; - /* Core voltage. PHY_CORE_VOLTAGE bit Recommended to be 0 always */ ret = regmap_update_bits(am62->syscon, am62->offset, PHY_CORE_VOLTAGE_MASK, 0); if (ret) {
Use syscon_regmap_lookup_by_phandle_args() which is a wrapper over syscon_regmap_lookup_by_phandle() combined with getting the syscon argument. Except simpler code this annotates within one line that given phandle has arguments, so grepping for code would be easier. Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> --- drivers/usb/dwc3/dwc3-am62.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-)