Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1332247 > unrolled thread

[PATCH 3/4] mailbox: mailbox-test: use print_hex_dump_bytes to allow dynamic printk

Started bySudeep Holla <sudeep.holla@arm.com>
First post2016-02-11 18:20 +0100
Last post2016-02-12 10:40 +0100
Articles 3 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 3/4] mailbox: mailbox-test: use print_hex_dump_bytes to allow dynamic printk Sudeep Holla <sudeep.holla@arm.com> - 2016-02-11 18:20 +0100
    Re: [PATCH 3/4] mailbox: mailbox-test: use print_hex_dump_bytes to  allow dynamic printk Lee Jones <lee.jones@linaro.org> - 2016-02-12 10:20 +0100
      Re: [PATCH 3/4] mailbox: mailbox-test: use print_hex_dump_bytes to  allow dynamic printk Sudeep Holla <sudeep.holla@arm.com> - 2016-02-12 10:40 +0100

#1332247 — [PATCH 3/4] mailbox: mailbox-test: use print_hex_dump_bytes to allow dynamic printk

FromSudeep Holla <sudeep.holla@arm.com>
Date2016-02-11 18:20 +0100
Subject[PATCH 3/4] mailbox: mailbox-test: use print_hex_dump_bytes to allow dynamic printk
Message-ID<r134l-3on-7@gated-at.bofh.it>
Reduce the logging from info to debug. Also use print_hex_dump_bytes
instead as it has support for dynamic printk providing options to
conditionally enable/disable these logs.

Cc: Jassi Brar <jassisinghbrar@gmail.com>
Cc: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
---
 drivers/mailbox/mailbox-test.c | 18 ++++++++----------
 1 file changed, 8 insertions(+), 10 deletions(-)

