drivers/media/platform/xilinx/xilinx-csi2rxss.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-)
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.
Signed-off-by: Nick Huang <sef1548@gmail.com>
---
drivers/media/platform/xilinx/xilinx-csi2rxss.c | 17 +++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)
diff --git a/drivers/media/platform/xilinx/xilinx-csi2rxss.c b/drivers/media/platform/xilinx/xilinx-csi2rxss.c
index 146131b8f..e0c5b2ceb 100644
--- a/drivers/media/platform/xilinx/xilinx-csi2rxss.c
+++ b/drivers/media/platform/xilinx/xilinx-csi2rxss.c
@@ -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;
}
--
2.43.0
On Fri, Jan 23, 2026 at 03:31:04PM +0000, Nick Huang wrote:
> 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.
> Added #include <linux/string_choices.h>
> for future use if symbolic flag printing is needed.
>
> Signed-off-by: Nick Huang <sef1548@gmail.com>
> ---
> drivers/media/platform/xilinx/xilinx-csi2rxss.c | 17 +++++++++--------
> 1 file changed, 9 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/media/platform/xilinx/xilinx-csi2rxss.c b/drivers/media/platform/xilinx/xilinx-csi2rxss.c
> index 146131b8f..e0c5b2ceb 100644
> --- a/drivers/media/platform/xilinx/xilinx-csi2rxss.c
> +++ b/drivers/media/platform/xilinx/xilinx-csi2rxss.c
> @@ -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;
> }
--
Regards,
Laurent Pinchart
Laurent Pinchart <laurent.pinchart@ideasonboard.com> 於 2026年1月23日週五 下午11:36寫道:
>
> On Fri, Jan 23, 2026 at 03:31:04PM +0000, Nick Huang wrote:
> > 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.
>
> > Added #include <linux/string_choices.h>
> > for future use if symbolic flag printing is needed.
> >
> > Signed-off-by: Nick Huang <sef1548@gmail.com>
> > ---
> > drivers/media/platform/xilinx/xilinx-csi2rxss.c | 17 +++++++++--------
> > 1 file changed, 9 insertions(+), 8 deletions(-)
> >
> > diff --git a/drivers/media/platform/xilinx/xilinx-csi2rxss.c b/drivers/media/platform/xilinx/xilinx-csi2rxss.c
> > index 146131b8f..e0c5b2ceb 100644
> > --- a/drivers/media/platform/xilinx/xilinx-csi2rxss.c
> > +++ b/drivers/media/platform/xilinx/xilinx-csi2rxss.c
> > @@ -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;
> > }
>
> --
> 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.
--
Regards,
Nick Huang
© 2016 - 2026 Red Hat, Inc.