All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] crypto: caam - fix job ring cleanup code
@ 2013-01-10 11:06 Vakul Garg
  2013-02-27 16:07 ` Horia Geantă
  0 siblings, 1 reply; 2+ messages in thread
From: Vakul Garg @ 2013-01-10 11:06 UTC (permalink / raw)
  To: linux-crypto

The job ring init function creates a platform device for each job ring.
While the job ring is shutdown, e.g. while module removal, its platform
device was not being removed. This lead to failure while reinserting
caam module again. Same problem appears while platform device for caam
is bound, unbound and then bound again to caam platform driver.

Signed-off-by: Vakul Garg <vakul@freescale.com>
Signed-off-by: Bharat Bhushan <bharat.bhushan@freescale.com>
---
 drivers/crypto/caam/intern.h |    1 +
 drivers/crypto/caam/jr.c     |    4 ++++
 2 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/drivers/crypto/caam/intern.h b/drivers/crypto/caam/intern.h
index 5cd4c1b..e4a16b7 100644
--- a/drivers/crypto/caam/intern.h
+++ b/drivers/crypto/caam/intern.h
@@ -41,6 +41,7 @@ struct caam_jrentry_info {
 /* Private sub-storage for a single JobR */
 struct caam_drv_private_jr {
 	struct device *parentdev;	/* points back to controller dev */
+	struct platform_device *jr_pdev;/* points to platform device for JR */
 	int ridx;
 	struct caam_job_ring __iomem *rregs;	/* JobR's register space */
 	struct tasklet_struct irqtask;
diff --git a/drivers/crypto/caam/jr.c b/drivers/crypto/caam/jr.c
index 93d1407..b4aa773e 100644
--- a/drivers/crypto/caam/jr.c
+++ b/drivers/crypto/caam/jr.c
@@ -407,6 +407,7 @@ int caam_jr_shutdown(struct device *dev)
 	dma_free_coherent(dev, sizeof(struct jr_outentry) * JOBR_DEPTH,
 			  jrp->outring, outbusaddr);
 	kfree(jrp->entinfo);
+	of_device_unregister(jrp->jr_pdev);
 
 	return ret;
 }
@@ -454,6 +455,8 @@ int caam_jr_probe(struct platform_device *pdev, struct device_node *np,
 		kfree(jrpriv);
 		return -EINVAL;
 	}
+
+	jrpriv->jr_pdev = jr_pdev;
 	jrdev = &jr_pdev->dev;
 	dev_set_drvdata(jrdev, jrpriv);
 	ctrlpriv->jrdev[ring] = jrdev;
@@ -472,6 +475,7 @@ int caam_jr_probe(struct platform_device *pdev, struct device_node *np,
 	/* Now do the platform independent part */
 	error = caam_jr_init(jrdev); /* now turn on hardware */
 	if (error) {
+		of_device_unregister(jr_pdev);
 		kfree(jrpriv);
 		return error;
 	}
-- 
1.7.7

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

* Re: [PATCH] crypto: caam - fix job ring cleanup code
  2013-01-10 11:06 [PATCH] crypto: caam - fix job ring cleanup code Vakul Garg
@ 2013-02-27 16:07 ` Horia Geantă
  0 siblings, 0 replies; 2+ messages in thread
From: Horia Geantă @ 2013-02-27 16:07 UTC (permalink / raw)
  To: Vakul Garg; +Cc: linux-crypto

On 1/10/2013 1:06 PM, Vakul Garg wrote:
> The job ring init function creates a platform device for each job ring.
> While the job ring is shutdown, e.g. while module removal, its platform
> device was not being removed. This lead to failure while reinserting
> caam module again. Same problem appears while platform device for caam
> is bound, unbound and then bound again to caam platform driver.
>
> Signed-off-by: Vakul Garg <vakul@freescale.com>
> Signed-off-by: Bharat Bhushan <bharat.bhushan@freescale.com>

Not sure I understand the commit message. You seem to explain there are 
two problems, but I see only one: caam module being reinserted.

I guess a stack traceback in the commit message wouldn't hurt.

Regards,
Horia

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

end of thread, other threads:[~2013-02-27 16:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-10 11:06 [PATCH] crypto: caam - fix job ring cleanup code Vakul Garg
2013-02-27 16:07 ` Horia Geantă

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.