[v1,3/5] crypto: ccp: Remove unused #defines
diff mbox

Message ID 20180703171152.3225.72516.stgit@tlendack-t1.amdoffice.net
State Accepted
Delegated to: Herbert Xu
Headers show

Commit Message

Lendacky, Thomas July 3, 2018, 5:11 p.m. UTC
Remove some unused #defines for register offsets that are not used. This
will lessen the changes required when register offsets change between
versions of the device.

Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
---
 drivers/crypto/ccp/psp-dev.c |    2 +-
 drivers/crypto/ccp/psp-dev.h |   10 +---------
 2 files changed, 2 insertions(+), 10 deletions(-)

Comments

Gary R Hook July 5, 2018, 6:24 p.m. UTC | #1
On 07/03/2018 12:11 PM, Tom Lendacky wrote:
> Remove some unused #defines for register offsets that are not used. This
> will lessen the changes required when register offsets change between
> versions of the device.
> 
> Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>

Acked-by: Gary R Hook <gary.hook@amd.com>

> ---
>   drivers/crypto/ccp/psp-dev.c |    2 +-
>   drivers/crypto/ccp/psp-dev.h |   10 +---------
>   2 files changed, 2 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/crypto/ccp/psp-dev.c b/drivers/crypto/ccp/psp-dev.c
> index 91ef6ed..875756d 100644
> --- a/drivers/crypto/ccp/psp-dev.c
> +++ b/drivers/crypto/ccp/psp-dev.c
> @@ -65,7 +65,7 @@ static irqreturn_t psp_irq_handler(int irq, void *data)
>   	status = ioread32(psp->io_regs + PSP_P2CMSG_INTSTS);
>   
>   	/* Check if it is command completion: */
> -	if (!(status & BIT(PSP_CMD_COMPLETE_REG)))
> +	if (!(status & PSP_CMD_COMPLETE))
>   		goto done;
>   
>   	/* Check if it is SEV command completion: */
> diff --git a/drivers/crypto/ccp/psp-dev.h b/drivers/crypto/ccp/psp-dev.h
> index c7e9098a..5d46a2b 100644
> --- a/drivers/crypto/ccp/psp-dev.h
> +++ b/drivers/crypto/ccp/psp-dev.h
> @@ -36,19 +36,11 @@
>   #define PSP_CMDBUFF_ADDR_HI             PSP_C2PMSG(57)
>   #define PSP_FEATURE_REG			PSP_C2PMSG(63)
>   
> -#define PSP_P2CMSG(_num)		((_num) << 2)
> -#define PSP_CMD_COMPLETE_REG		1
> -#define PSP_CMD_COMPLETE		PSP_P2CMSG(PSP_CMD_COMPLETE_REG)
> +#define PSP_CMD_COMPLETE		BIT(1)
>   
>   #define PSP_P2CMSG_INTEN		0x0110
>   #define PSP_P2CMSG_INTSTS		0x0114
>   
> -#define PSP_C2PMSG_ATTR_0		0x0118
> -#define PSP_C2PMSG_ATTR_1		0x011c
> -#define PSP_C2PMSG_ATTR_2		0x0120
> -#define PSP_C2PMSG_ATTR_3		0x0124
> -#define PSP_P2CMSG_ATTR_0		0x0128
> -
>   #define PSP_CMDRESP_CMD_SHIFT		16
>   #define PSP_CMDRESP_IOC			BIT(0)
>   #define PSP_CMDRESP_RESP		BIT(31)
>
Singh, Brijesh July 5, 2018, 7:38 p.m. UTC | #2
On 07/03/2018 12:11 PM, Tom Lendacky wrote:
> Remove some unused #defines for register offsets that are not used. This
> will lessen the changes required when register offsets change between
> versions of the device.
> 
> Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
> ---
>   drivers/crypto/ccp/psp-dev.c |    2 +-
>   drivers/crypto/ccp/psp-dev.h |   10 +---------
>   2 files changed, 2 insertions(+), 10 deletions(-)
> 

Reviewed-by: Brijesh Singh <brijesh.singh@amd.com>


