All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/5] drivers: bluetooth: ath3k: replace hardcode numbers with define
@ 2018-02-04 20:59 Maxim Zhukov
  2018-02-04 20:59 ` [PATCH 2/5] drivers: bluetooth: ath3k: do not init variables Maxim Zhukov
                   ` (3 more replies)
  0 siblings, 4 replies; 17+ messages in thread
From: Maxim Zhukov @ 2018-02-04 20:59 UTC (permalink / raw)
  To: marcel; +Cc: johan.hedberg, linux-bluetooth, linux-kernel, Maxim Zhukov

Replaced the numbers with a readable define.

Signed-off-by: Maxim Zhukov <mussitantesmortem@gmail.com>
---
 drivers/bluetooth/ath3k.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/bluetooth/ath3k.c b/drivers/bluetooth/ath3k.c
index 204afe66de92..0a5cfea44529 100644
--- a/drivers/bluetooth/ath3k.c
+++ b/drivers/bluetooth/ath3k.c
@@ -227,15 +227,16 @@ static int ath3k_load_firmware(struct usb_device *udev,
 		return -ENOMEM;
 	}
 
-	memcpy(send_buf, firmware->data, 20);
+	memcpy(send_buf, firmware->data, FW_HDR_SIZE);
 	err = usb_control_msg(udev, pipe, USB_REQ_DFU_DNLOAD, USB_TYPE_VENDOR,
-			      0, 0, send_buf, 20, USB_CTRL_SET_TIMEOUT);
+			      0, 0, send_buf, FW_HDR_SIZE,
+			      USB_CTRL_SET_TIMEOUT);
 	if (err < 0) {
 		BT_ERR("Can't change to loading configuration err");
 		goto error;
 	}
-	sent += 20;
-	count -= 20;
+	sent += FW_HDR_SIZE;
+	count -= FW_HDR_SIZE;
 
 	pipe = usb_sndbulkpipe(udev, 0x02);
 
-- 
2.16.1

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

* [PATCH 2/5] drivers: bluetooth: ath3k: do not init variables
  2018-02-04 20:59 [PATCH 1/5] drivers: bluetooth: ath3k: replace hardcode numbers with define Maxim Zhukov
@ 2018-02-04 20:59 ` Maxim Zhukov
  2018-02-04 20:59 ` [PATCH 3/5] drivers: bluetooth: ath3k: remove blank line after if Maxim Zhukov
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 17+ messages in thread
From: Maxim Zhukov @ 2018-02-04 20:59 UTC (permalink / raw)
  To: marcel; +Cc: johan.hedberg, linux-bluetooth, linux-kernel, Maxim Zhukov

Do not need to initialize variables, because further on the code they
fall into the snprintf.

Signed-off-by: Maxim Zhukov <mussitantesmortem@gmail.com>
---
 drivers/bluetooth/ath3k.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/bluetooth/ath3k.c b/drivers/bluetooth/ath3k.c
