diff mbox series

Bluetooth: hci_intel: Fix multiple issues reported by checkpatch.pl

Message ID 20240402155543.36856-1-me@wantyapps.xyz
State Superseded
Headers show
Series Bluetooth: hci_intel: Fix multiple issues reported by checkpatch.pl | expand

Commit Message

Uri Arev April 2, 2024, 3:55 p.m. UTC
From: Uri Arev <me@wantyapps.xyz>

This fixes the following CHECKs, WARNINGs, and ERRORs reported in
hci_intel.c

Reported by checkpatch.pl:
-----------
hci_intel.c
-----------
WARNING: Prefer using '"%s...", __func__' to using 'intel_setup', this function's name, in a string
+	bt_dev_dbg(hdev, "start intel_setup");

ERROR: code indent should use tabs where possible
+        /* Check for supported iBT hardware variants of this firmware$

ERROR: code indent should use tabs where possible
+         * loading method.$

ERROR: code indent should use tabs where possible
+         *$

ERROR: code indent should use tabs where possible
+         * This check has been put in place to ensure correct forward$

ERROR: code indent should use tabs where possible
+         * compatibility options when newer hardware variants come along.$

ERROR: code indent should use tabs where possible
+         */$

CHECK: No space is necessary after a cast
+	duration = (unsigned long long) ktime_to_ns(delta) >> 10;

CHECK: No space is necessary after a cast
+	duration = (unsigned long long) ktime_to_ns(delta) >> 10;

WARNING: Missing a blank line after declarations
+		int err = PTR_ERR(intel->rx_skb);
+		bt_dev_err(hu->hdev, "Frame reassembly failed (%d)", err);

Signed-off-by: Uri Arev <me@wantyapps.xyz>
---
 drivers/bluetooth/hci_intel.c | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

Comments

Uri Arev April 2, 2024, 4:12 p.m. UTC | #1
Hi Luiz, thanks for taking the time to review my patch.

On Tue, Apr 02, 2024 at 12:06:30PM -0400, Luiz Augusto von Dentz wrote:
> Hi Uri,
> 
> On Tue, Apr 2, 2024 at 11:56 AM <me@wantyapps.xyz> wrote:
> >
> > From: Uri Arev <me@wantyapps.xyz>
> >
> > This fixes the following CHECKs, WARNINGs, and ERRORs reported in
> > hci_intel.c
> >
> > Reported by checkpatch.pl:
> > -----------
> > hci_intel.c
> > -----------
> > WARNING: Prefer using '"%s...", __func__' to using 'intel_setup', this function's name, in a string
> > +       bt_dev_dbg(hdev, "start intel_setup");
> >
> > ERROR: code indent should use tabs where possible
> > +        /* Check for supported iBT hardware variants of this firmware$
> >
> > ERROR: code indent should use tabs where possible
> > +         * loading method.$
> >
> > ERROR: code indent should use tabs where possible
> > +         *$
> >
> > ERROR: code indent should use tabs where possible
> > +         * This check has been put in place to ensure correct forward$
> >
> > ERROR: code indent should use tabs where possible
> > +         * compatibility options when newer hardware variants come along$
> >
> > ERROR: code indent should use tabs where possible
> > +         */$
> >
> > CHECK: No space is necessary after a cast
> > +       duration = (unsigned long long) ktime_to_ns(delta) >> 10;
> >
> > CHECK: No space is necessary after a cast
> > +       duration = (unsigned long long) ktime_to_ns(delta) >> 10;
> >
> > WARNING: Missing a blank line after declarations
> > +               int err = PTR_ERR(intel->rx_skb);
> > +               bt_dev_err(hu->hdev, "Frame reassembly failed (%d)", err);
> >
> > Signed-off-by: Uri Arev <me@wantyapps.xyz>
> > ---
> >  drivers/bluetooth/hci_intel.c | 19 ++++++++++---------
> >  1 file changed, 10 insertions(+), 9 deletions(-)
> >
> > diff --git a/drivers/bluetooth/hci_intel.c b/drivers/bluetooth/hci_intel.c
> > index 78afb9a348e7..44731de1a2d6 100644
> > --- a/drivers/bluetooth/hci_intel.c
> > +++ b/drivers/bluetooth/hci_intel.c
> > @@ -537,7 +537,7 @@ static int intel_setup(struct hci_uart *hu)
> >         int speed_change = 0;
> >         int err;
> >
> > -       bt_dev_dbg(hdev, "start intel_setup");
> > +       bt_dev_dbg(hdev, "start %s", __func__);
> 
> We probably don't need __func__ either since this is normally calls
> pr_debug which already has support for printing function names if the
> user wants to, so I just leave as bt_dev_dbg(hdev, "");
> 
Thanks for the comment, will revise. I still don't know most of the
debugging functions in the kernel, as I am a relatively new hacker.

