Skip to contentSkip to conversation

Bluetooth: bfusb: Switch from BT_ERR to bt_dev_err where possible

PATCH Applied Marcel Holtmann 3 participants 3 messages Mar 9, 2020 – Mar 11, 2020 Bluetooth drivers

lore
Share & tools
lore

Marcel Holtmann

author maintainer
#0 lore raw

PATCH 1/1 Bluetooth: bfusb: Switch from BT_ERR to bt_dev_err where possible

All HCI device specific error messages shall use bt_dev_err to indicate the device name in the message.

---
 drivers/bluetooth/bfusb.c | 33 ++++++++++++++++-----------------
 1 file changed, 16 insertions(+), 17 deletions(-)
drivers/bluetooth/bfusb.c +16 -17
index 0e5954cac98e..5a321b4076aa 100644
@@ -133,8 +133,8 @@ static int bfusb_send_bulk(struct bfusb_data *data, struct sk_buff *skb)
 
 	err = usb_submit_urb(urb, GFP_ATOMIC);
 	if (err) {
-		BT_ERR("%s bulk tx submit failed urb %p err %d", 
-					data->hdev->name, urb, err);
+		bt_dev_err(data->hdev, "bulk tx submit failed urb %p err %d",
+			   urb, err);
 		skb_unlink(skb, &data->pending_q);
 		usb_free_urb(urb);
 	} else
