[PATCH] iommu: Use str_enable_disable-like helpers

Heiko Stübner heiko at sntech.de
Tue Jan 14 11:53:28 PST 2025


Am Dienstag, 14. Januar 2025, 20:26:42 CET schrieb Krzysztof Kozlowski:
> Replace ternary (condition ? "enable" : "disable") syntax with helpers
> from string_choices.h because:
> 1. Simple function call with one argument is easier to read.  Ternary
>    operator has three arguments and with wrapping might lead to quite
>    long code.
> 2. Is slightly shorter thus also easier to read.
> 3. It brings uniformity in the text - same string.
> 4. Allows deduping by the linker, which results in a smaller binary
>    file.
> 
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski at linaro.org>
> ---

>  drivers/iommu/rockchip-iommu.c              | 3 ++-

For the Rockchip part
Acked-by: Heiko Stuebner <heiko at sntech.de>

> diff --git a/drivers/iommu/rockchip-iommu.c b/drivers/iommu/rockchip-iommu.c
> index 4b369419b32c..323cc665c357 100644
> --- a/drivers/iommu/rockchip-iommu.c
> +++ b/drivers/iommu/rockchip-iommu.c
> @@ -25,6 +25,7 @@
>  #include <linux/pm_runtime.h>
>  #include <linux/slab.h>
>  #include <linux/spinlock.h>
> +#include <linux/string_choices.h>
>  
>  #include "iommu-pages.h"
>  
> @@ -611,7 +612,7 @@ static irqreturn_t rk_iommu_irq(int irq, void *dev_id)
>  
>  			dev_err(iommu->dev, "Page fault at %pad of type %s\n",
>  				&iova,
> -				(flags == IOMMU_FAULT_WRITE) ? "write" : "read");
> +				str_write_read(flags == IOMMU_FAULT_WRITE));
>  
>  			log_iova(iommu, i, iova);
>  
> 







More information about the Linux-mediatek mailing list