> >
> >         hu->hdev->set_diag = btintel_set_diag;
> >         hu->hdev->set_bdaddr = btintel_set_bdaddr;
> > @@ -591,12 +591,12 @@ static int intel_setup(struct hci_uart *hu)
> >                 return -EINVAL;
> >         }
> >
> > -        /* Check for supported iBT hardware variants of this firmware
> > -         * loading method.
> > -         *
> > -         * This check has been put in place to ensure correct forward
> > -         * compatibility options when newer hardware variants come along.
> > -         */
> > +       /* Check for supported iBT hardware variants of this firmware
> > +        * loading method.
> > +        *
> > +        * This check has been put in place to ensure correct forward
> > +        * compatibility options when newer hardware variants come along.
> > +        */
> >         switch (ver.hw_variant) {
> >         case 0x0b:      /* LnP */
> >         case 0x0c:      /* WsP */
> > @@ -777,7 +777,7 @@ static int intel_setup(struct hci_uart *hu)
> >
> >         rettime = ktime_get();
> >         delta = ktime_sub(rettime, calltime);
> > -       duration = (unsigned long long) ktime_to_ns(delta) >> 10;
> > +       duration = (unsigned long long)ktime_to_ns(delta) >> 10;
> >
> >         bt_dev_info(hdev, "Firmware loaded in %llu usecs", duration);
> >
> > @@ -822,7 +822,7 @@ static int intel_setup(struct hci_uart *hu)
> >
> >         rettime = ktime_get();
> >         delta = ktime_sub(rettime, calltime);
> > -       duration = (unsigned long long) ktime_to_ns(delta) >> 10;
> > +       duration = (unsigned long long)ktime_to_ns(delta) >> 10;
> >
> >         bt_dev_info(hdev, "Device booted in %llu usecs", duration);
> >
> > @@ -977,6 +977,7 @@ static int intel_recv(struct hci_uart *hu, const void *data, int count)
> >                                     ARRAY_SIZE(intel_recv_pkts));
> >         if (IS_ERR(intel->rx_skb)) {
> >                 int err = PTR_ERR(intel->rx_skb);
> > +
> >                 bt_dev_err(hu->hdev, "Frame reassembly failed (%d)", err);
> >                 intel->rx_skb = NULL;
> >                 return err;
> > --
> > 2.44.0
> >

                 Uri Arev
bluez.test.bot@gmail.com April 2, 2024, 4:47 p.m. UTC | #2
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=840707

---Test result---

Test Summary:
CheckPatch                    FAIL      0.91 seconds
GitLint                       FAIL      0.50 seconds
SubjectPrefix                 PASS      0.13 seconds
BuildKernel                   PASS      30.80 seconds
CheckAllWarning               PASS      32.96 seconds
CheckSparse                   PASS      38.67 seconds
CheckSmatch                   FAIL      34.98 seconds
BuildKernel32                 PASS      28.99 seconds
TestRunnerSetup               PASS      520.42 seconds
TestRunner_l2cap-tester       PASS      17.89 seconds
TestRunner_iso-tester         PASS      29.76 seconds
TestRunner_bnep-tester        PASS      4.70 seconds
TestRunner_mgmt-tester        PASS      118.19 seconds
TestRunner_rfcomm-tester      PASS      7.27 seconds
TestRunner_sco-tester         PASS      14.94 seconds
TestRunner_ioctl-tester       PASS      7.55 seconds
TestRunner_mesh-tester        PASS      5.82 seconds
TestRunner_smp-tester         PASS      6.73 seconds
TestRunner_userchan-tester    PASS      4.92 seconds
IncrementalBuild              PASS      27.80 seconds

Details
##############################
Test: CheckPatch - FAIL
Desc: Run checkpatch.pl script
Output:
Bluetooth: hci_intel: Fix multiple issues reported by checkpatch.pl
WARNING: Unnecessary ftrace-like logging - prefer using ftrace
#120: FILE: drivers/bluetooth/hci_intel.c:540:
+	bt_dev_dbg(hdev, "start %s", __func__);

total: 0 errors, 1 warnings, 49 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/13614367.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: hci_intel: Fix multiple issues reported by checkpatch.pl

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
12: B1 Line exceeds max length (99>80): "WARNING: Prefer using '"%s...", __func__' to using 'intel_setup', this function's name, in a string"
13: B3 Line contains hard tab characters (\t): "+	bt_dev_dbg(hdev, "start intel_setup");"
34: B3 Line contains hard tab characters (\t): "+	duration = (unsigned long long) ktime_to_ns(delta) >> 10;"
37: B3 Line contains hard tab characters (\t): "+	duration = (unsigned long long) ktime_to_ns(delta) >> 10;"
40: B3 Line contains hard tab characters (\t): "+		int err = PTR_ERR(intel->rx_skb);"
41: B3 Line contains hard tab characters (\t): "+		bt_dev_err(hu->hdev, "Frame reassembly failed (%d)", err);"
##############################
Test: CheckSmatch - FAIL
Desc: Run smatch tool with source
Output:

Segmentation fault (core dumped)
make[4]: *** [scripts/Makefile.build:244: net/bluetooth/hci_core.o] Error 139
make[4]: *** Deleting file 'net/bluetooth/hci_core.o'
make[3]: *** [scripts/Makefile.build:485: net/bluetooth] Error 2
make[2]: *** [scripts/Makefile.build:485: net] Error 2
make[2]: *** Waiting for unfinished jobs....
Segmentation fault (core dumped)
make[4]: *** [scripts/Makefile.build:244: drivers/bluetooth/bcm203x.o] Error 139
make[4]: *** Deleting file 'drivers/bluetooth/bcm203x.o'
make[4]: *** Waiting for unfinished jobs....
make[3]: *** [scripts/Makefile.build:485: drivers/bluetooth] Error 2
make[2]: *** [scripts/Makefile.build:485: drivers] Error 2
make[1]: *** [/github/workspace/src/src/Makefile:1919: .] Error 2
make: *** [Makefile:240: __sub-make] Error 2


---
Regards,
Linux Bluetooth
Uri Arev April 2, 2024, 9:35 p.m. UTC | #3
On Tue, Apr 02, 2024 at 07:12:23PM +0300, Uri Arev wrote:
> Hi Luiz, thanks for taking the time to review my patch.
> 
> On Tue, Apr 02, 2024 at 12:06:30PM -0400, Luiz Augusto von Dentz wrote:
> > Hi Uri,
> > 
> > On Tue, Apr 2, 2024 at 11:56 AM <me@wantyapps.xyz> wrote:
> > >
> > > From: Uri Arev <me@wantyapps.xyz>
> > >
> > > This fixes the following CHECKs, WARNINGs, and ERRORs reported in
> > > hci_intel.c
> > >
> > > Reported by checkpatch.pl:
> > > -----------
> > > hci_intel.c
> > > -----------
> > > WARNING: Prefer using '"%s...", __func__' to using 'intel_setup', this function's name, in a string
> > > +       bt_dev_dbg(hdev, "start intel_setup");
> > >
> > > ERROR: code indent should use tabs where possible
> > > +        /* Check for supported iBT hardware variants of this firmware$
> > >
> > > ERROR: code indent should use tabs where possible
> > > +         * loading method.$
> > >
> > > ERROR: code indent should use tabs where possible
> > > +         *$
> > >
> > > ERROR: code indent should use tabs where possible
> > > +         * This check has been put in place to ensure correct forward$
> > >
> > > ERROR: code indent should use tabs where possible
> > > +         * compatibility options when newer hardware variants come along$
> > >
> > > ERROR: code indent should use tabs where possible
> > > +         */$
> > >
> > > CHECK: No space is necessary after a cast
> > > +       duration = (unsigned long long) ktime_to_ns(delta) >> 10;
> > >
> > > CHECK: No space is necessary after a cast
> > > +       duration = (unsigned long long) ktime_to_ns(delta) >> 10;
> > >
> > > WARNING: Missing a blank line after declarations
> > > +               int err = PTR_ERR(intel->rx_skb);
> > > +               bt_dev_err(hu->hdev, "Frame reassembly failed (%d)", err);
> > >
> > > Signed-off-by: Uri Arev <me@wantyapps.xyz>
> > > ---
> > >  drivers/bluetooth/hci_intel.c | 19 ++++++++++---------
> > >  1 file changed, 10 insertions(+), 9 deletions(-)
> > >
> > > diff --git a/drivers/bluetooth/hci_intel.c b/drivers/bluetooth/hci_intel.c
> > > index 78afb9a348e7..44731de1a2d6 100644
> > > --- a/drivers/bluetooth/hci_intel.c
> > > +++ b/drivers/bluetooth/hci_intel.c
> > > @@ -537,7 +537,7 @@ static int intel_setup(struct hci_uart *hu)
> > >         int speed_change = 0;
> > >         int err;
> > >
> > > -       bt_dev_dbg(hdev, "start intel_setup");
> > > +       bt_dev_dbg(hdev, "start %s", __func__);
> > 
> > We probably don't need __func__ either since this is normally calls
> > pr_debug which already has support for printing function names if the
> > user wants to, so I just leave as bt_dev_dbg(hdev, "");
> > 
> Thanks for the comment, will revise. I still don't know most of the
> debugging functions in the kernel, as I am a relatively new hacker.
> 
> > >
> > >         hu->hdev->set_diag = btintel_set_diag;
> > >         hu->hdev->set_bdaddr = btintel_set_bdaddr;
> > > @@ -591,12 +591,12 @@ static int intel_setup(struct hci_uart *hu)
> > >                 return -EINVAL;
> > >         }
> > >
> > > -        /* Check for supported iBT hardware variants of this firmware
> > > -         * loading method.
> > > -         *
> > > -         * This check has been put in place to ensure correct forward
> > > -         * compatibility options when newer hardware variants come along.
> > > -         */
> > > +       /* Check for supported iBT hardware variants of this firmware
> > > +        * loading method.
> > > +        *
> > > +        * This check has been put in place to ensure correct forward
> > > +        * compatibility options when newer hardware variants come along.
> > > +        */
> > >         switch (ver.hw_variant) {
> > >         case 0x0b:      /* LnP */
> > >         case 0x0c:      /* WsP */
> > > @@ -777,7 +777,7 @@ static int intel_setup(struct hci_uart *hu)
> > >
> > >         rettime = ktime_get();
> > >         delta = ktime_sub(rettime, calltime);
> > > -       duration = (unsigned long long) ktime_to_ns(delta) >> 10;
> > > +       duration = (unsigned long long)ktime_to_ns(delta) >> 10;
> > >
> > >         bt_dev_info(hdev, "Firmware loaded in %llu usecs", duration);
> > >
> > > @@ -822,7 +822,7 @@ static int intel_setup(struct hci_uart *hu)
> > >
> > >         rettime = ktime_get();
> > >         delta = ktime_sub(rettime, calltime);
> > > -       duration = (unsigned long long) ktime_to_ns(delta) >> 10;
> > > +       duration = (unsigned long long)ktime_to_ns(delta) >> 10;
> > >
> > >         bt_dev_info(hdev, "Device booted in %llu usecs", duration);
> > >
> > > @@ -977,6 +977,7 @@ static int intel_recv(struct hci_uart *hu, const void *data, int count)
> > >                                     ARRAY_SIZE(intel_recv_pkts));
> > >         if (IS_ERR(intel->rx_skb)) {
> > >                 int err = PTR_ERR(intel->rx_skb);
> > > +
> > >                 bt_dev_err(hu->hdev, "Frame reassembly failed (%d)", err);
> > >                 intel->rx_skb = NULL;
> > >                 return err;
> > > --
> > > 2.44.0
> > >
Hey Luiz, I sent a v2 that adds the above suggestion and fixes gitlint.

                 Uri Arev
diff mbox series

Patch

diff --git a/drivers/bluetooth/hci_intel.c b/drivers/bluetooth/hci_intel.c
index 78afb9a348e7..44731de1a2d6 100644
--- a/drivers/bluetooth/hci_intel.c
+++ b/drivers/bluetooth/hci_intel.c
@@ -537,7 +537,7 @@  static int intel_setup(struct hci_uart *hu)
 	int speed_change = 0;
 	int err;
 
-	bt_dev_dbg(hdev, "start intel_setup");
+	bt_dev_dbg(hdev, "start %s", __func__);
 
 	hu->hdev->set_diag = btintel_set_diag;
 	hu->hdev->set_bdaddr = btintel_set_bdaddr;
@@ -591,12 +591,12 @@  static int intel_setup(struct hci_uart *hu)
 		return -EINVAL;
 	}
 
