Skip to contentSkip to conversation

drm/edid: use true and false for boolean values

PATCH In review Gustavo A. R. Silva 5 participants 6 messages Jan 30, 2018

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 drm/edid: use true and false for boolean values

Assign true or false to boolean variables instead of an integer value.

This issue was detected with the help of Coccinelle.

---
Changes in v2:
- Use true for boolean value in add_detailed_mode as suggested by Daniel Vetter.
- Update subject.

 drivers/gpu/drm/drm_edid.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/drm_edid.c +2 -2
index ddd5379..b1cb262 100644
@@ -2767,7 +2767,7 @@ do_detailed_mode(struct detailed_timing *timing, void *c)
 
 		drm_mode_probed_add(closure->connector, newmode);
 		closure->modes++;
-		closure->preferred = 0;
+		closure->preferred = false;
 	}
 }
 
@@ -2784,7 +2784,7 @@ add_detailed_modes(struct drm_connector *connector, struct edid *edid,
 	struct detailed_mode_closure closure = {
 		.connector = connector,
 		.edid = edid,
-		.preferred = 1,
+		.preferred = true,
 		.quirks = quirks,
 	};
 
Signature · 1 line
2.7.4
#1 lore raw
Quoted 3 lines · Gustavo A. R. Silva

Assign true or false to boolean variables instead of an integer value.

This issue was detected with the help of Coccinelle.

I suppose you could also fix up the other preferred assignment by adding !! to the bitwise & operation.

It's also helpful to post the spatch in the commit message so others can replicate your result (this case is pretty trivial, so less important).

Sean

Quoted 36 lines

---
Changes in v2:
- Use true for boolean value in add_detailed_mode as suggested by Daniel Vetter.
- Update subject.

 drivers/gpu/drm/drm_edid.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/drm_edid.c +2 -2
index ddd5379..b1cb262 100644
@@ -2767,7 +2767,7 @@ do_detailed_mode(struct detailed_timing *timing, void *c)
 
 		drm_mode_probed_add(closure->connector, newmode);
 		closure->modes++;
-		closure->preferred = 0;
+		closure->preferred = false;
 	}
 }
 
@@ -2784,7 +2784,7 @@ add_detailed_modes(struct drm_connector *connector, struct edid *edid,
 	struct detailed_mode_closure closure = {
 		.connector = connector,
 		.edid = edid,
-		.preferred = 1,
+		.preferred = true,
 		.quirks = quirks,
 	};
 
Signature · 1 line
2.7.4
Signature · 5 lines
Sean Paul, Software Engineer, Google / Chromium OS
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#2 lore raw
Quoted 7 lines · Sean Paul
Quoted 3 lines · Gustavo A. R. Silva

Assign true or false to boolean variables instead of an integer value.

This issue was detected with the help of Coccinelle.

I suppose you could also fix up the other preferred assignment by adding !! to the bitwise & operation.

Assigning >1 to a bool is well defined. No need to clutter the code with !! imo.

Quoted 49 lines

It's also helpful to post the spatch in the commit message so others can replicate your result (this case is pretty trivial, so less important).

Sean

Quoted 36 lines

---
Changes in v2:
- Use true for boolean value in add_detailed_mode as suggested by Daniel Vetter.
- Update subject.

 drivers/gpu/drm/drm_edid.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/drm_edid.c +2 -2
index ddd5379..b1cb262 100644
@@ -2767,7 +2767,7 @@ do_detailed_mode(struct detailed_timing *timing, void *c)
 
 		drm_mode_probed_add(closure->connector, newmode);
 		closure->modes++;
-		closure->preferred = 0;
+		closure->preferred = false;
 	}
 }
 
@@ -2784,7 +2784,7 @@ add_detailed_modes(struct drm_connector *connector, struct edid *edid,
 	struct detailed_mode_closure closure = {
 		.connector = connector,
 		.edid = edid,
-		.preferred = 1,
+		.preferred = true,
 		.quirks = quirks,
 	};
 
Signature · 1 line
2.7.4
Signature · 5 lines
Sean Paul, Software Engineer, Google / Chromium OS
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 6 lines
Ville Syrjälä
Intel OTC
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#3 lore raw
Quoted 11 lines · Ville Syrjälä
Quoted 7 lines · Sean Paul
Quoted 3 lines · Gustavo A. R. Silva

Assign true or false to boolean variables instead of an integer value.

This issue was detected with the help of Coccinelle.

I suppose you could also fix up the other preferred assignment by adding !! to the bitwise & operation.

Assigning >1 to a bool is well defined. No need to clutter the code with !! imo.

Agreed.

BR,
Jani.

Quoted 50 lines
Quoted 50 lines

It's also helpful to post the spatch in the commit message so others can replicate your result (this case is pretty trivial, so less important).

Sean

Quoted 36 lines

---
Changes in v2:
- Use true for boolean value in add_detailed_mode as suggested by Daniel Vetter.
- Update subject.

 drivers/gpu/drm/drm_edid.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/drm_edid.c +2 -2
index ddd5379..b1cb262 100644
@@ -2767,7 +2767,7 @@ do_detailed_mode(struct detailed_timing *timing, void *c)
 
 		drm_mode_probed_add(closure->connector, newmode);
 		closure->modes++;
-		closure->preferred = 0;
+		closure->preferred = false;
 	}
 }
 
