Skip to contentSkip to conversation

drm/panel: simple: fix -Wliteral-conversion warning

PATCH In review Nick Desaulniers 2 participants 4 messages Jun 15, 2018 – Aug 9, 2018

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

PATCH 1/1 drm/panel: simple: fix -Wliteral-conversion warning

Fixes commit 8cfe83419cdb ("drm/panel: simple: Add support for KEO TX31D200VM0BAA")

drivers/gpu/drm/panel/panel-simple.c:1250:27: warning: implicit conversion from

      'double' to 'u32' (aka 'unsigned int') changes value from 33.5 to 33
      [-Wliteral-conversion]
        .vfront_porch = { 6, 21, 33.5 },
                        ~        ^~~~
drivers/gpu/drm/panel/panel-simple.c:1251:26: warning: implicit conversion from
      'double' to 'u32' (aka 'unsigned int') changes value from 33.5 to 33
      [-Wliteral-conversion]
        .vback_porch = { 6, 21, 33.5 },
                       ~        ^~~~

---
Alternatively, should these be rounded up to 34? I'm guessing the current behaviour (truncation) is correct since that's how the patch was operating.

 drivers/gpu/drm/panel/panel-simple.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/panel/panel-simple.c +2 -2
index cbf1ab404ee7..12bcbd1dd77b 100644
@@ -1247,8 +1247,8 @@ static const struct display_timing koe_tx31d200vm0baa_timing = {
 	.hback_porch = { 16, 36, 56 },
 	.hsync_len = { 8, 8, 8 },
 	.vactive = { 480, 480, 480 },
-	.vfront_porch = { 6, 21, 33.5 },
-	.vback_porch = { 6, 21, 33.5 },
+	.vfront_porch = { 6, 21, 33 },
+	.vback_porch = { 6, 21, 33 },
 	.vsync_len = { 8, 8, 8 },
 	.flags = DISPLAY_FLAGS_DE_HIGH,
 };
Signature · 1 line
2.18.0.rc1.244.gcf134e6275-goog
#1 lore raw

bumping for review.

Quoted 42 lines · Nick Desaulniers

Fixes commit 8cfe83419cdb ("drm/panel: simple: Add support for KEO TX31D200VM0BAA")

drivers/gpu/drm/panel/panel-simple.c:1250:27: warning: implicit conversion from

      'double' to 'u32' (aka 'unsigned int') changes value from 33.5 to 33
      [-Wliteral-conversion]
        .vfront_porch = { 6, 21, 33.5 },
                        ~        ^~~~
drivers/gpu/drm/panel/panel-simple.c:1251:26: warning: implicit conversion from
      'double' to 'u32' (aka 'unsigned int') changes value from 33.5 to 33
      [-Wliteral-conversion]
        .vback_porch = { 6, 21, 33.5 },
                       ~        ^~~~

---
Alternatively, should these be rounded up to 34? I'm guessing the current behaviour (truncation) is correct since that's how the patch was operating.

 drivers/gpu/drm/panel/panel-simple.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/panel/panel-simple.c +2 -3
index cbf1ab404ee7..12bcbd1dd77b 100644
@@ -1247,8 +1247,8 @@ static const struct display_timing koe_tx31d200vm0baa_timing = {
        .hback_porch = { 16, 36, 56 },
        .hsync_len = { 8, 8, 8 },
        .vactive = { 480, 480, 480 },
-       .vfront_porch = { 6, 21, 33.5 },
-       .vback_porch = { 6, 21, 33.5 },
+       .vfront_porch = { 6, 21, 33 },
+       .vback_porch = { 6, 21, 33 },
        .vsync_len = { 8, 8, 8 },
        .flags = DISPLAY_FLAGS_DE_HIGH,
 };
--

2.18.0.rc1.244.gcf134e6275-goog

Signature · 2 lines
Thanks,
~Nick Desaulniers
#2 lore raw
In reply to Nick Desaulniers
Quoted 14 lines · Nick Desaulniers

Fixes commit 8cfe83419cdb ("drm/panel: simple: Add support for KEO TX31D200VM0BAA")

drivers/gpu/drm/panel/panel-simple.c:1250:27: warning: implicit conversion from

      'double' to 'u32' (aka 'unsigned int') changes value from 33.5 to 33
      [-Wliteral-conversion]
        .vfront_porch = { 6, 21, 33.5 },
                        ~        ^~~~
drivers/gpu/drm/panel/panel-simple.c:1251:26: warning: implicit conversion from
      'double' to 'u32' (aka 'unsigned int') changes value from 33.5 to 33
      [-Wliteral-conversion]
        .vback_porch = { 6, 21, 33.5 },
                       ~        ^~~~
Quoted 5 lines

---
Alternatively, should these be rounded up to 34? I'm guessing the current behaviour (truncation) is correct since that's how the patch was operating.

Looks like this is a duplicate of what was merged as:

commit c9b6be7dc13e2f87592ee4c9812cb450dba484d5

Author: Stefan Agner <[email protected]>
Date:   Thu Apr 19 23:20:03 2018 +0200

drm/panel: simple: Fix data type in KEO TX31D200VM0BAA timings

All values in a struct struct timing_entry (every entry in struct display_timing) require an integer. Choose the closest safe integer of 32.

This avoids a warning seen with clang:
drivers/gpu/drm/panel/panel-simple.c:1250:27: warning: implicit
conversion from 'double' to 'u32' (aka 'unsigned int') changes value from 33.5 to 33 [-Wliteral-conversion]
.vfront_porch = { 6, 21, 33.5 },
~ ^~~~
drivers/gpu/drm/panel/panel-simple.c:1251:26: warning: implicit
conversion from 'double' to 'u32' (aka 'unsigned int') changes value from 33.5 to 33 [-Wliteral-conversion]
.vback_porch = { 6, 21, 33.5 },
~ ^~~~

Thierry

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#3 lore raw
Quoted 22 lines · Thierry Reding
Quoted 14 lines · Nick Desaulniers

Fixes commit 8cfe83419cdb ("drm/panel: simple: Add support for KEO TX31D200VM0BAA")

drivers/gpu/drm/panel/panel-simple.c:1250:27: warning: implicit conversion from

      'double' to 'u32' (aka 'unsigned int') changes value from 33.5 to 33
      [-Wliteral-conversion]
        .vfront_porch = { 6, 21, 33.5 },
                        ~        ^~~~
drivers/gpu/drm/panel/panel-simple.c:1251:26: warning: implicit conversion from
      'double' to 'u32' (aka 'unsigned int') changes value from 33.5 to 33
      [-Wliteral-conversion]
        .vback_porch = { 6, 21, 33.5 },
                       ~        ^~~~
Quoted 5 lines

---
Alternatively, should these be rounded up to 34? I'm guessing the current behaviour (truncation) is correct since that's how the patch was operating.

Quoted 5 lines

Looks like this is a duplicate of what was merged as:

commit c9b6be7dc13e2f87592ee4c9812cb450dba484d5

Author: Stefan Agner <[email protected]>
Date:   Thu Apr 19 23:20:03 2018 +0200

Ah, cool. I need to be better about checking maintainers' trees.

Just curious, how come a patch from April hasn't hit torvalds/linux yet?

Signature · 2 lines
Thanks,
~Nick Desaulniers