diff mbox series

[v4,09/11] xen/arm: smmuv3: Use fallthrough pseudo-keyword

Message ID 36f9a1e88eea2f2c4cc413688c7210583a3433fe.1610115608.git.rahul.singh@arm.com (mailing list archive)
State Superseded
Headers show
Series xen/arm: Add support for SMMUv3 driver | expand

Commit Message

Rahul Singh Jan. 8, 2021, 2:46 p.m. UTC
Merge the patch from linux to use fallthrough pseudo-keyword.

Replace the existing /* fall through */ comments and its variants with
the new pseudo-keyword macro fallthrough[1]. Also, remove unnecessary
fall-through markings when it is the case.

Signed-off-by: Rahul Singh <rahul.singh@arm.com>
---
Changes in V4:
 - This patch is introduce in this verison.
---
 xen/drivers/passthrough/arm/smmu-v3.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

Comments

Stefano Stabellini Jan. 9, 2021, 1:44 a.m. UTC | #1
On Fri, 8 Jan 2021, Rahul Singh wrote:
> Merge the patch from linux to use fallthrough pseudo-keyword.
> 
> Replace the existing /* fall through */ comments and its variants with
> the new pseudo-keyword macro fallthrough[1]. Also, remove unnecessary
> fall-through markings when it is the case.
> 
> Signed-off-by: Rahul Singh <rahul.singh@arm.com>
> ---
> Changes in V4:
>  - This patch is introduce in this verison.
> ---
>  xen/drivers/passthrough/arm/smmu-v3.c | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/xen/drivers/passthrough/arm/smmu-v3.c b/xen/drivers/passthrough/arm/smmu-v3.c
> index 5ce14850b4..f5f8b4c981 100644
> --- a/xen/drivers/passthrough/arm/smmu-v3.c
> +++ b/xen/drivers/passthrough/arm/smmu-v3.c
> @@ -932,7 +932,6 @@ static void arm_smmu_cmdq_skip_err(struct arm_smmu_device *smmu)
>  		 */
>  		return;
>  	case CMDQ_ERR_CERROR_ILL_IDX:
> -		/* Fallthrough */

The fallthrough keyword is unnecessary here because of default, right?


>  	default:
>  		break;
>  	}
> @@ -2488,7 +2487,7 @@ static int arm_smmu_device_hw_probe(struct arm_smmu_device *smmu)
>  	switch (FIELD_GET(IDR0_STALL_MODEL, reg)) {
>  	case IDR0_STALL_MODEL_FORCE:
>  		smmu->features |= ARM_SMMU_FEAT_STALL_FORCE;
> -		/* Fallthrough */
> +		fallthrough;
>  	case IDR0_STALL_MODEL_STALL:
>  		smmu->features |= ARM_SMMU_FEAT_STALLS;
>  	}
> @@ -2505,7 +2504,7 @@ static int arm_smmu_device_hw_probe(struct arm_smmu_device *smmu)
>  	switch (FIELD_GET(IDR0_TTF, reg)) {
>  	case IDR0_TTF_AARCH32_64:
>  		smmu->ias = 40;
> -		/* Fallthrough */
> +		fallthrough;
>  	case IDR0_TTF_AARCH64:
>  		break;
>  	default:
> @@ -2589,7 +2588,7 @@ static int arm_smmu_device_hw_probe(struct arm_smmu_device *smmu)
>  	default:
>  		dev_info(smmu->dev,
>  			"unknown output address size. Truncating to 48-bit\n");
> -		/* Fallthrough */
> +		fallthrough;
>  	case IDR5_OAS_48_BIT:
>  		smmu->oas = 48;
>  	}
> -- 
> 2.17.1
>
Rahul Singh Jan. 9, 2021, 6:57 p.m. UTC | #2
Hello Stefano,

Thanks for reviewing the series.