@@ -2784,7 +2784,7 @@ add_detailed_modes(struct drm_connector *connector, struct edid *edid,
 	struct detailed_mode_closure closure = {
 		.connector = connector,
 		.edid = edid,
-		.preferred = 1,
+		.preferred = true,
 		.quirks = quirks,
 	};
 
Signature · 1 line
2.7.4
Signature · 5 lines
Sean Paul, Software Engineer, Google / Chromium OS
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#4 lore raw
In reply to Ville Syrjälä
Quoted 11 lines · Ville Syrjälä
Quoted 7 lines · Sean Paul
Quoted 3 lines · Gustavo A. R. Silva

Assign true or false to boolean variables instead of an integer value.

This issue was detected with the help of Coccinelle.

I suppose you could also fix up the other preferred assignment by adding !! to the bitwise & operation.

Assigning >1 to a bool is well defined. No need to clutter the code with !! imo.

There are examples of both in the file already. I don't have strong feelings either way.

Sea

Quoted 54 lines
Quoted 50 lines

It's also helpful to post the spatch in the commit message so others can replicate your result (this case is pretty trivial, so less important).

Sean

Quoted 36 lines

---
Changes in v2:
- Use true for boolean value in add_detailed_mode as suggested by Daniel Vetter.
- Update subject.

 drivers/gpu/drm/drm_edid.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/drm_edid.c +2 -2
index ddd5379..b1cb262 100644
@@ -2767,7 +2767,7 @@ do_detailed_mode(struct detailed_timing *timing, void *c)
 
 		drm_mode_probed_add(closure->connector, newmode);
 		closure->modes++;
-		closure->preferred = 0;
+		closure->preferred = false;
 	}
 }
 
@@ -2784,7 +2784,7 @@ add_detailed_modes(struct drm_connector *connector, struct edid *edid,
 	struct detailed_mode_closure closure = {
 		.connector = connector,
 		.edid = edid,
-		.preferred = 1,
+		.preferred = true,
 		.quirks = quirks,
 	};
 
Signature · 1 line
2.7.4
Signature · 5 lines
Sean Paul, Software Engineer, Google / Chromium OS
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 2 lines
Ville Syrjälä
Intel OTC
Signature · 1 line
Sean Paul, Software Engineer, Google / Chromium OS
#5 lore raw
Quoted 7 lines · Sean Paul
Quoted 6 lines · Ville Syrjälä
Quoted 5 lines · Sean Paul
Quoted 3 lines · Gustavo A. R. Silva

Assign true or false to boolean variables instead of an integer value.

This issue was detected with the help of Coccinelle.

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

I suppose you could also fix up the other preferred assignment by adding !! to the bitwise & operation.

Assigning >1 to a bool is well defined. No need to clutter the code with !! imo.

There are examples of both in the file already. I don't have strong feelings either way.

Yeah, I applied this one for now, we can do more color choice discussions with follow ups :-)

Thanks for the patch.
-Daniel

Quoted 64 lines

Sea

Quoted 54 lines
Quoted 50 lines

It's also helpful to post the spatch in the commit message so others can replicate your result (this case is pretty trivial, so less important).

Sean

Quoted 36 lines

---
Changes in v2:
- Use true for boolean value in add_detailed_mode as suggested by Daniel Vetter.
- Update subject.

 drivers/gpu/drm/drm_edid.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/drm_edid.c +2 -2
index ddd5379..b1cb262 100644
@@ -2767,7 +2767,7 @@ do_detailed_mode(struct detailed_timing *timing, void *c)
 
 		drm_mode_probed_add(closure->connector, newmode);
 		closure->modes++;
-		closure->preferred = 0;
+		closure->preferred = false;
 	}
 }
 
@@ -2784,7 +2784,7 @@ add_detailed_modes(struct drm_connector *connector, struct edid *edid,
 	struct detailed_mode_closure closure = {
 		.connector = connector,
 		.edid = edid,
-		.preferred = 1,
+		.preferred = true,
 		.quirks = quirks,
 	};
 
Signature · 1 line
2.7.4
Signature · 5 lines
Sean Paul, Software Engineer, Google / Chromium OS
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 2 lines
Ville Syrjälä
Intel OTC
Signature · 5 lines
Sean Paul, Software Engineer, Google / Chromium OS
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel