diff mbox series

[v4,3/4] clk: mvebu: armada-37xx-tbg: fill the device entry when registering the clocks

Message ID 20190108161940.4814-4-miquel.raynal@bootlin.com (mailing list archive)
State New, archived
Headers show
Series Add device links to clocks | expand

Commit Message

Miquel Raynal Jan. 8, 2019, 4:19 p.m. UTC
So far the clk_hw_register_fixed_factor() calls are not providing any
device structure. While doing so is harmless for regular use, the
missing device structure may be a problem for suspend to RAM support.

Since, device links have been added to clocks, links created during
probe will enforce the suspend/resume orders. When the device is
missing during the registration, no link can be established, hence the
order between parent and child clocks are not enforced.

Adding the device structure here will create a link between the 4 TBG
clocks (registered by this driver) and:
* their parent clock: XTAL,
* their child clocks: several 'periph' clock.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
---
 drivers/clk/mvebu/armada-37xx-tbg.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Comments

Gregory CLEMENT Jan. 18, 2019, 2:16 p.m. UTC | #1
Hi Miquel,
 
 On mar., janv. 08 2019, Miquel Raynal <miquel.raynal@bootlin.com> wrote:

> So far the clk_hw_register_fixed_factor() calls are not providing any
> device structure. While doing so is harmless for regular use, the
> missing device structure may be a problem for suspend to RAM support.
>
> Since, device links have been added to clocks, links created during
> probe will enforce the suspend/resume orders. When the device is
> missing during the registration, no link can be established, hence the
> order between parent and child clocks are not enforced.
>
> Adding the device structure here will create a link between the 4 TBG
> clocks (registered by this driver) and:
> * their parent clock: XTAL,
> * their child clocks: several 'periph' clock.
>
> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>

Reviewed-by: Gregory CLEMENT <gregory.clement@bootlin.com>

Thanks,

Gregory

> ---
>  drivers/clk/mvebu/armada-37xx-tbg.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/clk/mvebu/armada-37xx-tbg.c b/drivers/clk/mvebu/armada-37xx-tbg.c
> index 77b978c55ef6..da3a08e419d6 100644
> --- a/drivers/clk/mvebu/armada-37xx-tbg.c
> +++ b/drivers/clk/mvebu/armada-37xx-tbg.c
> @@ -116,8 +116,10 @@ static int armada_3700_tbg_clock_probe(struct platform_device *pdev)
>  		name = tbg[i].name;
>  		mult = tbg_get_mult(reg, &tbg[i]);
>  		div = tbg_get_div(reg, &tbg[i]);
> -		hw_tbg_data->hws[i] = clk_hw_register_fixed_factor(NULL, name,
> -						parent_name, 0, mult, div);
> +		hw_tbg_data->hws[i] = clk_hw_register_fixed_factor(dev, name,
> +								   parent_name,
> +								   0, mult,
> +								   div);
>  		if (IS_ERR(hw_tbg_data->hws[i]))
>  			dev_err(dev, "Can't register TBG clock %s\n", name);
>  	}
> -- 
> 2.19.1
>
diff mbox series

Patch

diff --git a/drivers/clk/mvebu/armada-37xx-tbg.c b/drivers/clk/mvebu/armada-37xx-tbg.c
index 77b978c55ef6..da3a08e419d6 100644
--- a/drivers/clk/mvebu/armada-37xx-tbg.c
+++ b/drivers/clk/mvebu/armada-37xx-tbg.c
@@ -116,8 +116,10 @@  static int armada_3700_tbg_clock_probe(struct platform_device *pdev)
 		name = tbg[i].name;
 		mult = tbg_get_mult(reg, &tbg[i]);
 		div = tbg_get_div(reg, &tbg[i]);
-		hw_tbg_data->hws[i] = clk_hw_register_fixed_factor(NULL, name,
-						parent_name, 0, mult, div);
+		hw_tbg_data->hws[i] = clk_hw_register_fixed_factor(dev, name,
+								   parent_name,
+								   0, mult,
+								   div);
 		if (IS_ERR(hw_tbg_data->hws[i]))
 			dev_err(dev, "Can't register TBG clock %s\n", name);
 	}