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] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 30 Jul 2015 23:07:11 -0700
From:	Stephen Boyd <sboyd@...eaurora.org>
To:	Viresh Kumar <viresh.kumar@...aro.org>
Cc:	Rafael Wysocki <rjw@...ysocki.net>, linaro-kernel@...ts.linaro.org,
	linux-pm@...r.kernel.org, rob.herring@...aro.org,
	arnd.bergmann@...aro.org, nm@...com, broonie@...nel.org,
	mturquette@...libre.com, Sudeep.Holla@....com,
	viswanath.puttagunta@...aro.org, l.stach@...gutronix.de,
	thomas.petazzoni@...e-electrons.com,
	linux-arm-kernel@...ts.infradead.org, ta.omasab@...il.com,
	kesavan.abhilash@...il.com, khilman@...aro.org,
	santosh.shilimkar@...cle.com, b.zolnierkie@...sung.com,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Len Brown <len.brown@...el.com>,
	open list <linux-kernel@...r.kernel.org>,
	Pavel Machek <pavel@....cz>
Subject: Re: [PATCH V3 11/16] PM / OPP: Add helpers for initializing CPU OPPs

On 07/29, Viresh Kumar wrote:
> With "operating-points-v2" its possible to tell which devices share
> OPPs. We already have infrastructure to decode that information.
> 
> This patch adds following APIs:
> - of_get_cpus_sharing_opps: Returns cpumask of CPUs sharing OPPs (only
>   valid with v2 bindings).
> - of_cpumask_init_opp_table: Initializes OPPs for all CPUs present in
>   cpumask.
> - of_cpumask_free_opp_table: Frees OPPs for all CPUs present in cpumask.
> 
> - set_cpus_sharing_opps: Sets which CPUs share OPPs (only valid with old
>   OPP bindings, as this information isn't present in DT).
> 
> Reviewed-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@...sung.com>
> Signed-off-by: Viresh Kumar <viresh.kumar@...aro.org>

Reviewed-by: Stephen Boyd <sboyd@...eaurora.org>

Some minor nitpicks below:

> +
> +/*
> + * Works only for OPP v2 bindings.
> + *
> + * cpumask should be already set to mask of cpu_dev->id.
> + * Returns -ENOENT if operating-points-v2 bindings aren't supported.
> + */
> +int of_get_cpus_sharing_opps(struct device *cpu_dev, cpumask_var_t cpumask)
> +{
> +	struct device_node *np, *tmp_np;
> +	struct device *tcpu_dev;
> +	int cpu, ret = 0;
> +
> +	/* Get OPP descriptor node */
> +	np = _of_get_opp_desc_node(cpu_dev);
> +	if (IS_ERR(np)) {
> +		dev_dbg(cpu_dev, "%s: Couldn't find opp node: %ld\n", __func__,
> +			PTR_ERR(np));
> +		return -ENOENT;
> +	}
> +
> +	/* OPPs are shared ? */
> +	if (!of_get_property(np, "opp-shared", NULL))

if (!of_property_read_bool(np, "opp-shared")) ?

> +		goto put_cpu_node;
> +
> +	for_each_possible_cpu(cpu) {
> +		if (cpu == cpu_dev->id)
> +			continue;
> +
> +		tcpu_dev = get_cpu_device(cpu);
> +		if (!tcpu_dev) {
> +			dev_err(cpu_dev, "%s: failed to get cpu%d device\n",
> +				__func__, cpu);
> +			ret = -ENODEV;
> +			goto put_cpu_node;
> +		}
> +
> +		/* Get OPP descriptor node */
> +		tmp_np = _of_get_opp_desc_node(tcpu_dev);
> +		if (IS_ERR(tmp_np)) {
> +			dev_info(tcpu_dev, "%s: Couldn't find opp node: %ld\n",

dev_err?

> +				 __func__, PTR_ERR(tmp_np));
> +			ret = -EINVAL;

Why aren't we returning the PTR_ERR value here?

> +			goto put_cpu_node;

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
--
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