> diff --git a/drivers/crypto/ccp/psp-dev.c b/drivers/crypto/ccp/psp-dev.c
> index 91ef6ed..875756d 100644
> --- a/drivers/crypto/ccp/psp-dev.c
> +++ b/drivers/crypto/ccp/psp-dev.c
> @@ -65,7 +65,7 @@ static irqreturn_t psp_irq_handler(int irq, void *data)
>   	status = ioread32(psp->io_regs + PSP_P2CMSG_INTSTS);
>   
>   	/* Check if it is command completion: */
> -	if (!(status & BIT(PSP_CMD_COMPLETE_REG)))
> +	if (!(status & PSP_CMD_COMPLETE))
>   		goto done;
>   
>   	/* Check if it is SEV command completion: */
> diff --git a/drivers/crypto/ccp/psp-dev.h b/drivers/crypto/ccp/psp-dev.h
> index c7e9098a..5d46a2b 100644
> --- a/drivers/crypto/ccp/psp-dev.h
> +++ b/drivers/crypto/ccp/psp-dev.h
> @@ -36,19 +36,11 @@
>   #define PSP_CMDBUFF_ADDR_HI             PSP_C2PMSG(57)
>   #define PSP_FEATURE_REG			PSP_C2PMSG(63)
>   
> -#define PSP_P2CMSG(_num)		((_num) << 2)
> -#define PSP_CMD_COMPLETE_REG		1
> -#define PSP_CMD_COMPLETE		PSP_P2CMSG(PSP_CMD_COMPLETE_REG)
> +#define PSP_CMD_COMPLETE		BIT(1)
>   
>   #define PSP_P2CMSG_INTEN		0x0110
>   #define PSP_P2CMSG_INTSTS		0x0114
>   
> -#define PSP_C2PMSG_ATTR_0		0x0118
> -#define PSP_C2PMSG_ATTR_1		0x011c
> -#define PSP_C2PMSG_ATTR_2		0x0120
> -#define PSP_C2PMSG_ATTR_3		0x0124
> -#define PSP_P2CMSG_ATTR_0		0x0128
> -
>   #define PSP_CMDRESP_CMD_SHIFT		16
>   #define PSP_CMDRESP_IOC			BIT(0)
>   #define PSP_CMDRESP_RESP		BIT(31)
>

Patch
diff mbox

diff --git a/drivers/crypto/ccp/psp-dev.c b/drivers/crypto/ccp/psp-dev.c
index 91ef6ed..875756d 100644
--- a/drivers/crypto/ccp/psp-dev.c
+++ b/drivers/crypto/ccp/psp-dev.c
@@ -65,7 +65,7 @@  static irqreturn_t psp_irq_handler(int irq, void *data)
 	status = ioread32(psp->io_regs + PSP_P2CMSG_INTSTS);
 
 	/* Check if it is command completion: */
-	if (!(status & BIT(PSP_CMD_COMPLETE_REG)))
+	if (!(status & PSP_CMD_COMPLETE))
 		goto done;
 
 	/* Check if it is SEV command completion: */
diff --git a/drivers/crypto/ccp/psp-dev.h b/drivers/crypto/ccp/psp-dev.h
index c7e9098a..5d46a2b 100644
--- a/drivers/crypto/ccp/psp-dev.h
+++ b/drivers/crypto/ccp/psp-dev.h
@@ -36,19 +36,11 @@ 
 #define PSP_CMDBUFF_ADDR_HI             PSP_C2PMSG(57)
 #define PSP_FEATURE_REG			PSP_C2PMSG(63)
 
-#define PSP_P2CMSG(_num)		((_num) << 2)
-#define PSP_CMD_COMPLETE_REG		1
-#define PSP_CMD_COMPLETE		PSP_P2CMSG(PSP_CMD_COMPLETE_REG)
+#define PSP_CMD_COMPLETE		BIT(1)
 
 #define PSP_P2CMSG_INTEN		0x0110
 #define PSP_P2CMSG_INTSTS		0x0114
 
-#define PSP_C2PMSG_ATTR_0		0x0118
-#define PSP_C2PMSG_ATTR_1		0x011c
-#define PSP_C2PMSG_ATTR_2		0x0120
-#define PSP_C2PMSG_ATTR_3		0x0124
-#define PSP_P2CMSG_ATTR_0		0x0128
-
 #define PSP_CMDRESP_CMD_SHIFT		16
 #define PSP_CMDRESP_IOC			BIT(0)
 #define PSP_CMDRESP_RESP		BIT(31)