* [PATCH] Bluetooth: bfusb: Updated code to follow style guide @ 2024-03-08 16:20 Ayaan Mirza Baig 2024-03-08 16:43 ` bluez.test.bot 2024-03-08 18:08 ` [PATCH] Bluetooth: bfusb: Updated code to follow style guide Joe Perches 0 siblings, 2 replies; 5+ messages in thread From: Ayaan Mirza Baig @ 2024-03-08 16:20 UTC (permalink / raw) To: marcel, luiz.dentz; +Cc: Ayaan Mirza Baig, linux-bluetooth, linux-kernel Added indendations, removed trailing spaces, added empty lines after declaration. Fixed Warnings with checkpatch Signed-off-by: Ayaan Mirza Baig <ayaanmirza.788@gmail.com> --- drivers/bluetooth/bfusb.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/bluetooth/bfusb.c b/drivers/bluetooth/bfusb.c index cab93935cc7f..08beae26e345 100644 --- a/drivers/bluetooth/bfusb.c +++ b/drivers/bluetooth/bfusb.c @@ -275,6 +275,7 @@ static inline int bfusb_recv_block(struct bfusb_data *data, int hdr, unsigned ch case HCI_EVENT_PKT: if (len >= HCI_EVENT_HDR_SIZE) { struct hci_event_hdr *hdr = (struct hci_event_hdr *) buf; + pkt_len = HCI_EVENT_HDR_SIZE + hdr->plen; } else { bt_dev_err(data->hdev, "event block is too short"); @@ -285,6 +286,7 @@ static inline int bfusb_recv_block(struct bfusb_data *data, int hdr, unsigned ch case HCI_ACLDATA_PKT: if (len >= HCI_ACL_HDR_SIZE) { struct hci_acl_hdr *hdr = (struct hci_acl_hdr *) buf; + pkt_len = HCI_ACL_HDR_SIZE + __le16_to_cpu(hdr->dlen); } else { bt_dev_err(data->hdev, "data block is too short"); @@ -295,6 +297,7 @@ static inline int bfusb_recv_block(struct bfusb_data *data, int hdr, unsigned ch case HCI_SCODATA_PKT: if (len >= HCI_SCO_HDR_SIZE) { struct hci_sco_hdr *hdr = (struct hci_sco_hdr *) buf; + pkt_len = HCI_SCO_HDR_SIZE + hdr->dlen; } else { bt_dev_err(data->hdev, "audio block is too short"); @@ -365,9 +368,8 @@ static void bfusb_rx_complete(struct urb *urb) buf += 3; } - if (count < len) { + if (count < len) bt_dev_err(data->hdev, "block extends over URB buffer ranges"); - } if ((hdr & 0xe1) == 0xc1) bfusb_recv_block(data, hdr, buf, len); -- 2.34.1 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* RE: Bluetooth: bfusb: Updated code to follow style guide 2024-03-08 16:20 [PATCH] Bluetooth: bfusb: Updated code to follow style guide Ayaan Mirza Baig @ 2024-03-08 16:43 ` bluez.test.bot 2024-03-08 18:03 ` [PATCH] Bluetooth: bfusb: corrected mistakes in previous commits Ayaan Mirza Baig 2024-03-08 18:08 ` [PATCH] Bluetooth: bfusb: Updated code to follow style guide Joe Perches 1 sibling, 1 reply; 5+ messages in thread From: bluez.test.bot @ 2024-03-08 16:43 UTC (permalink / raw) To: linux-bluetooth, ayaanmirza.788 [-- Attachment #1: Type: text/plain, Size: 2806 bytes --] This is automated email and please do not reply to this email! Dear submitter, Thank you for submitting the patches to the linux bluetooth mailing list. This is a CI test results with your patch series: PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=833841 ---Test result--- Test Summary: CheckPatch FAIL 0.89 seconds GitLint FAIL 0.48 seconds SubjectPrefix PASS 0.11 seconds BuildKernel PASS 27.03 seconds CheckAllWarning PASS 29.71 seconds CheckSparse PASS 34.77 seconds CheckSmatch PASS 96.15 seconds BuildKernel32 PASS 26.14 seconds TestRunnerSetup PASS 492.94 seconds TestRunner_l2cap-tester PASS 17.63 seconds TestRunner_iso-tester PASS 29.65 seconds TestRunner_bnep-tester PASS 4.62 seconds TestRunner_mgmt-tester PASS 105.66 seconds TestRunner_rfcomm-tester PASS 7.06 seconds TestRunner_sco-tester PASS 14.70 seconds TestRunner_ioctl-tester PASS 7.52 seconds TestRunner_mesh-tester PASS 5.61 seconds TestRunner_smp-tester PASS 7.15 seconds TestRunner_userchan-tester PASS 4.76 seconds IncrementalBuild PASS 25.17 seconds Details ############################## Test: CheckPatch - FAIL Desc: Run checkpatch.pl script Output: Bluetooth: bfusb: Updated code to follow style guide WARNING: Prefer a maximum 75 chars per line (possible unwrapped commit description?) #93: Added indendations, removed trailing spaces, added empty lines after declaration. total: 0 errors, 1 warnings, 31 lines checked NOTE: For some of the reported defects, checkpatch may be able to mechanically convert to the typical style using --fix or --fix-inplace. /github/workspace/src/src/13587034.patch has style problems, please review. NOTE: Ignored message types: UNKNOWN_COMMIT_ID NOTE: If any of the errors are false positives, please report them to the maintainer, see CHECKPATCH in MAINTAINERS. ############################## Test: GitLint - FAIL Desc: Run gitlint Output: Bluetooth: bfusb: Updated code to follow style guide WARNING: I3 - ignore-body-lines: gitlint will be switching from using Python regex 'match' (match beginning) to 'search' (match anywhere) semantics. Please review your ignore-body-lines.regex option accordingly. To remove this warning, set general.regex-style-search=True. More details: https://jorisroovers.github.io/gitlint/configuration/#regex-style-search 3: B1 Line exceeds max length (81>80): "Added indendations, removed trailing spaces, added empty lines after declaration." --- Regards, Linux Bluetooth ^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH] Bluetooth: bfusb: corrected mistakes in previous commits 2024-03-08 16:43 ` bluez.test.bot @ 2024-03-08 18:03 ` Ayaan Mirza Baig 2024-03-08 18:26 ` bluez.test.bot 0 siblings, 1 reply; 5+ messages in thread From: Ayaan Mirza Baig @ 2024-03-08 18:03 UTC (permalink / raw) To: marcel, luiz.dentz; +Cc: Ayaan Mirza Baig, linux-kernel, linux-bluetooth Left out some errors in previous commit Sending in newer patch fixing all style errors Signed-off-by: Ayaan Mirza Baig <ayaanmirza.788@gmail.com> --- drivers/bluetooth/bfusb.c | 51 ++++++++++++++++++++------------------- 1 file changed, 26 insertions(+), 25 deletions(-) diff --git a/drivers/bluetooth/bfusb.c b/drivers/bluetooth/bfusb.c index 08beae26e345..c97cf509b2e9 100644 --- a/drivers/bluetooth/bfusb.c +++ b/drivers/bluetooth/bfusb.c @@ -84,7 +84,7 @@ static struct urb *bfusb_get_completed(struct bfusb_data *data) skb = skb_dequeue(&data->completed_q); if (skb) { - urb = ((struct bfusb_data_scb *) skb->cb)->urb; + urb = ((struct bfusb_data_scb *)skb->cb)->urb; kfree_skb(skb); } @@ -99,7 +99,7 @@ static void bfusb_unlink_urbs(struct bfusb_data *data) BT_DBG("bfusb %p", data); while ((skb = skb_dequeue(&data->pending_q))) { - urb = ((struct bfusb_data_scb *) skb->cb)->urb; + urb = ((struct bfusb_data_scb *)skb->cb)->urb; usb_kill_urb(urb); skb_queue_tail(&data->completed_q, skb); } @@ -110,7 +110,7 @@ static void bfusb_unlink_urbs(struct bfusb_data *data) static int bfusb_send_bulk(struct bfusb_data *data, struct sk_buff *skb) { - struct bfusb_data_scb *scb = (void *) skb->cb; + struct bfusb_data_scb *scb = (void *)skb->cb; struct urb *urb = bfusb_get_completed(data); int err, pipe; @@ -125,7 +125,7 @@ static int bfusb_send_bulk(struct bfusb_data *data, struct sk_buff *skb) pipe = usb_sndbulkpipe(data->udev, data->bulk_out_ep); usb_fill_bulk_urb(urb, data->udev, pipe, skb->data, skb->len, - bfusb_tx_complete, skb); + bfusb_tx_complete, skb); scb->urb = urb; @@ -158,7 +158,7 @@ static void bfusb_tx_wakeup(struct bfusb_data *data) clear_bit(BFUSB_TX_WAKEUP, &data->state); while ((atomic_read(&data->pending_tx) < BFUSB_MAX_BULK_TX) && - (skb = skb_dequeue(&data->transmit_q))) { + (skb = skb_dequeue(&data->transmit_q))) { if (bfusb_send_bulk(data, skb) < 0) { skb_queue_head(&data->transmit_q, skb); break; @@ -172,8 +172,8 @@ static void bfusb_tx_wakeup(struct bfusb_data *data) static void bfusb_tx_complete(struct urb *urb) { - struct sk_buff *skb = (struct sk_buff *) urb->context; - struct bfusb_data *data = (struct bfusb_data *) skb->dev; + struct sk_buff *skb = (struct sk_buff *)urb->context; + struct bfusb_data *data = (struct bfusb_data *)skb->dev; BT_DBG("bfusb %p urb %p skb %p len %d", data, urb, skb, skb->len); @@ -197,7 +197,6 @@ static void bfusb_tx_complete(struct urb *urb) read_unlock(&data->lock); } - static int bfusb_rx_submit(struct bfusb_data *data, struct urb *urb) { struct bfusb_data_scb *scb; @@ -218,15 +217,15 @@ static int bfusb_rx_submit(struct bfusb_data *data, struct urb *urb) return -ENOMEM; } - skb->dev = (void *) data; + skb->dev = (void *)data; - scb = (struct bfusb_data_scb *) skb->cb; + scb = (struct bfusb_data_scb *)skb->cb; scb->urb = urb; pipe = usb_rcvbulkpipe(data->udev, data->bulk_in_ep); usb_fill_bulk_urb(urb, data->udev, pipe, skb->data, size, - bfusb_rx_complete, skb); + bfusb_rx_complete, skb); skb_queue_tail(&data->pending_q, skb); @@ -274,7 +273,7 @@ static inline int bfusb_recv_block(struct bfusb_data *data, int hdr, unsigned ch switch (pkt_type) { case HCI_EVENT_PKT: if (len >= HCI_EVENT_HDR_SIZE) { - struct hci_event_hdr *hdr = (struct hci_event_hdr *) buf; + struct hci_event_hdr *hdr = (struct hci_event_hdr *)buf; pkt_len = HCI_EVENT_HDR_SIZE + hdr->plen; } else { @@ -285,7 +284,7 @@ static inline int bfusb_recv_block(struct bfusb_data *data, int hdr, unsigned ch case HCI_ACLDATA_PKT: if (len >= HCI_ACL_HDR_SIZE) { - struct hci_acl_hdr *hdr = (struct hci_acl_hdr *) buf; + struct hci_acl_hdr *hdr = (struct hci_acl_hdr *)buf; pkt_len = HCI_ACL_HDR_SIZE + __le16_to_cpu(hdr->dlen); } else { @@ -296,7 +295,7 @@ static inline int bfusb_recv_block(struct bfusb_data *data, int hdr, unsigned ch case HCI_SCODATA_PKT: if (len >= HCI_SCO_HDR_SIZE) { - struct hci_sco_hdr *hdr = (struct hci_sco_hdr *) buf; + struct hci_sco_hdr *hdr = (struct hci_sco_hdr *)buf; pkt_len = HCI_SCO_HDR_SIZE + hdr->dlen; } else { @@ -335,8 +334,8 @@ static inline int bfusb_recv_block(struct bfusb_data *data, int hdr, unsigned ch static void bfusb_rx_complete(struct urb *urb) { - struct sk_buff *skb = (struct sk_buff *) urb->context; - struct bfusb_data *data = (struct bfusb_data *) skb->dev; + struct sk_buff *skb = (struct sk_buff *)urb->context; + struct bfusb_data *data = (struct bfusb_data *)skb->dev; unsigned char *buf = urb->transfer_buffer; int count = urb->actual_length; int err, hdr, len; @@ -482,7 +481,7 @@ static int bfusb_send_frame(struct hci_dev *hdev, struct sk_buff *skb) return -ENOMEM; } - nskb->dev = (void *) data; + nskb->dev = (void *)data; while (count) { size = min_t(uint, count, BFUSB_MAX_BLOCK_SIZE); @@ -536,13 +535,14 @@ static int bfusb_load_firmware(struct bfusb_data *data, pipe = usb_sndctrlpipe(data->udev, 0); if (usb_control_msg(data->udev, pipe, USB_REQ_SET_CONFIGURATION, - 0, 1, 0, NULL, 0, USB_CTRL_SET_TIMEOUT) < 0) { + 0, 1, 0, NULL, 0, USB_CTRL_SET_TIMEOUT) < 0) { BT_ERR("Can't change to loading configuration"); kfree(buf); return -EBUSY; } - data->udev->toggle[0] = data->udev->toggle[1] = 0; + data->udev->toggle[0] = data->udev->toggle[1]; + data->udev->toggle[1] = 0; pipe = usb_sndbulkpipe(data->udev, data->bulk_out_ep); @@ -552,9 +552,9 @@ static int bfusb_load_firmware(struct bfusb_data *data, memcpy(buf, firmware + sent, size); err = usb_bulk_msg(data->udev, pipe, buf, size, - &len, BFUSB_BLOCK_TIMEOUT); + &len, BFUSB_BLOCK_TIMEOUT); - if (err || (len != size)) { + if (err || len != size) { BT_ERR("Error in firmware loading"); goto error; } @@ -564,7 +564,7 @@ static int bfusb_load_firmware(struct bfusb_data *data, } err = usb_bulk_msg(data->udev, pipe, NULL, 0, - &len, BFUSB_BLOCK_TIMEOUT); + &len, BFUSB_BLOCK_TIMEOUT); if (err < 0) { BT_ERR("Error in null packet request"); goto error; @@ -573,13 +573,14 @@ static int bfusb_load_firmware(struct bfusb_data *data, pipe = usb_sndctrlpipe(data->udev, 0); err = usb_control_msg(data->udev, pipe, USB_REQ_SET_CONFIGURATION, - 0, 2, 0, NULL, 0, USB_CTRL_SET_TIMEOUT); + 0, 2, 0, NULL, 0, USB_CTRL_SET_TIMEOUT); if (err < 0) { BT_ERR("Can't change to running configuration"); goto error; } - data->udev->toggle[0] = data->udev->toggle[1] = 0; + data->udev->toggle[0] = data->udev->toggle[1]; + data->udev->toggle[1] = 0; BT_INFO("BlueFRITZ! USB device ready"); @@ -592,7 +593,7 @@ static int bfusb_load_firmware(struct bfusb_data *data, pipe = usb_sndctrlpipe(data->udev, 0); usb_control_msg(data->udev, pipe, USB_REQ_SET_CONFIGURATION, - 0, 0, 0, NULL, 0, USB_CTRL_SET_TIMEOUT); + 0, 0, 0, NULL, 0, USB_CTRL_SET_TIMEOUT); return err; } -- 2.40.1 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* RE: Bluetooth: bfusb: corrected mistakes in previous commits 2024-03-08 18:03 ` [PATCH] Bluetooth: bfusb: corrected mistakes in previous commits Ayaan Mirza Baig @ 2024-03-08 18:26 ` bluez.test.bot 0 siblings, 0 replies; 5+ messages in thread From: bluez.test.bot @ 2024-03-08 18:26 UTC (permalink / raw) To: linux-bluetooth, ayaanmirza.788 [-- Attachment #1: Type: text/plain, Size: 552 bytes --] This is an automated email and please do not reply to this email. Dear Submitter, Thank you for submitting the patches to the linux bluetooth mailing list. While preparing the CI tests, the patches you submitted couldn't be applied to the current HEAD of the repository. ----- Output ----- error: patch failed: drivers/bluetooth/bfusb.c:274 error: drivers/bluetooth/bfusb.c: patch does not apply hint: Use 'git am --show-current-patch' to see the failed patch Please resolve the issue and submit the patches again. --- Regards, Linux Bluetooth ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Bluetooth: bfusb: Updated code to follow style guide 2024-03-08 16:20 [PATCH] Bluetooth: bfusb: Updated code to follow style guide Ayaan Mirza Baig 2024-03-08 16:43 ` bluez.test.bot @ 2024-03-08 18:08 ` Joe Perches 1 sibling, 0 replies; 5+ messages in thread From: Joe Perches @ 2024-03-08 18:08 UTC (permalink / raw) To: Ayaan Mirza Baig, marcel, luiz.dentz; +Cc: linux-bluetooth, linux-kernel On Fri, 2024-03-08 at 21:50 +0530, Ayaan Mirza Baig wrote: > Added indendations, removed trailing spaces, added empty lines after declaration. indendations/indentations. Do please try to not just mollify checkpatch message bleats but try to make the code more intelligible. I think the tests are backwards would better be written with fewer block indentations and direct returns without creating used-once temporaries like: --- drivers/bluetooth/bfusb.c | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/drivers/bluetooth/bfusb.c b/drivers/bluetooth/bfusb.c index cab93935cc7f1..68587424187e6 100644 --- a/drivers/bluetooth/bfusb.c +++ b/drivers/bluetooth/bfusb.c @@ -273,33 +273,27 @@ static inline int bfusb_recv_block(struct bfusb_data *data, int hdr, unsigned ch switch (pkt_type) { case HCI_EVENT_PKT: - if (len >= HCI_EVENT_HDR_SIZE) { - struct hci_event_hdr *hdr = (struct hci_event_hdr *) buf; - pkt_len = HCI_EVENT_HDR_SIZE + hdr->plen; - } else { + if (len < HCI_EVENT_HDR_SIZE) { bt_dev_err(data->hdev, "event block is too short"); return -EILSEQ; } + pkt_len = HCI_EVENT_HDR_SIZE + ((struct hci_event_hdr *)buf)->plen; break; case HCI_ACLDATA_PKT: - if (len >= HCI_ACL_HDR_SIZE) { - struct hci_acl_hdr *hdr = (struct hci_acl_hdr *) buf; - pkt_len = HCI_ACL_HDR_SIZE + __le16_to_cpu(hdr->dlen); - } else { + if (len < HCI_ACL_HDR_SIZE) { bt_dev_err(data->hdev, "data block is too short"); return -EILSEQ; } + pkt_len = HCI_ACL_HDR_SIZE + __le16_to_cpu(((struct hci_acl_hdr *)buf)->dlen); break; case HCI_SCODATA_PKT: - if (len >= HCI_SCO_HDR_SIZE) { - struct hci_sco_hdr *hdr = (struct hci_sco_hdr *) buf; - pkt_len = HCI_SCO_HDR_SIZE + hdr->dlen; - } else { + if (len < HCI_SCO_HDR_SIZE) { bt_dev_err(data->hdev, "audio block is too short"); return -EILSEQ; } + pkt_len = HCI_SCO_HDR_SIZE + ((struct hci_sco_hdr *)buf)->dlen; break; } @@ -365,9 +359,8 @@ static void bfusb_rx_complete(struct urb *urb) buf += 3; } - if (count < len) { + if (count < len) bt_dev_err(data->hdev, "block extends over URB buffer ranges"); - } if ((hdr & 0xe1) == 0xc1) bfusb_recv_block(data, hdr, buf, len); ^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2024-03-08 18:26 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2024-03-08 16:20 [PATCH] Bluetooth: bfusb: Updated code to follow style guide Ayaan Mirza Baig 2024-03-08 16:43 ` bluez.test.bot 2024-03-08 18:03 ` [PATCH] Bluetooth: bfusb: corrected mistakes in previous commits Ayaan Mirza Baig 2024-03-08 18:26 ` bluez.test.bot 2024-03-08 18:08 ` [PATCH] Bluetooth: bfusb: Updated code to follow style guide Joe Perches
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).