> On 9 Jan 2021, at 1:44 am, Stefano Stabellini <sstabellini@kernel.org> wrote:
> 
> On Fri, 8 Jan 2021, Rahul Singh wrote:
>> Merge the patch from linux to use fallthrough pseudo-keyword.
>> 
>> Replace the existing /* fall through */ comments and its variants with
>> the new pseudo-keyword macro fallthrough[1]. Also, remove unnecessary
>> fall-through markings when it is the case.
>> 
>> Signed-off-by: Rahul Singh <rahul.singh@arm.com>
>> ---
>> Changes in V4:
>> - This patch is introduce in this verison.
>> ---
>> xen/drivers/passthrough/arm/smmu-v3.c | 7 +++----
>> 1 file changed, 3 insertions(+), 4 deletions(-)
>> 
>> diff --git a/xen/drivers/passthrough/arm/smmu-v3.c b/xen/drivers/passthrough/arm/smmu-v3.c
>> index 5ce14850b4..f5f8b4c981 100644
>> --- a/xen/drivers/passthrough/arm/smmu-v3.c
>> +++ b/xen/drivers/passthrough/arm/smmu-v3.c
>> @@ -932,7 +932,6 @@ static void arm_smmu_cmdq_skip_err(struct arm_smmu_device *smmu)
>> 		 */
>> 		return;
>> 	case CMDQ_ERR_CERROR_ILL_IDX:
>> -		/* Fallthrough */
> 
> The fallthrough keyword is unnecessary here because of default, right?

Yes you are right fallthrough keyword is unnecessary here because  "-Wimplicit-fallthrough” will not through the warning when a case label falls through to a case that breaks or returns.Therefore there is no need to have the fallthrough keyword here.

Regards,
Rahul

> 
> 
>> 	default:
>> 		break;
>> 	}
>> @@ -2488,7 +2487,7 @@ static int arm_smmu_device_hw_probe(struct arm_smmu_device *smmu)
>> 	switch (FIELD_GET(IDR0_STALL_MODEL, reg)) {
>> 	case IDR0_STALL_MODEL_FORCE:
>> 		smmu->features |= ARM_SMMU_FEAT_STALL_FORCE;
>> -		/* Fallthrough */
>> +		fallthrough;
>> 	case IDR0_STALL_MODEL_STALL:
>> 		smmu->features |= ARM_SMMU_FEAT_STALLS;
>> 	}
>> @@ -2505,7 +2504,7 @@ static int arm_smmu_device_hw_probe(struct arm_smmu_device *smmu)
>> 	switch (FIELD_GET(IDR0_TTF, reg)) {
>> 	case IDR0_TTF_AARCH32_64:
>> 		smmu->ias = 40;
>> -		/* Fallthrough */
>> +		fallthrough;
>> 	case IDR0_TTF_AARCH64:
>> 		break;
>> 	default:
>> @@ -2589,7 +2588,7 @@ static int arm_smmu_device_hw_probe(struct arm_smmu_device *smmu)
>> 	default:
>> 		dev_info(smmu->dev,
>> 			"unknown output address size. Truncating to 48-bit\n");
>> -		/* Fallthrough */
>> +		fallthrough;
>> 	case IDR5_OAS_48_BIT:
>> 		smmu->oas = 48;
>> 	}
>> -- 
>> 2.17.1
Bertrand Marquis Jan. 12, 2021, 11:34 a.m. UTC | #3
> On 8 Jan 2021, at 14:46, Rahul Singh <Rahul.Singh@arm.com> wrote:
> 
> Merge the patch from linux to use fallthrough pseudo-keyword.
> 
> Replace the existing /* fall through */ comments and its variants with
> the new pseudo-keyword macro fallthrough[1]. Also, remove unnecessary
> fall-through markings when it is the case.
> 
> Signed-off-by: Rahul Singh <rahul.singh@arm.com>
Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>

Maybe the fallthrough could be removed by the commiter ?

Cheers
Bertrand

> ---
> Changes in V4:
> - This patch is introduce in this verison.
> ---
> xen/drivers/passthrough/arm/smmu-v3.c | 7 +++----
> 1 file changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/xen/drivers/passthrough/arm/smmu-v3.c b/xen/drivers/passthrough/arm/smmu-v3.c
> index 5ce14850b4..f5f8b4c981 100644
> --- a/xen/drivers/passthrough/arm/smmu-v3.c
> +++ b/xen/drivers/passthrough/arm/smmu-v3.c
> @@ -932,7 +932,6 @@ static void arm_smmu_cmdq_skip_err(struct arm_smmu_device *smmu)
> 		 */
> 		return;
> 	case CMDQ_ERR_CERROR_ILL_IDX:
> -		/* Fallthrough */
> 	default:
> 		break;
> 	}
> @@ -2488,7 +2487,7 @@ static int arm_smmu_device_hw_probe(struct arm_smmu_device *smmu)
> 	switch (FIELD_GET(IDR0_STALL_MODEL, reg)) {
> 	case IDR0_STALL_MODEL_FORCE:
> 		smmu->features |= ARM_SMMU_FEAT_STALL_FORCE;
> -		/* Fallthrough */
> +		fallthrough;
> 	case IDR0_STALL_MODEL_STALL:
> 		smmu->features |= ARM_SMMU_FEAT_STALLS;
> 	}
> @@ -2505,7 +2504,7 @@ static int arm_smmu_device_hw_probe(struct arm_smmu_device *smmu)
> 	switch (FIELD_GET(IDR0_TTF, reg)) {
> 	case IDR0_TTF_AARCH32_64:
> 		smmu->ias = 40;
> -		/* Fallthrough */
> +		fallthrough;
> 	case IDR0_TTF_AARCH64:
> 		break;
> 	default:
> @@ -2589,7 +2588,7 @@ static int arm_smmu_device_hw_probe(struct arm_smmu_device *smmu)
> 	default:
> 		dev_info(smmu->dev,
> 			"unknown output address size. Truncating to 48-bit\n");
> -		/* Fallthrough */
> +		fallthrough;
> 	case IDR5_OAS_48_BIT:
> 		smmu->oas = 48;
> 	}
> -- 
> 2.17.1
>
Julien Grall Jan. 15, 2021, 12:18 p.m. UTC | #4
Hi Rahul,

