drm/edid: use true and false for boolean values
Subsystems (2)
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
@@ -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
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
Signed-off-by Gustavo A. R. Silva <[email protected]>---
Changes in v2:
- Use true for boolean value inadd_detailed_modeas 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@@ -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
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
Signed-off-by Gustavo A. R. Silva <[email protected]>---
Changes in v2:
- Use true for boolean value inadd_detailed_modeas 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@@ -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.4Signature · 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
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
Signed-off-by Gustavo A. R. Silva <[email protected]>---
Changes in v2:
- Use true for boolean value inadd_detailed_modeas 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@@ -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.4Signature · 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
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
Signed-off-by Gustavo A. R. Silva <[email protected]>---
Changes in v2:
- Use true for boolean value inadd_detailed_modeas 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@@ -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.4Signature · 5 lines
Sean Paul, Software Engineer, Google / Chromium OS _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-develSignature · 2 lines
Ville Syrjälä Intel OTC
Signature · 1 line
Sean Paul, Software Engineer, Google / Chromium OS
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
Signed-off-by Gustavo A. R. Silva <[email protected]>---
Changes in v2:
- Use true for boolean value inadd_detailed_modeas 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@@ -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.4Signature · 5 lines
Sean Paul, Software Engineer, Google / Chromium OS _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-develSignature · 2 lines
Ville Syrjälä Intel OTCSignature · 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