All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Heiko Stübner" <heiko-4mtYJXux2i+zQB+pC5nmwQ@public.gmane.org>
To: Finlye Xiao <finley.xiao-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
Cc: srinivas.kandagatla-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org,
	maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org,
	robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
	frowand.list-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
	sre-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
	dbaryshkov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
	dwmw2-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org,
	mark.rutland-5wv7dgnIgG8@public.gmane.org,
	khilman-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
	nm-l0cyMroinI0@public.gmane.org,
	rjw-LthD3rsA81gm4RdzfppkhA@public.gmane.org,
	viresh.kumar-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org,
	sboyd-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
	linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
	devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-pm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	wxt-TNX95d0MmH7DzftRWevZcw@public.gmane.org,
	jay.xu-TNX95d0MmH7DzftRWevZcw@public.gmane.org,
	rocky.hao-TNX95d0MmH7DzftRWevZcw@public.gmane.org,
	tim.chen-TNX95d0MmH7DzftRWevZcw@public.gmane.org,
	tony.xie-TNX95d0MmH7DzftRWevZcw@public.gmane.org,
	ulysses.huang-TNX95d0MmH7DzftRWevZcw@public.gmane.org,
	lin.huang-TNX95d0MmH7DzftRWevZcw@public.gmane.org
Subject: Re: [PATCH v1 2/3] of: Add support for reading a s32 from a multi-value property.
Date: Tue, 16 Aug 2016 14:09:52 +0200	[thread overview]
Message-ID: <23748508.K8gp1eOYRv@diego> (raw)
In-Reply-To: <1471315139-28285-3-git-send-email-finley.xiao-TNX95d0MmH7DzftRWevZcw@public.gmane.org>

Hi Finley,

Am Dienstag, 16. August 2016, 10:38:58 schrieb Finlye Xiao:
> From: Finley Xiao <finley.xiao-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
> 
> This patch adds an of_property_read_s32_index() function to allow
> reading a single indexed s32 value from a property containing multiple
> s32 values.
>
> Signed-off-by: Finley Xiao <finley.xiao-TNX95d0MmH7DzftRWevZcw@public.gmane.org>

for people reading along, this simply duplicates what of_property_read_s32 
already does, only for indexed properties.

But I do have one issue below.

> ---
>  drivers/of/base.c  | 23 +++++++++++++++++++++++
>  include/linux/of.h | 10 ++++++++++
>  2 files changed, 33 insertions(+)
> 
> diff --git a/drivers/of/base.c b/drivers/of/base.c
> index 7792266..346457d 100644
> --- a/drivers/of/base.c
> +++ b/drivers/of/base.c
> @@ -1200,6 +1200,29 @@ int of_property_read_u32_index(const struct
> device_node *np, EXPORT_SYMBOL_GPL(of_property_read_u32_index);
> 
>  /**
> + * of_property_read_s32_index - Find and read a s32 from a multi-value
> property. + *
> + * @np:		device node from which the property value is to be read.
> + * @propname:	name of the property to be searched.
> + * @index:	index of the u32 in the list of values
> + * @out_value:	pointer to return value, modified only if no error.
> + *
> + * Search for a property in a device node and read nth 32-bit value 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_value is modified only if a valid s32 value can be decoded.
> + */
> +int of_property_read_s32_index(const struct device_node *np,
> +			       const char *propname, u32 index, s32 *out_value)
> +{
> +	return of_property_read_u32_index(np, propname, index,
> +		(u32 *)out_value);
> +}
> +EXPORT_SYMBOL_GPL(of_property_read_s32_index);

I think this could very well live directly in the of.h header below 
of_property_read_s32 or so.

As this also only calls the more generic u32 variant, it can be just a static 
inline there and does not need to duplicate the whole stub voodoo, as the 
of_property_read_u32_index will also generate the -ENOSYS error in the !OF 
case.


Heiko
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

WARNING: multiple messages have this Message-ID (diff)
From: heiko@sntech.de (Heiko Stübner)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v1 2/3] of: Add support for reading a s32 from a multi-value property.
Date: Tue, 16 Aug 2016 14:09:52 +0200	[thread overview]
Message-ID: <23748508.K8gp1eOYRv@diego> (raw)
In-Reply-To: <1471315139-28285-3-git-send-email-finley.xiao@rock-chips.com>

Hi Finley,

Am Dienstag, 16. August 2016, 10:38:58 schrieb Finlye Xiao:
> From: Finley Xiao <finley.xiao@rock-chips.com>
> 
> This patch adds an of_property_read_s32_index() function to allow
> reading a single indexed s32 value from a property containing multiple
> s32 values.
>
> Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>

for people reading along, this simply duplicates what of_property_read_s32 
already does, only for indexed properties.

But I do have one issue below.