On 08/01/2021 14:46, Rahul Singh wrote:
> Merge the patch from linux to use fallthrough pseudo-keyword.

Please add more information about the patch you are backporting. Is it a 
clean backport?

> 
> Replace the existing /* fall through */ comments and its variants with
> the new pseudo-keyword macro fallthrough[1]. Also, remove unnecessary
> fall-through markings when it is the case.
> 
> Signed-off-by: Rahul Singh <rahul.singh@arm.com>
> ---
> Changes in V4:
>   - This patch is introduce in this verison.
> ---
>   xen/drivers/passthrough/arm/smmu-v3.c | 7 +++----
>   1 file changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/xen/drivers/passthrough/arm/smmu-v3.c b/xen/drivers/passthrough/arm/smmu-v3.c
> index 5ce14850b4..f5f8b4c981 100644
> --- a/xen/drivers/passthrough/arm/smmu-v3.c
> +++ b/xen/drivers/passthrough/arm/smmu-v3.c
> @@ -932,7 +932,6 @@ static void arm_smmu_cmdq_skip_err(struct arm_smmu_device *smmu)
>   		 */
>   		return;
>   	case CMDQ_ERR_CERROR_ILL_IDX:
> -		/* Fallthrough */
>   	default:
>   		break;
>   	}
> @@ -2488,7 +2487,7 @@ static int arm_smmu_device_hw_probe(struct arm_smmu_device *smmu)
>   	switch (FIELD_GET(IDR0_STALL_MODEL, reg)) {
>   	case IDR0_STALL_MODEL_FORCE:
>   		smmu->features |= ARM_SMMU_FEAT_STALL_FORCE;
> -		/* Fallthrough */
> +		fallthrough;
>   	case IDR0_STALL_MODEL_STALL:
>   		smmu->features |= ARM_SMMU_FEAT_STALLS;
>   	}
> @@ -2505,7 +2504,7 @@ static int arm_smmu_device_hw_probe(struct arm_smmu_device *smmu)
>   	switch (FIELD_GET(IDR0_TTF, reg)) {
>   	case IDR0_TTF_AARCH32_64:
>   		smmu->ias = 40;
> -		/* Fallthrough */
> +		fallthrough;
>   	case IDR0_TTF_AARCH64:
>   		break;
>   	default:
> @@ -2589,7 +2588,7 @@ static int arm_smmu_device_hw_probe(struct arm_smmu_device *smmu)
>   	default:
>   		dev_info(smmu->dev,
>   			"unknown output address size. Truncating to 48-bit\n");
> -		/* Fallthrough */
> +		fallthrough;
>   	case IDR5_OAS_48_BIT:
>   		smmu->oas = 48;
>   	}
>
Rahul Singh Jan. 18, 2021, 3:33 p.m. UTC | #5
Hello Julien,

> On 15 Jan 2021, at 12:18 pm, Julien Grall <julien@xen.org> wrote:
> 
> Hi Rahul,
> 
> On 08/01/2021 14:46, Rahul Singh wrote:
>> Merge the patch from linux to use fallthrough pseudo-keyword.
> 
> Please add more information about the patch you are backporting. Is it a clean backport?

Ok . I will add more information about the patch. Yes I think we can say it is clean backport.

Patch merged is :
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c?h=v5.9.10&id=df561f6688fef775baa341a0f5d960becd248b11

Regards,
Rahul

