Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1217798

Re: [PATCH v17 3/4] soc: rockchip: power-domain: Add power domain driver

From Kevin Hilman <khilman@linaro.org>
Newsgroups linux.kernel
Subject Re: [PATCH v17 3/4] soc: rockchip: power-domain: Add power domain driver
Date 2015-09-02 20:30 +0200
Message-ID <q4kXg-4BW-11@gated-at.bofh.it> (permalink)
References <q4cdl-zo-13@gated-at.bofh.it> <q4cdl-zo-15@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Caesar Wang <wxt@rock-chips.com> writes:

> This driver is found on RK3288 SoCs.
>
> In order to meet high performance and low power requirements, a power
> management unit is designed or saving power when RK3288 in low power
> mode.
> The RK3288 PMU is dedicated for managing the power of the whole chip.
>
> PMU can work in the Low Power Mode by setting bit[0] of PMU_PWRMODE_CON
> register. After setting the register, PMU would enter the Low Power mode.
> In the low power mode, pmu will auto power on/off the specified power
> domain, send idle req to specified power domain, shut down/up pll and
> so on. All of above are configurable by setting corresponding registers.
>
> Signed-off-by: jinkun.hong <jinkun.hong@rock-chips.com>
> Signed-off-by: Caesar Wang <wxt@rock-chips.com>

[...]

> +static void rockchip_pm_remove_one_domain(struct rockchip_pm_domain *pd)
> +{
> +	int i;
> +
> +	for (i = 0; i < pd->num_clks; i++) {
> +		clk_unprepare(pd->clks[i]);
> +		clk_put(pd->clks[i]);
> +	}


You don't set pd->num_clks = 0 here, which means other places that
iterate over the clocks might race with this and try to use clocks that
have been unprepared/put.

This might be over-paranoid, but in particular, this could race with
rockchip_pd_power().

Also not setting the pd->num_clks to zero would be a problem for a
power-controller that is configured as a module which could be unloaded
and reloaded (I know that doesn't really work now, but it will
eventually, I hope.)

Maybe use the mutex here?  It should at least protect the zeroing of
pm->num_clks.

Kevin
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v17 0/4] ARM: rk3288: Add PM Domain support Caesar Wang <wxt@rock-chips.com> - 2015-09-02 11:10 +0200
  [PATCH v17 3/4] soc: rockchip: power-domain: Add power domain driver Caesar Wang <wxt@rock-chips.com> - 2015-09-02 11:10 +0200
    Re: [PATCH v17 3/4] soc: rockchip: power-domain: Add power domain driver Kevin Hilman <khilman@linaro.org> - 2015-09-02 20:30 +0200
      Re: [PATCH v17 3/4] soc: rockchip: power-domain: Add power domain  driver Caesar Wang <wxt@rock-chips.com> - 2015-09-06 05:10 +0200
  [PATCH v17 1/4] dt-bindings: add document of Rockchip power domains Caesar Wang <wxt@rock-chips.com> - 2015-09-02 11:10 +0200
    Re: [PATCH v17 1/4] dt-bindings: add document of Rockchip power domains Kevin Hilman <khilman@linaro.org> - 2015-09-02 20:20 +0200
      Re: [PATCH v17 1/4] dt-bindings: add document of Rockchip power domains Caesar Wang <wxt@rock-chips.com> - 2015-09-06 12:20 +0200
  [PATCH v17 2/4] ARM: power-domain: rockchip: add all the domain type on RK3288 SoCs Caesar Wang <wxt@rock-chips.com> - 2015-09-02 11:10 +0200
  [PATCH v17 4/4] ARM: dts: add the support power-domain node on RK3288 SoCs Caesar Wang <wxt@rock-chips.com> - 2015-09-02 11:10 +0200

csiph-web