Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1275197 > unrolled thread

[PATCH] crypto: nx: use of_property_read_u32()

Started bySaurabh Sengar <saurabh.truth@gmail.com>
First post2015-11-23 11:00 +0100
Last post2015-11-24 11:30 +0100
Articles 3 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] crypto: nx: use of_property_read_u32() Saurabh Sengar <saurabh.truth@gmail.com> - 2015-11-23 11:00 +0100
    Re: [PATCH] crypto: nx: use of_property_read_u32() Dan Streetman <ddstreet@ieee.org> - 2015-11-23 15:20 +0100
    Re: [PATCH] crypto: nx: use of_property_read_u32() Herbert Xu <herbert@gondor.apana.org.au> - 2015-11-24 11:30 +0100

#1275197 — [PATCH] crypto: nx: use of_property_read_u32()

FromSaurabh Sengar <saurabh.truth@gmail.com>
Date2015-11-23 11:00 +0100
Subject[PATCH] crypto: nx: use of_property_read_u32()
Message-ID<qxW4I-8tT-33@gated-at.bofh.it>
use of_propert_read_u32() for reading int value,
it can help reducing number of variables used

Signed-off-by: Saurabh Sengar <saurabh.truth@gmail.com>
---
 drivers/crypto/nx/nx-842-powernv.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/drivers/crypto/nx/nx-842-powernv.c b/drivers/crypto/nx/nx-842-powernv.c
index 9ef51fa..87f7a0f 100644
--- a/drivers/crypto/nx/nx-842-powernv.c
+++ b/drivers/crypto/nx/nx-842-powernv.c
@@ -525,7 +525,6 @@ static int nx842_powernv_decompress(const unsigned char *in, unsigned int inlen,
 static int __init nx842_powernv_probe(struct device_node *dn)
 {
 	struct nx842_coproc *coproc;
-	struct property *ct_prop, *ci_prop;
 	unsigned int ct, ci;
 	int chip_id;
 
@@ -534,18 +533,16 @@ static int __init nx842_powernv_probe(struct device_node *dn)
 		pr_err("ibm,chip-id missing\n");
 		return -EINVAL;
 	}
-	ct_prop = of_find_property(dn, "ibm,842-coprocessor-type", NULL);
-	if (!ct_prop) {
+
+	if (of_property_read_u32(dn, "ibm,842-coprocessor-type", &ct)) {
 		pr_err("ibm,842-coprocessor-type missing\n");
 		return -EINVAL;
 	}
-	ct = be32_to_cpu(*(unsigned int *)ct_prop->value);
-	ci_prop = of_find_property(dn, "ibm,842-coprocessor-instance", NULL);
-	if (!ci_prop) {
+
+	if (of_property_read_u32(dn, "ibm,842-coprocessor-instance", &ci)) {
 		pr_err("ibm,842-coprocessor-instance missing\n");
 		return -EINVAL;
 	}
-	ci = be32_to_cpu(*(unsigned int *)ci_prop->value);
 
 	coproc = kmalloc(sizeof(*coproc), GFP_KERNEL);
 	if (!coproc)
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1275422

FromDan Streetman <ddstreet@ieee.org>
Date2015-11-23 15:20 +0100
Message-ID<qy08i-2R4-21@gated-at.bofh.it>
In reply to#1275197
On Mon, Nov 23, 2015 at 4:56 AM, Saurabh Sengar <saurabh.truth@gmail.com> wrote:
> use of_propert_read_u32() for reading int value,
> it can help reducing number of variables used
>
> Signed-off-by: Saurabh Sengar <saurabh.truth@gmail.com>

Acked-by: Dan Streetman <ddstreet@ieee.org>

> ---
>  drivers/crypto/nx/nx-842-powernv.c | 11 ++++-------
>  1 file changed, 4 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/crypto/nx/nx-842-powernv.c b/drivers/crypto/nx/nx-842-powernv.c
> index 9ef51fa..87f7a0f 100644
> --- a/drivers/crypto/nx/nx-842-powernv.c
> +++ b/drivers/crypto/nx/nx-842-powernv.c
> @@ -525,7 +525,6 @@ static int nx842_powernv_decompress(const unsigned char *in, unsigned int inlen,
>  static int __init nx842_powernv_probe(struct device_node *dn)
>  {
>         struct nx842_coproc *coproc;
> -       struct property *ct_prop, *ci_prop;
>         unsigned int ct, ci;
>         int chip_id;
>
> @@ -534,18 +533,16 @@ static int __init nx842_powernv_probe(struct device_node *dn)
>                 pr_err("ibm,chip-id missing\n");
>                 return -EINVAL;
>         }
> -       ct_prop = of_find_property(dn, "ibm,842-coprocessor-type", NULL);
> -       if (!ct_prop) {
> +
> +       if (of_property_read_u32(dn, "ibm,842-coprocessor-type", &ct)) {
>                 pr_err("ibm,842-coprocessor-type missing\n");
>                 return -EINVAL;
>         }
> -       ct = be32_to_cpu(*(unsigned int *)ct_prop->value);
> -       ci_prop = of_find_property(dn, "ibm,842-coprocessor-instance", NULL);
> -       if (!ci_prop) {
> +
> +       if (of_property_read_u32(dn, "ibm,842-coprocessor-instance", &ci)) {
>                 pr_err("ibm,842-coprocessor-instance missing\n");
>                 return -EINVAL;
>         }
> -       ci = be32_to_cpu(*(unsigned int *)ci_prop->value);
>
>         coproc = kmalloc(sizeof(*coproc), GFP_KERNEL);
>         if (!coproc)
> --
> 1.9.1
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1276275

FromHerbert Xu <herbert@gondor.apana.org.au>
Date2015-11-24 11:30 +0100
Message-ID<qyj1g-6Rp-25@gated-at.bofh.it>
In reply to#1275197
On Mon, Nov 23, 2015 at 03:26:54PM +0530, Saurabh Sengar wrote:
> use of_propert_read_u32() for reading int value,
> it can help reducing number of variables used
> 
> Signed-off-by: Saurabh Sengar <saurabh.truth@gmail.com>

Patch applied.  Thanks.
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web