Message ID | 20190527135509.184544-1-wangkefeng.wang@huawei.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [v2] pwm: rockchip: Use of_clk_get_parent_count() | expand |
Am Montag, 27. Mai 2019, 15:55:09 CEST schrieb Kefeng Wang: > Use of_clk_get_parent_count() instead of open coding. > > Cc: Thierry Reding <thierry.reding@gmail.com> > Cc: Heiko Stuebner <heiko@sntech.de> > Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com> on multiple rockchip boards with multiple pwm-regulator and -backlight Tested-by: Heiko Stuebner <heiko@sntech.de>
Am Montag, 27. Mai 2019, 15:55:09 CEST schrieb Kefeng Wang: > Use of_clk_get_parent_count() instead of open coding. > > Cc: Thierry Reding <thierry.reding@gmail.com> > Cc: Heiko Stuebner <heiko@sntech.de> > Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com> Reviewed-by: Heiko Stuebner <heiko@sntech.de> > --- > v2: > - add include <linux/of_clk.h> > drivers/pwm/pwm-rockchip.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/drivers/pwm/pwm-rockchip.c b/drivers/pwm/pwm-rockchip.c > index 4d99d468df09..d8f23daca290 100644 > --- a/drivers/pwm/pwm-rockchip.c > +++ b/drivers/pwm/pwm-rockchip.c > @@ -13,6 +13,7 @@ > #include <linux/io.h> > #include <linux/module.h> > #include <linux/of.h> > +#include <linux/of_clk.h> > #include <linux/of_device.h> > #include <linux/platform_device.h> > #include <linux/pwm.h> > @@ -329,8 +330,8 @@ static int rockchip_pwm_probe(struct platform_device *pdev) > } > } > > - count = of_count_phandle_with_args(pdev->dev.of_node, > - "clocks", "#clock-cells"); > + count = of_clk_get_parent_count(pdev->dev.of_node); > + > if (count == 2) > pc->pclk = devm_clk_get(&pdev->dev, "pclk"); > else >
diff --git a/drivers/pwm/pwm-rockchip.c b/drivers/pwm/pwm-rockchip.c index 4d99d468df09..d8f23daca290 100644 --- a/drivers/pwm/pwm-rockchip.c +++ b/drivers/pwm/pwm-rockchip.c @@ -13,6 +13,7 @@ #include <linux/io.h> #include <linux/module.h> #include <linux/of.h> +#include <linux/of_clk.h> #include <linux/of_device.h> #include <linux/platform_device.h> #include <linux/pwm.h> @@ -329,8 +330,8 @@ static int rockchip_pwm_probe(struct platform_device *pdev) } } - count = of_count_phandle_with_args(pdev->dev.of_node, - "clocks", "#clock-cells"); + count = of_clk_get_parent_count(pdev->dev.of_node); + if (count == 2) pc->pclk = devm_clk_get(&pdev->dev, "pclk"); else
Use of_clk_get_parent_count() instead of open coding. Cc: Thierry Reding <thierry.reding@gmail.com> Cc: Heiko Stuebner <heiko@sntech.de> Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com> --- v2: - add include <linux/of_clk.h> drivers/pwm/pwm-rockchip.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)