diff --git a/drivers/mailbox/mailbox-test.c b/drivers/mailbox/mailbox-test.c
index 036a852b5fa1..f690f11969a1 100644
--- a/drivers/mailbox/mailbox-test.c
+++ b/drivers/mailbox/mailbox-test.c
@@ -113,15 +113,15 @@ static ssize_t mbox_test_message_write(struct file *filp,
 	 * MMIO to subsequently pass the message through
 	 */
 	if (tdev->mmio && tdev->signal) {
-		print_hex_dump(KERN_INFO, "Client: Sending: Signal: ", DUMP_PREFIX_ADDRESS,
-			       MBOX_BYTES_PER_LINE, 1, tdev->signal, MBOX_MAX_SIG_LEN, true);
+		print_hex_dump_bytes("Client: Sending: Signal: ", DUMP_PREFIX_ADDRESS,
+				     tdev->signal, MBOX_MAX_SIG_LEN);
 
 		data = tdev->signal;
 	} else
 		data = tdev->message;
 
-	print_hex_dump(KERN_INFO, "Client: Sending: Message: ", DUMP_PREFIX_ADDRESS,
-		       MBOX_BYTES_PER_LINE, 1, tdev->message, MBOX_MAX_MSG_LEN, true);
+	print_hex_dump_bytes("Client: Sending: Message: ", DUMP_PREFIX_ADDRESS,
+			     tdev->message, MBOX_MAX_MSG_LEN);
 
 	ret = mbox_send_message(tdev->tx_channel, data);
 	if (ret < 0)
@@ -222,13 +222,11 @@ static void mbox_test_receive_message(struct mbox_client *client, void *message)
 	spin_lock_irqsave(&tdev->lock, flags);
 	if (tdev->mmio) {
 		memcpy_fromio(tdev->rx_buffer, tdev->mmio, MBOX_MAX_MSG_LEN);
-		print_hex_dump(KERN_INFO, "Client: Received [MMIO]: ",
-			       DUMP_PREFIX_ADDRESS, MBOX_BYTES_PER_LINE, 1,
-			       tdev->rx_buffer, MBOX_MAX_MSG_LEN, true);
+		print_hex_dump_bytes("Client: Received [MMIO]: ", DUMP_PREFIX_ADDRESS,
+				     tdev->rx_buffer, MBOX_MAX_MSG_LEN);
 	} else if (message) {
-		print_hex_dump(KERN_INFO, "Client: Received [API]: ",
-			       DUMP_PREFIX_ADDRESS, MBOX_BYTES_PER_LINE, 1,
-			       message, MBOX_MAX_MSG_LEN, true);
+		print_hex_dump_bytes("Client: Received [API]: ", DUMP_PREFIX_ADDRESS,
+				     message, MBOX_MAX_MSG_LEN);
 		memcpy(tdev->rx_buffer, message, MBOX_MAX_MSG_LEN);
 	}
 	spin_unlock_irqrestore(&tdev->lock, flags);
-- 
1.9.1

[toc] | [next] | [standalone]


#1332599 — Re: [PATCH 3/4] mailbox: mailbox-test: use print_hex_dump_bytes to allow dynamic printk

FromLee Jones <lee.jones@linaro.org>
Date2016-02-12 10:20 +0100
SubjectRe: [PATCH 3/4] mailbox: mailbox-test: use print_hex_dump_bytes to allow dynamic printk
Message-ID<r1i3o-4XY-9@gated-at.bofh.it>
In reply to#1332247
On Thu, 11 Feb 2016, Sudeep Holla wrote:

> Reduce the logging from info to debug. Also use print_hex_dump_bytes
> instead as it has support for dynamic printk providing options to
> conditionally enable/disable these logs.

Printing out the data in this way is kinda the point of the driver.
But if you don't have a use for it, then I guess it's okay to
downgrade it to DEBUG, as turning debug on, or hacking the driver back
again are trivial actions.

> Cc: Jassi Brar <jassisinghbrar@gmail.com>
> Cc: Lee Jones <lee.jones@linaro.org>
> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
> ---
>  drivers/mailbox/mailbox-test.c | 18 ++++++++----------
>  1 file changed, 8 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/mailbox/mailbox-test.c b/drivers/mailbox/mailbox-test.c
> index 036a852b5fa1..f690f11969a1 100644
> --- a/drivers/mailbox/mailbox-test.c
> +++ b/drivers/mailbox/mailbox-test.c
> @@ -113,15 +113,15 @@ static ssize_t mbox_test_message_write(struct file *filp,
>  	 * MMIO to subsequently pass the message through
>  	 */
>  	if (tdev->mmio && tdev->signal) {
> -		print_hex_dump(KERN_INFO, "Client: Sending: Signal: ", DUMP_PREFIX_ADDRESS,
> -			       MBOX_BYTES_PER_LINE, 1, tdev->signal, MBOX_MAX_SIG_LEN, true);
> +		print_hex_dump_bytes("Client: Sending: Signal: ", DUMP_PREFIX_ADDRESS,
> +				     tdev->signal, MBOX_MAX_SIG_LEN);
>  
>  		data = tdev->signal;
>  	} else
>  		data = tdev->message;
>  
> -	print_hex_dump(KERN_INFO, "Client: Sending: Message: ", DUMP_PREFIX_ADDRESS,
> -		       MBOX_BYTES_PER_LINE, 1, tdev->message, MBOX_MAX_MSG_LEN, true);
> +	print_hex_dump_bytes("Client: Sending: Message: ", DUMP_PREFIX_ADDRESS,
> +			     tdev->message, MBOX_MAX_MSG_LEN);
>  
>  	ret = mbox_send_message(tdev->tx_channel, data);
>  	if (ret < 0)
> @@ -222,13 +222,11 @@ static void mbox_test_receive_message(struct mbox_client *client, void *message)
>  	spin_lock_irqsave(&tdev->lock, flags);
>  	if (tdev->mmio) {
>  		memcpy_fromio(tdev->rx_buffer, tdev->mmio, MBOX_MAX_MSG_LEN);
> -		print_hex_dump(KERN_INFO, "Client: Received [MMIO]: ",
> -			       DUMP_PREFIX_ADDRESS, MBOX_BYTES_PER_LINE, 1,
> -			       tdev->rx_buffer, MBOX_MAX_MSG_LEN, true);
> +		print_hex_dump_bytes("Client: Received [MMIO]: ", DUMP_PREFIX_ADDRESS,
> +				     tdev->rx_buffer, MBOX_MAX_MSG_LEN);
>  	} else if (message) {
> -		print_hex_dump(KERN_INFO, "Client: Received [API]: ",
> -			       DUMP_PREFIX_ADDRESS, MBOX_BYTES_PER_LINE, 1,
> -			       message, MBOX_MAX_MSG_LEN, true);
> +		print_hex_dump_bytes("Client: Received [API]: ", DUMP_PREFIX_ADDRESS,
> +				     message, MBOX_MAX_MSG_LEN);
>  		memcpy(tdev->rx_buffer, message, MBOX_MAX_MSG_LEN);
>  	}
>  	spin_unlock_irqrestore(&tdev->lock, flags);

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

[toc] | [prev] | [next] | [standalone]


#1332612 — Re: [PATCH 3/4] mailbox: mailbox-test: use print_hex_dump_bytes to allow dynamic printk

FromSudeep Holla <sudeep.holla@arm.com>
Date2016-02-12 10:40 +0100
SubjectRe: [PATCH 3/4] mailbox: mailbox-test: use print_hex_dump_bytes to allow dynamic printk
Message-ID<r1imJ-54w-1@gated-at.bofh.it>
In reply to#1332599

On 12/02/16 09:12, Lee Jones wrote:
> On Thu, 11 Feb 2016, Sudeep Holla wrote:
>
>> Reduce the logging from info to debug. Also use print_hex_dump_bytes
>> instead as it has support for dynamic printk providing options to
>> conditionally enable/disable these logs.
>
> Printing out the data in this way is kinda the point of the driver.
> But if you don't have a use for it, then I guess it's okay to
> downgrade it to DEBUG, as turning debug on, or hacking the driver back
> again are trivial actions.
>

Agreed, I wanted check the same by adding additional note but forgot.
Sorry for missing that.

One of the reasons I preferred this it's easy to switch it on or off via
debug level or dynamic debug. It's useful when the test application
using these sysfs also logs and ends up cluttered by kernel logs.

-- 
Regards,
Sudeep

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web