All of lore.kernel.org
 help / color / mirror / Atom feed
From: lokeshvutla@ti.com (Lokesh Vutla)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 4/4] firmware: ti_sci: Add helper apis to mange resources
Date: Sat, 6 Oct 2018 13:08:58 +0530	[thread overview]
Message-ID: <176f77cf-d295-0f37-ea9d-26f76f6d79c7@ti.com> (raw)
In-Reply-To: <20181005201453.g3p2jhpigcvijpce@kahuna>



On 10/6/2018 1:44 AM, Nishanth Menon wrote:
> On 14:30-20181005, Lokesh Vutla wrote:
>> +struct ti_sci_resource *
>> +devm_ti_sci_get_of_resource(const struct ti_sci_handle *handle,
>> +			    struct device *dev, char *of_prop)
>> +{
>> +	u32 resource_type, resource_subtype;
>> +	struct ti_sci_resource *res;
>> +	int sets, i, ret;
>> +
>> +	res = devm_kzalloc(dev, sizeof(*res), GFP_KERNEL);
>> +	if (!res)
>> +		return ERR_PTR(-ENOMEM);
>> +
>> +	sets = of_property_count_elems_of_size(dev_of_node(dev), of_prop,
>> +					       sizeof(u32));
>> +	if (sets < 0) {
>> +		dev_err(dev, "%s resource type ids not available\n", of_prop);
>> +		return ERR_PTR(sets);
>> +	}
>> +
>> +	res->sets = sets / 2;
>> +
>> +	res->desc = devm_kcalloc(dev, res->sets, sizeof(*res->desc),
>> +				 GFP_KERNEL);
>> +	if (!res->desc)
>> +		return ERR_PTR(-ENOMEM);
>> +
>> +	for (i = 0; i < res->sets; i++) {
>> +		ret = of_property_read_u32_index(dev_of_node(dev), of_prop,
>> +						 i * 2, &resource_type);
>> +		if (ret)
>> +			return ERR_PTR(-EINVAL);
>> +
>> +		ret = of_property_read_u32_index(dev_of_node(dev), of_prop,
>> +						 (i * 2) + 1,
>> +						 &resource_subtype);
>> +		if (ret)
>> +			return ERR_PTR(-EINVAL);
>> +
>> +		ret = handle->ops.rm_core_ops.get_range(handle, resource_type,
>> +							resource_subtype,
>> +							&res->desc[i].start,
>> +							&res->desc[i].num);
>> +		if (ret) {
>> +			dev_err(dev, "type %d subtype %d not allocated for host %d\n",
>> +				resource_type, resource_subtype,
>> +				handle_to_ti_sci_info(handle)->host_id);
>> +			return ERR_PTR(ret);
>> +		}
>> +
>> +		dev_dbg(dev, "res type = %d, subtype = %d, start = %d, num = %d\n",
>> +			resource_type, resource_subtype, res->desc[i].start,
>> +			res->desc[i].num);
> 
> NAK. Where is the binding for this? What is this decoding? Please don't
> decode binding without having an official binding.

This is a helper library for the clients to get resource range from DT
and is not compulsory for clients to use this library to managing these
resources. So in my understanding DT bindings should go into the client
DT doc as posted here[1].  If you really insist I can add these details
in ti,sci documentation but not sure if we are doing the same for all
other helper apis.

[1] https://patchwork.kernel.org/patch/10629215/

Thanks and regards,
Lokesh

  reply	other threads:[~2018-10-06  7:38 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-05 14:30 [PATCH 0/4] firmware: ti_sci: Introduce RM support Lokesh Vutla
2018-10-05 14:30 ` [PATCH 1/4] firmware: ti_sci: Add support to get TISCI handle using of_phandle Lokesh Vutla
2018-10-05 14:30 ` [PATCH 2/4] firmware: ti_sci: Add support for RM core ops Lokesh Vutla
2018-10-05 14:30 ` [PATCH 3/4] firmware: ti_sci: Add support for IRQ management Lokesh Vutla
2018-10-05 14:30 ` [PATCH 4/4] firmware: ti_sci: Add helper apis to mange resources Lokesh Vutla
2018-10-05 20:14   ` Nishanth Menon
2018-10-06  7:38     ` Lokesh Vutla [this message]
2018-10-06 16:34       ` Nishanth Menon
2018-10-10 17:00         ` Santosh Shilimkar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=176f77cf-d295-0f37-ea9d-26f76f6d79c7@ti.com \
    --to=lokeshvutla@ti.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.