index 0a5cfea44529..b16c01a0b6d4 100644
--- a/drivers/bluetooth/ath3k.c
+++ b/drivers/bluetooth/ath3k.c
@@ -399,7 +399,7 @@ static int ath3k_set_normal_mode(struct usb_device *udev)
 static int ath3k_load_patch(struct usb_device *udev)
 {
 	unsigned char fw_state;
-	char filename[ATH3K_NAME_LEN] = {0};
+	char filename[ATH3K_NAME_LEN];
 	const struct firmware *firmware;
 	struct ath3k_version fw_version;
 	__u32 pt_rom_version, pt_build_version;
@@ -452,7 +452,7 @@ static int ath3k_load_patch(struct usb_device *udev)
 static int ath3k_load_syscfg(struct usb_device *udev)
 {
 	unsigned char fw_state;
-	char filename[ATH3K_NAME_LEN] = {0};
+	char filename[ATH3K_NAME_LEN];
 	const struct firmware *firmware;
 	struct ath3k_version fw_version;
 	int clk_value, ret;
-- 
2.16.1

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

* [PATCH 3/5] drivers: bluetooth: ath3k: remove blank line after if
  2018-02-04 20:59 [PATCH 1/5] drivers: bluetooth: ath3k: replace hardcode numbers with define Maxim Zhukov
  2018-02-04 20:59 ` [PATCH 2/5] drivers: bluetooth: ath3k: do not init variables Maxim Zhukov
@ 2018-02-04 20:59 ` Maxim Zhukov
  2018-02-04 20:59 ` [PATCH 4/5] drivers: bluetooth: ath3k: Fix warning: quoted string split across lines Maxim Zhukov
  2018-02-04 20:59 ` [PATCH 5/5] drivers: bluetooth: ath3k: fix Maxim Zhukov
  3 siblings, 0 replies; 17+ messages in thread
From: Maxim Zhukov @ 2018-02-04 20:59 UTC (permalink / raw)
  To: marcel; +Cc: johan.hedberg, linux-bluetooth, linux-kernel, Maxim Zhukov

Removed blank line after if.

Signed-off-by: Maxim Zhukov <mussitantesmortem@gmail.com>
---
 drivers/bluetooth/ath3k.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/bluetooth/ath3k.c b/drivers/bluetooth/ath3k.c
index b16c01a0b6d4..4df5b953a40d 100644
--- a/drivers/bluetooth/ath3k.c
+++ b/drivers/bluetooth/ath3k.c
@@ -523,7 +523,6 @@ static int ath3k_probe(struct usb_interface *intf,
 
 	/* load patch and sysconfig files for AR3012 */
 	if (id->driver_info & BTUSB_ATH3012) {
-
 		/* New firmware with patch and sysconfig files already loaded */
 		if (le16_to_cpu(udev->descriptor.bcdDevice) > 0x0001)
 			return -ENODEV;
-- 
2.16.1

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

* [PATCH 4/5] drivers: bluetooth: ath3k: Fix warning: quoted string split across lines
  2018-02-04 20:59 [PATCH 1/5] drivers: bluetooth: ath3k: replace hardcode numbers with define Maxim Zhukov
  2018-02-04 20:59 ` [PATCH 2/5] drivers: bluetooth: ath3k: do not init variables Maxim Zhukov
  2018-02-04 20:59 ` [PATCH 3/5] drivers: bluetooth: ath3k: remove blank line after if Maxim Zhukov
@ 2018-02-04 20:59 ` Maxim Zhukov
  2018-02-04 21:06   ` [PATCH 1/5] drivers: bluetooth: ath3k: replace hardcode numbers with define Maxim Zhukov
  2018-02-04 21:09   ` [PATCH v2 0/5] lite fixes for ath3k Maxim Zhukov
  2018-02-04 20:59 ` [PATCH 5/5] drivers: bluetooth: ath3k: fix Maxim Zhukov
  3 siblings, 2 replies; 17+ messages in thread
From: Maxim Zhukov @ 2018-02-04 20:59 UTC (permalink / raw)
  To: marcel; +Cc: johan.hedberg, linux-bluetooth, linux-kernel, Maxim Zhukov

This patch avoided the warning:
WARNING: quoted string split across lines
 #355: FILE: drivers/bluetooth/ath3k.c:355:
 +			BT_ERR("Error in firmware loading err = %d,"
 +				"len = %d, size = %d", err, len, size);

This patch fix this issue.

Signed-off-by: Maxim Zhukov <mussitantesmortem@gmail.com>
---
 drivers/bluetooth/ath3k.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/bluetooth/ath3k.c b/drivers/bluetooth/ath3k.c
index 4df5b953a40d..8fe5ec4bb342 100644
--- a/drivers/bluetooth/ath3k.c
+++ b/drivers/bluetooth/ath3k.c
@@ -203,6 +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)
+{
+	BT_ERR("Error in firmware loading err = %d, len = %d, size = %d",
+			err, len, size);
+}
+
 #define USB_REQ_DFU_DNLOAD	1
 #define BULK_SIZE		4096
 #define FW_HDR_SIZE		20
@@ -251,8 +257,7 @@ static int ath3k_load_firmware(struct usb_device *udev,
 					&len, 3000);
 
 		if (err || (len != size)) {
-			BT_ERR("Error in firmware loading err = %d,"
-				"len = %d, size = %d", err, len, size);
+			ath3k_log_failed_loading(err, len, size);
 			goto error;
 		}
 
@@ -351,8 +356,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)) {
-			BT_ERR("Error in firmware loading err = %d,"
-				"len = %d, size = %d", err, len, size);
+			ath3k_log_failed_loading(err, len, size);
 			kfree(send_buf);
 			return err;
 		}
-- 
2.16.1

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

* [PATCH 5/5] drivers: bluetooth: ath3k: fix
  2018-02-04 20:59 [PATCH 1/5] drivers: bluetooth: ath3k: replace hardcode numbers with define Maxim Zhukov
                   ` (2 preceding siblings ...)
  2018-02-04 20:59 ` [PATCH 4/5] drivers: bluetooth: ath3k: Fix warning: quoted string split across lines Maxim Zhukov
@ 2018-02-04 20:59 ` Maxim Zhukov
  3 siblings, 0 replies; 17+ messages in thread
From: Maxim Zhukov @ 2018-02-04 20:59 UTC (permalink / raw)
  To: marcel; +Cc: johan.hedberg, linux-bluetooth, linux-kernel, Maxim Zhukov

This patch fixed warning:
 WARNING: Prefer using '"%s...", __func__' to using 'ath3k_disconnect', this function's name, in a string
 #568: FILE: drivers/bluetooth/ath3k.c:568:
 +	BT_DBG("ath3k_disconnect intf %p", intf);

Signed-off-by: Maxim Zhukov <mussitantesmortem@gmail.com>
---
 drivers/bluetooth/ath3k.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/bluetooth/ath3k.c b/drivers/bluetooth/ath3k.c
index 8fe5ec4bb342..3d7a5c149af3 100644
--- a/drivers/bluetooth/ath3k.c
+++ b/drivers/bluetooth/ath3k.c
@@ -569,7 +569,7 @@ static int ath3k_probe(struct usb_interface *intf,
 
 static void ath3k_disconnect(struct usb_interface *intf)
 {
-	BT_DBG("ath3k_disconnect intf %p", intf);
+	BT_DBG("%s intf %p", __func__, intf);
 }
 
 static struct usb_driver ath3k_driver = {
-- 
2.16.1

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

* [PATCH 1/5] drivers: bluetooth: ath3k: replace hardcode numbers with define
  2018-02-04 20:59 ` [PATCH 4/5] drivers: bluetooth: ath3k: Fix warning: quoted string split across lines Maxim Zhukov
@ 2018-02-04 21:06   ` Maxim Zhukov
  2018-02-04 21:06     ` [PATCH 2/5] drivers: bluetooth: ath3k: do not init variables Maxim Zhukov
                       ` (3 more replies)
  2018-02-04 21:09   ` [PATCH v2 0/5] lite fixes for ath3k Maxim Zhukov
  1 sibling, 4 replies; 17+ messages in thread
From: Maxim Zhukov @ 2018-02-04 21:06 UTC (permalink / raw)
  To: marcel; +Cc: johan.hedberg, linux-bluetooth, linux-kernel, Maxim Zhukov

Replaced the numbers with a readable define.

Signed-off-by: Maxim Zhukov <mussitantesmortem@gmail.com>
---
 drivers/bluetooth/ath3k.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/bluetooth/ath3k.c b/drivers/bluetooth/ath3k.c
index 204afe66de92..0a5cfea44529 100644
--- a/drivers/bluetooth/ath3k.c
+++ b/drivers/bluetooth/ath3k.c
@@ -227,15 +227,16 @@ static int ath3k_load_firmware(struct usb_device *udev,
 		return -ENOMEM;
 	}
 
-	memcpy(send_buf, firmware->data, 20);
+	memcpy(send_buf, firmware->data, FW_HDR_SIZE);
 	err = usb_control_msg(udev, pipe, USB_REQ_DFU_DNLOAD, USB_TYPE_VENDOR,
-			      0, 0, send_buf, 20, USB_CTRL_SET_TIMEOUT);
+			      0, 0, send_buf, FW_HDR_SIZE,
+			      USB_CTRL_SET_TIMEOUT);
 	if (err < 0) {
 		BT_ERR("Can't change to loading configuration err");
 		goto error;
 	}
