Message ID | 20220124141711.1.Ic9cd1563aac729132cadae8c5df372be1a49ecc7@changeid |
---|---|
State | Accepted |
Commit | b0cdd8287add19d1af6668b6e9e968046506c08d |
Delegated to: | Sean Anderson |
Headers | show |
Series | clk: ccf: correct the test on the parent uclass in clk_enable/clk_disable | expand |
On 1/24/22 8:17 AM, Patrick Delaunay wrote: > It is safe to check if the uclass id on the device is UCLASS_CLK > before to call the clk_ functions, but today this comparison is > not done on the device used in API: clkp->dev->parent > but on the device himself: clkp->dev. > > This patch corrects this behavior and tests if the parent device > is a clock device before to call the clock API, clk_enable or > clk_disable, on this device. > > Fixes: 0520be0f67e3 ("clk: prograte clk enable/disable to parent") > Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com> > --- > > drivers/clk/clk-uclass.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/clk/clk-uclass.c b/drivers/clk/clk-uclass.c > index d245b672fa..8b6981a307 100644 > --- a/drivers/clk/clk-uclass.c > +++ b/drivers/clk/clk-uclass.c > @@ -652,7 +652,7 @@ int clk_enable(struct clk *clk) > return 0; > } > if (clkp->dev->parent && > - device_get_uclass_id(clkp->dev) == UCLASS_CLK) { > + device_get_uclass_id(clkp->dev->parent) == UCLASS_CLK) { > ret = clk_enable(dev_get_clk_ptr(clkp->dev->parent)); > if (ret) { > printf("Enable %s failed\n", > @@ -726,7 +726,7 @@ int clk_disable(struct clk *clk) > } > > if (clkp && clkp->dev->parent && > - device_get_uclass_id(clkp->dev) == UCLASS_CLK) { > + device_get_uclass_id(clkp->dev->parent) == UCLASS_CLK) { > ret = clk_disable(dev_get_clk_ptr(clkp->dev->parent)); > if (ret) { > printf("Disable %s failed\n", > Looks like I put this in [1] in v6, so Reviewed-by: Sean Anderson <seanga2@gmail.com> [1] https://lore.kernel.org/u-boot/20200521161503.384823-4-seanga2@gmail.com/
On Mon, 24 Jan 2022 14:17:14 +0100, Patrick Delaunay wrote: > It is safe to check if the uclass id on the device is UCLASS_CLK > before to call the clk_ functions, but today this comparison is > not done on the device used in API: clkp->dev->parent > but on the device himself: clkp->dev. > > This patch corrects this behavior and tests if the parent device > is a clock device before to call the clock API, clk_enable or > clk_disable, on this device. > > [...] Applied, thanks! [1/1] clk: ccf: correct the test on the parent uclass in clk_enable/clk_disable commit: b0cdd8287add19d1af6668b6e9e968046506c08d Best regards,
diff --git a/drivers/clk/clk-uclass.c b/drivers/clk/clk-uclass.c index d245b672fa..8b6981a307 100644 --- a/drivers/clk/clk-uclass.c +++ b/drivers/clk/clk-uclass.c @@ -652,7 +652,7 @@ int clk_enable(struct clk *clk) return 0; } if (clkp->dev->parent && - device_get_uclass_id(clkp->dev) == UCLASS_CLK) { + device_get_uclass_id(clkp->dev->parent) == UCLASS_CLK) { ret = clk_enable(dev_get_clk_ptr(clkp->dev->parent)); if (ret) { printf("Enable %s failed\n", @@ -726,7 +726,7 @@ int clk_disable(struct clk *clk) } if (clkp && clkp->dev->parent && - device_get_uclass_id(clkp->dev) == UCLASS_CLK) { + device_get_uclass_id(clkp->dev->parent) == UCLASS_CLK) { ret = clk_disable(dev_get_clk_ptr(clkp->dev->parent)); if (ret) { printf("Disable %s failed\n",
It is safe to check if the uclass id on the device is UCLASS_CLK before to call the clk_ functions, but today this comparison is not done on the device used in API: clkp->dev->parent but on the device himself: clkp->dev. This patch corrects this behavior and tests if the parent device is a clock device before to call the clock API, clk_enable or clk_disable, on this device. Fixes: 0520be0f67e3 ("clk: prograte clk enable/disable to parent") Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com> --- drivers/clk/clk-uclass.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)