Skip to contentSkip to conversation

drm/radeon: use raw buffer printk specifier

PATCH In review Dmitry Rozhkov 3 participants 4 messages Dec 21, 2017 – Jan 2, 2018 2 messages not in the archive

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

PATCH 1/1 drm/radeon: use raw buffer printk specifier

printk format strings accepting a single subsequent argument are shorter thus easier to read.

Instead of having format strings accepting 3 different arguments pointing to first 3 bytes of the same buffer rewrite the format string to accept only one argument - the buffer - with "%3ph" specifier.

---
 drivers/gpu/drm/radeon/radeon_dp_mst.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/radeon/radeon_dp_mst.c +2 -2
index 183b4b482138..ca2bcfb32935 100644
@@ -718,7 +718,7 @@ radeon_dp_mst_check_status(struct radeon_connector *radeon_connector)
 				       DP_SINK_COUNT_ESI, esi, 8);
 go_again:
 		if (dret == 8) {
-			DRM_DEBUG_KMS("got esi %02x %02x %02x\n", esi[0], esi[1], esi[2]);
+			DRM_DEBUG_KMS("got esi %3ph\n", esi);
 			ret = drm_dp_mst_hpd_irq(&radeon_connector->mst_mgr, esi, &handled);
 
 			if (handled) {
@@ -733,7 +733,7 @@ radeon_dp_mst_check_status(struct radeon_connector *radeon_connector)
 				dret = drm_dp_dpcd_read(&radeon_connector->ddc_bus->aux,
 							DP_SINK_COUNT_ESI, esi, 8);
 				if (dret == 8) {
-					DRM_DEBUG_KMS("got esi2 %02x %02x %02x\n", esi[0], esi[1], esi[2]);
+					DRM_DEBUG_KMS("got esi2 %3ph\n", esi);
 					goto go_again;
 				}
 			} else
Signature · 6 lines
2.13.6

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

A message that is not in the archive (sent off-list or not yet received): 20171221100453.6203-1-dmitry.rozhkov-VuQAYsv1563Yd54FQh9/[email protected]

#2 lore raw
Quoted 8 lines · Dmitry Rozhkov

printk format strings accepting a single subsequent argument are shorter thus easier to read.

Instead of having format strings accepting 3 different arguments pointing to first 3 bytes of the same buffer rewrite the format string to accept only one argument - the buffer - with "%3ph" specifier.

+Cc maintainers

Quoted 37 lines
---
 drivers/gpu/drm/radeon/radeon_dp_mst.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/radeon/radeon_dp_mst.c +1 -1
index 183b4b482138..ca2bcfb32935 100644
@@ -718,7 +718,7 @@ radeon_dp_mst_check_status(struct radeon_connector
 *radeon_connector)
 				       DP_SINK_COUNT_ESI, esi, 8);
 go_again:
 		if (dret == 8) {
-			DRM_DEBUG_KMS("got esi %02x %02x %02x\n",
 esi[0], esi[1], esi[2]);
+			DRM_DEBUG_KMS("got esi %3ph\n", esi);
 			ret = drm_dp_mst_hpd_irq(&radeon_connector-
Quoted 1 line

mst_mgr, esi, &handled);

drivers/gpu/drm/radeon/radeon_dp_mst.c +0 -1
 			if (handled) {
@@ -733,7 +733,7 @@ radeon_dp_mst_check_status(struct radeon_connector
 *radeon_connector)
 				dret =
 drm_dp_dpcd_read(&radeon_connector->ddc_bus->aux,
 							DP_SINK_COUNT
 _ESI, esi, 8);
 				if (dret == 8) {
-					DRM_DEBUG_KMS("got esi2 %02x

%02x %02x\n", esi[0], esi[1], esi[2]);

drivers/gpu/drm/radeon/radeon_dp_mst.c +1 -0
+					DRM_DEBUG_KMS("got esi2

%3ph\n", esi);

drivers/gpu/drm/radeon/radeon_dp_mst.c +0 -0
 					goto go_again;
 				}
 			} else
Signature · 6 lines
Andy Shevchenko <[email protected]>
Intel Finland Oy
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#3 lore raw
In reply to a message not in the archive
Quoted 2 lines · Dmitry Rozhkov

printk format strings accepting a single subsequent argument are shorter thus easier to read.

I'm not sure I agree it's easier to read. IMHO, it's somewhat less clear what's going on, but I don't have a particularly strong opinion either way. Applied.

Thanks,

Alex

Quoted 37 lines

Instead of having format strings accepting 3 different arguments pointing to first 3 bytes of the same buffer rewrite the format string to accept only one argument - the buffer - with "%3ph" specifier.

---
 drivers/gpu/drm/radeon/radeon_dp_mst.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/radeon/radeon_dp_mst.c +2 -3
index 183b4b482138..ca2bcfb32935 100644
@@ -718,7 +718,7 @@ radeon_dp_mst_check_status(struct radeon_connector *radeon_connector)
                                       DP_SINK_COUNT_ESI, esi, 8);
 go_again:
                if (dret == 8) {
-                       DRM_DEBUG_KMS("got esi %02x %02x %02x\n", esi[0], esi[1], esi[2]);
+                       DRM_DEBUG_KMS("got esi %3ph\n", esi);
                        ret = drm_dp_mst_hpd_irq(&radeon_connector->mst_mgr, esi, &handled);
 
                        if (handled) {
@@ -733,7 +733,7 @@ radeon_dp_mst_check_status(struct radeon_connector *radeon_connector)
                                dret = drm_dp_dpcd_read(&radeon_connector->ddc_bus->aux,
                                                        DP_SINK_COUNT_ESI, esi, 8);
                                if (dret == 8) {
-                                       DRM_DEBUG_KMS("got esi2 %02x %02x %02x\n", esi[0], esi[1], esi[2]);
+                                       DRM_DEBUG_KMS("got esi2 %3ph\n", esi);
                                        goto go_again;
                                }
                        } else
--

2.13.6

Quoted 4 lines

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

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

A message that is not in the archive (sent off-list or not yet received): CADnq5_M+UujKU=gwE0KGtLaXC_9ig+DoUFNwZ+v+z8+mhx2grw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#5 lore raw
Quoted 8 lines · Alex Deucher
Quoted 2 lines · Dmitry Rozhkov

printk format strings accepting a single subsequent argument are shorter thus easier to read.

I'm not sure I agree it's easier to read.
IMHO, it's somewhat less
clear what's going on,

If you check how many times %*ph is used in the kernel... Or then you may concern about entire bunch of %p extensions in the kernel.

Anyway, main rationale I think is a stack use and performance.

But it's still about debug messages in this case, and in particular only about 3 bytes (btw, if needed it might be easily expanded for up to 64 bytes or even with run-time adjusted length).

Quoted 2 lines

but I don't have a particularly strong opinion
either way. Applied.

Thanks.

Signature · 6 lines
Andy Shevchenko <[email protected]>
Intel Finland Oy
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx