All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] crypto: caam - Fix job ring discovery in controller driver
@ 2014-01-24  9:03 Nitesh Lal
  2014-02-07  4:42 ` NiteshNarayanLal
  2014-02-07  8:15 ` Horia Geantă
  0 siblings, 2 replies; 4+ messages in thread
From: Nitesh Lal @ 2014-01-24  9:03 UTC (permalink / raw)
  To: linux-crypto; +Cc: Nitesh Lal

The SEC Controller driver creates platform devices for it's child job ring nodes.
Currently the driver uses for_each_compatible routine which traverses
the whole device tree to create the job rings for the platform device.
The patch changes this to search for the compatible property of job ring
only in the child nodes i.e., the job rings are created as per the number
of children associated with the crypto node.

Signed-off-by: Nitesh Lal <NiteshNarayanLal@freescale.com>
---
 drivers/crypto/caam/ctrl.c | 25 ++++++-------------------
 1 file changed, 6 insertions(+), 19 deletions(-)

diff --git a/drivers/crypto/caam/ctrl.c b/drivers/crypto/caam/ctrl.c
index 63fb1af..30f434f 100644
--- a/drivers/crypto/caam/ctrl.c
+++ b/drivers/crypto/caam/ctrl.c
@@ -443,13 +443,10 @@ static int caam_probe(struct platform_device *pdev)
 	 * for all, then go probe each one.
 	 */
 	rspec = 0;
-	for_each_compatible_node(np, NULL, "fsl,sec-v4.0-job-ring")
-		rspec++;
-	if (!rspec) {
-		/* for backward compatible with device trees */
-		for_each_compatible_node(np, NULL, "fsl,sec4.0-job-ring")
+	for_each_available_child_of_node(nprop, np)
+		if (of_device_is_compatible(np, "fsl,sec-v4.0-job-ring") ||
+		    of_device_is_compatible(np, "fsl,sec4.0-job-ring"))
 			rspec++;
-	}
 
 	ctrlpriv->jrpdev = kzalloc(sizeof(struct platform_device *) * rspec,
 								GFP_KERNEL);
@@ -460,18 +457,9 @@ static int caam_probe(struct platform_device *pdev)
 
 	ring = 0;
 	ctrlpriv->total_jobrs = 0;