-	sent += 20;
-	count -= 20;
+	sent += FW_HDR_SIZE;
+	count -= FW_HDR_SIZE;
 
 	pipe = usb_sndbulkpipe(udev, 0x02);
 
-- 
2.16.1

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

* [PATCH 2/5] drivers: bluetooth: ath3k: do not init variables
  2018-02-04 21:06   ` [PATCH 1/5] drivers: bluetooth: ath3k: replace hardcode numbers with define Maxim Zhukov
@ 2018-02-04 21:06     ` Maxim Zhukov
  2018-02-04 21:06     ` [PATCH 3/5] drivers: bluetooth: ath3k: remove blank line after if Maxim Zhukov
                       ` (2 subsequent siblings)
  3 siblings, 0 replies; 17+ messages in thread
From: Maxim Zhukov @ 2018-02-04 21:06 UTC (permalink / raw)
  To: marcel; +Cc: johan.hedberg, linux-bluetooth, linux-kernel, Maxim Zhukov

Do not need to initialize variables, because further on the code they
fall into the snprintf.

Signed-off-by: Maxim Zhukov <mussitantesmortem@gmail.com>
---
 drivers/bluetooth/ath3k.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/bluetooth/ath3k.c b/drivers/bluetooth/ath3k.c
index 0a5cfea44529..b16c01a0b6d4 100644
--- a/drivers/bluetooth/ath3k.c
+++ b/drivers/bluetooth/ath3k.c
@@ -399,7 +399,7 @@ static int ath3k_set_normal_mode(struct usb_device *udev)
 static int ath3k_load_patch(struct usb_device *udev)
 {
 	unsigned char fw_state;
-	char filename[ATH3K_NAME_LEN] = {0};
+	char filename[ATH3K_NAME_LEN];
 	const struct firmware *firmware;
 	struct ath3k_version fw_version;
 	__u32 pt_rom_version, pt_build_version;
@@ -452,7 +452,7 @@ static int ath3k_load_patch(struct usb_device *udev)
 static int ath3k_load_syscfg(struct usb_device *udev)
 {
 	unsigned char fw_state;
-	char filename[ATH3K_NAME_LEN] = {0};
+	char filename[ATH3K_NAME_LEN];
 	const struct firmware *firmware;
 	struct ath3k_version fw_version;
 	int clk_value, ret;
-- 
2.16.1

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

* [PATCH 3/5] drivers: bluetooth: ath3k: remove blank line after if
  2018-02-04 21:06   ` [PATCH 1/5] drivers: bluetooth: ath3k: replace hardcode numbers with define Maxim Zhukov
  2018-02-04 21:06     ` [PATCH 2/5] drivers: bluetooth: ath3k: do not init variables Maxim Zhukov
@ 2018-02-04 21:06     ` Maxim Zhukov
  2018-02-04 21:06     ` [PATCH 4/5] drivers: bluetooth: ath3k: Fix warning: quoted string split across lines Maxim Zhukov
  2018-02-04 21:06     ` [PATCH 5/5] drivers: bluetooth: ath3k: fix checkpatch warning Maxim Zhukov
  3 siblings, 0 replies; 17+ messages in thread
From: Maxim Zhukov @ 2018-02-04 21:06 UTC (permalink / raw)
  To: marcel; +Cc: johan.hedberg, linux-bluetooth, linux-kernel, Maxim Zhukov

Removed blank line after if.

Signed-off-by: Maxim Zhukov <mussitantesmortem@gmail.com>
---
 drivers/bluetooth/ath3k.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/bluetooth/ath3k.c b/drivers/bluetooth/ath3k.c
index b16c01a0b6d4..4df5b953a40d 100644
--- a/drivers/bluetooth/ath3k.c
+++ b/drivers/bluetooth/ath3k.c
@@ -523,7 +523,6 @@ static int ath3k_probe(struct usb_interface *intf,
 
 	/* load patch and sysconfig files for AR3012 */
 	if (id->driver_info & BTUSB_ATH3012) {
-
 		/* New firmware with patch and sysconfig files already loaded */
 		if (le16_to_cpu(udev->descriptor.bcdDevice) > 0x0001)
 			return -ENODEV;
-- 
2.16.1

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

* [PATCH 4/5] drivers: bluetooth: ath3k: Fix warning: quoted string split across lines
  2018-02-04 21:06   ` [PATCH 1/5] drivers: bluetooth: ath3k: replace hardcode numbers with define Maxim Zhukov
  2018-02-04 21:06     ` [PATCH 2/5] drivers: bluetooth: ath3k: do not init variables Maxim Zhukov
  2018-02-04 21:06     ` [PATCH 3/5] drivers: bluetooth: ath3k: remove blank line after if Maxim Zhukov
@ 2018-02-04 21:06     ` Maxim Zhukov
  2018-02-04 21:06     ` [PATCH 5/5] drivers: bluetooth: ath3k: fix checkpatch warning Maxim Zhukov
  3 siblings, 0 replies; 17+ messages in thread
From: Maxim Zhukov @ 2018-02-04 21:06 UTC (permalink / raw)
  To: marcel; +Cc: johan.hedberg, linux-bluetooth, linux-kernel, Maxim Zhukov

This patch avoided the warning:
WARNING: quoted string split across lines
 #355: FILE: drivers/bluetooth/ath3k.c:355:
 +			BT_ERR("Error in firmware loading err = %d,"
 +				"len = %d, size = %d", err, len, size);

This patch fix this issue.

Signed-off-by: Maxim Zhukov <mussitantesmortem@gmail.com>
---
 drivers/bluetooth/ath3k.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/bluetooth/ath3k.c b/drivers/bluetooth/ath3k.c
index 4df5b953a40d..8fe5ec4bb342 100644
--- a/drivers/bluetooth/ath3k.c
+++ b/drivers/bluetooth/ath3k.c
@@ -203,6 +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)
+{
+	BT_ERR("Error in firmware loading err = %d, len = %d, size = %d",
+			err, len, size);
+}
+
 #define USB_REQ_DFU_DNLOAD	1
 #define BULK_SIZE		4096
 #define FW_HDR_SIZE		20
@@ -251,8 +257,7 @@ static int ath3k_load_firmware(struct usb_device *udev,
 					&len, 3000);
 
 		if (err || (len != size)) {
-			BT_ERR("Error in firmware loading err = %d,"
-				"len = %d, size = %d", err, len, size);
+			ath3k_log_failed_loading(err, len, size);
 			goto error;
 		}
 
@@ -351,8 +356,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)) {
-			BT_ERR("Error in firmware loading err = %d,"
-				"len = %d, size = %d", err, len, size);
+			ath3k_log_failed_loading(err, len, size);
 			kfree(send_buf);
 			return err;
 		}
