lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <5450F534.8030501@rock-chips.com>
Date:	Wed, 29 Oct 2014 22:09:56 +0800
From:	Hong jinkun <jinkun.hong@...k-chips.com>
To:	Ulf Hansson <ulf.hansson@...aro.org>
CC:	Linus Walleij <linus.walleij@...aro.org>,
	"linux-arm-kernel@...ts.infradead.org" 
	<linux-arm-kernel@...ts.infradead.org>,
	Russell King <linux@....linux.org.uk>,
	Rob Herring <robh+dt@...nel.org>,
	Pawel Moll <pawel.moll@....com>,
	Mark Rutland <mark.rutland@....com>,
	Ian Campbell <ijc+devicetree@...lion.org.uk>,
	Kumar Gala <galak@...eaurora.org>,
	Grant Likely <grant.likely@...aro.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	"devicetree@...r.kernel.org" <devicetree@...r.kernel.org>,
	Randy Dunlap <rdunlap@...radead.org>,
	"linux-doc@...r.kernel.org" <linux-doc@...r.kernel.org>,
	Doug Anderson <dianders@...omium.org>,
	Heiko Stuebner <heiko@...ech.de>,
	linux-rockchip@...ts.infradead.org,
	Jack Dai <jack.dai@...k-chips.com>,
	Geert Uytterhoeven <geert+renesas@...der.be>,
	Dmitry Torokhov <dmitry.torokhov@...il.com>
Subject: Re: [PATCH v5 1/3] power-domain: add power domain drivers for Rockchip
 platform


On 2014/10/22 15:58, Ulf Hansson wrote:
> [...]
>
>>>> +
>>>> +       list_for_each_entry(de, &pd->dev_list, node) {
>>>> +               i += 1;
>>>> +               pm_clk_resume(pd->dev);
>>> Do you really need to call pm_clk_resume() number of times that there
>>> are devices in power domain? Did you want it to be
>>>
>>>                  pm_clk_resume(de->dev);
>>>
>>> by any chance?
> I was just about to ask the similar question as Dmitry did. :-)
>
>> You are right.I will modify in the next version.
> Now, does that also mean you would like to assign the ->start|stop()
> callbacks in the struct gpd_dev_ops to pm_clk_suspend|resume()? Or do
> you intend to handle that from each driver instead?
If it can call dev_ops.start before calling power_on and power_off is 
the best.But I found dev_ops.start not called.Is not I did add some patch?
>>>> +       }
>>>> +
>>>> +       /* no clk, set power domain will fail */
>>>> +       if (i == 0) {
>>>> +               pr_err("%s: failed to on/off power domain!", __func__);
>>>> +               spin_unlock_irq(&pd->dev_lock);
>>>> +               return ret;
>>>> +       }
>>> Instead of counting I'd do
>>>
>>>          if (list_empty(&pd->dev_list)) {
>>>                  pr_waen("%s: no devices in power domain\n", __func__);
>>>                  goto out;
>>>          }
>>>
>>> in the beginning of the function.
>> This is a good idea.
>>
>>>> +
>>>> +       ret = rockchip_pmu_set_power_domain(pd, power_on);
>>>> +
>>>> +       list_for_each_entry(de, &pd->dev_list, node) {
>>>> +               pm_clk_suspend(pd->dev);
>>> Same here?
>>>
>>>> +       }
>>>> +
>>>> +       spin_unlock_irq(&pd->dev_lock);
>>>> +
>>>> +       return ret;
>>>> +}
>>>> +
>>>> +static int rockchip_pd_power_on(struct generic_pm_domain *domain)
>>>> +{
>>>> +       struct rockchip_domain *pd = to_rockchip_pd(domain);
>>>> +
>>>> +       return rockchip_pd_power(pd, true);
>>>> +}
>>>> +
>>>> +static int rockchip_pd_power_off(struct generic_pm_domain *domain)
>>>> +{
>>>> +       struct rockchip_domain *pd = to_rockchip_pd(domain);
>>>> +
>>>> +       return rockchip_pd_power(pd, false);
>>>> +}
>>>> +
>>>> +void rockchip_pm_domain_attach_dev(struct device *dev)
>>>> +{
>>>> +       int ret;
>>>> +       int i = 0;
>>>> +       struct clk *clk;
>>>> +       struct rockchip_domain *pd;
>>>> +       struct rockchip_dev_entry *de;
>>>> +
>>>> +       pd = (struct rockchip_domain *)dev->pm_domain;
>>>> +       ret = pm_clk_create(dev);
>>>> +       if (ret) {
>>>> +               dev_err(dev, "pm_clk_create failed %d\n", ret);
>>>> +               return;
>>>> +       };
>>> Stray semicolon.
>>>> +
>>>> +       while ((clk = of_clk_get(dev->of_node, i++)) && !IS_ERR(clk)) {
>>>> +               ret = pm_clk_add_clk(dev, clk);
>>>> +               if (ret) {
>>>> +                       dev_err(dev, "pm_clk_add_clk failed %d\n", ret);
>>>> +                       goto clk_err;
>>>> +               };
>>>> +       }
>>>> +
>>>> +       de = devm_kcalloc(pd->dev, 1,
>>>> +                       sizeof(struct rockchip_dev_entry *), GFP_KERNEL);
>>> Why devm_calloc for a single element and not devm_kzalloc? Also, I am a
>>> bit concerned about using devm_* API here. They are better reserved fir
>>> driver's ->probe() paths whereas we are called from
>>> dev_pm_domain_attach() which is more general API (yes, currently it is
>>> used by buses probing code, but that might change in the future).
> Using the devm_*API is supposed to work from here. I have kept this in
> mind, while we added the new dev_pm_domain_attach|detach() API. The
> buses also handles -EPROBE_DEFER.
>
> Now, I just realized that while Geert added attach|detach_dev()
> callbacks for the generic PM domain, those are both "void" callbacks.
> It means the deferred probe error handling is broken for these
> callbacks. We should convert the attach_dev() callback into an int, I
> will cook a patch immediately.
>
>>> Also, where is OOM error handling?
>> Ok,I will change the use  devm_kzalloc.
>> Register to pm domain devices, the number is not a lot.
> [...]
>
> Kind regards
> Uffe
>
>
>


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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