-	for_each_compatible_node(np, NULL, "fsl,sec-v4.0-job-ring") {
-		ctrlpriv->jrpdev[ring] =
-				of_platform_device_create(np, NULL, dev);
-		if (!ctrlpriv->jrpdev[ring]) {
-			pr_warn("JR%d Platform device creation error\n", ring);
-			continue;
-		}
-		ctrlpriv->total_jobrs++;
-		ring++;
-	}
-	if (!ring) {
-		for_each_compatible_node(np, NULL, "fsl,sec4.0-job-ring") {
+	for_each_available_child_of_node(nprop, np)
+		if (of_device_is_compatible(np, "fsl,sec-v4.0-job-ring") ||
+		    of_device_is_compatible(np, "fsl,sec4.0-job-ring")) {
 			ctrlpriv->jrpdev[ring] =
 				of_platform_device_create(np, NULL, dev);
 			if (!ctrlpriv->jrpdev[ring]) {
@@ -482,7 +470,6 @@ static int caam_probe(struct platform_device *pdev)
 			ctrlpriv->total_jobrs++;
 			ring++;
 		}
-	}
 
 	/* Check to see if QI present. If so, enable */
 	ctrlpriv->qi_present = !!(rd_reg64(&topregs->ctrl.perfmon.comp_parms) &
-- 
1.8.1.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* RE: [PATCH] crypto: caam - Fix job ring discovery in controller driver
  2014-01-24  9:03 [PATCH] crypto: caam - Fix job ring discovery in controller driver Nitesh Lal
@ 2014-02-07  4:42 ` NiteshNarayanLal
  2014-02-07  8:15 ` Horia Geantă
  1 sibling, 0 replies; 4+ messages in thread
From: NiteshNarayanLal @ 2014-02-07  4:42 UTC (permalink / raw)
  To: NiteshNarayanLal@freescale.com, linux-crypto@vger.kernel.org
  Cc: herbert@gondor.apana.org.au, Ruchika Gupta,
	yashpal.dutta@freescale.com

Hi Herbert,

Can you please pick up this patch.

Regards
Nitesh

-----Original Message-----
From: Nitesh Lal [mailto:NiteshNarayanLal@freescale.com] 
Sent: Friday, January 24, 2014 2:33 PM
To: linux-crypto@vger.kernel.org
Cc: Lal Nitesh-B44382
Subject: [PATCH] crypto: caam - Fix job ring discovery in controller driver

The SEC Controller driver creates platform devices for it's child job ring nodes.
Currently the driver uses for_each_compatible routine which traverses the whole device tree to create the job rings for the platform device.
The patch changes this to search for the compatible property of job ring only in the child nodes i.e., the job rings are created as per the number of children associated with the crypto node.

Signed-off-by: Nitesh Lal <NiteshNarayanLal@freescale.com>
---
 drivers/crypto/caam/ctrl.c | 25 ++++++-------------------
 1 file changed, 6 insertions(+), 19 deletions(-)

diff --git a/drivers/crypto/caam/ctrl.c b/drivers/crypto/caam/ctrl.c index 63fb1af..30f434f 100644
--- a/drivers/crypto/caam/ctrl.c
+++ b/drivers/crypto/caam/ctrl.c
@@ -443,13 +443,10 @@ static int caam_probe(struct platform_device *pdev)
 	 * for all, then go probe each one.
 	 */
 	rspec = 0;
-	for_each_compatible_node(np, NULL, "fsl,sec-v4.0-job-ring")
-		rspec++;
-	if (!rspec) {
-		/* for backward compatible with device trees */
-		for_each_compatible_node(np, NULL, "fsl,sec4.0-job-ring")
+	for_each_available_child_of_node(nprop, np)
+		if (of_device_is_compatible(np, "fsl,sec-v4.0-job-ring") ||
+		    of_device_is_compatible(np, "fsl,sec4.0-job-ring"))
 			rspec++;
-	}
 
 	ctrlpriv->jrpdev = kzalloc(sizeof(struct platform_device *) * rspec,
 								GFP_KERNEL);
@@ -460,18 +457,9 @@ static int caam_probe(struct platform_device *pdev)
 
 	ring = 0;
 	ctrlpriv->total_jobrs = 0;
-	for_each_compatible_node(np, NULL, "fsl,sec-v4.0-job-ring") {
-		ctrlpriv->jrpdev[ring] =
-				of_platform_device_create(np, NULL, dev);
-		if (!ctrlpriv->jrpdev[ring]) {
-			pr_warn("JR%d Platform device creation error\n", ring);
-			continue;
-		}
-		ctrlpriv->total_jobrs++;
-		ring++;
-	}
-	if (!ring) {
-		for_each_compatible_node(np, NULL, "fsl,sec4.0-job-ring") {
+	for_each_available_child_of_node(nprop, np)
+		if (of_device_is_compatible(np, "fsl,sec-v4.0-job-ring") ||
+		    of_device_is_compatible(np, "fsl,sec4.0-job-ring")) {
 			ctrlpriv->jrpdev[ring] =
 				of_platform_device_create(np, NULL, dev);
 			if (!ctrlpriv->jrpdev[ring]) {
@@ -482,7 +470,6 @@ static int caam_probe(struct platform_device *pdev)
 			ctrlpriv->total_jobrs++;
 			ring++;
 		}
-	}
 
 	/* Check to see if QI present. If so, enable */
 	ctrlpriv->qi_present = !!(rd_reg64(&topregs->ctrl.perfmon.comp_parms) &
--
1.8.1.4

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] crypto: caam - Fix job ring discovery in controller driver
  2014-01-24  9:03 [PATCH] crypto: caam - Fix job ring discovery in controller driver Nitesh Lal
  2014-02-07  4:42 ` NiteshNarayanLal
@ 2014-02-07  8:15 ` Horia Geantă
  2014-02-09  9:20   ` Herbert Xu
  1 sibling, 1 reply; 4+ messages in thread
From: Horia Geantă @ 2014-02-07  8:15 UTC (permalink / raw)
  To: Nitesh Lal, linux-crypto

On 1/24/2014 11:03 AM, Nitesh Lal wrote:
> The SEC Controller driver creates platform devices for it's child job ring nodes.
> Currently the driver uses for_each_compatible routine which traverses
> the whole device tree to create the job rings for the platform device.
> The patch changes this to search for the compatible property of job ring
> only in the child nodes i.e., the job rings are created as per the number
> of children associated with the crypto node.
>
> Signed-off-by: Nitesh Lal <NiteshNarayanLal@freescale.com>
> ---
>   drivers/crypto/caam/ctrl.c | 25 ++++++-------------------
>   1 file changed, 6 insertions(+), 19 deletions(-)

Reviewed-by: Horia Geanta <horia.geanta@freescale.com>

Regards,
Horia

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] crypto: caam - Fix job ring discovery in controller driver
  2014-02-07  8:15 ` Horia Geantă
@ 2014-02-09  9:20   ` Herbert Xu
  0 siblings, 0 replies; 4+ messages in thread
From: Herbert Xu @ 2014-02-09  9:20 UTC (permalink / raw)
  To: Horia Geantă; +Cc: Nitesh Lal, linux-crypto

On Fri, Feb 07, 2014 at 08:15:32AM +0000, Horia Geantă wrote:
> On 1/24/2014 11:03 AM, Nitesh Lal wrote:
> >The SEC Controller driver creates platform devices for it's child job ring nodes.
> >Currently the driver uses for_each_compatible routine which traverses
> >the whole device tree to create the job rings for the platform device.
> >The patch changes this to search for the compatible property of job ring
> >only in the child nodes i.e., the job rings are created as per the number
> >of children associated with the crypto node.
> >
> >Signed-off-by: Nitesh Lal <NiteshNarayanLal@freescale.com>
> >---
> >  drivers/crypto/caam/ctrl.c | 25 ++++++-------------------
> >  1 file changed, 6 insertions(+), 19 deletions(-)
> 
> Reviewed-by: Horia Geanta <horia.geanta@freescale.com>

Patch applied.
-- 
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] 4+ messages in thread

end of thread, other threads:[~2014-02-09  9:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-24  9:03 [PATCH] crypto: caam - Fix job ring discovery in controller driver Nitesh Lal
2014-02-07  4:42 ` NiteshNarayanLal
2014-02-07  8:15 ` Horia Geantă
2014-02-09  9:20   ` 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.