* [PATCH] crypto: nx: use of_property_read_u32()
@ 2015-11-23 9:56 Saurabh Sengar
2015-11-23 14:16 ` Dan Streetman
2015-11-24 10:24 ` Herbert Xu
0 siblings, 2 replies; 3+ messages in thread
From: Saurabh Sengar @ 2015-11-23 9:56 UTC (permalink / raw)
To: ddstreet, herbert, davem, linux-crypto, linux-kernel; +Cc: Saurabh Sengar
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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] crypto: nx: use of_property_read_u32()
2015-11-23 9:56 [PATCH] crypto: nx: use of_property_read_u32() Saurabh Sengar
@ 2015-11-23 14:16 ` Dan Streetman
2015-11-24 10:24 ` Herbert Xu
1 sibling, 0 replies; 3+ messages in thread
From: Dan Streetman @ 2015-11-23 14:16 UTC (permalink / raw)
To: Saurabh Sengar
Cc: Herbert Xu, David S. Miller, Linux Crypto Mailing List, linux-kernel
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
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] crypto: nx: use of_property_read_u32()
2015-11-23 9:56 [PATCH] crypto: nx: use of_property_read_u32() Saurabh Sengar
2015-11-23 14:16 ` Dan Streetman
@ 2015-11-24 10:24 ` Herbert Xu
1 sibling, 0 replies; 3+ messages in thread
From: Herbert Xu @ 2015-11-24 10:24 UTC (permalink / raw)
To: Saurabh Sengar; +Cc: ddstreet, davem, linux-crypto, linux-kernel
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
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-11-24 10:24 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-23 9:56 [PATCH] crypto: nx: use of_property_read_u32() Saurabh Sengar
2015-11-23 14:16 ` Dan Streetman
2015-11-24 10:24 ` Herbert Xu
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.