> ---
>  drivers/of/base.c  | 23 +++++++++++++++++++++++
>  include/linux/of.h | 10 ++++++++++
>  2 files changed, 33 insertions(+)
> 
> diff --git a/drivers/of/base.c b/drivers/of/base.c
> index 7792266..346457d 100644
> --- a/drivers/of/base.c
> +++ b/drivers/of/base.c
> @@ -1200,6 +1200,29 @@ int of_property_read_u32_index(const struct
> device_node *np, EXPORT_SYMBOL_GPL(of_property_read_u32_index);
> 
>  /**
> + * of_property_read_s32_index - Find and read a s32 from a multi-value
> property. + *
> + * @np:		device node from which the property value is to be read.
> + * @propname:	name of the property to be searched.
> + * @index:	index of the u32 in the list of values
> + * @out_value:	pointer to return value, modified only if no error.
> + *
> + * Search for a property in a device node and read nth 32-bit value 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_value is modified only if a valid s32 value can be decoded.
> + */
> +int of_property_read_s32_index(const struct device_node *np,
> +			       const char *propname, u32 index, s32 *out_value)
> +{
> +	return of_property_read_u32_index(np, propname, index,
> +		(u32 *)out_value);
> +}
> +EXPORT_SYMBOL_GPL(of_property_read_s32_index);

I think this could very well live directly in the of.h header below 
of_property_read_s32 or so.

As this also only calls the more generic u32 variant, it can be just a static 
inline there and does not need to duplicate the whole stub voodoo, as the 
of_property_read_u32_index will also generate the -ENOSYS error in the !OF 
case.


Heiko

WARNING: multiple messages have this Message-ID (diff)
From: "Heiko Stübner" <heiko@sntech.de>
To: Finlye Xiao <finley.xiao@rock-chips.com>
Cc: srinivas.kandagatla@linaro.org, maxime.ripard@free-electrons.com,
	robh+dt@kernel.org, frowand.list@gmail.com, sre@kernel.org,
	dbaryshkov@gmail.com, dwmw2@infradead.org, mark.rutland@arm.com,
	khilman@kernel.org, nm@ti.com, rjw@rjwysocki.net,
	viresh.kumar@linaro.org, sboyd@codeaurora.org,
	linux-arm-kernel@lists.infradead.org,
	linux-rockchip@lists.infradead.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org,
	wxt@rock-chips.com, jay.xu@rock-chips.com,
	rocky.hao@rock-chips.com, tim.chen@rock-chips.com,
	tony.xie@rock-chips.com, ulysses.huang@rock-chips.com,
	lin.huang@rock-chips.com
Subject: Re: [PATCH v1 2/3] of: Add support for reading a s32 from a multi-value property.
Date: Tue, 16 Aug 2016 14:09:52 +0200	[thread overview]
Message-ID: <23748508.K8gp1eOYRv@diego> (raw)
In-Reply-To: <1471315139-28285-3-git-send-email-finley.xiao@rock-chips.com>

Hi Finley,

Am Dienstag, 16. August 2016, 10:38:58 schrieb Finlye Xiao:
> From: Finley Xiao <finley.xiao@rock-chips.com>
> 
> This patch adds an of_property_read_s32_index() function to allow
> reading a single indexed s32 value from a property containing multiple
> s32 values.
>
> Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>

for people reading along, this simply duplicates what of_property_read_s32 
already does, only for indexed properties.

But I do have one issue below.

> ---
>  drivers/of/base.c  | 23 +++++++++++++++++++++++
>  include/linux/of.h | 10 ++++++++++
>  2 files changed, 33 insertions(+)
> 
> diff --git a/drivers/of/base.c b/drivers/of/base.c
> index 7792266..346457d 100644
> --- a/drivers/of/base.c
> +++ b/drivers/of/base.c
> @@ -1200,6 +1200,29 @@ int of_property_read_u32_index(const struct
> device_node *np, EXPORT_SYMBOL_GPL(of_property_read_u32_index);
> 
>  /**
> + * of_property_read_s32_index - Find and read a s32 from a multi-value
> property. + *
> + * @np:		device node from which the property value is to be read.
> + * @propname:	name of the property to be searched.
> + * @index:	index of the u32 in the list of values
> + * @out_value:	pointer to return value, modified only if no error.
> + *
> + * Search for a property in a device node and read nth 32-bit value 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_value is modified only if a valid s32 value can be decoded.
> + */
> +int of_property_read_s32_index(const struct device_node *np,
> +			       const char *propname, u32 index, s32 *out_value)
> +{
> +	return of_property_read_u32_index(np, propname, index,
> +		(u32 *)out_value);
> +}
> +EXPORT_SYMBOL_GPL(of_property_read_s32_index);

I think this could very well live directly in the of.h header below 
of_property_read_s32 or so.

As this also only calls the more generic u32 variant, it can be just a static 
inline there and does not need to duplicate the whole stub voodoo, as the 
of_property_read_u32_index will also generate the -ENOSYS error in the !OF 
case.


Heiko

  parent reply	other threads:[~2016-08-16 12:09 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-16  2:38 [PATCH v1 0/3] PM / AVS: add Rockchip cpu avs Finlye Xiao
2016-08-16  2:38 ` Finlye Xiao
2016-08-16  2:38 ` Finlye Xiao
2016-08-16  2:38 ` [PATCH v1 1/3] nvmem: rockchip-efuse: Change initcall to subsys Finlye Xiao
2016-08-16  2:38   ` Finlye Xiao
2016-08-16  2:38   ` Finlye Xiao
     [not found] ` <1471315139-28285-1-git-send-email-finley.xiao-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
2016-08-16  2:38   ` [PATCH v1 2/3] of: Add support for reading a s32 from a multi-value property Finlye Xiao
2016-08-16  2:38     ` Finlye Xiao
2016-08-16  2:38     ` Finlye Xiao
     [not found]     ` <1471315139-28285-3-git-send-email-finley.xiao-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
2016-08-16 12:09       ` Heiko Stübner [this message]
2016-08-16 12:09         ` Heiko Stübner
2016-08-16 12:09         ` Heiko Stübner
2016-08-19 14:15       ` David Woodhouse
2016-08-19 14:15         ` David Woodhouse
2016-08-19 14:15         ` David Woodhouse
2016-08-19 20:41         ` Heiko Stuebner
2016-08-19 20:41           ` Heiko Stuebner
2016-08-19 20:47           ` David Woodhouse
2016-08-19 20:47             ` David Woodhouse
2016-08-19 20:47             ` David Woodhouse
     [not found]             ` <1471639654.4611.2.camel-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>
2016-08-22 14:07               ` Finley Xiao
2016-08-22 14:07                 ` Finley Xiao
2016-08-22 14:07                 ` Finley Xiao
2016-08-22 14:51             ` Mark Rutland
2016-08-22 14:51               ` Mark Rutland
2016-08-16  2:38   ` [PATCH v1 3/3] PM / AVS: rockchip-cpu-avs: add driver handling Rockchip cpu avs Finlye Xiao
2016-08-16  2:38     ` Finlye Xiao
2016-08-16  2:38     ` Finlye Xiao
2016-08-16  5:13     ` kbuild test robot
2016-08-16  5:13       ` kbuild test robot
2016-08-16  5:13       ` kbuild test robot
2016-08-16 17:24     ` Heiko Stübner
2016-08-16 17:24       ` Heiko Stübner
2016-08-17 13:59       ` Finley Xiao
2016-08-17 13:59         ` Finley Xiao
2016-08-17 13:59         ` Finley Xiao
     [not found]     ` <1471315139-28285-4-git-send-email-finley.xiao-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
2016-08-19 13:36       ` Rob Herring
2016-08-19 13:36         ` Rob Herring
2016-08-19 13:36         ` Rob Herring
2016-08-23  4:10         ` Finley Xiao
2016-08-23  4:10           ` Finley Xiao
2016-08-23  4:10           ` Finley Xiao
2016-08-23  9:03           ` Heiko Stübner
2016-08-23  9:03             ` Heiko Stübner
2016-08-23  9:29             ` Finley Xiao
2016-08-23  9:29               ` Finley Xiao
2016-08-23  9:29               ` Finley Xiao
     [not found]               ` <4eab5b34-58f8-30bb-1a2c-0b0d6b3e2b2c-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
2016-09-08 16:56                 ` Rob Herring
2016-09-08 16:56                   ` Rob Herring
2016-09-08 16:56                   ` Rob Herring

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=23748508.K8gp1eOYRv@diego \
    --to=heiko-4mtyjxux2i+zqb+pc5nmwq@public.gmane.org \
    --cc=dbaryshkov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=dwmw2-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org \
    --cc=finley.xiao-TNX95d0MmH7DzftRWevZcw@public.gmane.org \
    --cc=frowand.list-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=jay.xu-TNX95d0MmH7DzftRWevZcw@public.gmane.org \
    --cc=khilman-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=lin.huang-TNX95d0MmH7DzftRWevZcw@public.gmane.org \
    --cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-pm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=mark.rutland-5wv7dgnIgG8@public.gmane.org \
    --cc=maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org \
    --cc=nm-l0cyMroinI0@public.gmane.org \
    --cc=rjw-LthD3rsA81gm4RdzfppkhA@public.gmane.org \
    --cc=robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=rocky.hao-TNX95d0MmH7DzftRWevZcw@public.gmane.org \
    --cc=sboyd-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org \
    --cc=sre-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=srinivas.kandagatla-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
    --cc=tim.chen-TNX95d0MmH7DzftRWevZcw@public.gmane.org \
    --cc=tony.xie-TNX95d0MmH7DzftRWevZcw@public.gmane.org \
    --cc=ulysses.huang-TNX95d0MmH7DzftRWevZcw@public.gmane.org \
    --cc=viresh.kumar-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
    --cc=wxt-TNX95d0MmH7DzftRWevZcw@public.gmane.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.