* [PATCH 1/2] Bluetooth: mt7921s: support bluetooth reset mechanism
@ 2022-01-29 6:02 ` sean.wang
0 siblings, 0 replies; 14+ messages in thread
From: sean.wang @ 2022-01-29 6:02 UTC (permalink / raw)
To: marcel, johan.hedberg
Cc: Mark-YW.Chen, sean.wang, Soul.Huang, YN.Chen, Leon.Yen,
Eric-SY.Chang, Deren.Wu, km.lin, robin.chiu, Eddie.Chen, ch.yeh,
posh.sun, ted.huang, Eric.Liang, Stella.Chang, Tom.Chou,
steve.lee, jsiuda, frankgor, jemele, abhishekpandit, michaelfsun,
mcchou, shawnku, linux-bluetooth, linux-mediatek, linux-kernel,
Chih-Ying Chiang, Mark Chen
From: Chih-Ying Chiang <chih-yin.chiang@mediatek.com>
Implement .cmd_timeout to reset the MT7921s device via a dedicated GPIO
pin when the firmware hang or the command has no response.
Co-developed-by: Mark Chen <mark-yw.chen@mediatek.com>
Signed-off-by: Mark Chen <mark-yw.chen@mediatek.com>
Co-developed-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Chih-Ying Chiang <chih-yin.chiang@mediatek.com>
---
drivers/bluetooth/btmtk.h | 6 ++
drivers/bluetooth/btmtksdio.c | 113 +++++++++++++++++++++++++++++++++-
2 files changed, 118 insertions(+), 1 deletion(-)
diff --git a/drivers/bluetooth/btmtk.h b/drivers/bluetooth/btmtk.h
index fb76d9765ce0..8960a5f89d48 100644
--- a/drivers/bluetooth/btmtk.h
+++ b/drivers/bluetooth/btmtk.h
@@ -10,9 +10,15 @@
#define BTMTK_WMT_REG_WRITE 0x1
#define BTMTK_WMT_REG_READ 0x2
+#define MT7921_BTSYS_RST 0x70002610
+#define MT7921_BTSYS_RST_WITH_GPIO BIT(7)
+
#define MT7921_PINMUX_0 0x70005050
#define MT7921_PINMUX_1 0x70005054
+#define MT7921_DLSTATUS 0x7c053c10
+#define BT_DL_STATE BIT(1)
+
enum {
BTMTK_WMT_PATCH_DWNLD = 0x1,
BTMTK_WMT_TEST = 0x2,
diff --git a/drivers/bluetooth/btmtksdio.c b/drivers/bluetooth/btmtksdio.c
index 8be763ab3bf4..8e200e80d2f6 100644
--- a/drivers/bluetooth/btmtksdio.c
+++ b/drivers/bluetooth/btmtksdio.c
@@ -12,10 +12,12 @@
#include <asm/unaligned.h>
#include <linux/atomic.h>
+#include <linux/gpio/consumer.h>
#include <linux/init.h>
#include <linux/iopoll.h>
#include <linux/kernel.h>
#include <linux/module.h>
+#include <linux/of.h>
#include <linux/pm_runtime.h>
#include <linux/skbuff.h>
@@ -83,6 +85,7 @@ MODULE_DEVICE_TABLE(sdio, btmtksdio_table);
#define MTK_REG_CHCR 0xc
#define C_INT_CLR_CTRL BIT(1)
+#define BT_RST_DONE BIT(8)
/* CHISR have the same bits field definition with CHIER */
#define MTK_REG_CHISR 0x10
@@ -114,6 +117,7 @@ MODULE_DEVICE_TABLE(sdio, btmtksdio_table);
#define BTMTKSDIO_HW_TX_READY 2
#define BTMTKSDIO_FUNC_ENABLED 3
#define BTMTKSDIO_PATCH_ENABLED 4
+#define BTMTKSDIO_HW_RESET_ACTIVE 5
struct mtkbtsdio_hdr {
__le16 len;
@@ -133,6 +137,8 @@ struct btmtksdio_dev {
struct sk_buff *evt_skb;
const struct btmtksdio_data *data;
+
+ struct gpio_desc *reset;
};
static int mtk_hci_wmt_sync(struct hci_dev *hdev,
@@ -297,6 +303,11 @@ static u32 btmtksdio_drv_own_query_79xx(struct btmtksdio_dev *bdev)
return sdio_readl(bdev->func, MTK_REG_PD2HRM0R, NULL);
}
+static u32 btmtksdio_chcr_query(struct btmtksdio_dev *bdev)
+{
+ return sdio_readl(bdev->func, MTK_REG_CHCR, NULL);
+}
+
static int btmtksdio_fw_pmctrl(struct btmtksdio_dev *bdev)
{
u32 status;
@@ -967,6 +978,28 @@ static int btmtksdio_sco_setting(struct hci_dev *hdev)
return btmtksdio_mtk_reg_write(hdev, MT7921_PINMUX_1, val, ~0);
}
+static int btmtksdio_reset_setting(struct hci_dev *hdev)
+{
+ int err;
+ u32 val;
+
+ err = btmtksdio_mtk_reg_read(hdev, MT7921_PINMUX_1, &val);
+ if (err < 0)
+ return err;
+
+ val |= 0x20; /* set the pin (bit field 11:8) work as GPIO mode */
+ err = btmtksdio_mtk_reg_write(hdev, MT7921_PINMUX_1, val, ~0);
+ if (err < 0)
+ return err;
+
+ err = btmtksdio_mtk_reg_read(hdev, MT7921_BTSYS_RST, &val);
+ if (err < 0)
+ return err;
+
+ val |= MT7921_BTSYS_RST_WITH_GPIO;
+ return btmtksdio_mtk_reg_write(hdev, MT7921_BTSYS_RST, val, ~0);
+}
+
static int btmtksdio_setup(struct hci_dev *hdev)
{
struct btmtksdio_dev *bdev = hci_get_drvdata(hdev);
@@ -974,13 +1007,32 @@ static int btmtksdio_setup(struct hci_dev *hdev)
unsigned long long duration;
char fwname[64];
int err, dev_id;
- u32 fw_version = 0;
+ u32 fw_version = 0, val;
calltime = ktime_get();
set_bit(BTMTKSDIO_HW_TX_READY, &bdev->tx_state);
switch (bdev->data->chipid) {
case 0x7921:
+ if (test_bit(BTMTKSDIO_HW_RESET_ACTIVE, &bdev->tx_state)) {
+ err = btmtksdio_mtk_reg_read(hdev, MT7921_DLSTATUS,
+ &val);
+ if (err < 0)
+ return err;
+
+ val &= ~BT_DL_STATE;
+ err = btmtksdio_mtk_reg_write(hdev, MT7921_DLSTATUS,
+ val, ~0);
+ if (err < 0)
+ return err;
+
+ btmtksdio_fw_pmctrl(bdev);
+ msleep(20);
+ btmtksdio_drv_pmctrl(bdev);
+
+ clear_bit(BTMTKSDIO_HW_RESET_ACTIVE, &bdev->tx_state);
+ }
+
err = btmtksdio_mtk_reg_read(hdev, 0x70010200, &dev_id);
if (err < 0) {
bt_dev_err(hdev, "Failed to get device id (%d)", err);
@@ -1015,6 +1067,16 @@ static int btmtksdio_setup(struct hci_dev *hdev)
return err;
}
+ /* Enable GPIO reset mechanism */
+ if (bdev->reset) {
+ err = btmtksdio_reset_setting(hdev);
+ if (err < 0) {
+ bt_dev_err(hdev, "Failed to enable Reset setting (%d)", err);
+ devm_gpiod_put(bdev->dev, bdev->reset);
+ bdev->reset = NULL;
+ }
+ }
+
break;
case 0x7663:
case 0x7668:
@@ -1111,6 +1173,47 @@ static int btmtksdio_send_frame(struct hci_dev *hdev, struct sk_buff *skb)
return 0;
}
+static void btmtksdio_cmd_timeout(struct hci_dev *hdev)
+{
+ struct btmtksdio_dev *bdev = hci_get_drvdata(hdev);
+ u32 status;
+ int err;
+
+ if (!bdev->reset || bdev->data->chipid != 0x7921)
+ return;
+
+ pm_runtime_get_sync(bdev->dev);
+
+ if (test_and_set_bit(BTMTKSDIO_HW_RESET_ACTIVE, &bdev->tx_state))
+ return;
+
+ sdio_claim_host(bdev->func);
+
+ sdio_writel(bdev->func, C_INT_EN_CLR, MTK_REG_CHLPCR, NULL);
+ skb_queue_purge(&bdev->txq);
+ cancel_work_sync(&bdev->txrx_work);
+
+ gpiod_set_value_cansleep(bdev->reset, 1);
+ msleep(100);
+ gpiod_set_value_cansleep(bdev->reset, 0);
+
+ err = readx_poll_timeout(btmtksdio_chcr_query, bdev, status,
+ status & BT_RST_DONE, 100000, 2000000);
+ if (err < 0) {
+ bt_dev_err(hdev, "Failed to reset (%d)", err);
+ goto err;
+ }
+
+ clear_bit(BTMTKSDIO_PATCH_ENABLED, &bdev->tx_state);
+err:
+ sdio_release_host(bdev->func);
+
+ pm_runtime_put_noidle(bdev->dev);
+ pm_runtime_disable(bdev->dev);
+
+ hci_reset_dev(hdev);
+}
+
static bool btmtksdio_sdio_wakeup(struct hci_dev *hdev)
{
struct btmtksdio_dev *bdev = hci_get_drvdata(hdev);
@@ -1172,6 +1275,7 @@ static int btmtksdio_probe(struct sdio_func *func,
hdev->open = btmtksdio_open;
hdev->close = btmtksdio_close;
+ hdev->cmd_timeout = btmtksdio_cmd_timeout;
hdev->flush = btmtksdio_flush;
hdev->setup = btmtksdio_setup;
hdev->shutdown = btmtksdio_shutdown;
@@ -1216,6 +1320,13 @@ static int btmtksdio_probe(struct sdio_func *func,
if (err)
bt_dev_err(hdev, "failed to initialize device wakeup");
+ bdev->dev->of_node = of_find_compatible_node(NULL, NULL,
+ "mediatek,mt7921s-bluetooth");
+ bdev->reset = devm_gpiod_get_optional(bdev->dev, "reset",
+ GPIOD_OUT_LOW);
+ if (IS_ERR(bdev->reset))
+ err = PTR_ERR(bdev->reset);
+
return err;
}
--
2.25.1
^ permalink raw reply related [flat|nested] 14+ messages in thread* [PATCH 1/2] Bluetooth: mt7921s: support bluetooth reset mechanism
@ 2022-01-29 6:02 ` sean.wang
0 siblings, 0 replies; 14+ messages in thread
From: sean.wang @ 2022-01-29 6:02 UTC (permalink / raw)
To: marcel, johan.hedberg
Cc: Mark-YW.Chen, sean.wang, Soul.Huang, YN.Chen, Leon.Yen,
Eric-SY.Chang, Deren.Wu, km.lin, robin.chiu, Eddie.Chen, ch.yeh,
posh.sun, ted.huang, Eric.Liang, Stella.Chang, Tom.Chou,
steve.lee, jsiuda, frankgor, jemele, abhishekpandit, michaelfsun,
mcchou, shawnku, linux-bluetooth, linux-mediatek, linux-kernel,
Chih-Ying Chiang, Mark Chen
From: Chih-Ying Chiang <chih-yin.chiang@mediatek.com>
Implement .cmd_timeout to reset the MT7921s device via a dedicated GPIO
pin when the firmware hang or the command has no response.
Co-developed-by: Mark Chen <mark-yw.chen@mediatek.com>
Signed-off-by: Mark Chen <mark-yw.chen@mediatek.com>
Co-developed-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Chih-Ying Chiang <chih-yin.chiang@mediatek.com>
---
drivers/bluetooth/btmtk.h | 6 ++
drivers/bluetooth/btmtksdio.c | 113 +++++++++++++++++++++++++++++++++-
2 files changed, 118 insertions(+), 1 deletion(-)
diff --git a/drivers/bluetooth/btmtk.h b/drivers/bluetooth/btmtk.h
index fb76d9765ce0..8960a5f89d48 100644
--- a/drivers/bluetooth/btmtk.h
+++ b/drivers/bluetooth/btmtk.h
@@ -10,9 +10,15 @@
#define BTMTK_WMT_REG_WRITE 0x1
#define BTMTK_WMT_REG_READ 0x2
+#define MT7921_BTSYS_RST 0x70002610
+#define MT7921_BTSYS_RST_WITH_GPIO BIT(7)
+
#define MT7921_PINMUX_0 0x70005050
#define MT7921_PINMUX_1 0x70005054
+#define MT7921_DLSTATUS 0x7c053c10
+#define BT_DL_STATE BIT(1)
+
enum {
BTMTK_WMT_PATCH_DWNLD = 0x1,
BTMTK_WMT_TEST = 0x2,
diff --git a/drivers/bluetooth/btmtksdio.c b/drivers/bluetooth/btmtksdio.c
index 8be763ab3bf4..8e200e80d2f6 100644
--- a/drivers/bluetooth/btmtksdio.c
+++ b/drivers/bluetooth/btmtksdio.c
@@ -12,10 +12,12 @@
#include <asm/unaligned.h>
#include <linux/atomic.h>
+#include <linux/gpio/consumer.h>
#include <linux/init.h>
#include <linux/iopoll.h>
#include <linux/kernel.h>
#include <linux/module.h>
+#include <linux/of.h>
#include <linux/pm_runtime.h>
#include <linux/skbuff.h>
@@ -83,6 +85,7 @@ MODULE_DEVICE_TABLE(sdio, btmtksdio_table);
#define MTK_REG_CHCR 0xc
#define C_INT_CLR_CTRL BIT(1)
+#define BT_RST_DONE BIT(8)
/* CHISR have the same bits field definition with CHIER */
#define MTK_REG_CHISR 0x10
@@ -114,6 +117,7 @@ MODULE_DEVICE_TABLE(sdio, btmtksdio_table);
#define BTMTKSDIO_HW_TX_READY 2
#define BTMTKSDIO_FUNC_ENABLED 3
#define BTMTKSDIO_PATCH_ENABLED 4
+#define BTMTKSDIO_HW_RESET_ACTIVE 5
struct mtkbtsdio_hdr {
__le16 len;
@@ -133,6 +137,8 @@ struct btmtksdio_dev {
struct sk_buff *evt_skb;
const struct btmtksdio_data *data;
+
+ struct gpio_desc *reset;
};
static int mtk_hci_wmt_sync(struct hci_dev *hdev,
@@ -297,6 +303,11 @@ static u32 btmtksdio_drv_own_query_79xx(struct btmtksdio_dev *bdev)
return sdio_readl(bdev->func, MTK_REG_PD2HRM0R, NULL);
}
+static u32 btmtksdio_chcr_query(struct btmtksdio_dev *bdev)
+{
+ return sdio_readl(bdev->func, MTK_REG_CHCR, NULL);
+}
+
static int btmtksdio_fw_pmctrl(struct btmtksdio_dev *bdev)
{
u32 status;
@@ -967,6 +978,28 @@ static int btmtksdio_sco_setting(struct hci_dev *hdev)
return btmtksdio_mtk_reg_write(hdev, MT7921_PINMUX_1, val, ~0);
}
+static int btmtksdio_reset_setting(struct hci_dev *hdev)
+{
+ int err;
+ u32 val;
+
+ err = btmtksdio_mtk_reg_read(hdev, MT7921_PINMUX_1, &val);
+ if (err < 0)
+ return err;
+
+ val |= 0x20; /* set the pin (bit field 11:8) work as GPIO mode */
+ err = btmtksdio_mtk_reg_write(hdev, MT7921_PINMUX_1, val, ~0);
+ if (err < 0)
+ return err;
+
+ err = btmtksdio_mtk_reg_read(hdev, MT7921_BTSYS_RST, &val);
+ if (err < 0)
+ return err;
+
+ val |= MT7921_BTSYS_RST_WITH_GPIO;
+ return btmtksdio_mtk_reg_write(hdev, MT7921_BTSYS_RST, val, ~0);
+}
+
static int btmtksdio_setup(struct hci_dev *hdev)
{
struct btmtksdio_dev *bdev = hci_get_drvdata(hdev);
@@ -974,13 +1007,32 @@ static int btmtksdio_setup(struct hci_dev *hdev)
unsigned long long duration;
char fwname[64];
int err, dev_id;
- u32 fw_version = 0;
+ u32 fw_version = 0, val;
calltime = ktime_get();
set_bit(BTMTKSDIO_HW_TX_READY, &bdev->tx_state);
switch (bdev->data->chipid) {
case 0x7921:
+ if (test_bit(BTMTKSDIO_HW_RESET_ACTIVE, &bdev->tx_state)) {
+ err = btmtksdio_mtk_reg_read(hdev, MT7921_DLSTATUS,
+ &val);
+ if (err < 0)
+ return err;
+
+ val &= ~BT_DL_STATE;
+ err = btmtksdio_mtk_reg_write(hdev, MT7921_DLSTATUS,
+ val, ~0);
+ if (err < 0)
+ return err;
+
+ btmtksdio_fw_pmctrl(bdev);
+ msleep(20);
+ btmtksdio_drv_pmctrl(bdev);
+
+ clear_bit(BTMTKSDIO_HW_RESET_ACTIVE, &bdev->tx_state);
+ }
+
err = btmtksdio_mtk_reg_read(hdev, 0x70010200, &dev_id);
if (err < 0) {
bt_dev_err(hdev, "Failed to get device id (%d)", err);
@@ -1015,6 +1067,16 @@ static int btmtksdio_setup(struct hci_dev *hdev)
return err;
}
+ /* Enable GPIO reset mechanism */
+ if (bdev->reset) {
+ err = btmtksdio_reset_setting(hdev);
+ if (err < 0) {
+ bt_dev_err(hdev, "Failed to enable Reset setting (%d)", err);
+ devm_gpiod_put(bdev->dev, bdev->reset);
+ bdev->reset = NULL;
+ }
+ }
+
break;
case 0x7663:
case 0x7668:
@@ -1111,6 +1173,47 @@ static int btmtksdio_send_frame(struct hci_dev *hdev, struct sk_buff *skb)
return 0;
}
+static void btmtksdio_cmd_timeout(struct hci_dev *hdev)
+{
+ struct btmtksdio_dev *bdev = hci_get_drvdata(hdev);
+ u32 status;
+ int err;
+
+ if (!bdev->reset || bdev->data->chipid != 0x7921)
+ return;
+
+ pm_runtime_get_sync(bdev->dev);
+
+ if (test_and_set_bit(BTMTKSDIO_HW_RESET_ACTIVE, &bdev->tx_state))
+ return;
+
+ sdio_claim_host(bdev->func);
+
+ sdio_writel(bdev->func, C_INT_EN_CLR, MTK_REG_CHLPCR, NULL);
+ skb_queue_purge(&bdev->txq);
+ cancel_work_sync(&bdev->txrx_work);
+
+ gpiod_set_value_cansleep(bdev->reset, 1);
+ msleep(100);
+ gpiod_set_value_cansleep(bdev->reset, 0);
+
+ err = readx_poll_timeout(btmtksdio_chcr_query, bdev, status,
+ status & BT_RST_DONE, 100000, 2000000);
+ if (err < 0) {
+ bt_dev_err(hdev, "Failed to reset (%d)", err);
+ goto err;
+ }
+
+ clear_bit(BTMTKSDIO_PATCH_ENABLED, &bdev->tx_state);
+err:
+ sdio_release_host(bdev->func);
+
+ pm_runtime_put_noidle(bdev->dev);
+ pm_runtime_disable(bdev->dev);
+
+ hci_reset_dev(hdev);
+}
+
static bool btmtksdio_sdio_wakeup(struct hci_dev *hdev)
{
struct btmtksdio_dev *bdev = hci_get_drvdata(hdev);
@@ -1172,6 +1275,7 @@ static int btmtksdio_probe(struct sdio_func *func,
hdev->open = btmtksdio_open;
hdev->close = btmtksdio_close;
+ hdev->cmd_timeout = btmtksdio_cmd_timeout;
hdev->flush = btmtksdio_flush;
hdev->setup = btmtksdio_setup;
hdev->shutdown = btmtksdio_shutdown;
@@ -1216,6 +1320,13 @@ static int btmtksdio_probe(struct sdio_func *func,
if (err)
bt_dev_err(hdev, "failed to initialize device wakeup");
+ bdev->dev->of_node = of_find_compatible_node(NULL, NULL,
+ "mediatek,mt7921s-bluetooth");
+ bdev->reset = devm_gpiod_get_optional(bdev->dev, "reset",
+ GPIOD_OUT_LOW);
+ if (IS_ERR(bdev->reset))
+ err = PTR_ERR(bdev->reset);
+
return err;
}
--
2.25.1
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek
^ permalink raw reply related [flat|nested] 14+ messages in thread* [PATCH 2/2] Bluetooth: mediatek: fix the conflict between mtk and msft vendor event
2022-01-29 6:02 ` sean.wang
@ 2022-01-29 6:02 ` sean.wang
-1 siblings, 0 replies; 14+ messages in thread
From: sean.wang @ 2022-01-29 6:02 UTC (permalink / raw)
To: marcel, johan.hedberg
Cc: Mark-YW.Chen, sean.wang, Soul.Huang, YN.Chen, Leon.Yen,
Eric-SY.Chang, Deren.Wu, km.lin, robin.chiu, Eddie.Chen, ch.yeh,
posh.sun, ted.huang, Eric.Liang, Stella.Chang, Tom.Chou,
steve.lee, jsiuda, frankgor, jemele, abhishekpandit, michaelfsun,
mcchou, shawnku, linux-bluetooth, linux-mediatek, linux-kernel
From: Sean Wang <sean.wang@mediatek.com>
There is a conflict between MediaTek wmt event and msft vendor extension
logic in the core layer since 145373cb1b1f ("Bluetooth: Add framework for
Microsoft vendor extension") was introduced because we changed the type of
mediatek wmt event to the type of msft vendor event in the driver.
But the purpose we reported mediatek event to the core layer is for the
diagnostic purpose with that we are able to see the full packet trace via
monitoring socket with btmon. Thus, it is harmless we keep the original
type of mediatek vendor event here to avoid breaking the msft extension
function especially they can be supported by Mediatek chipset like MT7921
, MT7922 devices and future devices.
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
---
drivers/bluetooth/btmtk.h | 1 +
drivers/bluetooth/btmtksdio.c | 9 +--------
drivers/bluetooth/btusb.c | 5 -----
3 files changed, 2 insertions(+), 13 deletions(-)
diff --git a/drivers/bluetooth/btmtk.h b/drivers/bluetooth/btmtk.h
index 8960a5f89d48..013850fd2055 100644
--- a/drivers/bluetooth/btmtk.h
+++ b/drivers/bluetooth/btmtk.h
@@ -5,6 +5,7 @@
#define FIRMWARE_MT7668 "mediatek/mt7668pr2h.bin"
#define FIRMWARE_MT7961 "mediatek/BT_RAM_CODE_MT7961_1_2_hdr.bin"
+#define HCI_EV_WMT 0xe4
#define HCI_WMT_MAX_EVENT_SIZE 64
#define BTMTK_WMT_REG_WRITE 0x1
diff --git a/drivers/bluetooth/btmtksdio.c b/drivers/bluetooth/btmtksdio.c
index 8e200e80d2f6..cbb09e1b823d 100644
--- a/drivers/bluetooth/btmtksdio.c
+++ b/drivers/bluetooth/btmtksdio.c
@@ -381,13 +381,6 @@ static int btmtksdio_recv_event(struct hci_dev *hdev, struct sk_buff *skb)
struct hci_event_hdr *hdr = (void *)skb->data;
int err;
- /* Fix up the vendor event id with 0xff for vendor specific instead
- * of 0xe4 so that event send via monitoring socket can be parsed
- * properly.
- */
- if (hdr->evt == 0xe4)
- hdr->evt = HCI_EV_VENDOR;
-
/* When someone waits for the WMT event, the skb is being cloned
* and being processed the events from there then.
*/
@@ -403,7 +396,7 @@ static int btmtksdio_recv_event(struct hci_dev *hdev, struct sk_buff *skb)
if (err < 0)
goto err_free_skb;
- if (hdr->evt == HCI_EV_VENDOR) {
+ if (hdr->evt == HCI_EV_WMT) {
if (test_and_clear_bit(BTMTKSDIO_TX_WAIT_VND_EVT,
&bdev->tx_state)) {
/* Barrier to sync with other CPUs */
diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index aefa0ee293f3..55ebab019d29 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -2271,11 +2271,6 @@ static void btusb_mtk_wmt_recv(struct urb *urb)
skb_put_data(skb, urb->transfer_buffer, urb->actual_length);
hdr = (void *)skb->data;
- /* Fix up the vendor event id with 0xff for vendor specific
- * instead of 0xe4 so that event send via monitoring socket can
- * be parsed properly.
- */
- hdr->evt = 0xff;
/* When someone waits for the WMT event, the skb is being cloned
* and being processed the events from there then.
--
2.25.1
^ permalink raw reply related [flat|nested] 14+ messages in thread* [PATCH 2/2] Bluetooth: mediatek: fix the conflict between mtk and msft vendor event
@ 2022-01-29 6:02 ` sean.wang
0 siblings, 0 replies; 14+ messages in thread
From: sean.wang @ 2022-01-29 6:02 UTC (permalink / raw)
To: marcel, johan.hedberg
Cc: Mark-YW.Chen, sean.wang, Soul.Huang, YN.Chen, Leon.Yen,
Eric-SY.Chang, Deren.Wu, km.lin, robin.chiu, Eddie.Chen, ch.yeh,
posh.sun, ted.huang, Eric.Liang, Stella.Chang, Tom.Chou,
steve.lee, jsiuda, frankgor, jemele, abhishekpandit, michaelfsun,
mcchou, shawnku, linux-bluetooth, linux-mediatek, linux-kernel
From: Sean Wang <sean.wang@mediatek.com>
There is a conflict between MediaTek wmt event and msft vendor extension
logic in the core layer since 145373cb1b1f ("Bluetooth: Add framework for
Microsoft vendor extension") was introduced because we changed the type of
mediatek wmt event to the type of msft vendor event in the driver.
But the purpose we reported mediatek event to the core layer is for the
diagnostic purpose with that we are able to see the full packet trace via
monitoring socket with btmon. Thus, it is harmless we keep the original
type of mediatek vendor event here to avoid breaking the msft extension
function especially they can be supported by Mediatek chipset like MT7921
, MT7922 devices and future devices.
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
---
drivers/bluetooth/btmtk.h | 1 +
drivers/bluetooth/btmtksdio.c | 9 +--------
drivers/bluetooth/btusb.c | 5 -----
3 files changed, 2 insertions(+), 13 deletions(-)
diff --git a/drivers/bluetooth/btmtk.h b/drivers/bluetooth/btmtk.h
index 8960a5f89d48..013850fd2055 100644
--- a/drivers/bluetooth/btmtk.h
+++ b/drivers/bluetooth/btmtk.h
@@ -5,6 +5,7 @@
#define FIRMWARE_MT7668 "mediatek/mt7668pr2h.bin"
#define FIRMWARE_MT7961 "mediatek/BT_RAM_CODE_MT7961_1_2_hdr.bin"
+#define HCI_EV_WMT 0xe4
#define HCI_WMT_MAX_EVENT_SIZE 64
#define BTMTK_WMT_REG_WRITE 0x1
diff --git a/drivers/bluetooth/btmtksdio.c b/drivers/bluetooth/btmtksdio.c
index 8e200e80d2f6..cbb09e1b823d 100644
--- a/drivers/bluetooth/btmtksdio.c
+++ b/drivers/bluetooth/btmtksdio.c
@@ -381,13 +381,6 @@ static int btmtksdio_recv_event(struct hci_dev *hdev, struct sk_buff *skb)
struct hci_event_hdr *hdr = (void *)skb->data;
int err;
- /* Fix up the vendor event id with 0xff for vendor specific instead
- * of 0xe4 so that event send via monitoring socket can be parsed
- * properly.
- */
- if (hdr->evt == 0xe4)
- hdr->evt = HCI_EV_VENDOR;
-
/* When someone waits for the WMT event, the skb is being cloned
* and being processed the events from there then.
*/
@@ -403,7 +396,7 @@ static int btmtksdio_recv_event(struct hci_dev *hdev, struct sk_buff *skb)
if (err < 0)
goto err_free_skb;
- if (hdr->evt == HCI_EV_VENDOR) {
+ if (hdr->evt == HCI_EV_WMT) {
if (test_and_clear_bit(BTMTKSDIO_TX_WAIT_VND_EVT,
&bdev->tx_state)) {
/* Barrier to sync with other CPUs */
diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index aefa0ee293f3..55ebab019d29 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -2271,11 +2271,6 @@ static void btusb_mtk_wmt_recv(struct urb *urb)
skb_put_data(skb, urb->transfer_buffer, urb->actual_length);
hdr = (void *)skb->data;
- /* Fix up the vendor event id with 0xff for vendor specific
- * instead of 0xe4 so that event send via monitoring socket can
- * be parsed properly.
- */
- hdr->evt = 0xff;
/* When someone waits for the WMT event, the skb is being cloned
* and being processed the events from there then.
--
2.25.1
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek
^ permalink raw reply related [flat|nested] 14+ messages in thread* Re: [PATCH 2/2] Bluetooth: mediatek: fix the conflict between mtk and msft vendor event
2022-01-29 6:02 ` sean.wang
(?)
@ 2022-01-29 9:54 ` kernel test robot
-1 siblings, 0 replies; 14+ messages in thread
From: kernel test robot @ 2022-01-29 9:54 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 8438 bytes --]
Hi,
I love your patch! Perhaps something to improve:
[auto build test WARNING on bluetooth-next/master]
[also build test WARNING on next-20220128]
[cannot apply to bluetooth/master v5.17-rc1]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/sean-wang-mediatek-com/Bluetooth-mt7921s-support-bluetooth-reset-mechanism/20220129-140313
base: https://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth-next.git master
config: mips-allyesconfig (https://download.01.org/0day-ci/archive/20220129/202201291727.neufc3xR-lkp(a)intel.com/config)
compiler: mips-linux-gcc (GCC) 11.2.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/33092fd43b74594bae07555a6fdf15133cc8ec54
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review sean-wang-mediatek-com/Bluetooth-mt7921s-support-bluetooth-reset-mechanism/20220129-140313
git checkout 33092fd43b74594bae07555a6fdf15133cc8ec54
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=mips SHELL=/bin/bash drivers/
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
drivers/bluetooth/btusb.c: In function 'btusb_mtk_wmt_recv':
>> drivers/bluetooth/btusb.c:2253:31: warning: variable 'hdr' set but not used [-Wunused-but-set-variable]
2253 | struct hci_event_hdr *hdr;
| ^~~
vim +/hdr +2253 drivers/bluetooth/btusb.c
5a87679ffd4436 mark-yw.chen 2021-09-01 2248
a1c49c434e1505 Sean Wang 2019-06-02 2249 static void btusb_mtk_wmt_recv(struct urb *urb)
a1c49c434e1505 Sean Wang 2019-06-02 2250 {
a1c49c434e1505 Sean Wang 2019-06-02 2251 struct hci_dev *hdev = urb->context;
a1c49c434e1505 Sean Wang 2019-06-02 2252 struct btusb_data *data = hci_get_drvdata(hdev);
a1c49c434e1505 Sean Wang 2019-06-02 @2253 struct hci_event_hdr *hdr;
a1c49c434e1505 Sean Wang 2019-06-02 2254 struct sk_buff *skb;
a1c49c434e1505 Sean Wang 2019-06-02 2255 int err;
a1c49c434e1505 Sean Wang 2019-06-02 2256
a1c49c434e1505 Sean Wang 2019-06-02 2257 if (urb->status == 0 && urb->actual_length > 0) {
a1c49c434e1505 Sean Wang 2019-06-02 2258 hdev->stat.byte_rx += urb->actual_length;
a1c49c434e1505 Sean Wang 2019-06-02 2259
a1c49c434e1505 Sean Wang 2019-06-02 2260 /* WMT event shouldn't be fragmented and the size should be
a1c49c434e1505 Sean Wang 2019-06-02 2261 * less than HCI_WMT_MAX_EVENT_SIZE.
a1c49c434e1505 Sean Wang 2019-06-02 2262 */
a1c49c434e1505 Sean Wang 2019-06-02 2263 skb = bt_skb_alloc(HCI_WMT_MAX_EVENT_SIZE, GFP_ATOMIC);
a1c49c434e1505 Sean Wang 2019-06-02 2264 if (!skb) {
a1c49c434e1505 Sean Wang 2019-06-02 2265 hdev->stat.err_rx++;
60c6a63a3d3080 Mark-YW.Chen 2021-10-14 2266 kfree(urb->setup_packet);
de71a6cb4bf24d Jupeng Zhong 2021-02-02 2267 return;
a1c49c434e1505 Sean Wang 2019-06-02 2268 }
a1c49c434e1505 Sean Wang 2019-06-02 2269
a1c49c434e1505 Sean Wang 2019-06-02 2270 hci_skb_pkt_type(skb) = HCI_EVENT_PKT;
a1c49c434e1505 Sean Wang 2019-06-02 2271 skb_put_data(skb, urb->transfer_buffer, urb->actual_length);
a1c49c434e1505 Sean Wang 2019-06-02 2272
a1c49c434e1505 Sean Wang 2019-06-02 2273 hdr = (void *)skb->data;
a1c49c434e1505 Sean Wang 2019-06-02 2274
a1c49c434e1505 Sean Wang 2019-06-02 2275 /* When someone waits for the WMT event, the skb is being cloned
a1c49c434e1505 Sean Wang 2019-06-02 2276 * and being processed the events from there then.
a1c49c434e1505 Sean Wang 2019-06-02 2277 */
a1c49c434e1505 Sean Wang 2019-06-02 2278 if (test_bit(BTUSB_TX_WAIT_VND_EVT, &data->flags)) {
22cc6b7a1dbb58 Johan Hovold 2019-11-28 2279 data->evt_skb = skb_clone(skb, GFP_ATOMIC);
de71a6cb4bf24d Jupeng Zhong 2021-02-02 2280 if (!data->evt_skb) {
de71a6cb4bf24d Jupeng Zhong 2021-02-02 2281 kfree_skb(skb);
60c6a63a3d3080 Mark-YW.Chen 2021-10-14 2282 kfree(urb->setup_packet);
de71a6cb4bf24d Jupeng Zhong 2021-02-02 2283 return;
de71a6cb4bf24d Jupeng Zhong 2021-02-02 2284 }
a1c49c434e1505 Sean Wang 2019-06-02 2285 }
a1c49c434e1505 Sean Wang 2019-06-02 2286
a1c49c434e1505 Sean Wang 2019-06-02 2287 err = hci_recv_frame(hdev, skb);
de71a6cb4bf24d Jupeng Zhong 2021-02-02 2288 if (err < 0) {
de71a6cb4bf24d Jupeng Zhong 2021-02-02 2289 kfree_skb(data->evt_skb);
de71a6cb4bf24d Jupeng Zhong 2021-02-02 2290 data->evt_skb = NULL;
60c6a63a3d3080 Mark-YW.Chen 2021-10-14 2291 kfree(urb->setup_packet);
de71a6cb4bf24d Jupeng Zhong 2021-02-02 2292 return;
de71a6cb4bf24d Jupeng Zhong 2021-02-02 2293 }
a1c49c434e1505 Sean Wang 2019-06-02 2294
a1c49c434e1505 Sean Wang 2019-06-02 2295 if (test_and_clear_bit(BTUSB_TX_WAIT_VND_EVT,
a1c49c434e1505 Sean Wang 2019-06-02 2296 &data->flags)) {
a1c49c434e1505 Sean Wang 2019-06-02 2297 /* Barrier to sync with other CPUs */
a1c49c434e1505 Sean Wang 2019-06-02 2298 smp_mb__after_atomic();
a1c49c434e1505 Sean Wang 2019-06-02 2299 wake_up_bit(&data->flags,
a1c49c434e1505 Sean Wang 2019-06-02 2300 BTUSB_TX_WAIT_VND_EVT);
a1c49c434e1505 Sean Wang 2019-06-02 2301 }
60c6a63a3d3080 Mark-YW.Chen 2021-10-14 2302 kfree(urb->setup_packet);
a1c49c434e1505 Sean Wang 2019-06-02 2303 return;
a1c49c434e1505 Sean Wang 2019-06-02 2304 } else if (urb->status == -ENOENT) {
a1c49c434e1505 Sean Wang 2019-06-02 2305 /* Avoid suspend failed when usb_kill_urb */
a1c49c434e1505 Sean Wang 2019-06-02 2306 return;
a1c49c434e1505 Sean Wang 2019-06-02 2307 }
a1c49c434e1505 Sean Wang 2019-06-02 2308
a1c49c434e1505 Sean Wang 2019-06-02 2309 usb_mark_last_busy(data->udev);
a1c49c434e1505 Sean Wang 2019-06-02 2310
a1c49c434e1505 Sean Wang 2019-06-02 2311 /* The URB complete handler is still called with urb->actual_length = 0
a1c49c434e1505 Sean Wang 2019-06-02 2312 * when the event is not available, so we should keep re-submitting
a1c49c434e1505 Sean Wang 2019-06-02 2313 * URB until WMT event returns, Also, It's necessary to wait some time
a1c49c434e1505 Sean Wang 2019-06-02 2314 * between the two consecutive control URBs to relax the target device
a1c49c434e1505 Sean Wang 2019-06-02 2315 * to generate the event. Otherwise, the WMT event cannot return from
a1c49c434e1505 Sean Wang 2019-06-02 2316 * the device successfully.
a1c49c434e1505 Sean Wang 2019-06-02 2317 */
48c13301e6baba Mark Chen 2021-02-02 2318 udelay(500);
a1c49c434e1505 Sean Wang 2019-06-02 2319
a1c49c434e1505 Sean Wang 2019-06-02 2320 usb_anchor_urb(urb, &data->ctrl_anchor);
a1c49c434e1505 Sean Wang 2019-06-02 2321 err = usb_submit_urb(urb, GFP_ATOMIC);
a1c49c434e1505 Sean Wang 2019-06-02 2322 if (err < 0) {
60c6a63a3d3080 Mark-YW.Chen 2021-10-14 2323 kfree(urb->setup_packet);
a1c49c434e1505 Sean Wang 2019-06-02 2324 /* -EPERM: urb is being killed;
a1c49c434e1505 Sean Wang 2019-06-02 2325 * -ENODEV: device got disconnected
a1c49c434e1505 Sean Wang 2019-06-02 2326 */
a1c49c434e1505 Sean Wang 2019-06-02 2327 if (err != -EPERM && err != -ENODEV)
a1c49c434e1505 Sean Wang 2019-06-02 2328 bt_dev_err(hdev, "urb %p failed to resubmit (%d)",
a1c49c434e1505 Sean Wang 2019-06-02 2329 urb, -err);
a1c49c434e1505 Sean Wang 2019-06-02 2330 usb_unanchor_urb(urb);
a1c49c434e1505 Sean Wang 2019-06-02 2331 }
a1c49c434e1505 Sean Wang 2019-06-02 2332 }
a1c49c434e1505 Sean Wang 2019-06-02 2333
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
^ permalink raw reply [flat|nested] 14+ messages in thread* Re: [PATCH 2/2] Bluetooth: mediatek: fix the conflict between mtk and msft vendor event
2022-01-29 6:02 ` sean.wang
@ 2022-01-29 9:54 ` kernel test robot
-1 siblings, 0 replies; 14+ messages in thread
From: kernel test robot @ 2022-01-29 9:54 UTC (permalink / raw)
To: sean.wang, marcel, johan.hedberg
Cc: llvm, kbuild-all, Mark-YW.Chen, sean.wang, Soul.Huang, YN.Chen,
Leon.Yen, Eric-SY.Chang, Deren.Wu, km.lin
Hi,
I love your patch! Perhaps something to improve:
[auto build test WARNING on bluetooth-next/master]
[also build test WARNING on next-20220128]
[cannot apply to v5.17-rc1]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/sean-wang-mediatek-com/Bluetooth-mt7921s-support-bluetooth-reset-mechanism/20220129-140313
base: https://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth-next.git master
config: x86_64-randconfig-a012-20220124 (https://download.01.org/0day-ci/archive/20220129/202201291757.gh2GX6y1-lkp@intel.com/config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 33b45ee44b1f32ffdbc995e6fec806271b4b3ba4)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/33092fd43b74594bae07555a6fdf15133cc8ec54
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review sean-wang-mediatek-com/Bluetooth-mt7921s-support-bluetooth-reset-mechanism/20220129-140313
git checkout 33092fd43b74594bae07555a6fdf15133cc8ec54
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
>> drivers/bluetooth/btusb.c:2253:24: warning: variable 'hdr' set but not used [-Wunused-but-set-variable]
struct hci_event_hdr *hdr;
^
1 warning generated.
vim +/hdr +2253 drivers/bluetooth/btusb.c
5a87679ffd4436 mark-yw.chen 2021-09-01 2248
a1c49c434e1505 Sean Wang 2019-06-02 2249 static void btusb_mtk_wmt_recv(struct urb *urb)
a1c49c434e1505 Sean Wang 2019-06-02 2250 {
a1c49c434e1505 Sean Wang 2019-06-02 2251 struct hci_dev *hdev = urb->context;
a1c49c434e1505 Sean Wang 2019-06-02 2252 struct btusb_data *data = hci_get_drvdata(hdev);
a1c49c434e1505 Sean Wang 2019-06-02 @2253 struct hci_event_hdr *hdr;
a1c49c434e1505 Sean Wang 2019-06-02 2254 struct sk_buff *skb;
a1c49c434e1505 Sean Wang 2019-06-02 2255 int err;
a1c49c434e1505 Sean Wang 2019-06-02 2256
a1c49c434e1505 Sean Wang 2019-06-02 2257 if (urb->status == 0 && urb->actual_length > 0) {
a1c49c434e1505 Sean Wang 2019-06-02 2258 hdev->stat.byte_rx += urb->actual_length;
a1c49c434e1505 Sean Wang 2019-06-02 2259
a1c49c434e1505 Sean Wang 2019-06-02 2260 /* WMT event shouldn't be fragmented and the size should be
a1c49c434e1505 Sean Wang 2019-06-02 2261 * less than HCI_WMT_MAX_EVENT_SIZE.
a1c49c434e1505 Sean Wang 2019-06-02 2262 */
a1c49c434e1505 Sean Wang 2019-06-02 2263 skb = bt_skb_alloc(HCI_WMT_MAX_EVENT_SIZE, GFP_ATOMIC);
a1c49c434e1505 Sean Wang 2019-06-02 2264 if (!skb) {
a1c49c434e1505 Sean Wang 2019-06-02 2265 hdev->stat.err_rx++;
60c6a63a3d3080 Mark-YW.Chen 2021-10-14 2266 kfree(urb->setup_packet);
de71a6cb4bf24d Jupeng Zhong 2021-02-02 2267 return;
a1c49c434e1505 Sean Wang 2019-06-02 2268 }
a1c49c434e1505 Sean Wang 2019-06-02 2269
a1c49c434e1505 Sean Wang 2019-06-02 2270 hci_skb_pkt_type(skb) = HCI_EVENT_PKT;
a1c49c434e1505 Sean Wang 2019-06-02 2271 skb_put_data(skb, urb->transfer_buffer, urb->actual_length);
a1c49c434e1505 Sean Wang 2019-06-02 2272
a1c49c434e1505 Sean Wang 2019-06-02 2273 hdr = (void *)skb->data;
a1c49c434e1505 Sean Wang 2019-06-02 2274
a1c49c434e1505 Sean Wang 2019-06-02 2275 /* When someone waits for the WMT event, the skb is being cloned
a1c49c434e1505 Sean Wang 2019-06-02 2276 * and being processed the events from there then.
a1c49c434e1505 Sean Wang 2019-06-02 2277 */
a1c49c434e1505 Sean Wang 2019-06-02 2278 if (test_bit(BTUSB_TX_WAIT_VND_EVT, &data->flags)) {
22cc6b7a1dbb58 Johan Hovold 2019-11-28 2279 data->evt_skb = skb_clone(skb, GFP_ATOMIC);
de71a6cb4bf24d Jupeng Zhong 2021-02-02 2280 if (!data->evt_skb) {
de71a6cb4bf24d Jupeng Zhong 2021-02-02 2281 kfree_skb(skb);
60c6a63a3d3080 Mark-YW.Chen 2021-10-14 2282 kfree(urb->setup_packet);
de71a6cb4bf24d Jupeng Zhong 2021-02-02 2283 return;
de71a6cb4bf24d Jupeng Zhong 2021-02-02 2284 }
a1c49c434e1505 Sean Wang 2019-06-02 2285 }
a1c49c434e1505 Sean Wang 2019-06-02 2286
a1c49c434e1505 Sean Wang 2019-06-02 2287 err = hci_recv_frame(hdev, skb);
de71a6cb4bf24d Jupeng Zhong 2021-02-02 2288 if (err < 0) {
de71a6cb4bf24d Jupeng Zhong 2021-02-02 2289 kfree_skb(data->evt_skb);
de71a6cb4bf24d Jupeng Zhong 2021-02-02 2290 data->evt_skb = NULL;
60c6a63a3d3080 Mark-YW.Chen 2021-10-14 2291 kfree(urb->setup_packet);
de71a6cb4bf24d Jupeng Zhong 2021-02-02 2292 return;
de71a6cb4bf24d Jupeng Zhong 2021-02-02 2293 }
a1c49c434e1505 Sean Wang 2019-06-02 2294
a1c49c434e1505 Sean Wang 2019-06-02 2295 if (test_and_clear_bit(BTUSB_TX_WAIT_VND_EVT,
a1c49c434e1505 Sean Wang 2019-06-02 2296 &data->flags)) {
a1c49c434e1505 Sean Wang 2019-06-02 2297 /* Barrier to sync with other CPUs */
a1c49c434e1505 Sean Wang 2019-06-02 2298 smp_mb__after_atomic();
a1c49c434e1505 Sean Wang 2019-06-02 2299 wake_up_bit(&data->flags,
a1c49c434e1505 Sean Wang 2019-06-02 2300 BTUSB_TX_WAIT_VND_EVT);
a1c49c434e1505 Sean Wang 2019-06-02 2301 }
60c6a63a3d3080 Mark-YW.Chen 2021-10-14 2302 kfree(urb->setup_packet);
a1c49c434e1505 Sean Wang 2019-06-02 2303 return;
a1c49c434e1505 Sean Wang 2019-06-02 2304 } else if (urb->status == -ENOENT) {
a1c49c434e1505 Sean Wang 2019-06-02 2305 /* Avoid suspend failed when usb_kill_urb */
a1c49c434e1505 Sean Wang 2019-06-02 2306 return;
a1c49c434e1505 Sean Wang 2019-06-02 2307 }
a1c49c434e1505 Sean Wang 2019-06-02 2308
a1c49c434e1505 Sean Wang 2019-06-02 2309 usb_mark_last_busy(data->udev);
a1c49c434e1505 Sean Wang 2019-06-02 2310
a1c49c434e1505 Sean Wang 2019-06-02 2311 /* The URB complete handler is still called with urb->actual_length = 0
a1c49c434e1505 Sean Wang 2019-06-02 2312 * when the event is not available, so we should keep re-submitting
a1c49c434e1505 Sean Wang 2019-06-02 2313 * URB until WMT event returns, Also, It's necessary to wait some time
a1c49c434e1505 Sean Wang 2019-06-02 2314 * between the two consecutive control URBs to relax the target device
a1c49c434e1505 Sean Wang 2019-06-02 2315 * to generate the event. Otherwise, the WMT event cannot return from
a1c49c434e1505 Sean Wang 2019-06-02 2316 * the device successfully.
a1c49c434e1505 Sean Wang 2019-06-02 2317 */
48c13301e6baba Mark Chen 2021-02-02 2318 udelay(500);
a1c49c434e1505 Sean Wang 2019-06-02 2319
a1c49c434e1505 Sean Wang 2019-06-02 2320 usb_anchor_urb(urb, &data->ctrl_anchor);
a1c49c434e1505 Sean Wang 2019-06-02 2321 err = usb_submit_urb(urb, GFP_ATOMIC);
a1c49c434e1505 Sean Wang 2019-06-02 2322 if (err < 0) {
60c6a63a3d3080 Mark-YW.Chen 2021-10-14 2323 kfree(urb->setup_packet);
a1c49c434e1505 Sean Wang 2019-06-02 2324 /* -EPERM: urb is being killed;
a1c49c434e1505 Sean Wang 2019-06-02 2325 * -ENODEV: device got disconnected
a1c49c434e1505 Sean Wang 2019-06-02 2326 */
a1c49c434e1505 Sean Wang 2019-06-02 2327 if (err != -EPERM && err != -ENODEV)
a1c49c434e1505 Sean Wang 2019-06-02 2328 bt_dev_err(hdev, "urb %p failed to resubmit (%d)",
a1c49c434e1505 Sean Wang 2019-06-02 2329 urb, -err);
a1c49c434e1505 Sean Wang 2019-06-02 2330 usb_unanchor_urb(urb);
a1c49c434e1505 Sean Wang 2019-06-02 2331 }
a1c49c434e1505 Sean Wang 2019-06-02 2332 }
a1c49c434e1505 Sean Wang 2019-06-02 2333
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
^ permalink raw reply [flat|nested] 14+ messages in thread* Re: [PATCH 2/2] Bluetooth: mediatek: fix the conflict between mtk and msft vendor event
@ 2022-01-29 9:54 ` kernel test robot
0 siblings, 0 replies; 14+ messages in thread
From: kernel test robot @ 2022-01-29 9:54 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 8442 bytes --]
Hi,
I love your patch! Perhaps something to improve:
[auto build test WARNING on bluetooth-next/master]
[also build test WARNING on next-20220128]
[cannot apply to v5.17-rc1]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/sean-wang-mediatek-com/Bluetooth-mt7921s-support-bluetooth-reset-mechanism/20220129-140313
base: https://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth-next.git master
config: x86_64-randconfig-a012-20220124 (https://download.01.org/0day-ci/archive/20220129/202201291757.gh2GX6y1-lkp(a)intel.com/config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 33b45ee44b1f32ffdbc995e6fec806271b4b3ba4)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/33092fd43b74594bae07555a6fdf15133cc8ec54
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review sean-wang-mediatek-com/Bluetooth-mt7921s-support-bluetooth-reset-mechanism/20220129-140313
git checkout 33092fd43b74594bae07555a6fdf15133cc8ec54
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
>> drivers/bluetooth/btusb.c:2253:24: warning: variable 'hdr' set but not used [-Wunused-but-set-variable]
struct hci_event_hdr *hdr;
^
1 warning generated.
vim +/hdr +2253 drivers/bluetooth/btusb.c
5a87679ffd4436 mark-yw.chen 2021-09-01 2248
a1c49c434e1505 Sean Wang 2019-06-02 2249 static void btusb_mtk_wmt_recv(struct urb *urb)
a1c49c434e1505 Sean Wang 2019-06-02 2250 {
a1c49c434e1505 Sean Wang 2019-06-02 2251 struct hci_dev *hdev = urb->context;
a1c49c434e1505 Sean Wang 2019-06-02 2252 struct btusb_data *data = hci_get_drvdata(hdev);
a1c49c434e1505 Sean Wang 2019-06-02 @2253 struct hci_event_hdr *hdr;
a1c49c434e1505 Sean Wang 2019-06-02 2254 struct sk_buff *skb;
a1c49c434e1505 Sean Wang 2019-06-02 2255 int err;
a1c49c434e1505 Sean Wang 2019-06-02 2256
a1c49c434e1505 Sean Wang 2019-06-02 2257 if (urb->status == 0 && urb->actual_length > 0) {
a1c49c434e1505 Sean Wang 2019-06-02 2258 hdev->stat.byte_rx += urb->actual_length;
a1c49c434e1505 Sean Wang 2019-06-02 2259
a1c49c434e1505 Sean Wang 2019-06-02 2260 /* WMT event shouldn't be fragmented and the size should be
a1c49c434e1505 Sean Wang 2019-06-02 2261 * less than HCI_WMT_MAX_EVENT_SIZE.
a1c49c434e1505 Sean Wang 2019-06-02 2262 */
a1c49c434e1505 Sean Wang 2019-06-02 2263 skb = bt_skb_alloc(HCI_WMT_MAX_EVENT_SIZE, GFP_ATOMIC);
a1c49c434e1505 Sean Wang 2019-06-02 2264 if (!skb) {
a1c49c434e1505 Sean Wang 2019-06-02 2265 hdev->stat.err_rx++;
60c6a63a3d3080 Mark-YW.Chen 2021-10-14 2266 kfree(urb->setup_packet);
de71a6cb4bf24d Jupeng Zhong 2021-02-02 2267 return;
a1c49c434e1505 Sean Wang 2019-06-02 2268 }
a1c49c434e1505 Sean Wang 2019-06-02 2269
a1c49c434e1505 Sean Wang 2019-06-02 2270 hci_skb_pkt_type(skb) = HCI_EVENT_PKT;
a1c49c434e1505 Sean Wang 2019-06-02 2271 skb_put_data(skb, urb->transfer_buffer, urb->actual_length);
a1c49c434e1505 Sean Wang 2019-06-02 2272
a1c49c434e1505 Sean Wang 2019-06-02 2273 hdr = (void *)skb->data;
a1c49c434e1505 Sean Wang 2019-06-02 2274
a1c49c434e1505 Sean Wang 2019-06-02 2275 /* When someone waits for the WMT event, the skb is being cloned
a1c49c434e1505 Sean Wang 2019-06-02 2276 * and being processed the events from there then.
a1c49c434e1505 Sean Wang 2019-06-02 2277 */
a1c49c434e1505 Sean Wang 2019-06-02 2278 if (test_bit(BTUSB_TX_WAIT_VND_EVT, &data->flags)) {
22cc6b7a1dbb58 Johan Hovold 2019-11-28 2279 data->evt_skb = skb_clone(skb, GFP_ATOMIC);
de71a6cb4bf24d Jupeng Zhong 2021-02-02 2280 if (!data->evt_skb) {
de71a6cb4bf24d Jupeng Zhong 2021-02-02 2281 kfree_skb(skb);
60c6a63a3d3080 Mark-YW.Chen 2021-10-14 2282 kfree(urb->setup_packet);
de71a6cb4bf24d Jupeng Zhong 2021-02-02 2283 return;
de71a6cb4bf24d Jupeng Zhong 2021-02-02 2284 }
a1c49c434e1505 Sean Wang 2019-06-02 2285 }
a1c49c434e1505 Sean Wang 2019-06-02 2286
a1c49c434e1505 Sean Wang 2019-06-02 2287 err = hci_recv_frame(hdev, skb);
de71a6cb4bf24d Jupeng Zhong 2021-02-02 2288 if (err < 0) {
de71a6cb4bf24d Jupeng Zhong 2021-02-02 2289 kfree_skb(data->evt_skb);
de71a6cb4bf24d Jupeng Zhong 2021-02-02 2290 data->evt_skb = NULL;
60c6a63a3d3080 Mark-YW.Chen 2021-10-14 2291 kfree(urb->setup_packet);
de71a6cb4bf24d Jupeng Zhong 2021-02-02 2292 return;
de71a6cb4bf24d Jupeng Zhong 2021-02-02 2293 }
a1c49c434e1505 Sean Wang 2019-06-02 2294
a1c49c434e1505 Sean Wang 2019-06-02 2295 if (test_and_clear_bit(BTUSB_TX_WAIT_VND_EVT,
a1c49c434e1505 Sean Wang 2019-06-02 2296 &data->flags)) {
a1c49c434e1505 Sean Wang 2019-06-02 2297 /* Barrier to sync with other CPUs */
a1c49c434e1505 Sean Wang 2019-06-02 2298 smp_mb__after_atomic();
a1c49c434e1505 Sean Wang 2019-06-02 2299 wake_up_bit(&data->flags,
a1c49c434e1505 Sean Wang 2019-06-02 2300 BTUSB_TX_WAIT_VND_EVT);
a1c49c434e1505 Sean Wang 2019-06-02 2301 }
60c6a63a3d3080 Mark-YW.Chen 2021-10-14 2302 kfree(urb->setup_packet);
a1c49c434e1505 Sean Wang 2019-06-02 2303 return;
a1c49c434e1505 Sean Wang 2019-06-02 2304 } else if (urb->status == -ENOENT) {
a1c49c434e1505 Sean Wang 2019-06-02 2305 /* Avoid suspend failed when usb_kill_urb */
a1c49c434e1505 Sean Wang 2019-06-02 2306 return;
a1c49c434e1505 Sean Wang 2019-06-02 2307 }
a1c49c434e1505 Sean Wang 2019-06-02 2308
a1c49c434e1505 Sean Wang 2019-06-02 2309 usb_mark_last_busy(data->udev);
a1c49c434e1505 Sean Wang 2019-06-02 2310
a1c49c434e1505 Sean Wang 2019-06-02 2311 /* The URB complete handler is still called with urb->actual_length = 0
a1c49c434e1505 Sean Wang 2019-06-02 2312 * when the event is not available, so we should keep re-submitting
a1c49c434e1505 Sean Wang 2019-06-02 2313 * URB until WMT event returns, Also, It's necessary to wait some time
a1c49c434e1505 Sean Wang 2019-06-02 2314 * between the two consecutive control URBs to relax the target device
a1c49c434e1505 Sean Wang 2019-06-02 2315 * to generate the event. Otherwise, the WMT event cannot return from
a1c49c434e1505 Sean Wang 2019-06-02 2316 * the device successfully.
a1c49c434e1505 Sean Wang 2019-06-02 2317 */
48c13301e6baba Mark Chen 2021-02-02 2318 udelay(500);
a1c49c434e1505 Sean Wang 2019-06-02 2319
a1c49c434e1505 Sean Wang 2019-06-02 2320 usb_anchor_urb(urb, &data->ctrl_anchor);
a1c49c434e1505 Sean Wang 2019-06-02 2321 err = usb_submit_urb(urb, GFP_ATOMIC);
a1c49c434e1505 Sean Wang 2019-06-02 2322 if (err < 0) {
60c6a63a3d3080 Mark-YW.Chen 2021-10-14 2323 kfree(urb->setup_packet);
a1c49c434e1505 Sean Wang 2019-06-02 2324 /* -EPERM: urb is being killed;
a1c49c434e1505 Sean Wang 2019-06-02 2325 * -ENODEV: device got disconnected
a1c49c434e1505 Sean Wang 2019-06-02 2326 */
a1c49c434e1505 Sean Wang 2019-06-02 2327 if (err != -EPERM && err != -ENODEV)
a1c49c434e1505 Sean Wang 2019-06-02 2328 bt_dev_err(hdev, "urb %p failed to resubmit (%d)",
a1c49c434e1505 Sean Wang 2019-06-02 2329 urb, -err);
a1c49c434e1505 Sean Wang 2019-06-02 2330 usb_unanchor_urb(urb);
a1c49c434e1505 Sean Wang 2019-06-02 2331 }
a1c49c434e1505 Sean Wang 2019-06-02 2332 }
a1c49c434e1505 Sean Wang 2019-06-02 2333
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 2/2] Bluetooth: mediatek: fix the conflict between mtk and msft vendor event
2022-01-29 6:02 ` sean.wang
@ 2022-02-07 15:48 ` Marcel Holtmann
-1 siblings, 0 replies; 14+ messages in thread
From: Marcel Holtmann @ 2022-02-07 15:48 UTC (permalink / raw)
To: Sean Wang
Cc: Johan Hedberg, "Mark-YW Chen (陳揚文)",
Soul.Huang, YN.Chen, Leon.Yen, Eric-SY.Chang, Deren.Wu, km.lin,
robin.chiu, Eddie.Chen, ch.yeh, posh.sun, ted.huang, Eric.Liang,
Stella.Chang, Tom.Chou, steve.lee, jsiuda, frankgor, jemele,
abhishekpandit, michaelfsun, mcchou, shawnku, linux-bluetooth,
linux-mediatek, linux-kernel
Hi Sean,
> There is a conflict between MediaTek wmt event and msft vendor extension
> logic in the core layer since 145373cb1b1f ("Bluetooth: Add framework for
> Microsoft vendor extension") was introduced because we changed the type of
> mediatek wmt event to the type of msft vendor event in the driver.
>
> But the purpose we reported mediatek event to the core layer is for the
> diagnostic purpose with that we are able to see the full packet trace via
> monitoring socket with btmon. Thus, it is harmless we keep the original
> type of mediatek vendor event here to avoid breaking the msft extension
> function especially they can be supported by Mediatek chipset like MT7921
> , MT7922 devices and future devices.
>
> Signed-off-by: Sean Wang <sean.wang@mediatek.com>
> ---
> drivers/bluetooth/btmtk.h | 1 +
> drivers/bluetooth/btmtksdio.c | 9 +--------
> drivers/bluetooth/btusb.c | 5 -----
> 3 files changed, 2 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/bluetooth/btmtk.h b/drivers/bluetooth/btmtk.h
> index 8960a5f89d48..013850fd2055 100644
> --- a/drivers/bluetooth/btmtk.h
> +++ b/drivers/bluetooth/btmtk.h
> @@ -5,6 +5,7 @@
> #define FIRMWARE_MT7668 "mediatek/mt7668pr2h.bin"
> #define FIRMWARE_MT7961 "mediatek/BT_RAM_CODE_MT7961_1_2_hdr.bin"
>
> +#define HCI_EV_WMT 0xe4
> #define HCI_WMT_MAX_EVENT_SIZE 64
>
> #define BTMTK_WMT_REG_WRITE 0x1
> diff --git a/drivers/bluetooth/btmtksdio.c b/drivers/bluetooth/btmtksdio.c
> index 8e200e80d2f6..cbb09e1b823d 100644
> --- a/drivers/bluetooth/btmtksdio.c
> +++ b/drivers/bluetooth/btmtksdio.c
> @@ -381,13 +381,6 @@ static int btmtksdio_recv_event(struct hci_dev *hdev, struct sk_buff *skb)
> struct hci_event_hdr *hdr = (void *)skb->data;
> int err;
>
> - /* Fix up the vendor event id with 0xff for vendor specific instead
> - * of 0xe4 so that event send via monitoring socket can be parsed
> - * properly.
> - */
> - if (hdr->evt == 0xe4)
> - hdr->evt = HCI_EV_VENDOR;
> -
> /* When someone waits for the WMT event, the skb is being cloned
> * and being processed the events from there then.
> */
> @@ -403,7 +396,7 @@ static int btmtksdio_recv_event(struct hci_dev *hdev, struct sk_buff *skb)
> if (err < 0)
> goto err_free_skb;
>
> - if (hdr->evt == HCI_EV_VENDOR) {
> + if (hdr->evt == HCI_EV_WMT) {
> if (test_and_clear_bit(BTMTKSDIO_TX_WAIT_VND_EVT,
> &bdev->tx_state)) {
> /* Barrier to sync with other CPUs */
> diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
> index aefa0ee293f3..55ebab019d29 100644
> --- a/drivers/bluetooth/btusb.c
> +++ b/drivers/bluetooth/btusb.c
> @@ -2271,11 +2271,6 @@ static void btusb_mtk_wmt_recv(struct urb *urb)
> skb_put_data(skb, urb->transfer_buffer, urb->actual_length);
>
> hdr = (void *)skb->data;
> - /* Fix up the vendor event id with 0xff for vendor specific
> - * instead of 0xe4 so that event send via monitoring socket can
> - * be parsed properly.
> - */
> - hdr->evt = 0xff;
>
> /* When someone waits for the WMT event, the skb is being cloned
> * and being processed the events from there then.
please fix the reported issue by kernel test robot.
Regards
Marcel
^ permalink raw reply [flat|nested] 14+ messages in thread* Re: [PATCH 2/2] Bluetooth: mediatek: fix the conflict between mtk and msft vendor event
@ 2022-02-07 15:48 ` Marcel Holtmann
0 siblings, 0 replies; 14+ messages in thread
From: Marcel Holtmann @ 2022-02-07 15:48 UTC (permalink / raw)
To: Sean Wang
Cc: Johan Hedberg, "Mark-YW Chen (陳揚文)",
Soul.Huang, YN.Chen, Leon.Yen, Eric-SY.Chang, Deren.Wu, km.lin,
robin.chiu, Eddie.Chen, ch.yeh, posh.sun, ted.huang, Eric.Liang,
Stella.Chang, Tom.Chou, steve.lee, jsiuda, frankgor, jemele,
abhishekpandit, michaelfsun, mcchou, shawnku, linux-bluetooth,
linux-mediatek, linux-kernel
Hi Sean,
> There is a conflict between MediaTek wmt event and msft vendor extension
> logic in the core layer since 145373cb1b1f ("Bluetooth: Add framework for
> Microsoft vendor extension") was introduced because we changed the type of
> mediatek wmt event to the type of msft vendor event in the driver.
>
> But the purpose we reported mediatek event to the core layer is for the
> diagnostic purpose with that we are able to see the full packet trace via
> monitoring socket with btmon. Thus, it is harmless we keep the original
> type of mediatek vendor event here to avoid breaking the msft extension
> function especially they can be supported by Mediatek chipset like MT7921
> , MT7922 devices and future devices.
>
> Signed-off-by: Sean Wang <sean.wang@mediatek.com>
> ---
> drivers/bluetooth/btmtk.h | 1 +
> drivers/bluetooth/btmtksdio.c | 9 +--------
> drivers/bluetooth/btusb.c | 5 -----
> 3 files changed, 2 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/bluetooth/btmtk.h b/drivers/bluetooth/btmtk.h
> index 8960a5f89d48..013850fd2055 100644
> --- a/drivers/bluetooth/btmtk.h
> +++ b/drivers/bluetooth/btmtk.h
> @@ -5,6 +5,7 @@
> #define FIRMWARE_MT7668 "mediatek/mt7668pr2h.bin"
> #define FIRMWARE_MT7961 "mediatek/BT_RAM_CODE_MT7961_1_2_hdr.bin"
>
> +#define HCI_EV_WMT 0xe4
> #define HCI_WMT_MAX_EVENT_SIZE 64
>
> #define BTMTK_WMT_REG_WRITE 0x1
> diff --git a/drivers/bluetooth/btmtksdio.c b/drivers/bluetooth/btmtksdio.c
> index 8e200e80d2f6..cbb09e1b823d 100644
> --- a/drivers/bluetooth/btmtksdio.c
> +++ b/drivers/bluetooth/btmtksdio.c
> @@ -381,13 +381,6 @@ static int btmtksdio_recv_event(struct hci_dev *hdev, struct sk_buff *skb)
> struct hci_event_hdr *hdr = (void *)skb->data;
> int err;
>
> - /* Fix up the vendor event id with 0xff for vendor specific instead
> - * of 0xe4 so that event send via monitoring socket can be parsed
> - * properly.
> - */
> - if (hdr->evt == 0xe4)
> - hdr->evt = HCI_EV_VENDOR;
> -
> /* When someone waits for the WMT event, the skb is being cloned
> * and being processed the events from there then.
> */
> @@ -403,7 +396,7 @@ static int btmtksdio_recv_event(struct hci_dev *hdev, struct sk_buff *skb)
> if (err < 0)
> goto err_free_skb;
>
> - if (hdr->evt == HCI_EV_VENDOR) {
> + if (hdr->evt == HCI_EV_WMT) {
> if (test_and_clear_bit(BTMTKSDIO_TX_WAIT_VND_EVT,
> &bdev->tx_state)) {
> /* Barrier to sync with other CPUs */
> diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
> index aefa0ee293f3..55ebab019d29 100644
> --- a/drivers/bluetooth/btusb.c
> +++ b/drivers/bluetooth/btusb.c
> @@ -2271,11 +2271,6 @@ static void btusb_mtk_wmt_recv(struct urb *urb)
> skb_put_data(skb, urb->transfer_buffer, urb->actual_length);
>
> hdr = (void *)skb->data;
> - /* Fix up the vendor event id with 0xff for vendor specific
> - * instead of 0xe4 so that event send via monitoring socket can
> - * be parsed properly.
> - */
> - hdr->evt = 0xff;
>
> /* When someone waits for the WMT event, the skb is being cloned
> * and being processed the events from there then.
please fix the reported issue by kernel test robot.
Regards
Marcel
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek
^ permalink raw reply [flat|nested] 14+ messages in thread
* RE: [1/2] Bluetooth: mt7921s: support bluetooth reset mechanism
2022-01-29 6:02 ` sean.wang
(?)
(?)
@ 2022-01-29 7:05 ` bluez.test.bot
-1 siblings, 0 replies; 14+ messages in thread
From: bluez.test.bot @ 2022-01-29 7:05 UTC (permalink / raw)
To: linux-bluetooth, sean.wang
[-- Attachment #1: Type: text/plain, Size: 1097 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=609706
---Test result---
Test Summary:
CheckPatch PASS 3.77 seconds
GitLint PASS 2.08 seconds
SubjectPrefix PASS 1.71 seconds
BuildKernel PASS 30.47 seconds
BuildKernel32 PASS 26.94 seconds
Incremental Build with patchesPASS 42.88 seconds
TestRunner: Setup PASS 472.91 seconds
TestRunner: l2cap-tester PASS 13.67 seconds
TestRunner: bnep-tester PASS 6.19 seconds
TestRunner: mgmt-tester PASS 105.33 seconds
TestRunner: rfcomm-tester PASS 7.59 seconds
TestRunner: sco-tester PASS 7.75 seconds
TestRunner: smp-tester PASS 7.58 seconds
TestRunner: userchan-tester PASS 6.45 seconds
---
Regards,
Linux Bluetooth
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 2/2] Bluetooth: mediatek: fix the conflict between mtk and msft vendor event
@ 2022-02-13 0:25 kernel test robot
2022-02-14 8:52 ` kernel test robot
0 siblings, 1 reply; 14+ messages in thread
From: kernel test robot @ 2022-02-13 0:25 UTC (permalink / raw)
To: kbuild
[-- Attachment #1: Type: text/plain, Size: 22077 bytes --]
CC: llvm(a)lists.linux.dev
CC: kbuild-all(a)lists.01.org
In-Reply-To: <2eed797ac2605bd068a025486fc0c09c2687e50c.1643435854.git.objelf@gmail.com>
References: <2eed797ac2605bd068a025486fc0c09c2687e50c.1643435854.git.objelf@gmail.com>
TO: sean.wang(a)mediatek.com
TO: marcel(a)holtmann.org
TO: johan.hedberg(a)gmail.com
CC: Mark-YW.Chen(a)mediatek.com
CC: sean.wang(a)mediatek.com
CC: Soul.Huang(a)mediatek.com
CC: YN.Chen(a)mediatek.com
CC: Leon.Yen(a)mediatek.com
CC: Eric-SY.Chang(a)mediatek.com
CC: Deren.Wu(a)mediatek.com
CC: km.lin(a)mediatek.com
CC: robin.chiu(a)mediatek.com
CC: Eddie.Chen(a)mediatek.com
CC: ch.yeh(a)mediatek.com
CC: posh.sun(a)mediatek.com
CC: ted.huang(a)mediatek.com
CC: Eric.Liang(a)mediatek.com
CC: Stella.Chang(a)mediatek.com
CC: Tom.Chou(a)mediatek.com
CC: steve.lee(a)mediatek.com
CC: jsiuda(a)google.com
CC: frankgor(a)google.com
CC: jemele(a)google.com
CC: abhishekpandit(a)google.com
CC: michaelfsun(a)google.com
CC: mcchou(a)chromium.org
CC: shawnku(a)google.com
CC: linux-bluetooth(a)vger.kernel.org
CC: linux-mediatek(a)lists.infradead.org
CC: linux-kernel(a)vger.kernel.org
Hi,
I love your patch! Perhaps something to improve:
[auto build test WARNING on bluetooth-next/master]
[also build test WARNING on next-20220211]
[cannot apply to v5.17-rc3]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/sean-wang-mediatek-com/Bluetooth-mt7921s-support-bluetooth-reset-mechanism/20220129-140313
base: https://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth-next.git master
:::::: branch date: 2 weeks ago
:::::: commit date: 2 weeks ago
config: riscv-randconfig-c006-20220205 (https://download.01.org/0day-ci/archive/20220213/202202130806.UHxKw5N3-lkp(a)intel.com/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project dee058c670593b999fec19c458dbbd882ad9de56)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install riscv cross compiling tool for clang build
# apt-get install binutils-riscv64-linux-gnu
# https://github.com/0day-ci/linux/commit/33092fd43b74594bae07555a6fdf15133cc8ec54
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review sean-wang-mediatek-com/Bluetooth-mt7921s-support-bluetooth-reset-mechanism/20220129-140313
git checkout 33092fd43b74594bae07555a6fdf15133cc8ec54
# save the config file to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=riscv clang-analyzer
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
clang-analyzer warnings: (new ones prefixed by >>)
^
drivers/mtd/nand/raw/nand_onfi.c:190:7: note: Assuming 'crc' is equal to field 'crc'
if (crc == le16_to_cpu(pbuf[i].crc)) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/mtd/nand/raw/nand_onfi.c:190:3: note: Taking true branch
if (crc == le16_to_cpu(pbuf[i].crc)) {
^
drivers/mtd/nand/raw/nand_onfi.c:192:4: note: Execution continues on line 196
break;
^
drivers/mtd/nand/raw/nand_onfi.c:196:6: note: 'i' is not equal to ONFI_PARAM_PAGES
if (i == ONFI_PARAM_PAGES) {
^
drivers/mtd/nand/raw/nand_onfi.c:196:2: note: Taking false branch
if (i == ONFI_PARAM_PAGES) {
^
drivers/mtd/nand/raw/nand_onfi.c:215:6: note: Assuming field 'desc' is null
if (chip->manufacturer.desc && chip->manufacturer.desc->ops &&
^~~~~~~~~~~~~~~~~~~~~~~
drivers/mtd/nand/raw/nand_onfi.c:215:30: note: Left side of '&&' is false
if (chip->manufacturer.desc && chip->manufacturer.desc->ops &&
^
drivers/mtd/nand/raw/nand_onfi.c:221:6: note: Assuming the condition is false
if (val & ONFI_VERSION_2_3)
^~~~~~~~~~~~~~~~~~~~~~
drivers/mtd/nand/raw/nand_onfi.c:221:2: note: Taking false branch
if (val & ONFI_VERSION_2_3)
^
drivers/mtd/nand/raw/nand_onfi.c:223:11: note: Assuming the condition is false
else if (val & ONFI_VERSION_2_2)
^~~~~~~~~~~~~~~~~~~~~~
drivers/mtd/nand/raw/nand_onfi.c:223:7: note: Taking false branch
else if (val & ONFI_VERSION_2_2)
^
drivers/mtd/nand/raw/nand_onfi.c:225:11: note: Assuming the condition is false
else if (val & ONFI_VERSION_2_1)
^~~~~~~~~~~~~~~~~~~~~~
drivers/mtd/nand/raw/nand_onfi.c:225:7: note: Taking false branch
else if (val & ONFI_VERSION_2_1)
^
drivers/mtd/nand/raw/nand_onfi.c:227:11: note: Assuming the condition is false
else if (val & ONFI_VERSION_2_0)
^~~~~~~~~~~~~~~~~~~~~~
drivers/mtd/nand/raw/nand_onfi.c:227:7: note: Taking false branch
else if (val & ONFI_VERSION_2_0)
^
drivers/mtd/nand/raw/nand_onfi.c:229:11: note: Assuming the condition is true
else if (val & ONFI_VERSION_1_0)
^~~~~~~~~~~~~~~~~~~~~~
drivers/mtd/nand/raw/nand_onfi.c:229:7: note: Taking true branch
else if (val & ONFI_VERSION_1_0)
^
drivers/mtd/nand/raw/nand_onfi.c:232:7: note: 'onfi_version' is 10
if (!onfi_version) {
^~~~~~~~~~~~
drivers/mtd/nand/raw/nand_onfi.c:232:2: note: Taking false branch
if (!onfi_version) {
^
drivers/mtd/nand/raw/nand_onfi.c:240:6: note: Assuming field 'model' is non-null
if (!chip->parameters.model) {
^~~~~~~~~~~~~~~~~~~~~~~
drivers/mtd/nand/raw/nand_onfi.c:240:2: note: Taking false branch
if (!chip->parameters.model) {
^
drivers/mtd/nand/raw/nand_onfi.c:265:5: note: The result of the left shift is undefined because the right operand is negative
1 << (fls(le32_to_cpu(p->blocks_per_lun)) - 1);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Suppressed 3 warnings (3 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
9 warnings generated.
Suppressed 9 warnings (2 in non-user code, 7 with check filters).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
9 warnings generated.
Suppressed 9 warnings (2 in non-user code, 7 with check filters).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
9 warnings generated.
Suppressed 9 warnings (2 in non-user code, 7 with check filters).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
9 warnings generated.
Suppressed 9 warnings (2 in non-user code, 7 with check filters).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
9 warnings generated.
Suppressed 9 warnings (2 in non-user code, 7 with check filters).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
2 warnings generated.
Suppressed 2 warnings (2 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
9 warnings generated.
Suppressed 9 warnings (2 in non-user code, 7 with check filters).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
9 warnings generated.
Suppressed 9 warnings (2 in non-user code, 7 with check filters).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
9 warnings generated.
Suppressed 9 warnings (2 in non-user code, 7 with check filters).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
10 warnings generated.
Suppressed 10 warnings (3 in non-user code, 7 with check filters).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
12 warnings generated.
>> drivers/bluetooth/btusb.c:2273:3: warning: Value stored to 'hdr' is never read [clang-analyzer-deadcode.DeadStores]
hdr = (void *)skb->data;
^ ~~~~~~~~~~~~~~~~~
drivers/bluetooth/btusb.c:2273:3: note: Value stored to 'hdr' is never read
hdr = (void *)skb->data;
^ ~~~~~~~~~~~~~~~~~
Suppressed 11 warnings (3 in non-user code, 8 with check filters).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
9 warnings generated.
Suppressed 9 warnings (2 in non-user code, 7 with check filters).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
9 warnings generated.
Suppressed 9 warnings (2 in non-user code, 7 with check filters).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
9 warnings generated.
Suppressed 9 warnings (2 in non-user code, 7 with check filters).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
23 warnings generated.
drivers/net/ethernet/qlogic/qed/qed_debug.c:1100:3: warning: Call to function 'strcpy' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcpy'. CWE-119 [clang-analyzer-security.insecureAPI.strcpy]
strcpy(dump_buf, str);
^~~~~~
drivers/net/ethernet/qlogic/qed/qed_debug.c:1100:3: note: Call to function 'strcpy' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcpy'. CWE-119
strcpy(dump_buf, str);
^~~~~~
drivers/net/ethernet/qlogic/qed/qed_debug.c:1100:3: warning: Null pointer passed as 1st argument to string copy function [clang-analyzer-unix.cstring.NullArg]
strcpy(dump_buf, str);
^
drivers/net/ethernet/qlogic/qed/qed_debug.c:5676:6: note: 'status' is equal to DBG_STATUS_OK
if (status != DBG_STATUS_OK)
^~~~~~
drivers/net/ethernet/qlogic/qed/qed_debug.c:5676:2: note: Taking false branch
if (status != DBG_STATUS_OK)
^
drivers/net/ethernet/qlogic/qed/qed_debug.c:5679:42: note: Passing null pointer value via 3rd parameter 'dump_buf'
*buf_size = qed_ilt_dump(p_hwfn, p_ptt, NULL, 0, false);
^
include/linux/stddef.h:8:14: note: expanded from macro 'NULL'
#define NULL ((void *)0)
^~~~~~~~~~~
drivers/net/ethernet/qlogic/qed/qed_debug.c:5679:14: note: Calling 'qed_ilt_dump'
*buf_size = qed_ilt_dump(p_hwfn, p_ptt, NULL, 0, false);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/qlogic/qed/qed_debug.c:5017:6: note: 'dump' is false
if (dump) {
^~~~
drivers/net/ethernet/qlogic/qed/qed_debug.c:5017:2: note: Taking false branch
if (dump) {
^
drivers/net/ethernet/qlogic/qed/qed_debug.c:5033:6: note: 'continue_dump' is false
if (continue_dump) {
^~~~~~~~~~~~~
drivers/net/ethernet/qlogic/qed/qed_debug.c:5033:2: note: Taking false branch
if (continue_dump) {
^
drivers/net/ethernet/qlogic/qed/qed_debug.c:5064:6: note: 'continue_dump' is false
if (continue_dump) {
^~~~~~~~~~~~~
drivers/net/ethernet/qlogic/qed/qed_debug.c:5064:2: note: Taking false branch
if (continue_dump) {
^
drivers/net/ethernet/qlogic/qed/qed_debug.c:5085:6: note: 'continue_dump' is false
if (continue_dump) {
^~~~~~~~~~~~~
drivers/net/ethernet/qlogic/qed/qed_debug.c:5085:2: note: Taking false branch
if (continue_dump) {
^
drivers/net/ethernet/qlogic/qed/qed_debug.c:5110:6: note: 'continue_dump' is false
if (continue_dump) {
^~~~~~~~~~~~~
drivers/net/ethernet/qlogic/qed/qed_debug.c:5110:2: note: Taking false branch
if (continue_dump) {
^
drivers/net/ethernet/qlogic/qed/qed_debug.c:5135:6: note: 'continue_dump' is false
if (continue_dump) {
^~~~~~~~~~~~~
drivers/net/ethernet/qlogic/qed/qed_debug.c:5135:2: note: Taking false branch
if (continue_dump) {
^
drivers/net/ethernet/qlogic/qed/qed_debug.c:5168:37: note: Passing null pointer value via 2nd parameter 'dump_buf'
qed_ilt_dump_pages_section(p_hwfn, dump_buf, &offset, &continue_dump,
^~~~~~~~
drivers/net/ethernet/qlogic/qed/qed_debug.c:5168:2: note: Calling 'qed_ilt_dump_pages_section'
qed_ilt_dump_pages_section(p_hwfn, dump_buf, &offset, &continue_dump,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/qlogic/qed/qed_debug.c:4654:17: note: 'dump_page_ids' is false
section_name = dump_page_ids ? "ilt_page_ids" : "ilt_page_mem";
^~~~~~~~~~~~~
drivers/net/ethernet/qlogic/qed/qed_debug.c:4654:17: note: '?' condition is false
drivers/net/ethernet/qlogic/qed/qed_debug.c:4668:6: note: Assuming 'continue_dump' is true
if ((continue_dump) &&
^~~~~~~~~~~~~~~
drivers/net/ethernet/qlogic/qed/qed_debug.c:4668:6: note: Left side of '&&' is true
drivers/net/ethernet/qlogic/qed/qed_debug.c:4669:7: note: Assuming the condition is false
(offset + section_header_and_param_size > buf_size_in_dwords)) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/qlogic/qed/qed_debug.c:4668:2: note: Taking false branch
if ((continue_dump) &&
^
drivers/net/ethernet/qlogic/qed/qed_debug.c:4675:33: note: Passing null pointer value via 1st parameter 'dump_buf'
offset += qed_dump_section_hdr(dump_buf + offset,
^~~~~~~~~~~~~~~~~
vim +/hdr +2273 drivers/bluetooth/btusb.c
5a87679ffd4436 mark-yw.chen 2021-09-01 2248
a1c49c434e1505 Sean Wang 2019-06-02 2249 static void btusb_mtk_wmt_recv(struct urb *urb)
a1c49c434e1505 Sean Wang 2019-06-02 2250 {
a1c49c434e1505 Sean Wang 2019-06-02 2251 struct hci_dev *hdev = urb->context;
a1c49c434e1505 Sean Wang 2019-06-02 2252 struct btusb_data *data = hci_get_drvdata(hdev);
a1c49c434e1505 Sean Wang 2019-06-02 2253 struct hci_event_hdr *hdr;
a1c49c434e1505 Sean Wang 2019-06-02 2254 struct sk_buff *skb;
a1c49c434e1505 Sean Wang 2019-06-02 2255 int err;
a1c49c434e1505 Sean Wang 2019-06-02 2256
a1c49c434e1505 Sean Wang 2019-06-02 2257 if (urb->status == 0 && urb->actual_length > 0) {
a1c49c434e1505 Sean Wang 2019-06-02 2258 hdev->stat.byte_rx += urb->actual_length;
a1c49c434e1505 Sean Wang 2019-06-02 2259
a1c49c434e1505 Sean Wang 2019-06-02 2260 /* WMT event shouldn't be fragmented and the size should be
a1c49c434e1505 Sean Wang 2019-06-02 2261 * less than HCI_WMT_MAX_EVENT_SIZE.
a1c49c434e1505 Sean Wang 2019-06-02 2262 */
a1c49c434e1505 Sean Wang 2019-06-02 2263 skb = bt_skb_alloc(HCI_WMT_MAX_EVENT_SIZE, GFP_ATOMIC);
a1c49c434e1505 Sean Wang 2019-06-02 2264 if (!skb) {
a1c49c434e1505 Sean Wang 2019-06-02 2265 hdev->stat.err_rx++;
60c6a63a3d3080 Mark-YW.Chen 2021-10-14 2266 kfree(urb->setup_packet);
de71a6cb4bf24d Jupeng Zhong 2021-02-02 2267 return;
a1c49c434e1505 Sean Wang 2019-06-02 2268 }
a1c49c434e1505 Sean Wang 2019-06-02 2269
a1c49c434e1505 Sean Wang 2019-06-02 2270 hci_skb_pkt_type(skb) = HCI_EVENT_PKT;
a1c49c434e1505 Sean Wang 2019-06-02 2271 skb_put_data(skb, urb->transfer_buffer, urb->actual_length);
a1c49c434e1505 Sean Wang 2019-06-02 2272
a1c49c434e1505 Sean Wang 2019-06-02 @2273 hdr = (void *)skb->data;
a1c49c434e1505 Sean Wang 2019-06-02 2274
a1c49c434e1505 Sean Wang 2019-06-02 2275 /* When someone waits for the WMT event, the skb is being cloned
a1c49c434e1505 Sean Wang 2019-06-02 2276 * and being processed the events from there then.
a1c49c434e1505 Sean Wang 2019-06-02 2277 */
a1c49c434e1505 Sean Wang 2019-06-02 2278 if (test_bit(BTUSB_TX_WAIT_VND_EVT, &data->flags)) {
22cc6b7a1dbb58 Johan Hovold 2019-11-28 2279 data->evt_skb = skb_clone(skb, GFP_ATOMIC);
de71a6cb4bf24d Jupeng Zhong 2021-02-02 2280 if (!data->evt_skb) {
de71a6cb4bf24d Jupeng Zhong 2021-02-02 2281 kfree_skb(skb);
60c6a63a3d3080 Mark-YW.Chen 2021-10-14 2282 kfree(urb->setup_packet);
de71a6cb4bf24d Jupeng Zhong 2021-02-02 2283 return;
de71a6cb4bf24d Jupeng Zhong 2021-02-02 2284 }
a1c49c434e1505 Sean Wang 2019-06-02 2285 }
a1c49c434e1505 Sean Wang 2019-06-02 2286
a1c49c434e1505 Sean Wang 2019-06-02 2287 err = hci_recv_frame(hdev, skb);
de71a6cb4bf24d Jupeng Zhong 2021-02-02 2288 if (err < 0) {
de71a6cb4bf24d Jupeng Zhong 2021-02-02 2289 kfree_skb(data->evt_skb);
de71a6cb4bf24d Jupeng Zhong 2021-02-02 2290 data->evt_skb = NULL;
60c6a63a3d3080 Mark-YW.Chen 2021-10-14 2291 kfree(urb->setup_packet);
de71a6cb4bf24d Jupeng Zhong 2021-02-02 2292 return;
de71a6cb4bf24d Jupeng Zhong 2021-02-02 2293 }
a1c49c434e1505 Sean Wang 2019-06-02 2294
a1c49c434e1505 Sean Wang 2019-06-02 2295 if (test_and_clear_bit(BTUSB_TX_WAIT_VND_EVT,
a1c49c434e1505 Sean Wang 2019-06-02 2296 &data->flags)) {
a1c49c434e1505 Sean Wang 2019-06-02 2297 /* Barrier to sync with other CPUs */
a1c49c434e1505 Sean Wang 2019-06-02 2298 smp_mb__after_atomic();
a1c49c434e1505 Sean Wang 2019-06-02 2299 wake_up_bit(&data->flags,
a1c49c434e1505 Sean Wang 2019-06-02 2300 BTUSB_TX_WAIT_VND_EVT);
a1c49c434e1505 Sean Wang 2019-06-02 2301 }
60c6a63a3d3080 Mark-YW.Chen 2021-10-14 2302 kfree(urb->setup_packet);
a1c49c434e1505 Sean Wang 2019-06-02 2303 return;
a1c49c434e1505 Sean Wang 2019-06-02 2304 } else if (urb->status == -ENOENT) {
a1c49c434e1505 Sean Wang 2019-06-02 2305 /* Avoid suspend failed when usb_kill_urb */
a1c49c434e1505 Sean Wang 2019-06-02 2306 return;
a1c49c434e1505 Sean Wang 2019-06-02 2307 }
a1c49c434e1505 Sean Wang 2019-06-02 2308
a1c49c434e1505 Sean Wang 2019-06-02 2309 usb_mark_last_busy(data->udev);
a1c49c434e1505 Sean Wang 2019-06-02 2310
a1c49c434e1505 Sean Wang 2019-06-02 2311 /* The URB complete handler is still called with urb->actual_length = 0
a1c49c434e1505 Sean Wang 2019-06-02 2312 * when the event is not available, so we should keep re-submitting
a1c49c434e1505 Sean Wang 2019-06-02 2313 * URB until WMT event returns, Also, It's necessary to wait some time
a1c49c434e1505 Sean Wang 2019-06-02 2314 * between the two consecutive control URBs to relax the target device
a1c49c434e1505 Sean Wang 2019-06-02 2315 * to generate the event. Otherwise, the WMT event cannot return from
a1c49c434e1505 Sean Wang 2019-06-02 2316 * the device successfully.
a1c49c434e1505 Sean Wang 2019-06-02 2317 */
48c13301e6baba Mark Chen 2021-02-02 2318 udelay(500);
a1c49c434e1505 Sean Wang 2019-06-02 2319
a1c49c434e1505 Sean Wang 2019-06-02 2320 usb_anchor_urb(urb, &data->ctrl_anchor);
a1c49c434e1505 Sean Wang 2019-06-02 2321 err = usb_submit_urb(urb, GFP_ATOMIC);
a1c49c434e1505 Sean Wang 2019-06-02 2322 if (err < 0) {
60c6a63a3d3080 Mark-YW.Chen 2021-10-14 2323 kfree(urb->setup_packet);
a1c49c434e1505 Sean Wang 2019-06-02 2324 /* -EPERM: urb is being killed;
a1c49c434e1505 Sean Wang 2019-06-02 2325 * -ENODEV: device got disconnected
a1c49c434e1505 Sean Wang 2019-06-02 2326 */
a1c49c434e1505 Sean Wang 2019-06-02 2327 if (err != -EPERM && err != -ENODEV)
a1c49c434e1505 Sean Wang 2019-06-02 2328 bt_dev_err(hdev, "urb %p failed to resubmit (%d)",
a1c49c434e1505 Sean Wang 2019-06-02 2329 urb, -err);
a1c49c434e1505 Sean Wang 2019-06-02 2330 usb_unanchor_urb(urb);
a1c49c434e1505 Sean Wang 2019-06-02 2331 }
a1c49c434e1505 Sean Wang 2019-06-02 2332 }
a1c49c434e1505 Sean Wang 2019-06-02 2333
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
^ permalink raw reply [flat|nested] 14+ messages in thread* Re: [PATCH 2/2] Bluetooth: mediatek: fix the conflict between mtk and msft vendor event
2022-02-13 0:25 [PATCH 2/2] Bluetooth: mediatek: fix the conflict between mtk and msft vendor event kernel test robot
2022-02-14 8:52 ` kernel test robot
@ 2022-02-14 8:52 ` kernel test robot
0 siblings, 0 replies; 14+ messages in thread
From: kernel test robot @ 2022-02-14 8:52 UTC (permalink / raw)
To: sean.wang
Cc: llvm, kbuild-all, linux-bluetooth, linux-mediatek,
Linux Kernel Mailing List, marcel, johan.hedberg
Hi Sean,
Thanks for your patch! Perhaps something to improve:
[auto build test WARNING on bluetooth-next/master]
[also build test WARNING on next-20220211]
[cannot apply to v5.17-rc3]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/sean-wang-mediatek-com/Bluetooth-mt7921s-support-bluetooth-reset-mechanism/20220129-140313
base: https://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth-next.git master
config: riscv-randconfig-c006-20220205 (https://download.01.org/0day-ci/archive/20220213/202202130806.UHxKw5N3-lkp@intel.com/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project dee058c670593b999fec19c458dbbd882ad9de56)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install riscv cross compiling tool for clang build
# apt-get install binutils-riscv64-linux-gnu
# https://github.com/0day-ci/linux/commit/33092fd43b74594bae07555a6fdf15133cc8ec54
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review sean-wang-mediatek-com/Bluetooth-mt7921s-support-bluetooth-reset-mechanism/20220129-140313
git checkout 33092fd43b74594bae07555a6fdf15133cc8ec54
# save the config file to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=riscv clang-analyzer
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <yujie.liu@intel.com>
clang-analyzer warnings: (new ones prefixed by >>)
>> drivers/bluetooth/btusb.c:2273:3: warning: Value stored to 'hdr' is never read [clang-analyzer-deadcode.DeadStores]
hdr = (void *)skb->data;
^ ~~~~~~~~~~~~~~~~~
vim +/hdr +2273 drivers/bluetooth/btusb.c
5a87679ffd4436 mark-yw.chen 2021-09-01 2248
a1c49c434e1505 Sean Wang 2019-06-02 2249 static void btusb_mtk_wmt_recv(struct urb *urb)
a1c49c434e1505 Sean Wang 2019-06-02 2250 {
a1c49c434e1505 Sean Wang 2019-06-02 2251 struct hci_dev *hdev = urb->context;
a1c49c434e1505 Sean Wang 2019-06-02 2252 struct btusb_data *data = hci_get_drvdata(hdev);
a1c49c434e1505 Sean Wang 2019-06-02 @2253 struct hci_event_hdr *hdr;
a1c49c434e1505 Sean Wang 2019-06-02 2254 struct sk_buff *skb;
a1c49c434e1505 Sean Wang 2019-06-02 2255 int err;
a1c49c434e1505 Sean Wang 2019-06-02 2256
a1c49c434e1505 Sean Wang 2019-06-02 2257 if (urb->status == 0 && urb->actual_length > 0) {
a1c49c434e1505 Sean Wang 2019-06-02 2258 hdev->stat.byte_rx += urb->actual_length;
a1c49c434e1505 Sean Wang 2019-06-02 2259
a1c49c434e1505 Sean Wang 2019-06-02 2260 /* WMT event shouldn't be fragmented and the size should be
a1c49c434e1505 Sean Wang 2019-06-02 2261 * less than HCI_WMT_MAX_EVENT_SIZE.
a1c49c434e1505 Sean Wang 2019-06-02 2262 */
a1c49c434e1505 Sean Wang 2019-06-02 2263 skb = bt_skb_alloc(HCI_WMT_MAX_EVENT_SIZE, GFP_ATOMIC);
a1c49c434e1505 Sean Wang 2019-06-02 2264 if (!skb) {
a1c49c434e1505 Sean Wang 2019-06-02 2265 hdev->stat.err_rx++;
60c6a63a3d3080 Mark-YW.Chen 2021-10-14 2266 kfree(urb->setup_packet);
de71a6cb4bf24d Jupeng Zhong 2021-02-02 2267 return;
a1c49c434e1505 Sean Wang 2019-06-02 2268 }
a1c49c434e1505 Sean Wang 2019-06-02 2269
a1c49c434e1505 Sean Wang 2019-06-02 2270 hci_skb_pkt_type(skb) = HCI_EVENT_PKT;
a1c49c434e1505 Sean Wang 2019-06-02 2271 skb_put_data(skb, urb->transfer_buffer, urb->actual_length);
a1c49c434e1505 Sean Wang 2019-06-02 2272
a1c49c434e1505 Sean Wang 2019-06-02 @2273 hdr = (void *)skb->data;
a1c49c434e1505 Sean Wang 2019-06-02 2274
a1c49c434e1505 Sean Wang 2019-06-02 2275 /* When someone waits for the WMT event, the skb is being cloned
a1c49c434e1505 Sean Wang 2019-06-02 2276 * and being processed the events from there then.
a1c49c434e1505 Sean Wang 2019-06-02 2277 */
a1c49c434e1505 Sean Wang 2019-06-02 2278 if (test_bit(BTUSB_TX_WAIT_VND_EVT, &data->flags)) {
22cc6b7a1dbb58 Johan Hovold 2019-11-28 2279 data->evt_skb = skb_clone(skb, GFP_ATOMIC);
de71a6cb4bf24d Jupeng Zhong 2021-02-02 2280 if (!data->evt_skb) {
de71a6cb4bf24d Jupeng Zhong 2021-02-02 2281 kfree_skb(skb);
60c6a63a3d3080 Mark-YW.Chen 2021-10-14 2282 kfree(urb->setup_packet);
de71a6cb4bf24d Jupeng Zhong 2021-02-02 2283 return;
de71a6cb4bf24d Jupeng Zhong 2021-02-02 2284 }
a1c49c434e1505 Sean Wang 2019-06-02 2285 }
a1c49c434e1505 Sean Wang 2019-06-02 2286
a1c49c434e1505 Sean Wang 2019-06-02 2287 err = hci_recv_frame(hdev, skb);
de71a6cb4bf24d Jupeng Zhong 2021-02-02 2288 if (err < 0) {
de71a6cb4bf24d Jupeng Zhong 2021-02-02 2289 kfree_skb(data->evt_skb);
de71a6cb4bf24d Jupeng Zhong 2021-02-02 2290 data->evt_skb = NULL;
60c6a63a3d3080 Mark-YW.Chen 2021-10-14 2291 kfree(urb->setup_packet);
de71a6cb4bf24d Jupeng Zhong 2021-02-02 2292 return;
de71a6cb4bf24d Jupeng Zhong 2021-02-02 2293 }
a1c49c434e1505 Sean Wang 2019-06-02 2294
a1c49c434e1505 Sean Wang 2019-06-02 2295 if (test_and_clear_bit(BTUSB_TX_WAIT_VND_EVT,
a1c49c434e1505 Sean Wang 2019-06-02 2296 &data->flags)) {
a1c49c434e1505 Sean Wang 2019-06-02 2297 /* Barrier to sync with other CPUs */
a1c49c434e1505 Sean Wang 2019-06-02 2298 smp_mb__after_atomic();
a1c49c434e1505 Sean Wang 2019-06-02 2299 wake_up_bit(&data->flags,
a1c49c434e1505 Sean Wang 2019-06-02 2300 BTUSB_TX_WAIT_VND_EVT);
a1c49c434e1505 Sean Wang 2019-06-02 2301 }
60c6a63a3d3080 Mark-YW.Chen 2021-10-14 2302 kfree(urb->setup_packet);
a1c49c434e1505 Sean Wang 2019-06-02 2303 return;
a1c49c434e1505 Sean Wang 2019-06-02 2304 } else if (urb->status == -ENOENT) {
a1c49c434e1505 Sean Wang 2019-06-02 2305 /* Avoid suspend failed when usb_kill_urb */
a1c49c434e1505 Sean Wang 2019-06-02 2306 return;
a1c49c434e1505 Sean Wang 2019-06-02 2307 }
a1c49c434e1505 Sean Wang 2019-06-02 2308
a1c49c434e1505 Sean Wang 2019-06-02 2309 usb_mark_last_busy(data->udev);
a1c49c434e1505 Sean Wang 2019-06-02 2310
a1c49c434e1505 Sean Wang 2019-06-02 2311 /* The URB complete handler is still called with urb->actual_length = 0
a1c49c434e1505 Sean Wang 2019-06-02 2312 * when the event is not available, so we should keep re-submitting
a1c49c434e1505 Sean Wang 2019-06-02 2313 * URB until WMT event returns, Also, It's necessary to wait some time
a1c49c434e1505 Sean Wang 2019-06-02 2314 * between the two consecutive control URBs to relax the target device
a1c49c434e1505 Sean Wang 2019-06-02 2315 * to generate the event. Otherwise, the WMT event cannot return from
a1c49c434e1505 Sean Wang 2019-06-02 2316 * the device successfully.
a1c49c434e1505 Sean Wang 2019-06-02 2317 */
48c13301e6baba Mark Chen 2021-02-02 2318 udelay(500);
a1c49c434e1505 Sean Wang 2019-06-02 2319
a1c49c434e1505 Sean Wang 2019-06-02 2320 usb_anchor_urb(urb, &data->ctrl_anchor);
a1c49c434e1505 Sean Wang 2019-06-02 2321 err = usb_submit_urb(urb, GFP_ATOMIC);
a1c49c434e1505 Sean Wang 2019-06-02 2322 if (err < 0) {
60c6a63a3d3080 Mark-YW.Chen 2021-10-14 2323 kfree(urb->setup_packet);
a1c49c434e1505 Sean Wang 2019-06-02 2324 /* -EPERM: urb is being killed;
a1c49c434e1505 Sean Wang 2019-06-02 2325 * -ENODEV: device got disconnected
a1c49c434e1505 Sean Wang 2019-06-02 2326 */
a1c49c434e1505 Sean Wang 2019-06-02 2327 if (err != -EPERM && err != -ENODEV)
a1c49c434e1505 Sean Wang 2019-06-02 2328 bt_dev_err(hdev, "urb %p failed to resubmit (%d)",
a1c49c434e1505 Sean Wang 2019-06-02 2329 urb, -err);
a1c49c434e1505 Sean Wang 2019-06-02 2330 usb_unanchor_urb(urb);
a1c49c434e1505 Sean Wang 2019-06-02 2331 }
a1c49c434e1505 Sean Wang 2019-06-02 2332 }
a1c49c434e1505 Sean Wang 2019-06-02 2333
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
^ permalink raw reply [flat|nested] 14+ messages in thread* Re: [PATCH 2/2] Bluetooth: mediatek: fix the conflict between mtk and msft vendor event
@ 2022-02-14 8:52 ` kernel test robot
0 siblings, 0 replies; 14+ messages in thread
From: kernel test robot @ 2022-02-14 8:52 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 8530 bytes --]
Hi Sean,
Thanks for your patch! Perhaps something to improve:
[auto build test WARNING on bluetooth-next/master]
[also build test WARNING on next-20220211]
[cannot apply to v5.17-rc3]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/sean-wang-mediatek-com/Bluetooth-mt7921s-support-bluetooth-reset-mechanism/20220129-140313
base: https://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth-next.git master
config: riscv-randconfig-c006-20220205 (https://download.01.org/0day-ci/archive/20220213/202202130806.UHxKw5N3-lkp(a)intel.com/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project dee058c670593b999fec19c458dbbd882ad9de56)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install riscv cross compiling tool for clang build
# apt-get install binutils-riscv64-linux-gnu
# https://github.com/0day-ci/linux/commit/33092fd43b74594bae07555a6fdf15133cc8ec54
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review sean-wang-mediatek-com/Bluetooth-mt7921s-support-bluetooth-reset-mechanism/20220129-140313
git checkout 33092fd43b74594bae07555a6fdf15133cc8ec54
# save the config file to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=riscv clang-analyzer
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <yujie.liu@intel.com>
clang-analyzer warnings: (new ones prefixed by >>)
>> drivers/bluetooth/btusb.c:2273:3: warning: Value stored to 'hdr' is never read [clang-analyzer-deadcode.DeadStores]
hdr = (void *)skb->data;
^ ~~~~~~~~~~~~~~~~~
vim +/hdr +2273 drivers/bluetooth/btusb.c
5a87679ffd4436 mark-yw.chen 2021-09-01 2248
a1c49c434e1505 Sean Wang 2019-06-02 2249 static void btusb_mtk_wmt_recv(struct urb *urb)
a1c49c434e1505 Sean Wang 2019-06-02 2250 {
a1c49c434e1505 Sean Wang 2019-06-02 2251 struct hci_dev *hdev = urb->context;
a1c49c434e1505 Sean Wang 2019-06-02 2252 struct btusb_data *data = hci_get_drvdata(hdev);
a1c49c434e1505 Sean Wang 2019-06-02 @2253 struct hci_event_hdr *hdr;
a1c49c434e1505 Sean Wang 2019-06-02 2254 struct sk_buff *skb;
a1c49c434e1505 Sean Wang 2019-06-02 2255 int err;
a1c49c434e1505 Sean Wang 2019-06-02 2256
a1c49c434e1505 Sean Wang 2019-06-02 2257 if (urb->status == 0 && urb->actual_length > 0) {
a1c49c434e1505 Sean Wang 2019-06-02 2258 hdev->stat.byte_rx += urb->actual_length;
a1c49c434e1505 Sean Wang 2019-06-02 2259
a1c49c434e1505 Sean Wang 2019-06-02 2260 /* WMT event shouldn't be fragmented and the size should be
a1c49c434e1505 Sean Wang 2019-06-02 2261 * less than HCI_WMT_MAX_EVENT_SIZE.
a1c49c434e1505 Sean Wang 2019-06-02 2262 */
a1c49c434e1505 Sean Wang 2019-06-02 2263 skb = bt_skb_alloc(HCI_WMT_MAX_EVENT_SIZE, GFP_ATOMIC);
a1c49c434e1505 Sean Wang 2019-06-02 2264 if (!skb) {
a1c49c434e1505 Sean Wang 2019-06-02 2265 hdev->stat.err_rx++;
60c6a63a3d3080 Mark-YW.Chen 2021-10-14 2266 kfree(urb->setup_packet);
de71a6cb4bf24d Jupeng Zhong 2021-02-02 2267 return;
a1c49c434e1505 Sean Wang 2019-06-02 2268 }
a1c49c434e1505 Sean Wang 2019-06-02 2269
a1c49c434e1505 Sean Wang 2019-06-02 2270 hci_skb_pkt_type(skb) = HCI_EVENT_PKT;
a1c49c434e1505 Sean Wang 2019-06-02 2271 skb_put_data(skb, urb->transfer_buffer, urb->actual_length);
a1c49c434e1505 Sean Wang 2019-06-02 2272
a1c49c434e1505 Sean Wang 2019-06-02 @2273 hdr = (void *)skb->data;
a1c49c434e1505 Sean Wang 2019-06-02 2274
a1c49c434e1505 Sean Wang 2019-06-02 2275 /* When someone waits for the WMT event, the skb is being cloned
a1c49c434e1505 Sean Wang 2019-06-02 2276 * and being processed the events from there then.
a1c49c434e1505 Sean Wang 2019-06-02 2277 */
a1c49c434e1505 Sean Wang 2019-06-02 2278 if (test_bit(BTUSB_TX_WAIT_VND_EVT, &data->flags)) {
22cc6b7a1dbb58 Johan Hovold 2019-11-28 2279 data->evt_skb = skb_clone(skb, GFP_ATOMIC);
de71a6cb4bf24d Jupeng Zhong 2021-02-02 2280 if (!data->evt_skb) {
de71a6cb4bf24d Jupeng Zhong 2021-02-02 2281 kfree_skb(skb);
60c6a63a3d3080 Mark-YW.Chen 2021-10-14 2282 kfree(urb->setup_packet);
de71a6cb4bf24d Jupeng Zhong 2021-02-02 2283 return;
de71a6cb4bf24d Jupeng Zhong 2021-02-02 2284 }
a1c49c434e1505 Sean Wang 2019-06-02 2285 }
a1c49c434e1505 Sean Wang 2019-06-02 2286
a1c49c434e1505 Sean Wang 2019-06-02 2287 err = hci_recv_frame(hdev, skb);
de71a6cb4bf24d Jupeng Zhong 2021-02-02 2288 if (err < 0) {
de71a6cb4bf24d Jupeng Zhong 2021-02-02 2289 kfree_skb(data->evt_skb);
de71a6cb4bf24d Jupeng Zhong 2021-02-02 2290 data->evt_skb = NULL;
60c6a63a3d3080 Mark-YW.Chen 2021-10-14 2291 kfree(urb->setup_packet);
de71a6cb4bf24d Jupeng Zhong 2021-02-02 2292 return;
de71a6cb4bf24d Jupeng Zhong 2021-02-02 2293 }
a1c49c434e1505 Sean Wang 2019-06-02 2294
a1c49c434e1505 Sean Wang 2019-06-02 2295 if (test_and_clear_bit(BTUSB_TX_WAIT_VND_EVT,
a1c49c434e1505 Sean Wang 2019-06-02 2296 &data->flags)) {
a1c49c434e1505 Sean Wang 2019-06-02 2297 /* Barrier to sync with other CPUs */
a1c49c434e1505 Sean Wang 2019-06-02 2298 smp_mb__after_atomic();
a1c49c434e1505 Sean Wang 2019-06-02 2299 wake_up_bit(&data->flags,
a1c49c434e1505 Sean Wang 2019-06-02 2300 BTUSB_TX_WAIT_VND_EVT);
a1c49c434e1505 Sean Wang 2019-06-02 2301 }
60c6a63a3d3080 Mark-YW.Chen 2021-10-14 2302 kfree(urb->setup_packet);
a1c49c434e1505 Sean Wang 2019-06-02 2303 return;
a1c49c434e1505 Sean Wang 2019-06-02 2304 } else if (urb->status == -ENOENT) {
a1c49c434e1505 Sean Wang 2019-06-02 2305 /* Avoid suspend failed when usb_kill_urb */
a1c49c434e1505 Sean Wang 2019-06-02 2306 return;
a1c49c434e1505 Sean Wang 2019-06-02 2307 }
a1c49c434e1505 Sean Wang 2019-06-02 2308
a1c49c434e1505 Sean Wang 2019-06-02 2309 usb_mark_last_busy(data->udev);
a1c49c434e1505 Sean Wang 2019-06-02 2310
a1c49c434e1505 Sean Wang 2019-06-02 2311 /* The URB complete handler is still called with urb->actual_length = 0
a1c49c434e1505 Sean Wang 2019-06-02 2312 * when the event is not available, so we should keep re-submitting
a1c49c434e1505 Sean Wang 2019-06-02 2313 * URB until WMT event returns, Also, It's necessary to wait some time
a1c49c434e1505 Sean Wang 2019-06-02 2314 * between the two consecutive control URBs to relax the target device
a1c49c434e1505 Sean Wang 2019-06-02 2315 * to generate the event. Otherwise, the WMT event cannot return from
a1c49c434e1505 Sean Wang 2019-06-02 2316 * the device successfully.
a1c49c434e1505 Sean Wang 2019-06-02 2317 */
48c13301e6baba Mark Chen 2021-02-02 2318 udelay(500);
a1c49c434e1505 Sean Wang 2019-06-02 2319
a1c49c434e1505 Sean Wang 2019-06-02 2320 usb_anchor_urb(urb, &data->ctrl_anchor);
a1c49c434e1505 Sean Wang 2019-06-02 2321 err = usb_submit_urb(urb, GFP_ATOMIC);
a1c49c434e1505 Sean Wang 2019-06-02 2322 if (err < 0) {
60c6a63a3d3080 Mark-YW.Chen 2021-10-14 2323 kfree(urb->setup_packet);
a1c49c434e1505 Sean Wang 2019-06-02 2324 /* -EPERM: urb is being killed;
a1c49c434e1505 Sean Wang 2019-06-02 2325 * -ENODEV: device got disconnected
a1c49c434e1505 Sean Wang 2019-06-02 2326 */
a1c49c434e1505 Sean Wang 2019-06-02 2327 if (err != -EPERM && err != -ENODEV)
a1c49c434e1505 Sean Wang 2019-06-02 2328 bt_dev_err(hdev, "urb %p failed to resubmit (%d)",
a1c49c434e1505 Sean Wang 2019-06-02 2329 urb, -err);
a1c49c434e1505 Sean Wang 2019-06-02 2330 usb_unanchor_urb(urb);
a1c49c434e1505 Sean Wang 2019-06-02 2331 }
a1c49c434e1505 Sean Wang 2019-06-02 2332 }
a1c49c434e1505 Sean Wang 2019-06-02 2333
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
^ permalink raw reply [flat|nested] 14+ messages in thread* Re: [PATCH 2/2] Bluetooth: mediatek: fix the conflict between mtk and msft vendor event
@ 2022-02-14 8:52 ` kernel test robot
0 siblings, 0 replies; 14+ messages in thread
From: kernel test robot @ 2022-02-14 8:52 UTC (permalink / raw)
To: sean.wang
Cc: llvm, kbuild-all, linux-bluetooth, linux-mediatek,
Linux Kernel Mailing List, marcel, johan.hedberg
Hi Sean,
Thanks for your patch! Perhaps something to improve:
[auto build test WARNING on bluetooth-next/master]
[also build test WARNING on next-20220211]
[cannot apply to v5.17-rc3]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/sean-wang-mediatek-com/Bluetooth-mt7921s-support-bluetooth-reset-mechanism/20220129-140313
base: https://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth-next.git master
config: riscv-randconfig-c006-20220205 (https://download.01.org/0day-ci/archive/20220213/202202130806.UHxKw5N3-lkp@intel.com/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project dee058c670593b999fec19c458dbbd882ad9de56)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install riscv cross compiling tool for clang build
# apt-get install binutils-riscv64-linux-gnu
# https://github.com/0day-ci/linux/commit/33092fd43b74594bae07555a6fdf15133cc8ec54
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review sean-wang-mediatek-com/Bluetooth-mt7921s-support-bluetooth-reset-mechanism/20220129-140313
git checkout 33092fd43b74594bae07555a6fdf15133cc8ec54
# save the config file to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=riscv clang-analyzer
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <yujie.liu@intel.com>
clang-analyzer warnings: (new ones prefixed by >>)
>> drivers/bluetooth/btusb.c:2273:3: warning: Value stored to 'hdr' is never read [clang-analyzer-deadcode.DeadStores]
hdr = (void *)skb->data;
^ ~~~~~~~~~~~~~~~~~
vim +/hdr +2273 drivers/bluetooth/btusb.c
5a87679ffd4436 mark-yw.chen 2021-09-01 2248
a1c49c434e1505 Sean Wang 2019-06-02 2249 static void btusb_mtk_wmt_recv(struct urb *urb)
a1c49c434e1505 Sean Wang 2019-06-02 2250 {
a1c49c434e1505 Sean Wang 2019-06-02 2251 struct hci_dev *hdev = urb->context;
a1c49c434e1505 Sean Wang 2019-06-02 2252 struct btusb_data *data = hci_get_drvdata(hdev);
a1c49c434e1505 Sean Wang 2019-06-02 @2253 struct hci_event_hdr *hdr;
a1c49c434e1505 Sean Wang 2019-06-02 2254 struct sk_buff *skb;
a1c49c434e1505 Sean Wang 2019-06-02 2255 int err;
a1c49c434e1505 Sean Wang 2019-06-02 2256
a1c49c434e1505 Sean Wang 2019-06-02 2257 if (urb->status == 0 && urb->actual_length > 0) {
a1c49c434e1505 Sean Wang 2019-06-02 2258 hdev->stat.byte_rx += urb->actual_length;
a1c49c434e1505 Sean Wang 2019-06-02 2259
a1c49c434e1505 Sean Wang 2019-06-02 2260 /* WMT event shouldn't be fragmented and the size should be
a1c49c434e1505 Sean Wang 2019-06-02 2261 * less than HCI_WMT_MAX_EVENT_SIZE.
a1c49c434e1505 Sean Wang 2019-06-02 2262 */
a1c49c434e1505 Sean Wang 2019-06-02 2263 skb = bt_skb_alloc(HCI_WMT_MAX_EVENT_SIZE, GFP_ATOMIC);
a1c49c434e1505 Sean Wang 2019-06-02 2264 if (!skb) {
a1c49c434e1505 Sean Wang 2019-06-02 2265 hdev->stat.err_rx++;
60c6a63a3d3080 Mark-YW.Chen 2021-10-14 2266 kfree(urb->setup_packet);
de71a6cb4bf24d Jupeng Zhong 2021-02-02 2267 return;
a1c49c434e1505 Sean Wang 2019-06-02 2268 }
a1c49c434e1505 Sean Wang 2019-06-02 2269
a1c49c434e1505 Sean Wang 2019-06-02 2270 hci_skb_pkt_type(skb) = HCI_EVENT_PKT;
a1c49c434e1505 Sean Wang 2019-06-02 2271 skb_put_data(skb, urb->transfer_buffer, urb->actual_length);
a1c49c434e1505 Sean Wang 2019-06-02 2272
a1c49c434e1505 Sean Wang 2019-06-02 @2273 hdr = (void *)skb->data;
a1c49c434e1505 Sean Wang 2019-06-02 2274
a1c49c434e1505 Sean Wang 2019-06-02 2275 /* When someone waits for the WMT event, the skb is being cloned
a1c49c434e1505 Sean Wang 2019-06-02 2276 * and being processed the events from there then.
a1c49c434e1505 Sean Wang 2019-06-02 2277 */
a1c49c434e1505 Sean Wang 2019-06-02 2278 if (test_bit(BTUSB_TX_WAIT_VND_EVT, &data->flags)) {
22cc6b7a1dbb58 Johan Hovold 2019-11-28 2279 data->evt_skb = skb_clone(skb, GFP_ATOMIC);
de71a6cb4bf24d Jupeng Zhong 2021-02-02 2280 if (!data->evt_skb) {
de71a6cb4bf24d Jupeng Zhong 2021-02-02 2281 kfree_skb(skb);
60c6a63a3d3080 Mark-YW.Chen 2021-10-14 2282 kfree(urb->setup_packet);
de71a6cb4bf24d Jupeng Zhong 2021-02-02 2283 return;
de71a6cb4bf24d Jupeng Zhong 2021-02-02 2284 }
a1c49c434e1505 Sean Wang 2019-06-02 2285 }
a1c49c434e1505 Sean Wang 2019-06-02 2286
a1c49c434e1505 Sean Wang 2019-06-02 2287 err = hci_recv_frame(hdev, skb);
de71a6cb4bf24d Jupeng Zhong 2021-02-02 2288 if (err < 0) {
de71a6cb4bf24d Jupeng Zhong 2021-02-02 2289 kfree_skb(data->evt_skb);
de71a6cb4bf24d Jupeng Zhong 2021-02-02 2290 data->evt_skb = NULL;
60c6a63a3d3080 Mark-YW.Chen 2021-10-14 2291 kfree(urb->setup_packet);
de71a6cb4bf24d Jupeng Zhong 2021-02-02 2292 return;
de71a6cb4bf24d Jupeng Zhong 2021-02-02 2293 }
a1c49c434e1505 Sean Wang 2019-06-02 2294
a1c49c434e1505 Sean Wang 2019-06-02 2295 if (test_and_clear_bit(BTUSB_TX_WAIT_VND_EVT,
a1c49c434e1505 Sean Wang 2019-06-02 2296 &data->flags)) {
a1c49c434e1505 Sean Wang 2019-06-02 2297 /* Barrier to sync with other CPUs */
a1c49c434e1505 Sean Wang 2019-06-02 2298 smp_mb__after_atomic();
a1c49c434e1505 Sean Wang 2019-06-02 2299 wake_up_bit(&data->flags,
a1c49c434e1505 Sean Wang 2019-06-02 2300 BTUSB_TX_WAIT_VND_EVT);
a1c49c434e1505 Sean Wang 2019-06-02 2301 }
60c6a63a3d3080 Mark-YW.Chen 2021-10-14 2302 kfree(urb->setup_packet);
a1c49c434e1505 Sean Wang 2019-06-02 2303 return;
a1c49c434e1505 Sean Wang 2019-06-02 2304 } else if (urb->status == -ENOENT) {
a1c49c434e1505 Sean Wang 2019-06-02 2305 /* Avoid suspend failed when usb_kill_urb */
a1c49c434e1505 Sean Wang 2019-06-02 2306 return;
a1c49c434e1505 Sean Wang 2019-06-02 2307 }
a1c49c434e1505 Sean Wang 2019-06-02 2308
a1c49c434e1505 Sean Wang 2019-06-02 2309 usb_mark_last_busy(data->udev);
a1c49c434e1505 Sean Wang 2019-06-02 2310
a1c49c434e1505 Sean Wang 2019-06-02 2311 /* The URB complete handler is still called with urb->actual_length = 0
a1c49c434e1505 Sean Wang 2019-06-02 2312 * when the event is not available, so we should keep re-submitting
a1c49c434e1505 Sean Wang 2019-06-02 2313 * URB until WMT event returns, Also, It's necessary to wait some time
a1c49c434e1505 Sean Wang 2019-06-02 2314 * between the two consecutive control URBs to relax the target device
a1c49c434e1505 Sean Wang 2019-06-02 2315 * to generate the event. Otherwise, the WMT event cannot return from
a1c49c434e1505 Sean Wang 2019-06-02 2316 * the device successfully.
a1c49c434e1505 Sean Wang 2019-06-02 2317 */
48c13301e6baba Mark Chen 2021-02-02 2318 udelay(500);
a1c49c434e1505 Sean Wang 2019-06-02 2319
a1c49c434e1505 Sean Wang 2019-06-02 2320 usb_anchor_urb(urb, &data->ctrl_anchor);
a1c49c434e1505 Sean Wang 2019-06-02 2321 err = usb_submit_urb(urb, GFP_ATOMIC);
a1c49c434e1505 Sean Wang 2019-06-02 2322 if (err < 0) {
60c6a63a3d3080 Mark-YW.Chen 2021-10-14 2323 kfree(urb->setup_packet);
a1c49c434e1505 Sean Wang 2019-06-02 2324 /* -EPERM: urb is being killed;
a1c49c434e1505 Sean Wang 2019-06-02 2325 * -ENODEV: device got disconnected
a1c49c434e1505 Sean Wang 2019-06-02 2326 */
a1c49c434e1505 Sean Wang 2019-06-02 2327 if (err != -EPERM && err != -ENODEV)
a1c49c434e1505 Sean Wang 2019-06-02 2328 bt_dev_err(hdev, "urb %p failed to resubmit (%d)",
a1c49c434e1505 Sean Wang 2019-06-02 2329 urb, -err);
a1c49c434e1505 Sean Wang 2019-06-02 2330 usb_unanchor_urb(urb);
a1c49c434e1505 Sean Wang 2019-06-02 2331 }
a1c49c434e1505 Sean Wang 2019-06-02 2332 }
a1c49c434e1505 Sean Wang 2019-06-02 2333
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2022-02-14 8:53 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-01-29 6:02 [PATCH 1/2] Bluetooth: mt7921s: support bluetooth reset mechanism sean.wang
2022-01-29 6:02 ` sean.wang
2022-01-29 6:02 ` [PATCH 2/2] Bluetooth: mediatek: fix the conflict between mtk and msft vendor event sean.wang
2022-01-29 6:02 ` sean.wang
2022-01-29 9:54 ` kernel test robot
2022-01-29 9:54 ` kernel test robot
2022-01-29 9:54 ` kernel test robot
2022-02-07 15:48 ` Marcel Holtmann
2022-02-07 15:48 ` Marcel Holtmann
2022-01-29 7:05 ` [1/2] Bluetooth: mt7921s: support bluetooth reset mechanism bluez.test.bot
-- strict thread matches above, loose matches on Subject: below --
2022-02-13 0:25 [PATCH 2/2] Bluetooth: mediatek: fix the conflict between mtk and msft vendor event kernel test robot
2022-02-14 8:52 ` kernel test robot
2022-02-14 8:52 ` kernel test robot
2022-02-14 8:52 ` kernel test robot
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.