> 
>> Replace the existing /* fall through */ comments and its variants with
>> the new pseudo-keyword macro fallthrough[1]. Also, remove unnecessary
>> fall-through markings when it is the case.
>> Signed-off-by: Rahul Singh <rahul.singh@arm.com>
>> ---
>> Changes in V4:
>>  - This patch is introduce in this verison.
>> ---
>>  xen/drivers/passthrough/arm/smmu-v3.c | 7 +++----
>>  1 file changed, 3 insertions(+), 4 deletions(-)
>> diff --git a/xen/drivers/passthrough/arm/smmu-v3.c b/xen/drivers/passthrough/arm/smmu-v3.c
>> index 5ce14850b4..f5f8b4c981 100644
>> --- a/xen/drivers/passthrough/arm/smmu-v3.c
>> +++ b/xen/drivers/passthrough/arm/smmu-v3.c
>> @@ -932,7 +932,6 @@ static void arm_smmu_cmdq_skip_err(struct arm_smmu_device *smmu)
>>  		 */
>>  		return;
>>  	case CMDQ_ERR_CERROR_ILL_IDX:
>> -		/* Fallthrough */
>>  	default:
>>  		break;
>>  	}
>> @@ -2488,7 +2487,7 @@ static int arm_smmu_device_hw_probe(struct arm_smmu_device *smmu)
>>  	switch (FIELD_GET(IDR0_STALL_MODEL, reg)) {
>>  	case IDR0_STALL_MODEL_FORCE:
>>  		smmu->features |= ARM_SMMU_FEAT_STALL_FORCE;
>> -		/* Fallthrough */
>> +		fallthrough;
>>  	case IDR0_STALL_MODEL_STALL:
>>  		smmu->features |= ARM_SMMU_FEAT_STALLS;
>>  	}
>> @@ -2505,7 +2504,7 @@ static int arm_smmu_device_hw_probe(struct arm_smmu_device *smmu)
>>  	switch (FIELD_GET(IDR0_TTF, reg)) {
>>  	case IDR0_TTF_AARCH32_64:
>>  		smmu->ias = 40;
>> -		/* Fallthrough */
>> +		fallthrough;
>>  	case IDR0_TTF_AARCH64:
>>  		break;
>>  	default:
>> @@ -2589,7 +2588,7 @@ static int arm_smmu_device_hw_probe(struct arm_smmu_device *smmu)
>>  	default:
>>  		dev_info(smmu->dev,
>>  			"unknown output address size. Truncating to 48-bit\n");
>> -		/* Fallthrough */
>> +		fallthrough;
>>  	case IDR5_OAS_48_BIT:
>>  		smmu->oas = 48;
>>  	}
> 
> -- 
> Julien Grall
diff mbox series

Patch

diff --git a/xen/drivers/passthrough/arm/smmu-v3.c b/xen/drivers/passthrough/arm/smmu-v3.c
index 5ce14850b4..f5f8b4c981 100644
--- a/xen/drivers/passthrough/arm/smmu-v3.c
+++ b/xen/drivers/passthrough/arm/smmu-v3.c
@@ -932,7 +932,6 @@  static void arm_smmu_cmdq_skip_err(struct arm_smmu_device *smmu)
 		 */
 		return;
 	case CMDQ_ERR_CERROR_ILL_IDX:
-		/* Fallthrough */
 	default:
 		break;
 	}
@@ -2488,7 +2487,7 @@  static int arm_smmu_device_hw_probe(struct arm_smmu_device *smmu)
 	switch (FIELD_GET(IDR0_STALL_MODEL, reg)) {
 	case IDR0_STALL_MODEL_FORCE:
 		smmu->features |= ARM_SMMU_FEAT_STALL_FORCE;
-		/* Fallthrough */
+		fallthrough;
 	case IDR0_STALL_MODEL_STALL:
 		smmu->features |= ARM_SMMU_FEAT_STALLS;
 	}
@@ -2505,7 +2504,7 @@  static int arm_smmu_device_hw_probe(struct arm_smmu_device *smmu)
 	switch (FIELD_GET(IDR0_TTF, reg)) {
 	case IDR0_TTF_AARCH32_64:
 		smmu->ias = 40;
-		/* Fallthrough */
+		fallthrough;
 	case IDR0_TTF_AARCH64:
 		break;
 	default:
@@ -2589,7 +2588,7 @@  static int arm_smmu_device_hw_probe(struct arm_smmu_device *smmu)
 	default:
 		dev_info(smmu->dev,
 			"unknown output address size. Truncating to 48-bit\n");
-		/* Fallthrough */
+		fallthrough;
 	case IDR5_OAS_48_BIT:
 		smmu->oas = 48;
 	}