All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/radeon: use raw buffer printk specifier
@ 2017-12-21 10:04 Dmitry Rozhkov
       [not found] ` <20171221100453.6203-1-dmitry.rozhkov-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Dmitry Rozhkov @ 2017-12-21 10:04 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW
  Cc: Dmitry Rozhkov, andriy.shevchenko-VuQAYsv1563Yd54FQh9/CA

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.

Signed-off-by: Dmitry Rozhkov <dmitry.rozhkov@linux.intel.com>
Suggested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/gpu/drm/radeon/radeon_dp_mst.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/radeon/radeon_dp_mst.c b/drivers/gpu/drm/radeon/radeon_dp_mst.c
index 183b4b482138..ca2bcfb32935 100644
--- a/drivers/gpu/drm/radeon/radeon_dp_mst.c
+++ b/drivers/gpu/drm/radeon/radeon_dp_mst.c
@@ -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

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] drm/radeon: use raw buffer printk specifier
       [not found] ` <20171221100453.6203-1-dmitry.rozhkov-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
@ 2017-12-28 15:26   ` Andy Shevchenko
  2018-01-01 21:12   ` Alex Deucher
  1 sibling, 0 replies; 4+ messages in thread
From: Andy Shevchenko @ 2017-12-28 15:26 UTC (permalink / raw)
  To: Dmitry Rozhkov, amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW
  Cc: Alex Deucher, David Airlie, Christian König

On Thu, 2017-12-21 at 12:04 +0200, Dmitry Rozhkov wrote:
> 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

> Signed-off-by: Dmitry Rozhkov <dmitry.rozhkov@linux.intel.com>
> Suggested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
>  drivers/gpu/drm/radeon/radeon_dp_mst.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/radeon/radeon_dp_mst.c
> b/drivers/gpu/drm/radeon/radeon_dp_mst.c
> index 183b4b482138..ca2bcfb32935 100644
> --- a/drivers/gpu/drm/radeon/radeon_dp_mst.c
> +++ b/drivers/gpu/drm/radeon/radeon_dp_mst.c
> @@ -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

-- 
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Intel Finland Oy
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] drm/radeon: use raw buffer printk specifier
       [not found] ` <20171221100453.6203-1-dmitry.rozhkov-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
  2017-12-28 15:26   ` Andy Shevchenko
@ 2018-01-01 21:12   ` Alex Deucher
       [not found]     ` <CADnq5_M+UujKU=gwE0KGtLaXC_9ig+DoUFNwZ+v+z8+mhx2grw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  1 sibling, 1 reply; 4+ messages in thread
From: Alex Deucher @ 2018-01-01 21:12 UTC (permalink / raw)
  To: Dmitry Rozhkov; +Cc: Andy Shevchenko, amd-gfx list

On Thu, Dec 21, 2017 at 5:04 AM, Dmitry Rozhkov
<dmitry.rozhkov@linux.intel.com> wrote:
> 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

>
> 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.
>
> Signed-off-by: Dmitry Rozhkov <dmitry.rozhkov@linux.intel.com>
> Suggested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
>  drivers/gpu/drm/radeon/radeon_dp_mst.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/radeon/radeon_dp_mst.c b/drivers/gpu/drm/radeon/radeon_dp_mst.c
> index 183b4b482138..ca2bcfb32935 100644
> --- a/drivers/gpu/drm/radeon/radeon_dp_mst.c
> +++ b/drivers/gpu/drm/radeon/radeon_dp_mst.c
> @@ -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
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] drm/radeon: use raw buffer printk specifier
       [not found]     ` <CADnq5_M+UujKU=gwE0KGtLaXC_9ig+DoUFNwZ+v+z8+mhx2grw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2018-01-02 12:35       ` Andy Shevchenko
  0 siblings, 0 replies; 4+ messages in thread
From: Andy Shevchenko @ 2018-01-02 12:35 UTC (permalink / raw)
  To: Alex Deucher, Dmitry Rozhkov; +Cc: amd-gfx list

On Mon, 2018-01-01 at 16:12 -0500, Alex Deucher wrote:
> On Thu, Dec 21, 2017 at 5:04 AM, Dmitry Rozhkov
> <dmitry.rozhkov@linux.intel.com> wrote:
> > 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).

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

Thanks.

-- 
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Intel Finland Oy
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-01-02 12:35 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-12-21 10:04 [PATCH] drm/radeon: use raw buffer printk specifier Dmitry Rozhkov
     [not found] ` <20171221100453.6203-1-dmitry.rozhkov-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2017-12-28 15:26   ` Andy Shevchenko
2018-01-01 21:12   ` Alex Deucher
     [not found]     ` <CADnq5_M+UujKU=gwE0KGtLaXC_9ig+DoUFNwZ+v+z8+mhx2grw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-01-02 12:35       ` Andy Shevchenko

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.