diff mbox series

Bluetooth: bfusb: Switch from BT_ERR to bt_dev_err where possible

Message ID 20200309214456.431153-1-marcel@holtmann.org (mailing list archive)
State Accepted
Delegated to: Johan Hedberg
Headers show
Series Bluetooth: bfusb: Switch from BT_ERR to bt_dev_err where possible | expand

Commit Message

Marcel Holtmann March 9, 2020, 9:44 p.m. UTC
All HCI device specific error messages shall use bt_dev_err to indicate
the device name in the message.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
---
 drivers/bluetooth/bfusb.c | 33 ++++++++++++++++-----------------
 1 file changed, 16 insertions(+), 17 deletions(-)

Comments

Alain Michaud March 10, 2020, 3:13 p.m. UTC | #1
Hi Marcel,

On Mon, Mar 9, 2020 at 5:45 PM Marcel Holtmann <marcel@holtmann.org> wrote:
>
> All HCI device specific error messages shall use bt_dev_err to indicate
> the device name in the message.
>
> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
> ---
>  drivers/bluetooth/bfusb.c | 33 ++++++++++++++++-----------------
>  1 file changed, 16 insertions(+), 17 deletions(-)
>
> diff --git a/drivers/bluetooth/bfusb.c b/drivers/bluetooth/bfusb.c
> index 0e5954cac98e..5a321b4076aa 100644
> --- a/drivers/bluetooth/bfusb.c
> +++ b/drivers/bluetooth/bfusb.c
> @@ -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;
>         }
>
> --
> 2.24.1
>

LGTM.
Johan Hedberg March 11, 2020, 8:08 a.m. UTC | #2
Hi Marcel,

On Mon, Mar 09, 2020, Marcel Holtmann wrote:
> All HCI device specific error messages shall use bt_dev_err to indicate
> the device name in the message.
> 
> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
> ---
>  drivers/bluetooth/bfusb.c | 33 ++++++++++++++++-----------------
>  1 file changed, 16 insertions(+), 17 deletions(-)

Applied to bluetooth-next. Thanks.

Johan
diff mbox series

Patch

diff --git a/drivers/bluetooth/bfusb.c b/drivers/bluetooth/bfusb.c
index 0e5954cac98e..5a321b4076aa 100644
--- a/drivers/bluetooth/bfusb.c
+++ b/drivers/bluetooth/bfusb.c
@@ -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;
 	}