All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ath3k: add more information to error message
@ 2018-09-27 20:19 Luiz Carlos Ramos
  2018-09-28 17:28 ` Marcel Holtmann
  0 siblings, 1 reply; 5+ messages in thread
From: Luiz Carlos Ramos @ 2018-09-27 20:19 UTC (permalink / raw)
  To: Marcel Holtmann, Johan Hedberg; +Cc: linux-bluetooth

When there is an error in either ath3k_load_firmware() or
ath3k_load_fwfile(), the inlined function ath3k_log_failed_loading() is
called receiving the error returned and both the block size requested to
load and the size actually loaded. These values are printed in an error
message using the macro BT_ERR.

This patch changes that function in order to print the variable "count"
as well, to show more information when a failing firmware loading
operation happens. The calls to the older function were changed to the
new one.

This event is being monitored in a laptop with an adapter which
identifies itself as 0cf3:0036, where sometimes there are errors in the
firmware loading process.

Signed-off-by: Luiz Carlos Ramos <lramos.prof@yahoo.com.br>
---
 drivers/bluetooth/ath3k.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/drivers/bluetooth/ath3k.c b/drivers/bluetooth/ath3k.c
index 3a8c47efea55..73453fdff4e7 100644
--- a/drivers/bluetooth/ath3k.c
+++ b/drivers/bluetooth/ath3k.c
@@ -203,10 +203,12 @@ static const struct usb_device_id ath3k_blist_tbl[] = {
 	{ }	/* Terminating entry */
 };
 
-static inline void ath3k_log_failed_loading(int err, int len, int size)
+static inline void ath3k_log_failed_loading(int err, int len, int size,
+						int count)
 {
-	BT_ERR("Error in firmware loading err = %d, len = %d, size = %d",
-			err, len, size);
+	BT_ERR("%s err = %d, len = %d, size = %d, count = %d",
+			"Error in firmware loading",
+			err, len, size, count);
 }
 
 #define USB_REQ_DFU_DNLOAD	1
@@ -257,7 +259,7 @@ static int ath3k_load_firmware(struct usb_device *udev,
 					&len, 3000);
 
 		if (err || (len != size)) {
-			ath3k_log_failed_loading(err, len, size);
+			ath3k_log_failed_loading(err, len, size, count);
 			goto error;
 		}
 
@@ -356,7 +358,7 @@ static int ath3k_load_fwfile(struct usb_device *udev,
 		err = usb_bulk_msg(udev, pipe, send_buf, size,
 					&len, 3000);
 		if (err || (len != size)) {
-			ath3k_log_failed_loading(err, len, size);
+			ath3k_log_failed_loading(err, len, size, count);
 			kfree(send_buf);
 			return err;
 		}
-- 
2.14.4


^ permalink raw reply related	[flat|nested] 5+ messages in thread
* [PATCH] ath3k: add more information to error message
@ 2018-09-07 23:36 Luiz Carlos Ramos
  2018-09-27 10:47 ` Marcel Holtmann
  0 siblings, 1 reply; 5+ messages in thread
From: Luiz Carlos Ramos @ 2018-09-07 23:36 UTC (permalink / raw)
  To: Marcel Holtmann, Johan Hedberg; +Cc: linux-bluetooth

When there is an error in either ath3k_load_firmware() or
ath3k_load_fwfile(), the inlined function ath3k_log_failed_loading() is
called receiving the error returned and both the block size requested to
load and the size actually loaded. These values are printed in an error
message using the macro BT_ERR.

This patch creates a new function which does the same but also receives
the "count" variable, in order to show more information when a failing
firmware loading happens. The calls to the older function were changed
to the new one.

This event is being monitored in a laptop with an adapter which
identifies itself as 0cf3:0036, where sometimes there are errors in the
firmware loading process.

Signed-off-by: Luiz Carlos Ramos <lramos.prof@yahoo.com.br>
---
 drivers/bluetooth/ath3k.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/drivers/bluetooth/ath3k.c b/drivers/bluetooth/ath3k.c
index 3a8c47efea55..ebc312cb4412 100644
--- a/drivers/bluetooth/ath3k.c
+++ b/drivers/bluetooth/ath3k.c
@@ -209,6 +209,14 @@ static inline void ath3k_log_failed_loading(int err, int len, int size)
 			err, len, size);
 }
 
+static inline void ath3k_log_failed_loading_2(int err, int len, int size,
+						int count)
+{
+	BT_ERR("%s err = %d, len = %d, size = %d, count = %d",
+			"Error in firmware loading",
+			err, len, size, count);
+}
+
 #define USB_REQ_DFU_DNLOAD	1
 #define BULK_SIZE		4096
 #define FW_HDR_SIZE		20
@@ -257,7 +265,7 @@ static int ath3k_load_firmware(struct usb_device *udev,
 					&len, 3000);
 
 		if (err || (len != size)) {
-			ath3k_log_failed_loading(err, len, size);
+			ath3k_log_failed_loading_2(err, len, size, count);
 			goto error;
 		}
 
@@ -356,7 +364,7 @@ static int ath3k_load_fwfile(struct usb_device *udev,
 		err = usb_bulk_msg(udev, pipe, send_buf, size,
 					&len, 3000);
 		if (err || (len != size)) {
-			ath3k_log_failed_loading(err, len, size);
+			ath3k_log_failed_loading_2(err, len, size, count);
 			kfree(send_buf);
 			return err;
 		}
-- 
2.14.4

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

end of thread, other threads:[~2018-09-28 17:28 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-27 20:19 [PATCH] ath3k: add more information to error message Luiz Carlos Ramos
2018-09-28 17:28 ` Marcel Holtmann
  -- strict thread matches above, loose matches on Subject: below --
2018-09-07 23:36 Luiz Carlos Ramos
2018-09-27 10:47 ` Marcel Holtmann
2018-09-27 20:13   ` Luiz Carlos Ramos

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.