-- 
2.16.1

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

* [PATCH 5/5] drivers: bluetooth: ath3k: fix checkpatch warning
  2018-02-04 21:06   ` [PATCH 1/5] drivers: bluetooth: ath3k: replace hardcode numbers with define Maxim Zhukov
                       ` (2 preceding siblings ...)
  2018-02-04 21:06     ` [PATCH 4/5] drivers: bluetooth: ath3k: Fix warning: quoted string split across lines Maxim Zhukov
@ 2018-02-04 21:06     ` Maxim Zhukov
  3 siblings, 0 replies; 17+ messages in thread
From: Maxim Zhukov @ 2018-02-04 21:06 UTC (permalink / raw)
  To: marcel; +Cc: johan.hedberg, linux-bluetooth, linux-kernel, Maxim Zhukov

This patch fixed warning:
 WARNING: Prefer using '"%s...", __func__' to using 'ath3k_disconnect', this function's name, in a string
 #568: FILE: drivers/bluetooth/ath3k.c:568:
 +	BT_DBG("ath3k_disconnect intf %p", intf);

Signed-off-by: Maxim Zhukov <mussitantesmortem@gmail.com>
---
 drivers/bluetooth/ath3k.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/bluetooth/ath3k.c b/drivers/bluetooth/ath3k.c
