Skip to contentSkip to conversation

Minor CCP driver changes

PATCH In review Gary R Hook 2 participants 4 messages Sep 28, 2016 – Oct 2, 2016

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

v2 cover Minor CCP driver changes

V2: point a goto statement at the correct label

The following series is for miscellaneous small changes.

---

Gary R Hook (2):
crypto: ccp - clean up data structure
crypto: ccp - Make syslog errors human-readable

 drivers/crypto/ccp/ccp-dev-v3.c |    5 +++-
 drivers/crypto/ccp/ccp-dev-v5.c |   12 +++++++--
 drivers/crypto/ccp/ccp-dev.c    |   53 +++++++++++++++++++++++++++++++++++++++
 drivers/crypto/ccp/ccp-dev.h    |    8 ++++--
 drivers/crypto/ccp/ccp-pci.c    |    4 +--
 5 files changed, 73 insertions(+), 9 deletions(-)

--

#1 lore raw

PATCH v2 1/2 crypto: ccp - clean up data structure

Change names of data structure instances. Add const keyword where appropriate. Add error handling path.

---
 drivers/crypto/ccp/ccp-dev-v3.c |    2 +-
 drivers/crypto/ccp/ccp-dev-v5.c |    9 ++++++---
 drivers/crypto/ccp/ccp-dev.h    |    6 +++---
 drivers/crypto/ccp/ccp-pci.c    |    4 ++--
 4 files changed, 12 insertions(+), 9 deletions(-)
drivers/crypto/ccp/ccp-dev-v3.c +1 -1
index 578522d..b6615b1 100644
@@ -566,7 +566,7 @@ static const struct ccp_actions ccp3_actions = {
 	.irqhandler = ccp_irq_handler,
 };
 
-struct ccp_vdata ccpv3 = {
+const struct ccp_vdata ccpv3 = {
 	.version = CCP_VERSION(3, 0),
 	.setup = NULL,
 	.perform = &ccp3_actions,
drivers/crypto/ccp/ccp-dev-v5.c +6 -3
index f499e34..a90ca9e 100644
@@ -835,10 +835,13 @@ static int ccp5_init(struct ccp_device *ccp)
 	/* Register the DMA engine support */
 	ret = ccp_dmaengine_register(ccp);
 	if (ret)
-		goto e_kthread;
+		goto e_hwrng;
 
 	return 0;
 
+e_hwrng:
+	ccp_unregister_rng(ccp);
+
 e_kthread:
 	for (i = 0; i < ccp->cmd_q_count; i++)
 		if (ccp->cmd_q[i].kthread)
@@ -994,7 +997,7 @@ static const struct ccp_actions ccp5_actions = {
 	.irqhandler = ccp5_irq_handler,
 };
 
-struct ccp_vdata ccpv5 = {
+const struct ccp_vdata ccpv5a = {
 	.version = CCP_VERSION(5, 0),
 	.setup = ccp5_config,
 	.perform = &ccp5_actions,
@@ -1002,7 +1005,7 @@ struct ccp_vdata ccpv5 = {
 	.offset = 0x0,
 };
 
-struct ccp_vdata ccpv5other = {
+const struct ccp_vdata ccpv5b = {
 	.version = CCP_VERSION(5, 0),
 	.setup = ccp5other_config,
 	.perform = &ccp5_actions,
drivers/crypto/ccp/ccp-dev.h +3 -3
index ebc9365..08f58b0 100644
@@ -639,8 +639,8 @@ struct ccp_vdata {
 	const unsigned int offset;
 };
 
-extern	struct ccp_vdata ccpv3;
-extern	struct ccp_vdata ccpv5;
-extern	struct ccp_vdata ccpv5other;
+extern const struct ccp_vdata ccpv3;
+extern const struct ccp_vdata ccpv5a;
+extern const struct ccp_vdata ccpv5b;
 
 #endif
drivers/crypto/ccp/ccp-pci.c +2 -2
index 239cbf2..28a9996 100644
@@ -325,8 +325,8 @@ static int ccp_pci_resume(struct pci_dev *pdev)
 
 static const struct pci_device_id ccp_pci_table[] = {
 	{ PCI_VDEVICE(AMD, 0x1537), (kernel_ulong_t)&ccpv3 },
-	{ PCI_VDEVICE(AMD, 0x1456), (kernel_ulong_t)&ccpv5 },
-	{ PCI_VDEVICE(AMD, 0x1468), (kernel_ulong_t)&ccpv5other },
+	{ PCI_VDEVICE(AMD, 0x1456), (kernel_ulong_t)&ccpv5a },
+	{ PCI_VDEVICE(AMD, 0x1468), (kernel_ulong_t)&ccpv5b },
 	/* Last entry must be zero */
 	{ 0, }
 };
#2 lore raw

PATCH v2 2/2 crypto: ccp - Make syslog errors human-readable

In reply to Gary R Hook

Add human-readable strings to log messages about CCP errors

---
 drivers/crypto/ccp/ccp-dev-v3.c |    3 ++
 drivers/crypto/ccp/ccp-dev-v5.c |    3 ++
 drivers/crypto/ccp/ccp-dev.c    |   53 +++++++++++++++++++++++++++++++++++++++
 drivers/crypto/ccp/ccp-dev.h    |    2 +
 4 files changed, 61 insertions(+)
drivers/crypto/ccp/ccp-dev-v3.c +3 -0
index b6615b1..8d2dbac 100644
@@ -124,6 +124,9 @@ static int ccp_do_cmd(struct ccp_op *op, u32 *cr, unsigned int cr_count)
 			/* On error delete all related jobs from the queue */
 			cmd = (cmd_q->id << DEL_Q_ID_SHIFT)
 			      | op->jobid;
+			if (cmd_q->cmd_error)
+				ccp_log_error(cmd_q->ccp,
+					      cmd_q->cmd_error);
 
 			iowrite32(cmd, ccp->io_regs + DEL_CMD_Q_JOB);
 
drivers/crypto/ccp/ccp-dev-v5.c +3 -0
index a90ca9e..faf3cb3 100644
@@ -243,6 +243,9 @@ static int ccp5_do_cmd(struct ccp5_desc *desc,
 		ret = wait_event_interruptible(cmd_q->int_queue,
 					       cmd_q->int_rcvd);
 		if (ret || cmd_q->cmd_error) {
+			if (cmd_q->cmd_error)
+				ccp_log_error(cmd_q->ccp,
+					      cmd_q->cmd_error);
 			/* A version 5 device doesn't use Job IDs... */
 			if (!ret)
 				ret = -EIO;
drivers/crypto/ccp/ccp-dev.c +53 -0

59 lines not on this page · raw message

drivers/crypto/ccp/ccp-dev.h +2 -0
index 08f58b0..da5f4a6 100644
@@ -601,6 +601,8 @@ void ccp_platform_exit(void);
 void ccp_add_device(struct ccp_device *ccp);
 void ccp_del_device(struct ccp_device *ccp);
 
+extern void ccp_log_error(struct ccp_device *, int);
+
 struct ccp_device *ccp_alloc_struct(struct device *dev);
 bool ccp_queues_suspended(struct ccp_device *ccp);
 int ccp_cmd_queue_thread(void *data);
maintainer
#3 lore raw
In reply to Gary R Hook
Quoted 3 lines · Gary R Hook

V2: point a goto statement at the correct label

The following series is for miscellaneous small changes.

Both patches applied. Thanks.

Signature · 3 lines
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt