Skip to contentSkip to conversation

drm/xcsi2rxss: use str_true_false() for boolean dev_info output

PATCH In review Nick Huang 2 participants 3 messages Jan 23 – Jan 24

Subsystems (3)
lore
Share & tools
lore

Nick Huang

author
#0 lore raw

PATCH 1/1 drm/xcsi2rxss: use str_true_false() for boolean dev_info output

Refactor dev_info calls in xcsi2rxss_log_status() to use the str_true_false() helper instead of inline ternary operators ("true" : "false"). This makes the code cleaner, more readable, and easier to maintain. Added #include <linux/string_choices.h> for future use if symbolic flag printing is needed.

---
 drivers/media/platform/xilinx/xilinx-csi2rxss.c | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)
drivers/media/platform/xilinx/xilinx-csi2rxss.c +9 -8
index 146131b8f..e0c5b2ceb 100644
@@ -17,6 +17,7 @@
 #include <linux/of_irq.h>
 #include <linux/platform_device.h>
 #include <linux/v4l2-subdev.h>
+#include <linux/string_choices.h>
 #include <media/media-entity.h>
 #include <media/mipi-csi2.h>
 #include <media/v4l2-common.h>
@@ -400,19 +401,19 @@ static int xcsi2rxss_log_status(struct v4l2_subdev *sd)
 	dev_info(dev, "***** Core Status *****\n");
 	data = xcsi2rxss_read(xcsi2rxss, XCSI_CSR_OFFSET);
 	dev_info(dev, "Short Packet FIFO Full = %s\n",
-		 data & XCSI_CSR_SPFIFOFULL ? "true" : "false");
+		 str_true_false(data & XCSI_CSR_SPFIFOFULL));
 	dev_info(dev, "Short Packet FIFO Not Empty = %s\n",
-		 data & XCSI_CSR_SPFIFONE ? "true" : "false");
+		 str_true_false(data & XCSI_CSR_SPFIFONE));
 	dev_info(dev, "Stream line buffer full = %s\n",
-		 data & XCSI_CSR_SLBF ? "true" : "false");
+		 str_true_false(data & XCSI_CSR_SLBF));
 	dev_info(dev, "Soft reset/Core disable in progress = %s\n",
-		 data & XCSI_CSR_RIPCD ? "true" : "false");
+		 str_true_false(data & XCSI_CSR_RIPCD));
 
 	/* Clk & Lane Info  */
 	dev_info(dev, "******** Clock Lane Info *********\n");
 	data = xcsi2rxss_read(xcsi2rxss, XCSI_CLKINFR_OFFSET);
 	dev_info(dev, "Clock Lane in Stop State = %s\n",
-		 data & XCSI_CLKINFR_STOP ? "true" : "false");
+		 str_true_false(data & XCSI_CLKINFR_STOP));
 
 	dev_info(dev, "******** Data Lane Info *********\n");
 	dev_info(dev, "Lane\tSoT Error\tSoT Sync Error\tStop State\n");
@@ -421,9 +422,9 @@ static int xcsi2rxss_log_status(struct v4l2_subdev *sd)
 		data = xcsi2rxss_read(xcsi2rxss, reg);
 
 		dev_info(dev, "%d\t%s\t\t%s\t\t%s\n", i,
-			 data & XCSI_DLXINFR_SOTERR ? "true" : "false",
-			 data & XCSI_DLXINFR_SOTSYNCERR ? "true" : "false",
-			 data & XCSI_DLXINFR_STOP ? "true" : "false");
+			 str_true_false(data & XCSI_DLXINFR_SOTERR),
+			 str_true_false(data & XCSI_DLXINFR_SOTSYNCERR),
+			 str_true_false(data & XCSI_DLXINFR_STOP));
 
 		reg += XCSI_NEXTREG_OFFSET;
 	}
Signature · 1 line
2.43.0
maintainer
#1 lore raw
Quoted 4 lines · Nick Huang

Refactor dev_info calls in xcsi2rxss_log_status() to use the str_true_false() helper instead of inline ternary operators ("true" : "false"). This makes the code cleaner, more readable, and easier to maintain.

That's a matter of personal preference, and I disagree with that. Please don't post this kind of refactoring that doesn't bring actual improvements, that's not a good use of reviewers and maintainers' time.

Quoted 58 lines

Added #include <linux/string_choices.h>
for future use if symbolic flag printing is needed.

---
 drivers/media/platform/xilinx/xilinx-csi2rxss.c | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)
drivers/media/platform/xilinx/xilinx-csi2rxss.c +9 -8
index 146131b8f..e0c5b2ceb 100644
@@ -17,6 +17,7 @@
 #include <linux/of_irq.h>
 #include <linux/platform_device.h>
 #include <linux/v4l2-subdev.h>
+#include <linux/string_choices.h>
 #include <media/media-entity.h>
 #include <media/mipi-csi2.h>
 #include <media/v4l2-common.h>
@@ -400,19 +401,19 @@ static int xcsi2rxss_log_status(struct v4l2_subdev *sd)
 	dev_info(dev, "***** Core Status *****\n");
 	data = xcsi2rxss_read(xcsi2rxss, XCSI_CSR_OFFSET);
 	dev_info(dev, "Short Packet FIFO Full = %s\n",
-		 data & XCSI_CSR_SPFIFOFULL ? "true" : "false");
+		 str_true_false(data & XCSI_CSR_SPFIFOFULL));
 	dev_info(dev, "Short Packet FIFO Not Empty = %s\n",
-		 data & XCSI_CSR_SPFIFONE ? "true" : "false");
+		 str_true_false(data & XCSI_CSR_SPFIFONE));
 	dev_info(dev, "Stream line buffer full = %s\n",
-		 data & XCSI_CSR_SLBF ? "true" : "false");
+		 str_true_false(data & XCSI_CSR_SLBF));
 	dev_info(dev, "Soft reset/Core disable in progress = %s\n",
-		 data & XCSI_CSR_RIPCD ? "true" : "false");
+		 str_true_false(data & XCSI_CSR_RIPCD));
 
 	/* Clk & Lane Info  */
 	dev_info(dev, "******** Clock Lane Info *********\n");
 	data = xcsi2rxss_read(xcsi2rxss, XCSI_CLKINFR_OFFSET);
 	dev_info(dev, "Clock Lane in Stop State = %s\n",
-		 data & XCSI_CLKINFR_STOP ? "true" : "false");
+		 str_true_false(data & XCSI_CLKINFR_STOP));
 
 	dev_info(dev, "******** Data Lane Info *********\n");
 	dev_info(dev, "Lane\tSoT Error\tSoT Sync Error\tStop State\n");
@@ -421,9 +422,9 @@ static int xcsi2rxss_log_status(struct v4l2_subdev *sd)
 		data = xcsi2rxss_read(xcsi2rxss, reg);
 
 		dev_info(dev, "%d\t%s\t\t%s\t\t%s\n", i,
-			 data & XCSI_DLXINFR_SOTERR ? "true" : "false",
-			 data & XCSI_DLXINFR_SOTSYNCERR ? "true" : "false",
-			 data & XCSI_DLXINFR_STOP ? "true" : "false");
+			 str_true_false(data & XCSI_DLXINFR_SOTERR),
+			 str_true_false(data & XCSI_DLXINFR_SOTSYNCERR),
+			 str_true_false(data & XCSI_DLXINFR_STOP));
 
 		reg += XCSI_NEXTREG_OFFSET;
 	}
Signature · 3 lines
Regards,

Laurent Pinchart
author
#2 lore raw

Laurent Pinchart <[email protected]> 於 2026年1月23日週五 下午11:36寫道:

Quoted 67 lines · Nick Huang
Quoted 4 lines

Refactor dev_info calls in xcsi2rxss_log_status() to use the str_true_false() helper instead of inline ternary operators ("true" : "false"). This makes the code cleaner, more readable, and easier to maintain.

That's a matter of personal preference, and I disagree with that. Please don't post this kind of refactoring that doesn't bring actual improvements, that's not a good use of reviewers and maintainers' time.

Quoted 56 lines

Added #include <linux/string_choices.h>
for future use if symbolic flag printing is needed.

---
 drivers/media/platform/xilinx/xilinx-csi2rxss.c | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)
drivers/media/platform/xilinx/xilinx-csi2rxss.c +9 -8
index 146131b8f..e0c5b2ceb 100644
@@ -17,6 +17,7 @@
 #include <linux/of_irq.h>
 #include <linux/platform_device.h>
 #include <linux/v4l2-subdev.h>
+#include <linux/string_choices.h>
 #include <media/media-entity.h>
 #include <media/mipi-csi2.h>
 #include <media/v4l2-common.h>
@@ -400,19 +401,19 @@ static int xcsi2rxss_log_status(struct v4l2_subdev *sd)
      dev_info(dev, "***** Core Status *****\n");
      data = xcsi2rxss_read(xcsi2rxss, XCSI_CSR_OFFSET);
      dev_info(dev, "Short Packet FIFO Full = %s\n",
-              data & XCSI_CSR_SPFIFOFULL ? "true" : "false");
+              str_true_false(data & XCSI_CSR_SPFIFOFULL));
      dev_info(dev, "Short Packet FIFO Not Empty = %s\n",
-              data & XCSI_CSR_SPFIFONE ? "true" : "false");
+              str_true_false(data & XCSI_CSR_SPFIFONE));
      dev_info(dev, "Stream line buffer full = %s\n",
-              data & XCSI_CSR_SLBF ? "true" : "false");
+              str_true_false(data & XCSI_CSR_SLBF));
      dev_info(dev, "Soft reset/Core disable in progress = %s\n",
-              data & XCSI_CSR_RIPCD ? "true" : "false");
+              str_true_false(data & XCSI_CSR_RIPCD));
 
      /* Clk & Lane Info  */
      dev_info(dev, "******** Clock Lane Info *********\n");
      data = xcsi2rxss_read(xcsi2rxss, XCSI_CLKINFR_OFFSET);
      dev_info(dev, "Clock Lane in Stop State = %s\n",
-              data & XCSI_CLKINFR_STOP ? "true" : "false");
+              str_true_false(data & XCSI_CLKINFR_STOP));
 
      dev_info(dev, "******** Data Lane Info *********\n");
      dev_info(dev, "Lane\tSoT Error\tSoT Sync Error\tStop State\n");
@@ -421,9 +422,9 @@ static int xcsi2rxss_log_status(struct v4l2_subdev *sd)
              data = xcsi2rxss_read(xcsi2rxss, reg);
 
              dev_info(dev, "%d\t%s\t\t%s\t\t%s\n", i,
-                      data & XCSI_DLXINFR_SOTERR ? "true" : "false",
-                      data & XCSI_DLXINFR_SOTSYNCERR ? "true" : "false",
-                      data & XCSI_DLXINFR_STOP ? "true" : "false");
+                      str_true_false(data & XCSI_DLXINFR_SOTERR),
+                      str_true_false(data & XCSI_DLXINFR_SOTSYNCERR),
+                      str_true_false(data & XCSI_DLXINFR_STOP));
 
Quoted 7 lines

drivers/media/platform/xilinx/xilinx-csi2rxss.c static int xcsi2rxss_log_status(struct v4l2_subdev *sd) · line 430

Quoted 2 lines
drivers/media/platform/xilinx/xilinx-csi2rxss.c +0 -0
              reg += XCSI_NEXTREG_OFFSET;
      }

--
Regards,

Laurent Pinchart

Hi Laurent Pinchart

Thanks for your reply! Since this refactor doesn't introduce significant logic improvements, let's stick to the original design to respect the maintainers' time.

Signature · 2 lines
Regards,
Nick Huang