Bluetooth: btmtk: Fix btmtk.c undefined reference build error
Subsystems (2)
PATCH 1/1 Bluetooth: btmtk: Fix btmtk.c undefined reference build error
MediaTek move some usb interface related function to btmtk.c which may cause build failed if BT USB Kconfig wasn't enabled. Fix undefined reference by adding config check.
--- drivers/bluetooth/btmtk.c | 2 ++ drivers/bluetooth/btmtk.h | 4 ++++ 2 files changed, 6 insertions(+)
drivers/bluetooth/btmtk.c +2 -0
@@ -437,6 +437,7 @@ int btmtk_process_coredump(struct hci_dev *hdev, struct sk_buff *skb) }EXPORT_SYMBOL_GPL (btmtk_process_coredump); +#if IS_ENABLED (CONFIG_BT_HCIBTUSB_MTK )static void btmtk_usb_wmt_recv (struct urb *urb) {struct hci_dev *hdev = urb->context;
@@ -1487,6 +1488,7 @@ int btmtk_usb_shutdown(struct hci_dev *hdev) return 0; }EXPORT_SYMBOL_GPL (btmtk_usb_shutdown); +#endif MODULE_AUTHOR ("Sean Wang <[email protected]>" );MODULE_AUTHOR ("Mark Chen <[email protected]>" );
drivers/bluetooth/btmtk.h +4 -0
@@ -165,6 +165,7 @@ struct btmtk_data {btmtk_reset_sync_func_t reset_sync;struct btmtk_coredump_info cd_info; +#if IS_ENABLED (CONFIG_BT_HCIBTUSB_MTK )struct usb_device *udev;struct usb_interface *intf;struct usb_anchor *ctrl_anchor;
@@ -177,6 +178,7 @@ struct btmtk_data {/* spinlock for ISO data transmission */ spinlock_t isorxlock; +#endif }; typedef int (*wmt_cmd_sync_func_t)(struct hci_dev *,
@@ -202,6 +204,7 @@ int btmtk_process_coredump(struct hci_dev *hdev, struct sk_buff *skb);void btmtk_fw_get_filename (char *buf,size_t size,u32 dev_id,u32 fw_ver,u32 fw_flavor); +#if IS_ENABLED (CONFIG_BT_HCIBTUSB_MTK )int btmtk_usb_subsys_reset (struct hci_dev *hdev,u32 dev_id);int btmtk_usb_recv_acl (struct hci_dev *hdev,struct sk_buff *skb);
@@ -216,6 +219,7 @@ int btmtk_usb_suspend(struct hci_dev *hdev);int btmtk_usb_setup (struct hci_dev *hdev);int btmtk_usb_shutdown (struct hci_dev *hdev); +#endif #else static inline int btmtk_set_bdaddr(struct hci_dev *hdev,
Signature · 1 line
2.18.0
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=869995
---Test result---
Test Summary:
CheckPatch FAIL 1.10 seconds GitLint FAIL 0.57 seconds SubjectPrefix PASS 0.14 seconds BuildKernel PASS 31.30 seconds CheckAllWarning PASS 33.27 seconds CheckSparse PASS 39.22 seconds CheckSmatch PASS 104.07 seconds BuildKernel32 PASS 29.68 seconds TestRunnerSetup PASS 546.78 seconds TestRunner_l2cap-tester PASS 20.70 seconds TestRunner_iso-tester FAIL 40.34 seconds TestRunner_bnep-tester PASS 4.99 seconds TestRunner_mgmt-tester FAIL 115.77 seconds TestRunner_rfcomm-tester PASS 7.76 seconds TestRunner_sco-tester PASS 15.32 seconds TestRunner_ioctl-tester PASS 8.40 seconds TestRunner_mesh-tester PASS 6.24 seconds TestRunner_smp-tester PASS 7.09 seconds TestRunner_userchan-tester PASS 5.18 seconds IncrementalBuild PASS 29.32 seconds
Details
##############################
Test: CheckPatch - FAIL
Desc: Run checkpatch.pl script
Output:
Bluetooth: btmtk: Fix btmtk.c undefined reference build error
WARNING: Please use correct Fixes: style 'Fixes: <12 chars of sha1> ("<title line>")' - ie: 'Fixes: 7055cf63bb80 ("Merge 2dcf37264c29230ea17bdbc70e3cea288dac5adc into 13c5da2f1c16f5e1e953f524a562286eda01f5e6")' #101:
total: 0 errors, 1 warnings, 42 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/13728967.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: btmtk: Fix btmtk.c undefined reference build error
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
8: B1 Line exceeds max length (82>80): "Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/"
##############################
Test: TestRunner_iso-tester - FAIL
Desc: Run iso-tester with test-runner
Output:
Total: 122, Passed: 117 (95.9%), Failed: 1, Not Run: 4
Failed Test Cases
ISO Connect2 Suspend - Success Failed 4.225 seconds
##############################
Test: TestRunner_mgmt-tester - FAIL
Desc: Run mgmt-tester with test-runner Output:
Total: 492, Passed: 488 (99.2%), Failed: 2, Not Run: 2
Failed Test Cases
LL Privacy - Add Device 4 (2 Devices to AL) Failed 0.166 seconds LL Privacy - Remove Device 4 (Disable Adv) Timed out 2.119 seconds
---
Regards,
Linux Bluetooth
Luiz Augusto von Dentz
maintainerHi Chris,
Quoted 47 lines · Chris Lu
MediaTek move some usb interface related function to
btmtk.cwhich may cause build failed if BT USBKconfigwasn't enabled. Fix undefined reference by adding config check.Fixes 39a9e1c69e74 Bluetooth: btmtk: move btusb_mtk_hci_wmt_sync to btmtk.cReported-by kernel test robot <[email protected]>Signed-off-by Chris Lu <[email protected]>--- drivers/bluetooth/btmtk.c | 2 ++ drivers/bluetooth/btmtk.h | 4 ++++ 2 files changed, 6 insertions(+)drivers/bluetooth/btmtk.c +2
-0@@ -437,6 +437,7 @@ int btmtk_process_coredump(struct hci_dev *hdev, struct sk_buff *skb) }EXPORT_SYMBOL_GPL (btmtk_process_coredump); +#if IS_ENABLED (CONFIG_BT_HCIBTUSB_MTK )static void btmtk_usb_wmt_recv (struct urb *urb) {struct hci_dev *hdev = urb->context;@@ -1487,6 +1488,7 @@ int btmtk_usb_shutdown(struct hci_dev *hdev) return 0; }EXPORT_SYMBOL_GPL (btmtk_usb_shutdown); +#endif MODULE_AUTHOR ("Sean Wang <[email protected]>" );MODULE_AUTHOR ("Mark Chen <[email protected]>" );drivers/bluetooth/btmtk.h +1
-0@@ -165,6 +165,7 @@ struct btmtk_data {btmtk_reset_sync_func_t reset_sync;struct btmtk_coredump_info cd_info; +#if IS_ENABLED (CONFIG_BT_HCIBTUSB_MTK )struct usb_device *udev;struct usb_interface *intf;struct usb_anchor *ctrl_anchor;
drivers/bluetooth/btmtk.h struct btmtk_data { · line 181
Quoted 4 lines
drivers/bluetooth/btmtk.h +1
-0@@ -177,6 +178,7 @@ struct btmtk_data {/* spinlock for ISO data transmission */ spinlock_t isorxlock; +#endif
If I recall this correctly it is not a good practice to use #if inside structs as it would change its overall size, memory layout, etc, and it also makes it difficult to use if (IS_DEFINED) and let the compiler eliminate dead code instead of using the preprocessor like you doing.
Quoted 22 lines
drivers/bluetooth/btmtk.h +2
-1}; typedef int (*wmt_cmd_sync_func_t)(struct hci_dev *,@@ -202,6 +204,7 @@ int btmtk_process_coredump(struct hci_dev *hdev, struct sk_buff *skb);void btmtk_fw_get_filename (char *buf,size_t size,u32 dev_id,u32 fw_ver,u32 fw_flavor); +#if IS_ENABLED (CONFIG_BT_HCIBTUSB_MTK )int btmtk_usb_subsys_reset (struct hci_dev *hdev,u32 dev_id);int btmtk_usb_recv_acl (struct hci_dev *hdev,struct sk_buff *skb);@@ -216,6 +219,7 @@ int btmtk_usb_suspend(struct hci_dev *hdev);int btmtk_usb_setup (struct hci_dev *hdev);int btmtk_usb_shutdown (struct hci_dev *hdev); +#endif #else static inline int btmtk_set_bdaddr(struct hci_dev *hdev, --2.18.0
Signature · 1 line
Luiz Augusto von Dentz
Hi Luiz,
Quoted 58 lines · Luiz Augusto von Dentz
External email : Please do not click links or open attachments until you have verified the sender or the content.
Hi Chris,Quoted 6 lines · Chris Lu
MediaTek move some usb interface related function to
btmtk.cwhich may cause build failed if BT USBKconfigwasn't enabled. Fix undefined reference by adding config check.Fixes 39a9e1c69e74 Bluetooth: btmtk: move btusb_mtk_hci_wmt_syncto
btmtk.cQuoted 2 lines
Reported-by kernel test robot <[email protected]>Closes:
https://lore.kernel.org/oe-kbuild-all/[email protected]/
drivers/bluetooth/btmtk.c int btmtk_process_coredump(struct hci_dev
Quoted 11 lines
Signed-off-by Chris Lu <[email protected]>--- drivers/bluetooth/btmtk.c | 2 ++ drivers/bluetooth/btmtk.h | 4 ++++ 2 files changed, 6 insertions(+)drivers/bluetooth/btmtk.c +0
-0@@ -437,6 +437,7 @@ int btmtk_process_coredump(struct hci_dev*hdev, struct
sk_buff*skb)Quoted 29 lines
drivers/bluetooth/btmtk.c +2
-0}EXPORT_SYMBOL_GPL (btmtk_process_coredump); +#if IS_ENABLED (CONFIG_BT_HCIBTUSB_MTK )static void btmtk_usb_wmt_recv (struct urb *urb) {struct hci_dev *hdev = urb->context;@@ -1487,6 +1488,7 @@ int btmtk_usb_shutdown(struct hci_dev *hdev) return 0; }EXPORT_SYMBOL_GPL (btmtk_usb_shutdown); +#endif MODULE_AUTHOR ("Sean Wang <[email protected]>" );MODULE_AUTHOR ("Mark Chen <[email protected]>" );drivers/bluetooth/btmtk.h +1
-0@@ -165,6 +165,7 @@ struct btmtk_data {btmtk_reset_sync_func_t reset_sync;struct btmtk_coredump_info cd_info; +#if IS_ENABLED (CONFIG_BT_HCIBTUSB_MTK )struct usb_device *udev;struct usb_interface *intf;struct usb_anchor *ctrl_anchor;@@ -177,6 +178,7 @@ struct btmtk_data {
Quoted 12 lines
drivers/bluetooth/btmtk.h struct btmtk_data { · line 181
Quoted 3 lines
drivers/bluetooth/btmtk.h +1
-0/* spinlock for ISO data transmission */ spinlock_t isorxlock; +#endif If I recall this correctly it is not a good practice to use #if inside
structs as it would change its overall size, memory layout, etc, and it also makes it difficult to use if (IS_DEFINED) and let the compiler
eliminate dead code instead of using the preprocessor like you doing.
"#if" can be remove here, usb.h was included in each c file in case making certain compiler error as you mentioned. It should be fine not to separate these element. I'm able to build pass after remove the "#if" here locally with same Kconfig.
I saw someone sent another patch for this issue by adding inline to each function. It would be another way to avoid undefined reference.
Thanks,
Chris Lu
Quoted 28 lines
drivers/bluetooth/btmtk.h int btmtk_process_coredump(struct hci_dev
Quoted 4 lines
drivers/bluetooth/btmtk.h +0
-0}; typedef int (*wmt_cmd_sync_func_t)(struct hci_dev *,@@ -202,6 +204,7 @@ int btmtk_process_coredump(struct hci_dev*hdev, struct
sk_buff*skb);drivers/bluetooth/btmtk.h int btmtk_process_coredump(struct hci_dev · line 204
Quoted 1 line
drivers/bluetooth/btmtk.h +0
-0void btmtk_fw_get_filename(char *buf, size_t size, u32 dev_id, u32
fw_ver,Quoted 17 lines
drivers/bluetooth/btmtk.h +2
-1u32 fw_flavor); +#if IS_ENABLED (CONFIG_BT_HCIBTUSB_MTK )int btmtk_usb_subsys_reset (struct hci_dev *hdev,u32 dev_id);int btmtk_usb_recv_acl (struct hci_dev *hdev,struct sk_buff *skb);@@ -216,6 +219,7 @@ int btmtk_usb_suspend(struct hci_dev *hdev);int btmtk_usb_setup (struct hci_dev *hdev);int btmtk_usb_shutdown (struct hci_dev *hdev); +#endif #else static inline int btmtk_set_bdaddr(struct hci_dev *hdev, --2.18.0
Signature · 1 line
Luiz Augusto von Dentz