@@ -232,8 +232,8 @@ static int bfusb_rx_submit(struct bfusb_data *data, struct urb *urb)
 
 	err = usb_submit_urb(urb, GFP_ATOMIC);
 	if (err) {
-		BT_ERR("%s bulk rx submit failed urb %p err %d",
-					data->hdev->name, urb, err);
+		bt_dev_err(data->hdev, "bulk rx submit failed urb %p err %d",
+			   urb, err);
 		skb_unlink(skb, &data->pending_q);
 		kfree_skb(skb);
 		usb_free_urb(urb);
@@ -247,7 +247,7 @@ static inline int bfusb_recv_block(struct bfusb_data *data, int hdr, unsigned ch
 	BT_DBG("bfusb %p hdr 0x%02x data %p len %d", data, hdr, buf, len);
 
 	if (hdr & 0x10) {
-		BT_ERR("%s error in block", data->hdev->name);
+		bt_dev_err(data->hdev, "error in block");
 		kfree_skb(data->reassembly);
 		data->reassembly = NULL;
 		return -EIO;
@@ -259,13 +259,13 @@ static inline int bfusb_recv_block(struct bfusb_data *data, int hdr, unsigned ch
 		int pkt_len = 0;
 
 		if (data->reassembly) {
-			BT_ERR("%s unexpected start block", data->hdev->name);
+			bt_dev_err(data->hdev, "unexpected start block");
 			kfree_skb(data->reassembly);
 			data->reassembly = NULL;
 		}
 
 		if (len < 1) {
-			BT_ERR("%s no packet type found", data->hdev->name);
+			bt_dev_err(data->hdev, "no packet type found");
 			return -EPROTO;
 		}
 
@@ -277,7 +277,7 @@ static inline int bfusb_recv_block(struct bfusb_data *data, int hdr, unsigned ch
 				struct hci_event_hdr *hdr = (struct hci_event_hdr *) buf;
 				pkt_len = HCI_EVENT_HDR_SIZE + hdr->plen;
 			} else {
-				BT_ERR("%s event block is too short", data->hdev->name);
+				bt_dev_err(data->hdev, "event block is too short");
 				return -EILSEQ;
 			}
 			break;
@@ -287,7 +287,7 @@ static inline int bfusb_recv_block(struct bfusb_data *data, int hdr, unsigned ch
 				struct hci_acl_hdr *hdr = (struct hci_acl_hdr *) buf;
 				pkt_len = HCI_ACL_HDR_SIZE + __le16_to_cpu(hdr->dlen);
 			} else {
-				BT_ERR("%s data block is too short", data->hdev->name);
+				bt_dev_err(data->hdev, "data block is too short");
 				return -EILSEQ;
 			}
 			break;
@@ -297,7 +297,7 @@ static inline int bfusb_recv_block(struct bfusb_data *data, int hdr, unsigned ch
 				struct hci_sco_hdr *hdr = (struct hci_sco_hdr *) buf;
 				pkt_len = HCI_SCO_HDR_SIZE + hdr->dlen;
 			} else {
-				BT_ERR("%s audio block is too short", data->hdev->name);
+				bt_dev_err(data->hdev, "audio block is too short");
 				return -EILSEQ;
 			}
 			break;
@@ -305,7 +305,7 @@ static inline int bfusb_recv_block(struct bfusb_data *data, int hdr, unsigned ch
 
 		skb = bt_skb_alloc(pkt_len, GFP_ATOMIC);
 		if (!skb) {
-			BT_ERR("%s no memory for the packet", data->hdev->name);
+			bt_dev_err(data->hdev, "no memory for the packet");
 			return -ENOMEM;
 		}
 
@@ -314,7 +314,7 @@ static inline int bfusb_recv_block(struct bfusb_data *data, int hdr, unsigned ch
 		data->reassembly = skb;
 	} else {
 		if (!data->reassembly) {
-			BT_ERR("%s unexpected continuation block", data->hdev->name);
+			bt_dev_err(data->hdev, "unexpected continuation block");
 			return -EIO;
 		}
 	}
@@ -366,8 +366,7 @@ static void bfusb_rx_complete(struct urb *urb)
 		}
 
 		if (count < len) {
-			BT_ERR("%s block extends over URB buffer ranges",
-					data->hdev->name);
+			bt_dev_err(data->hdev, "block extends over URB buffer ranges");
 		}
 
 		if ((hdr & 0xe1) == 0xc1)
@@ -391,8 +390,8 @@ static void bfusb_rx_complete(struct urb *urb)
 
 	err = usb_submit_urb(urb, GFP_ATOMIC);
 	if (err) {
-		BT_ERR("%s bulk resubmit failed urb %p err %d",
-					data->hdev->name, urb, err);
+		bt_dev_err(data->hdev, "bulk resubmit failed urb %p err %d",
+			   urb, err);
 	}
 
 unlock:
@@ -477,7 +476,7 @@ static int bfusb_send_frame(struct hci_dev *hdev, struct sk_buff *skb)
 	/* Max HCI frame size seems to be 1511 + 1 */
 	nskb = bt_skb_alloc(count + 32, GFP_KERNEL);
 	if (!nskb) {
-		BT_ERR("Can't allocate memory for new packet");
+		bt_dev_err(hdev, "Can't allocate memory for new packet");
 		return -ENOMEM;
 	}
 
Signature · 1 line
2.24.1
#1 lore raw

Hi Marcel,

Quoted 136 lines · Marcel Holtmann

All HCI device specific error messages shall use bt_dev_err to indicate the device name in the message.

---
 drivers/bluetooth/bfusb.c | 33 ++++++++++++++++-----------------
 1 file changed, 16 insertions(+), 17 deletions(-)
drivers/bluetooth/bfusb.c +16 -18
index 0e5954cac98e..5a321b4076aa 100644
@@ -133,8 +133,8 @@ static int bfusb_send_bulk(struct bfusb_data *data, struct sk_buff *skb)
 
        err = usb_submit_urb(urb, GFP_ATOMIC);
        if (err) {
-               BT_ERR("%s bulk tx submit failed urb %p err %d",
-                                       data->hdev->name, urb, err);
+               bt_dev_err(data->hdev, "bulk tx submit failed urb %p err %d",
+                          urb, err);
                skb_unlink(skb, &data->pending_q);
                usb_free_urb(urb);
        } else
@@ -232,8 +232,8 @@ static int bfusb_rx_submit(struct bfusb_data *data, struct urb *urb)
 
        err = usb_submit_urb(urb, GFP_ATOMIC);
        if (err) {
-               BT_ERR("%s bulk rx submit failed urb %p err %d",
-                                       data->hdev->name, urb, err);
+               bt_dev_err(data->hdev, "bulk rx submit failed urb %p err %d",
+                          urb, err);
                skb_unlink(skb, &data->pending_q);
                kfree_skb(skb);
                usb_free_urb(urb);
@@ -247,7 +247,7 @@ static inline int bfusb_recv_block(struct bfusb_data *data, int hdr, unsigned ch
        BT_DBG("bfusb %p hdr 0x%02x data %p len %d", data, hdr, buf, len);
 
        if (hdr & 0x10) {
-               BT_ERR("%s error in block", data->hdev->name);
+               bt_dev_err(data->hdev, "error in block");
                kfree_skb(data->reassembly);
                data->reassembly = NULL;
                return -EIO;
@@ -259,13 +259,13 @@ static inline int bfusb_recv_block(struct bfusb_data *data, int hdr, unsigned ch
                int pkt_len = 0;
 
                if (data->reassembly) {
-                       BT_ERR("%s unexpected start block", data->hdev->name);
+                       bt_dev_err(data->hdev, "unexpected start block");
                        kfree_skb(data->reassembly);
                        data->reassembly = NULL;
                }
 
                if (len < 1) {
-                       BT_ERR("%s no packet type found", data->hdev->name);
+                       bt_dev_err(data->hdev, "no packet type found");
                        return -EPROTO;
                }
 
@@ -277,7 +277,7 @@ static inline int bfusb_recv_block(struct bfusb_data *data, int hdr, unsigned ch
                                struct hci_event_hdr *hdr = (struct hci_event_hdr *) buf;
                                pkt_len = HCI_EVENT_HDR_SIZE + hdr->plen;
                        } else {
-                               BT_ERR("%s event block is too short", data->hdev->name);
+                               bt_dev_err(data->hdev, "event block is too short");
                                return -EILSEQ;
                        }
                        break;
@@ -287,7 +287,7 @@ static inline int bfusb_recv_block(struct bfusb_data *data, int hdr, unsigned ch
                                struct hci_acl_hdr *hdr = (struct hci_acl_hdr *) buf;
                                pkt_len = HCI_ACL_HDR_SIZE + __le16_to_cpu(hdr->dlen);
                        } else {
-                               BT_ERR("%s data block is too short", data->hdev->name);
+                               bt_dev_err(data->hdev, "data block is too short");
                                return -EILSEQ;
                        }
                        break;
@@ -297,7 +297,7 @@ static inline int bfusb_recv_block(struct bfusb_data *data, int hdr, unsigned ch
                                struct hci_sco_hdr *hdr = (struct hci_sco_hdr *) buf;
                                pkt_len = HCI_SCO_HDR_SIZE + hdr->dlen;
                        } else {
-                               BT_ERR("%s audio block is too short", data->hdev->name);
+                               bt_dev_err(data->hdev, "audio block is too short");
                                return -EILSEQ;
                        }
                        break;
@@ -305,7 +305,7 @@ static inline int bfusb_recv_block(struct bfusb_data *data, int hdr, unsigned ch
 
                skb = bt_skb_alloc(pkt_len, GFP_ATOMIC);
                if (!skb) {
-                       BT_ERR("%s no memory for the packet", data->hdev->name);
+                       bt_dev_err(data->hdev, "no memory for the packet");
                        return -ENOMEM;
                }
 
@@ -314,7 +314,7 @@ static inline int bfusb_recv_block(struct bfusb_data *data, int hdr, unsigned ch
                data->reassembly = skb;
        } else {
                if (!data->reassembly) {
-                       BT_ERR("%s unexpected continuation block", data->hdev->name);
+                       bt_dev_err(data->hdev, "unexpected continuation block");
                        return -EIO;
                }
        }
@@ -366,8 +366,7 @@ static void bfusb_rx_complete(struct urb *urb)
                }
 
                if (count < len) {
-                       BT_ERR("%s block extends over URB buffer ranges",
-                                       data->hdev->name);
+                       bt_dev_err(data->hdev, "block extends over URB buffer ranges");
                }
 
                if ((hdr & 0xe1) == 0xc1)
@@ -391,8 +390,8 @@ static void bfusb_rx_complete(struct urb *urb)
 
        err = usb_submit_urb(urb, GFP_ATOMIC);
        if (err) {
-               BT_ERR("%s bulk resubmit failed urb %p err %d",
-                                       data->hdev->name, urb, err);
+               bt_dev_err(data->hdev, "bulk resubmit failed urb %p err %d",
+                          urb, err);
        }
 
 unlock:
@@ -477,7 +476,7 @@ static int bfusb_send_frame(struct hci_dev *hdev, struct sk_buff *skb)
        /* Max HCI frame size seems to be 1511 + 1 */
        nskb = bt_skb_alloc(count + 32, GFP_KERNEL);
        if (!nskb) {
-               BT_ERR("Can't allocate memory for new packet");
+               bt_dev_err(hdev, "Can't allocate memory for new packet");
                return -ENOMEM;
        }
 
--
Quoted 2 lines

2.24.1

LGTM.

#2 lore raw
In reply to Marcel Holtmann

Hi Marcel,

Quoted 7 lines · Marcel Holtmann

All HCI device specific error messages shall use bt_dev_err to indicate the device name in the message.

---
 drivers/bluetooth/bfusb.c | 33 ++++++++++++++++-----------------
 1 file changed, 16 insertions(+), 17 deletions(-)

Applied to bluetooth-next. Thanks.

Johan