* RE: [PATCH v2 5/6] soc/fsl/qe: qe.c: support fsl,qe-snums property
@ 2019-05-09 2:33 Qiang Zhao
0 siblings, 0 replies; 3+ messages in thread
From: Qiang Zhao @ 2019-05-09 2:33 UTC (permalink / raw)
To: Rasmus Villemoes, devicetree, Leo Li
Cc: linuxppc-dev, linux-arm-kernel, linux-kernel, Rob Herring,
Scott Wood, Christophe Leroy, Mark Rutland, Rasmus Villemoes
On 2019/5/1 17:29, Rasmus Villemoes <rasmus.villemoes@prevas.dk> wrote:
> -----Original Message-----
> From: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
> Sent: 2019年5月1日 17:29
> To: devicetree@vger.kernel.org; Qiang Zhao <qiang.zhao@nxp.com>; Leo Li
> <leoyang.li@nxp.com>
> Cc: linuxppc-dev@lists.ozlabs.org; linux-arm-kernel@lists.infradead.org;
> linux-kernel@vger.kernel.org; Rob Herring <robh+dt@kernel.org>; Scott Wood
> <oss@buserror.net>; Christophe Leroy <christophe.leroy@c-s.fr>; Mark
> Rutland <mark.rutland@arm.com>; Rasmus Villemoes
> <Rasmus.Villemoes@prevas.se>
> Subject: [PATCH v2 5/6] soc/fsl/qe: qe.c: support fsl,qe-snums property
>
> Add driver support for the newly introduced fsl,qe-snums property.
>
> Conveniently, of_property_read_variable_u8_array does exactly what we
> need: If the property fsl,qe-snums is found (and has an allowed size), the array
> of values get copied to snums, and the return value is the number of snums -
> we cannot assign directly to num_of_snums, since we need to check whether
> the return value is negative.
>
> Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
> ---
Reviewed-by: Qiang Zhao <qiang.zhao@nxp.com>
> drivers/soc/fsl/qe/qe.c | 16 ++++++++++++++--
> 1 file changed, 14 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/soc/fsl/qe/qe.c b/drivers/soc/fsl/qe/qe.c index
> 0fb8b59f61ad..325d689cbf5c 100644
> --- a/drivers/soc/fsl/qe/qe.c
> +++ b/drivers/soc/fsl/qe/qe.c
> @@ -283,7 +283,6 @@ EXPORT_SYMBOL(qe_clock_source);
> */
> static void qe_snums_init(void)
> {
> - int i;
> static const u8 snum_init_76[] = {
> 0x04, 0x05, 0x0C, 0x0D, 0x14, 0x15, 0x1C, 0x1D,
> 0x24, 0x25, 0x2C, 0x2D, 0x34, 0x35, 0x88, 0x89, @@
> -304,7 +303,21 @@ static void qe_snums_init(void)
> 0x28, 0x29, 0x38, 0x39, 0x48, 0x49, 0x58, 0x59,
> 0x68, 0x69, 0x78, 0x79, 0x80, 0x81,
> };
> + struct device_node *qe;
> const u8 *snum_init;
> + int i;
> +
> + bitmap_zero(snum_state, QE_NUM_OF_SNUM);
> + qe = qe_get_device_node();
> + if (qe) {
> + i = of_property_read_variable_u8_array(qe, "fsl,qe-snums",
> + snums, 1,
> QE_NUM_OF_SNUM);
> + of_node_put(qe);
> + if (i > 0) {
> + qe_num_of_snum = i;
> + return;
> + }
> + }
>
> qe_num_of_snum = qe_get_num_of_snums();
>
> @@ -313,7 +326,6 @@ static void qe_snums_init(void)
> else
> snum_init = snum_init_46;
>
> - bitmap_zero(snum_state, QE_NUM_OF_SNUM);
> memcpy(snums, snum_init, qe_num_of_snum); }
>
> --
> 2.20.1
Best Regards
Qiang Zhao
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2 5/6] soc/fsl/qe: qe.c: support fsl,qe-snums property
2019-05-01 9:29 ` [PATCH v2 5/6] soc/fsl/qe: qe.c: support fsl,qe-snums property Rasmus Villemoes
@ 2019-05-02 4:52 ` Christophe Leroy
0 siblings, 0 replies; 3+ messages in thread
From: Christophe Leroy @ 2019-05-02 4:52 UTC (permalink / raw)
To: Rasmus Villemoes, devicetree, Qiang Zhao, Li Yang
Cc: linuxppc-dev, linux-arm-kernel, linux-kernel, Rob Herring,
Scott Wood, Mark Rutland, Rasmus Villemoes
Le 01/05/2019 à 11:29, Rasmus Villemoes a écrit :
> Add driver support for the newly introduced fsl,qe-snums property.
>
> Conveniently, of_property_read_variable_u8_array does exactly what we
> need: If the property fsl,qe-snums is found (and has an allowed size),
> the array of values get copied to snums, and the return value is the
> number of snums - we cannot assign directly to num_of_snums, since we
> need to check whether the return value is negative.
>
> Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Reviewed-by: Christophe Leroy <christophe.leroy@c-s.fr>
> ---
> drivers/soc/fsl/qe/qe.c | 16 ++++++++++++++--
> 1 file changed, 14 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/soc/fsl/qe/qe.c b/drivers/soc/fsl/qe/qe.c
> index 0fb8b59f61ad..325d689cbf5c 100644
> --- a/drivers/soc/fsl/qe/qe.c
> +++ b/drivers/soc/fsl/qe/qe.c
> @@ -283,7 +283,6 @@ EXPORT_SYMBOL(qe_clock_source);
> */
> static void qe_snums_init(void)
> {
> - int i;
> static const u8 snum_init_76[] = {
> 0x04, 0x05, 0x0C, 0x0D, 0x14, 0x15, 0x1C, 0x1D,
> 0x24, 0x25, 0x2C, 0x2D, 0x34, 0x35, 0x88, 0x89,
> @@ -304,7 +303,21 @@ static void qe_snums_init(void)
> 0x28, 0x29, 0x38, 0x39, 0x48, 0x49, 0x58, 0x59,
> 0x68, 0x69, 0x78, 0x79, 0x80, 0x81,
> };
> + struct device_node *qe;
> const u8 *snum_init;
> + int i;
> +
> + bitmap_zero(snum_state, QE_NUM_OF_SNUM);
> + qe = qe_get_device_node();
> + if (qe) {
> + i = of_property_read_variable_u8_array(qe, "fsl,qe-snums",
> + snums, 1, QE_NUM_OF_SNUM);
> + of_node_put(qe);
> + if (i > 0) {
> + qe_num_of_snum = i;
> + return;
> + }
> + }
>
> qe_num_of_snum = qe_get_num_of_snums();
>
> @@ -313,7 +326,6 @@ static void qe_snums_init(void)
> else
> snum_init = snum_init_46;
>
> - bitmap_zero(snum_state, QE_NUM_OF_SNUM);
> memcpy(snums, snum_init, qe_num_of_snum);
> }
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH v2 5/6] soc/fsl/qe: qe.c: support fsl,qe-snums property
2019-05-01 9:29 ` [PATCH v2 0/6] " Rasmus Villemoes
@ 2019-05-01 9:29 ` Rasmus Villemoes
2019-05-02 4:52 ` Christophe Leroy
0 siblings, 1 reply; 3+ messages in thread
From: Rasmus Villemoes @ 2019-05-01 9:29 UTC (permalink / raw)
To: devicetree, Qiang Zhao, Li Yang
Cc: linuxppc-dev, linux-arm-kernel, linux-kernel, Rob Herring,
Scott Wood, Christophe Leroy, Mark Rutland, Rasmus Villemoes
Add driver support for the newly introduced fsl,qe-snums property.
Conveniently, of_property_read_variable_u8_array does exactly what we
need: If the property fsl,qe-snums is found (and has an allowed size),
the array of values get copied to snums, and the return value is the
number of snums - we cannot assign directly to num_of_snums, since we
need to check whether the return value is negative.
Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
---
drivers/soc/fsl/qe/qe.c | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/drivers/soc/fsl/qe/qe.c b/drivers/soc/fsl/qe/qe.c
index 0fb8b59f61ad..325d689cbf5c 100644
--- a/drivers/soc/fsl/qe/qe.c
+++ b/drivers/soc/fsl/qe/qe.c
@@ -283,7 +283,6 @@ EXPORT_SYMBOL(qe_clock_source);
*/
static void qe_snums_init(void)
{
- int i;
static const u8 snum_init_76[] = {
0x04, 0x05, 0x0C, 0x0D, 0x14, 0x15, 0x1C, 0x1D,
0x24, 0x25, 0x2C, 0x2D, 0x34, 0x35, 0x88, 0x89,
@@ -304,7 +303,21 @@ static void qe_snums_init(void)
0x28, 0x29, 0x38, 0x39, 0x48, 0x49, 0x58, 0x59,
0x68, 0x69, 0x78, 0x79, 0x80, 0x81,
};
+ struct device_node *qe;
const u8 *snum_init;
+ int i;
+
+ bitmap_zero(snum_state, QE_NUM_OF_SNUM);
+ qe = qe_get_device_node();
+ if (qe) {
+ i = of_property_read_variable_u8_array(qe, "fsl,qe-snums",
+ snums, 1, QE_NUM_OF_SNUM);
+ of_node_put(qe);
+ if (i > 0) {
+ qe_num_of_snum = i;
+ return;
+ }
+ }
qe_num_of_snum = qe_get_num_of_snums();
@@ -313,7 +326,6 @@ static void qe_snums_init(void)
else
snum_init = snum_init_46;
- bitmap_zero(snum_state, QE_NUM_OF_SNUM);
memcpy(snums, snum_init, qe_num_of_snum);
}
--
2.20.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-05-09 2:33 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-09 2:33 [PATCH v2 5/6] soc/fsl/qe: qe.c: support fsl,qe-snums property Qiang Zhao
-- strict thread matches above, loose matches on Subject: below --
2019-04-30 13:36 [PATCH RESEND 0/5] soc/fsl/qe: cleanups and new DT binding Rasmus Villemoes
2019-05-01 9:29 ` [PATCH v2 0/6] " Rasmus Villemoes
2019-05-01 9:29 ` [PATCH v2 5/6] soc/fsl/qe: qe.c: support fsl,qe-snums property Rasmus Villemoes
2019-05-02 4:52 ` Christophe Leroy
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).