index 8fe5ec4bb342..3d7a5c149af3 100644
--- a/drivers/bluetooth/ath3k.c
+++ b/drivers/bluetooth/ath3k.c
@@ -569,7 +569,7 @@ static int ath3k_probe(struct usb_interface *intf,
 
 static void ath3k_disconnect(struct usb_interface *intf)
 {
-	BT_DBG("ath3k_disconnect intf %p", intf);
+	BT_DBG("%s intf %p", __func__, intf);
 }
 
 static struct usb_driver ath3k_driver = {
-- 
2.16.1

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

* [PATCH v2 0/5] lite fixes for ath3k
  2018-02-04 20:59 ` [PATCH 4/5] drivers: bluetooth: ath3k: Fix warning: quoted string split across lines Maxim Zhukov
  2018-02-04 21:06   ` [PATCH 1/5] drivers: bluetooth: ath3k: replace hardcode numbers with define Maxim Zhukov
@ 2018-02-04 21:09   ` Maxim Zhukov
  2018-02-04 21:09     ` [PATCH v2 1/5] drivers: bluetooth: ath3k: replace hardcode numbers with define Maxim Zhukov
                       ` (5 more replies)
  1 sibling, 6 replies; 17+ messages in thread
From: Maxim Zhukov @ 2018-02-04 21:09 UTC (permalink / raw)
  To: marcel; +Cc: johan.hedberg, linux-bluetooth, linux-kernel, Maxim Zhukov

Sorry for the last series of patches

Maxim Zhukov (5):
  drivers: bluetooth: ath3k: replace hardcode numbers with define
  drivers: bluetooth: ath3k: do not init variables
  drivers: bluetooth: ath3k: remove blank line after if
  drivers: bluetooth: ath3k: Fix warning: quoted string split across lines
  drivers: bluetooth: ath3k: fix checkpatch warning

 drivers/bluetooth/ath3k.c | 28 ++++++++++++++++------------
 1 file changed, 16 insertions(+), 12 deletions(-)

-- 
2.16.1

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

* [PATCH v2 1/5] drivers: bluetooth: ath3k: replace hardcode numbers with define
  2018-02-04 21:09   ` [PATCH v2 0/5] lite fixes for ath3k Maxim Zhukov
@ 2018-02-04 21:09     ` Maxim Zhukov
  2018-02-04 21:09     ` [PATCH v2 2/5] drivers: bluetooth: ath3k: do not init variables Maxim Zhukov
                       ` (4 subsequent siblings)
  5 siblings, 0 replies; 17+ messages in thread
From: Maxim Zhukov @ 2018-02-04 21:09 UTC (permalink / raw)
  To: marcel; +Cc: johan.hedberg, linux-bluetooth, linux-kernel, Maxim Zhukov

Replaced the numbers with a readable define.

Signed-off-by: Maxim Zhukov <mussitantesmortem@gmail.com>
---
 drivers/bluetooth/ath3k.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/bluetooth/ath3k.c b/drivers/bluetooth/ath3k.c
index 204afe66de92..0a5cfea44529 100644
--- a/drivers/bluetooth/ath3k.c
+++ b/drivers/bluetooth/ath3k.c
@@ -227,15 +227,16 @@ static int ath3k_load_firmware(struct usb_device *udev,
 		return -ENOMEM;
 	}
 
-	memcpy(send_buf, firmware->data, 20);
+	memcpy(send_buf, firmware->data, FW_HDR_SIZE);
 	err = usb_control_msg(udev, pipe, USB_REQ_DFU_DNLOAD, USB_TYPE_VENDOR,
-			      0, 0, send_buf, 20, USB_CTRL_SET_TIMEOUT);
+			      0, 0, send_buf, FW_HDR_SIZE,
+			      USB_CTRL_SET_TIMEOUT);
 	if (err < 0) {
 		BT_ERR("Can't change to loading configuration err");
 		goto error;
 	}
-	sent += 20;
-	count -= 20;
+	sent += FW_HDR_SIZE;
+	count -= FW_HDR_SIZE;
 
 	pipe = usb_sndbulkpipe(udev, 0x02);
 
-- 
2.16.1

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

* [PATCH v2 2/5] drivers: bluetooth: ath3k: do not init variables
  2018-02-04 21:09   ` [PATCH v2 0/5] lite fixes for ath3k Maxim Zhukov
  2018-02-04 21:09     ` [PATCH v2 1/5] drivers: bluetooth: ath3k: replace hardcode numbers with define Maxim Zhukov
@ 2018-02-04 21:09     ` Maxim Zhukov
  2018-02-04 21:09     ` [PATCH v2 3/5] drivers: bluetooth: ath3k: remove blank line after if Maxim Zhukov
                       ` (3 subsequent siblings)
  5 siblings, 0 replies; 17+ messages in thread
From: Maxim Zhukov @ 2018-02-04 21:09 UTC (permalink / raw)
  To: marcel; +Cc: johan.hedberg, linux-bluetooth, linux-kernel, Maxim Zhukov

Do not need to initialize variables, because further on the code they
fall into the snprintf.

Signed-off-by: Maxim Zhukov <mussitantesmortem@gmail.com>
---
 drivers/bluetooth/ath3k.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/bluetooth/ath3k.c b/drivers/bluetooth/ath3k.c
index 0a5cfea44529..b16c01a0b6d4 100644
--- a/drivers/bluetooth/ath3k.c
+++ b/drivers/bluetooth/ath3k.c
@@ -399,7 +399,7 @@ static int ath3k_set_normal_mode(struct usb_device *udev)
 static int ath3k_load_patch(struct usb_device *udev)
 {
 	unsigned char fw_state;
-	char filename[ATH3K_NAME_LEN] = {0};
+	char filename[ATH3K_NAME_LEN];
 	const struct firmware *firmware;
 	struct ath3k_version fw_version;
 	__u32 pt_rom_version, pt_build_version;
@@ -452,7 +452,7 @@ static int ath3k_load_patch(struct usb_device *udev)
 static int ath3k_load_syscfg(struct usb_device *udev)
 {
 	unsigned char fw_state;
-	char filename[ATH3K_NAME_LEN] = {0};
+	char filename[ATH3K_NAME_LEN];
 	const struct firmware *firmware;
 	struct ath3k_version fw_version;
 	int clk_value, ret;
-- 
2.16.1

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

* [PATCH v2 3/5] drivers: bluetooth: ath3k: remove blank line after if
  2018-02-04 21:09   ` [PATCH v2 0/5] lite fixes for ath3k Maxim Zhukov
  2018-02-04 21:09     ` [PATCH v2 1/5] drivers: bluetooth: ath3k: replace hardcode numbers with define Maxim Zhukov
  2018-02-04 21:09     ` [PATCH v2 2/5] drivers: bluetooth: ath3k: do not init variables Maxim Zhukov
@ 2018-02-04 21:09     ` Maxim Zhukov
  2018-02-04 21:09     ` [PATCH v2 4/5] drivers: bluetooth: ath3k: Fix warning: quoted string split across lines Maxim Zhukov
                       ` (2 subsequent siblings)
  5 siblings, 0 replies; 17+ messages in thread
From: Maxim Zhukov @ 2018-02-04 21:09 UTC (permalink / raw)
  To: marcel; +Cc: johan.hedberg, linux-bluetooth, linux-kernel, Maxim Zhukov

Removed blank line after if.

Signed-off-by: Maxim Zhukov <mussitantesmortem@gmail.com>
---
 drivers/bluetooth/ath3k.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/bluetooth/ath3k.c b/drivers/bluetooth/ath3k.c
index b16c01a0b6d4..4df5b953a40d 100644
--- a/drivers/bluetooth/ath3k.c
+++ b/drivers/bluetooth/ath3k.c
@@ -523,7 +523,6 @@ static int ath3k_probe(struct usb_interface *intf,
 
 	/* load patch and sysconfig files for AR3012 */
 	if (id->driver_info & BTUSB_ATH3012) {
-
 		/* New firmware with patch and sysconfig files already loaded */
 		if (le16_to_cpu(udev->descriptor.bcdDevice) > 0x0001)
 			return -ENODEV;
-- 
2.16.1

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

* [PATCH v2 4/5] drivers: bluetooth: ath3k: Fix warning: quoted string split across lines
  2018-02-04 21:09   ` [PATCH v2 0/5] lite fixes for ath3k Maxim Zhukov
                       ` (2 preceding siblings ...)
  2018-02-04 21:09     ` [PATCH v2 3/5] drivers: bluetooth: ath3k: remove blank line after if Maxim Zhukov
@ 2018-02-04 21:09     ` Maxim Zhukov
  2018-02-04 21:09     ` [PATCH v2 5/5] drivers: bluetooth: ath3k: fix checkpatch warning Maxim Zhukov
  2018-02-07  8:55     ` [PATCH v2 0/5] lite fixes for ath3k Marcel Holtmann
  5 siblings, 0 replies; 17+ messages in thread
From: Maxim Zhukov @ 2018-02-04 21:09 UTC (permalink / raw)
  To: marcel; +Cc: johan.hedberg, linux-bluetooth, linux-kernel, Maxim Zhukov

This patch avoided the warning:
WARNING: quoted string split across lines
 #355: FILE: drivers/bluetooth/ath3k.c:355:
 +			BT_ERR("Error in firmware loading err = %d,"
 +				"len = %d, size = %d", err, len, size);

This patch fix this issue.

Signed-off-by: Maxim Zhukov <mussitantesmortem@gmail.com>
---
 drivers/bluetooth/ath3k.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/bluetooth/ath3k.c b/drivers/bluetooth/ath3k.c
index 4df5b953a40d..8fe5ec4bb342 100644
--- a/drivers/bluetooth/ath3k.c
+++ b/drivers/bluetooth/ath3k.c
@@ -203,6 +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)
+{
+	BT_ERR("Error in firmware loading err = %d, len = %d, size = %d",
+			err, len, size);
+}
+
 #define USB_REQ_DFU_DNLOAD	1
 #define BULK_SIZE		4096
 #define FW_HDR_SIZE		20
@@ -251,8 +257,7 @@ static int ath3k_load_firmware(struct usb_device *udev,
 					&len, 3000);
 
 		if (err || (len != size)) {
-			BT_ERR("Error in firmware loading err = %d,"
-				"len = %d, size = %d", err, len, size);
+			ath3k_log_failed_loading(err, len, size);
 			goto error;
 		}
 
@@ -351,8 +356,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)) {
-			BT_ERR("Error in firmware loading err = %d,"
-				"len = %d, size = %d", err, len, size);
+			ath3k_log_failed_loading(err, len, size);
 			kfree(send_buf);
 			return err;
 		}
-- 
2.16.1

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

* [PATCH v2 5/5] drivers: bluetooth: ath3k: fix checkpatch warning
  2018-02-04 21:09   ` [PATCH v2 0/5] lite fixes for ath3k Maxim Zhukov
                       ` (3 preceding siblings ...)
  2018-02-04 21:09     ` [PATCH v2 4/5] drivers: bluetooth: ath3k: Fix warning: quoted string split across lines Maxim Zhukov
@ 2018-02-04 21:09     ` Maxim Zhukov
  2018-02-07  8:55     ` [PATCH v2 0/5] lite fixes for ath3k Marcel Holtmann
  5 siblings, 0 replies; 17+ messages in thread
From: Maxim Zhukov @ 2018-02-04 21:09 UTC (permalink / raw)
  To: marcel; +Cc: johan.hedberg, linux-bluetooth, linux-kernel, Maxim Zhukov

This patch fixed warning:
 WARNING: Prefer using '"%s...", __func__' to using 'ath3k_disconnect', this function's name, in a string
 #568: FILE: drivers/bluetooth/ath3k.c:568:
 +	BT_DBG("ath3k_disconnect intf %p", intf);

Signed-off-by: Maxim Zhukov <mussitantesmortem@gmail.com>
---
 drivers/bluetooth/ath3k.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/bluetooth/ath3k.c b/drivers/bluetooth/ath3k.c
index 8fe5ec4bb342..3d7a5c149af3 100644
--- a/drivers/bluetooth/ath3k.c
+++ b/drivers/bluetooth/ath3k.c
@@ -569,7 +569,7 @@ static int ath3k_probe(struct usb_interface *intf,
 
 static void ath3k_disconnect(struct usb_interface *intf)
 {
-	BT_DBG("ath3k_disconnect intf %p", intf);
+	BT_DBG("%s intf %p", __func__, intf);
 }
 
 static struct usb_driver ath3k_driver = {
-- 
2.16.1

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

* Re: [PATCH v2 0/5] lite fixes for ath3k
  2018-02-04 21:09   ` [PATCH v2 0/5] lite fixes for ath3k Maxim Zhukov
                       ` (4 preceding siblings ...)
  2018-02-04 21:09     ` [PATCH v2 5/5] drivers: bluetooth: ath3k: fix checkpatch warning Maxim Zhukov
@ 2018-02-07  8:55     ` Marcel Holtmann
  5 siblings, 0 replies; 17+ messages in thread
From: Marcel Holtmann @ 2018-02-07  8:55 UTC (permalink / raw)
  To: Maxim Zhukov; +Cc: Johan Hedberg, Bluez mailing list, Linux Kernel Mailing List

Hi Maxim,

> Sorry for the last series of patches
> 
> Maxim Zhukov (5):
>  drivers: bluetooth: ath3k: replace hardcode numbers with define
>  drivers: bluetooth: ath3k: do not init variables
>  drivers: bluetooth: ath3k: remove blank line after if
>  drivers: bluetooth: ath3k: Fix warning: quoted string split across lines
>  drivers: bluetooth: ath3k: fix checkpatch warning
> 
> drivers/bluetooth/ath3k.c | 28 ++++++++++++++++------------
> 1 file changed, 16 insertions(+), 12 deletions(-)

all 5 patches have been applied to bluetooth-next tree.

Regards

Marcel

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

end of thread, other threads:[~2018-02-07  8:55 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-04 20:59 [PATCH 1/5] drivers: bluetooth: ath3k: replace hardcode numbers with define Maxim Zhukov
2018-02-04 20:59 ` [PATCH 2/5] drivers: bluetooth: ath3k: do not init variables Maxim Zhukov
2018-02-04 20:59 ` [PATCH 3/5] drivers: bluetooth: ath3k: remove blank line after if Maxim Zhukov
2018-02-04 20:59 ` [PATCH 4/5] drivers: bluetooth: ath3k: Fix warning: quoted string split across lines Maxim Zhukov
2018-02-04 21:06   ` [PATCH 1/5] drivers: bluetooth: ath3k: replace hardcode numbers with define Maxim Zhukov
2018-02-04 21:06     ` [PATCH 2/5] drivers: bluetooth: ath3k: do not init variables Maxim Zhukov
2018-02-04 21:06     ` [PATCH 3/5] drivers: bluetooth: ath3k: remove blank line after if Maxim Zhukov
2018-02-04 21:06     ` [PATCH 4/5] drivers: bluetooth: ath3k: Fix warning: quoted string split across lines Maxim Zhukov
2018-02-04 21:06     ` [PATCH 5/5] drivers: bluetooth: ath3k: fix checkpatch warning Maxim Zhukov
2018-02-04 21:09   ` [PATCH v2 0/5] lite fixes for ath3k Maxim Zhukov
2018-02-04 21:09     ` [PATCH v2 1/5] drivers: bluetooth: ath3k: replace hardcode numbers with define Maxim Zhukov
2018-02-04 21:09     ` [PATCH v2 2/5] drivers: bluetooth: ath3k: do not init variables Maxim Zhukov
2018-02-04 21:09     ` [PATCH v2 3/5] drivers: bluetooth: ath3k: remove blank line after if Maxim Zhukov
2018-02-04 21:09     ` [PATCH v2 4/5] drivers: bluetooth: ath3k: Fix warning: quoted string split across lines Maxim Zhukov
2018-02-04 21:09     ` [PATCH v2 5/5] drivers: bluetooth: ath3k: fix checkpatch warning Maxim Zhukov
2018-02-07  8:55     ` [PATCH v2 0/5] lite fixes for ath3k Marcel Holtmann
2018-02-04 20:59 ` [PATCH 5/5] drivers: bluetooth: ath3k: fix Maxim Zhukov

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.