Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754799AbbKWORE (ORCPT ); Mon, 23 Nov 2015 09:17:04 -0500 Received: from mail-ig0-f175.google.com ([209.85.213.175]:36662 "EHLO mail-ig0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754554AbbKWORC (ORCPT ); Mon, 23 Nov 2015 09:17:02 -0500 MIME-Version: 1.0 In-Reply-To: <1448272614-24337-1-git-send-email-saurabh.truth@gmail.com> References: <1448272614-24337-1-git-send-email-saurabh.truth@gmail.com> From: Dan Streetman Date: Mon, 23 Nov 2015 09:16:21 -0500 X-Google-Sender-Auth: 7-e9DJihVQt79HZdPElNrrMz2nc Message-ID: Subject: Re: [PATCH] crypto: nx: use of_property_read_u32() To: Saurabh Sengar Cc: Herbert Xu , "David S. Miller" , Linux Crypto Mailing List , linux-kernel Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2160 Lines: 55 On Mon, Nov 23, 2015 at 4:56 AM, 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 Acked-by: Dan Streetman > --- > 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/