Skip to contentSkip to conversation

media: atomisp: gmin: Use str_on_off() helper

PATCH Superseded Mert Seftali 3 participants 7 messages Jun 10 – Jun 11

Subsystems (4)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 media: atomisp: gmin: Use str_on_off() helper

Replace the open-coded "on" : "off" ternary with the standard str_on_off() helper from <linux/string_choices.h>. This improves readability and reuses the kernel's existing string helper instead of duplicating the literals.

No functional change intended.

---
 drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c +3 -2
index 4026e98c5845..322eca4a3755 100644
@@ -13,6 +13,7 @@
 #include <linux/gpio/consumer.h>
 #include <linux/gpio.h>
 #include <linux/platform_device.h>
+#include <linux/string_choices.h>
 #include "../../include/linux/atomisp_platform.h"
 #include "../../include/linux/atomisp_gmin_platform.h"
 
@@ -917,7 +918,7 @@ static int gmin_acpi_pm_ctrl(struct v4l2_subdev *subdev, int on)
 		return 0;
 
 	dev_dbg(subdev->dev, "Setting power state to %s\n",
-		on ? "on" : "off");
+		str_on_off(on));
 
 	if (on)
 		ret = acpi_device_set_power(adev,
@@ -930,7 +931,7 @@ static int gmin_acpi_pm_ctrl(struct v4l2_subdev *subdev, int on)
 		gs->clock_on = on;
 	else
 		dev_err(subdev->dev, "Couldn't set power state to %s\n",
-			on ? "on" : "off");
+			str_on_off(on));
 
 	return ret;
 }
Signature · 1 line
2.54.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 8 lines · Mert Seftali

Replace the open-coded "on" : "off" ternary with the standard str_on_off() helper from <linux/string_choices.h>. This improves readability and reuses the kernel's existing string helper instead of duplicating the literals.

No functional change intended.

Signature · 1 line
Kees Cook
Reviewed-by on v1 1/1
#2 lore raw
In reply to Mert Seftali
Quoted 6 lines · Mert Seftali

Replace the open-coded "on" : "off" ternary with the standard str_on_off() helper from <linux/string_choices.h>. This improves readability and reuses the kernel's existing string helper instead of duplicating the literals.

No functional change intended.

but see a couple of nit-picks below.

...

Quoted 4 lines

#include <linux/gpio/consumer.h>
#include <linux/gpio.h>
#include <linux/platform_device.h>
+#include <linux/string_choices.h>

While at it, perhaps add a blank line here.

Quoted 2 lines

#include "../../include/linux/atomisp_platform.h" #include "../../include/linux/atomisp_gmin_platform.h"

...

drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c static int gmin_acpi_pm_ctrl(struct v4l2_subdev *subdev, int on) · line 921

Quoted 3 lines
drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c +1 -1
 	dev_dbg(subdev->dev, "Setting power state to %s\n",
-		on ? "on" : "off");
+		str_on_off(on));

Now this goes to be perfectly one line.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#3 lore raw

PATCH v2 1/1 media: atomisp: gmin: Use str_on_off() helper

Replace the open-coded "on" : "off" ternary with the standard str_on_off() helper from <linux/string_choices.h>. This improves readability and reuses the kernel's existing string helper instead of duplicating the literals.

No functional change intended.

---
Changes in v2:
- Add a blank line between the system and local includes.
- Join the dev_dbg() call onto a single line now that it fits.

 drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c +4 -3
index 4026e98c5845..cb60cb3fab48 100644
@@ -13,6 +13,8 @@
 #include <linux/gpio/consumer.h>
 #include <linux/gpio.h>
 #include <linux/platform_device.h>
+#include <linux/string_choices.h>
+
 #include "../../include/linux/atomisp_platform.h"
 #include "../../include/linux/atomisp_gmin_platform.h"
 
@@ -916,8 +918,7 @@ static int gmin_acpi_pm_ctrl(struct v4l2_subdev *subdev, int on)
 	if (gs->clock_on == on)
 		return 0;
 
-	dev_dbg(subdev->dev, "Setting power state to %s\n",
-		on ? "on" : "off");
+	dev_dbg(subdev->dev, "Setting power state to %s\n", str_on_off(on));
 
 	if (on)
 		ret = acpi_device_set_power(adev,
@@ -930,7 +931,7 @@ static int gmin_acpi_pm_ctrl(struct v4l2_subdev *subdev, int on)
 		gs->clock_on = on;
 	else
 		dev_err(subdev->dev, "Couldn't set power state to %s\n",
-			on ? "on" : "off");
+			str_on_off(on));
 
 	return ret;
 }
Signature · 1 line
2.54.0
#4 lore raw
Quoted 6 lines · Mert Seftali

Replace the open-coded "on" : "off" ternary with the standard str_on_off() helper from <linux/string_choices.h>. This improves readability and reuses the kernel's existing string helper instead of duplicating the literals.

No functional change intended.

First of all, do not chain a new version to the email thread with the old one. Second, you forgot tag from Kees. Why did you not take it?

Signature · 2 lines
With Best Regards,
Andy Shevchenko
author
#5 lore raw
Quoted 2 lines · Andy Shevchenko

First of all, do not chain a new version to the email thread with the old one.

Sorry about that. I'm pretty new to all this and still finding my way around the process, so I appreciate you pointing it out. I'll send the next revision as its own separate thread.

Quoted 1 line

Second, you forgot tag from Kees. Why did you not take it?

That ones just my mistake, I overlooked Kees' tag when I put v2 together. I'll make sure to take it in v3.

Thanks for your patience with me, and for the review.

Mert Seftali

#6 lore raw
Quoted 7 lines · Mert S
Quoted 2 lines · Andy Shevchenko

First of all, do not chain a new version to the email thread with the old one.

Sorry about that. I'm pretty new to all this and still finding my way around the process, so I appreciate you pointing it out. I'll send the next revision as its own separate thread.

Also note, the new version of the patch should be sent not earlier than 24+h after the previous one.

Quoted 4 lines
Quoted 1 line

Second, you forgot tag from Kees. Why did you not take it?

That ones just my mistake, I overlooked Kees' tag when I put v2 together. I'll make sure to take it in v3.

b4 tool is your friend. Become familiar with it and it helps you a lot.

Signature · 2 lines
With Best Regards,
Andy Shevchenko