-        /* Check for supported iBT hardware variants of this firmware
-         * loading method.
-         *
-         * This check has been put in place to ensure correct forward
-         * compatibility options when newer hardware variants come along.
-         */
+	/* Check for supported iBT hardware variants of this firmware
+	 * loading method.
+	 *
+	 * This check has been put in place to ensure correct forward
+	 * compatibility options when newer hardware variants come along.
+	 */
 	switch (ver.hw_variant) {
 	case 0x0b:	/* LnP */
 	case 0x0c:	/* WsP */
@@ -777,7 +777,7 @@  static int intel_setup(struct hci_uart *hu)
 
 	rettime = ktime_get();
 	delta = ktime_sub(rettime, calltime);
-	duration = (unsigned long long) ktime_to_ns(delta) >> 10;
+	duration = (unsigned long long)ktime_to_ns(delta) >> 10;
 
 	bt_dev_info(hdev, "Firmware loaded in %llu usecs", duration);
 
@@ -822,7 +822,7 @@  static int intel_setup(struct hci_uart *hu)
 
 	rettime = ktime_get();
 	delta = ktime_sub(rettime, calltime);
-	duration = (unsigned long long) ktime_to_ns(delta) >> 10;
+	duration = (unsigned long long)ktime_to_ns(delta) >> 10;
 
 	bt_dev_info(hdev, "Device booted in %llu usecs", duration);
 
@@ -977,6 +977,7 @@  static int intel_recv(struct hci_uart *hu, const void *data, int count)
 				    ARRAY_SIZE(intel_recv_pkts));
 	if (IS_ERR(intel->rx_skb)) {
 		int err = PTR_ERR(intel->rx_skb);
+
 		bt_dev_err(hu->hdev, "Frame reassembly failed (%d)", err);
 		intel->rx_skb = NULL;
 		return err;