[PATCH 1/3] media: ti: cal: Use str_up_down()

Ricardo Ribalda posted 3 patches 2 months ago
There is a newer version of this series
[PATCH 1/3] media: ti: cal: Use str_up_down()
Posted by Ricardo Ribalda 2 months ago
The str_up_down() helper simplifies the code and fixes the following cocci
warning:

drivers/media/platform/ti/cal/cal-camerarx.c:194:3-9: opportunity for str_up_down(enable)

Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
---
 drivers/media/platform/ti/cal/cal-camerarx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/platform/ti/cal/cal-camerarx.c b/drivers/media/platform/ti/cal/cal-camerarx.c
index 42dfe08b765f..ba8c4743f539 100644
--- a/drivers/media/platform/ti/cal/cal-camerarx.c
+++ b/drivers/media/platform/ti/cal/cal-camerarx.c
@@ -191,7 +191,7 @@ static void cal_camerarx_power(struct cal_camerarx *phy, bool enable)
 
 	if (i == 10)
 		phy_err(phy, "Failed to power %s complexio\n",
-			enable ? "up" : "down");
+			str_up_down(enable);
 }
 
 static void cal_camerarx_wait_reset(struct cal_camerarx *phy)

-- 
2.46.1.824.gd892dcdcdd-goog
Re: [PATCH 1/3] media: ti: cal: Use str_up_down()
Posted by Andy Shevchenko 2 months ago
On Fri, Sep 27, 2024 at 09:42:13AM +0000, Ricardo Ribalda wrote:
> The str_up_down() helper simplifies the code and fixes the following cocci
> warning:
> 
> drivers/media/platform/ti/cal/cal-camerarx.c:194:3-9: opportunity for str_up_down(enable)

...

>  	if (i == 10)
>  		phy_err(phy, "Failed to power %s complexio\n",
> -			enable ? "up" : "down");
> +			str_up_down(enable);

Now can fit one line

		phy_err(phy, "Failed to power %s complexio\n", str_up_down(enable));

But have you compiled it?

>  }

-- 
With Best Regards,
Andy Shevchenko