From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751266AbbIFDFQ (ORCPT ); Sat, 5 Sep 2015 23:05:16 -0400 Received: from regular1.263xmail.com ([211.150.99.139]:58157 "EHLO regular1.263xmail.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750878AbbIFDFJ (ORCPT ); Sat, 5 Sep 2015 23:05:09 -0400 X-263anti-spam: KSV:0; X-MAIL-GRAY: 0 X-MAIL-DELIVERY: 1 X-KSVirus-check: 0 X-ABS-CHECKED: 4 X-ADDR-CHECKED: 0 X-RL-SENDER: wxt@rock-chips.com X-FST-TO: linux-arm-kernel@lists.infradead.org X-SENDER-IP: 58.22.7.114 X-LOGIN-NAME: wxt@rock-chips.com X-UNIQUE-TAG: <3feca9a0988f8e6f8f464d1a4c1baaeb> X-ATTACHMENT-NUM: 0 X-DNS-TYPE: 0 Message-ID: <55EBAD5A.9060107@rock-chips.com> Date: Sun, 06 Sep 2015 11:04:58 +0800 From: Caesar Wang User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: Kevin Hilman CC: Caesar Wang , devicetree@vger.kernel.org, ulf.hansson@linaro.org, linux@arm.linux.org.uk, heiko@sntech.de, arnd@arndb.de, ijc+devicetree@hellion.org.uk, "jinkun.hong" , linus.walleij@linaro.org, dmitry.torokhov@gmail.com, linux-kernel@vger.kernel.org, dianders@chromium.org, linux-rockchip@lists.infradead.org, robh+dt@kernel.org, galak@codeaurora.org, tomasz.figa@gmail.com, mturquette@baylibre.com, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH v17 3/4] soc: rockchip: power-domain: Add power domain driver References: <1441184380-13827-1-git-send-email-wxt@rock-chips.com> <1441184380-13827-4-git-send-email-wxt@rock-chips.com> <7hbndkptfm.fsf@linaro.org> In-Reply-To: <7hbndkptfm.fsf@linaro.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Kevin, Thanks for having a look into it. 在 2015年09月03日 02:28, Kevin Hilman 写道: > Caesar Wang 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 >> Signed-off-by: Caesar Wang > [...] > >> +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. Agree, we should set the "pd->num_cloks=0' in here. > 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.) Yep. > > Maybe use the mutex here? It should at least protect the zeroing of > pm->num_clks. Sound resonable. Done. --- Thanks, Caesar > > Kevin > > _______________________________________________ > Linux-rockchip mailing list > Linux-rockchip@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-rockchip