From: Frank Rowand <frowand.list@gmail.com>
To: Stefan Wahren <stefan.wahren@i2se.com>,
Eduardo Valentin <edubezval@gmail.com>,
Zhang Rui <rui.zhang@intel.com>,
kernel@martin.sperl.org
Cc: Eric Anholt <eric@anholt.net>, Rob Herring <robh+dt@kernel.org>,
Florian Fainelli <f.fainelli@gmail.com>,
linux-rpi-kernel@lists.infradead.org, devicetree@vger.kernel.org,
linux-pm@vger.kernel.org
Subject: Re: [PATCH V11 1/6] of: base: Implement read function for s32 array
Date: Thu, 23 Mar 2017 16:26:04 -0700 [thread overview]
Message-ID: <58D4598C.8030407@gmail.com> (raw)
In-Reply-To: <1489356665-3175-2-git-send-email-stefan.wahren@i2se.com>
On 03/12/17 15:11, Stefan Wahren wrote:
> In order to read signed thermal coefficients from DT we need a proper
> function.
>
> Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
> ---
> include/linux/of.h | 35 +++++++++++++++++++++++++++++++++++
> 1 file changed, 35 insertions(+)
>
> diff --git a/include/linux/of.h b/include/linux/of.h
> index 21e6323..98a046a 100644
> --- a/include/linux/of.h
> +++ b/include/linux/of.h
> @@ -474,6 +474,34 @@ static inline int of_property_read_u32_array(const struct device_node *np,
> }
>
> /**
> + * of_property_read_s32_array - Find and read an array of 32 bit signed integers
> + * from a property.
> + *
> + * @np: device node from which the property value is to be read.
> + * @propname: name of the property to be searched.
> + * @out_values: pointer to return value, modified only if return value is 0.
> + * @sz: number of array elements to read
> + *
> + * Search for a property in a device node and read 32-bit value(s) from
> + * it. Returns 0 on success, -EINVAL if the property does not exist,
> + * -ENODATA if property does not have a value, and -EOVERFLOW if the
> + * property data isn't large enough.
> + *
> + * The out_values is modified only if a valid s32 value can be decoded.
> + */
> +static inline int of_property_read_s32_array(const struct device_node *np,
> + const char *propname,
> + s32 *out_values, size_t sz)
> +{
> + int ret = of_property_read_variable_u32_array(np, propname, out_values,
> + sz, 0);
Add the type coercion of out_values to make it obvious:
+ int ret = of_property_read_variable_u32_array(np, propname,
+ (u32*) out_values, sz, 0);
> + if (ret >= 0)
> + return 0;
> + else
> + return ret;
> +}
> +
> +/**
> * of_property_read_u64_array - Find and read an array of 64 bit integers
> * from a property.
> *
> @@ -676,6 +704,13 @@ static inline int of_property_read_u32_array(const struct device_node *np,
> return -ENOSYS;
> }
>
> +static inline int of_property_read_s32_array(const struct device_node *np,
> + const char *propname,
> + s32 *out_values, size_t sz)
> +{
> + return -ENOSYS;
> +}
> +
> static inline int of_property_read_u64_array(const struct device_node *np,
> const char *propname,
> u64 *out_values, size_t sz)
>
Reviewed-by: Frank Rowand <frowand.list@gmail.com>
next prev parent reply other threads:[~2017-03-23 23:26 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-12 22:10 [PATCH V11 0/6] thermal: bcm2835: add thermal driver for bcm2835 SoC Stefan Wahren
[not found] ` <1489356665-3175-1-git-send-email-stefan.wahren-eS4NqCHxEME@public.gmane.org>
2017-03-12 22:11 ` [PATCH V11 1/6] of: base: Implement read function for s32 array Stefan Wahren
2017-03-23 23:26 ` Frank Rowand [this message]
2017-03-12 22:11 ` [PATCH V11 2/6] thermal: of-thermal: Implement signed coefficient support Stefan Wahren
[not found] ` <1489356665-3175-3-git-send-email-stefan.wahren-eS4NqCHxEME@public.gmane.org>
2017-03-23 23:32 ` Frank Rowand
2017-03-24 7:27 ` Stefan Wahren
2017-03-24 17:23 ` Frank Rowand
2017-03-29 4:52 ` Eduardo Valentin
2017-03-29 4:54 ` Eduardo Valentin
2017-03-12 22:11 ` [PATCH V11 3/6] dt-bindings: Add thermal zone to bcm2835-thermal example Stefan Wahren
2017-03-12 22:11 ` [PATCH V11 4/6] ARM: dts: bcm283x: Add CPU thermal zone with 1 trip point Stefan Wahren
2017-03-12 22:11 ` [PATCH V11 5/6] ARM64: dts: bcm2837: Define CPU thermal coefficients Stefan Wahren
2017-03-12 22:11 ` [PATCH V11 6/6] thermal: bcm2835: add thermal driver for bcm2835 SoC Stefan Wahren
2017-03-23 16:53 ` Nobuhiro Iwamatsu
[not found] ` <CABMQnVJx10e2qm0N=C_vxU9WAQGUJ3ZyAUgrK7WQZoxm9+P0wg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-03-23 18:52 ` Stefan Wahren
[not found] ` <1489356665-3175-7-git-send-email-stefan.wahren-eS4NqCHxEME@public.gmane.org>
2017-03-29 4:58 ` Eduardo Valentin
2017-03-30 4:57 ` Eduardo Valentin
[not found] ` <20170330045725.GA12995-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2017-03-30 6:30 ` Stefan Wahren
[not found] ` <1205844664.21224.1490855429497-7tX72C7vayboQLBSYMtkGA@public.gmane.org>
2017-03-31 1:08 ` Eduardo Valentin
2017-03-30 19:11 ` Stefan Wahren
[not found] ` <1620097357.332334.1490901102005-7tX72C7vayboQLBSYMtkGA@public.gmane.org>
2017-03-31 1:06 ` Eduardo Valentin
2017-03-22 19:30 ` [PATCH V11 0/6] " Stefan Wahren
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=58D4598C.8030407@gmail.com \
--to=frowand.list@gmail.com \
--cc=devicetree@vger.kernel.org \
--cc=edubezval@gmail.com \
--cc=eric@anholt.net \
--cc=f.fainelli@gmail.com \
--cc=kernel@martin.sperl.org \
--cc=linux-pm@vger.kernel.org \
--cc=linux-rpi-kernel@lists.infradead.org \
--cc=robh+dt@kernel.org \
--cc=rui.zhang@intel.com \
--cc=stefan.wahren@i2se.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).