All of lore.kernel.org
 help / color / mirror / Atom feed
From: mahendra singh meena <mahendra.devel@gmail.com>
To: marcel@holtmann.org
Cc: padovan@profusion.mobi, linux-bluetooth@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH] Bluetooth: bfusb: Fixed some coding style issues
Date: Mon, 16 Jan 2012 01:17:03 +0530	[thread overview]
Message-ID: <4F132D37.7030405@gmail.com> (raw)


Fixed some coding style issues shown by scripts/checkpatch.pl

Signed-off-by: Mahendra Singh Meena <mahendra.devel@gmail.com>
---
 drivers/bluetooth/bfusb.c |   52 ++++++++++++++++++++++++++++++--------------
 1 files changed, 35 insertions(+), 17 deletions(-)

diff --git a/drivers/bluetooth/bfusb.c b/drivers/bluetooth/bfusb.c
index a323bae..e74062a 100644
--- a/drivers/bluetooth/bfusb.c
+++ b/drivers/bluetooth/bfusb.c
@@ -127,11 +127,13 @@ static int bfusb_send_bulk(struct bfusb_data *data, struct sk_buff *skb)
 {
 	struct bfusb_data_scb *scb = (void *) skb->cb;
 	struct urb *urb = bfusb_get_completed(data);
+	struct urb *urb_chk = urb;
 	int err, pipe;

 	BT_DBG("bfusb %p skb %p len %d", data, skb, skb->len);
+	urb = usb_alloc_urb(0, GFP_ATOMIC);

-	if (!urb && !(urb = usb_alloc_urb(0, GFP_ATOMIC)))
+	if (!urb_chk && !urb)
 		return -ENOMEM;

 	pipe = usb_sndbulkpipe(data->udev, data->bulk_out_ep);
@@ -145,7 +147,7 @@ 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",
+		BT_ERR("%s bulk tx submit failed urb %p err %d",
 					data->hdev->name, urb, err);
 		skb_unlink(skb, &data->pending_q);
 		usb_free_urb(urb);
@@ -214,11 +216,13 @@ static int bfusb_rx_submit(struct bfusb_data *data, struct urb *urb)
 {
 	struct bfusb_data_scb *scb;
 	struct sk_buff *skb;
+	struct urb *urb_chk = urb;
 	int err, pipe, size = HCI_MAX_FRAME_SIZE + 32;

 	BT_DBG("bfusb %p urb %p", data, urb);
+	urb = usb_alloc_urb(0, GFP_ATOMIC);

-	if (!urb && !(urb = usb_alloc_urb(0, GFP_ATOMIC)))
+	if (!urb && !urb_chk)
 		return -ENOMEM;

 	skb = bt_skb_alloc(size, GFP_ATOMIC);
@@ -251,7 +255,8 @@ static int bfusb_rx_submit(struct bfusb_data *data, struct urb *urb)
 	return err;
 }

-static inline int bfusb_recv_block(struct bfusb_data *data, int hdr, unsigned char *buf, int len)
+static inline int bfusb_recv_block(struct bfusb_data *data, int hdr,
+						 unsigned char *buf, int len)
 {
 	BT_DBG("bfusb %p hdr 0x%02x data %p len %d", data, hdr, buf, len);

@@ -283,30 +288,37 @@ static inline int bfusb_recv_block(struct bfusb_data *data, int hdr, unsigned ch
 		switch (pkt_type) {
 		case HCI_EVENT_PKT:
 			if (len >= HCI_EVENT_HDR_SIZE) {
-				struct hci_event_hdr *hdr = (struct hci_event_hdr *) buf;
+				struct hci_event_hdr *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_ERR("%s event block is too short",
+							 data->hdev->name);
 				return -EILSEQ;
 			}
 			break;

 		case HCI_ACLDATA_PKT:
 			if (len >= HCI_ACL_HDR_SIZE) {
-				struct hci_acl_hdr *hdr = (struct hci_acl_hdr *) buf;
-				pkt_len = HCI_ACL_HDR_SIZE + __le16_to_cpu(hdr->dlen);
+				struct hci_acl_hdr *hdr;
+				hdr = (struct hci_acl_hdr *) buf;
+				pkt_len = HCI_ACL_HDR_SIZE;
+				pkt_len = pkt_len + __le16_to_cpu(hdr->dlen);
 			} else {
-				BT_ERR("%s data block is too short", data->hdev->name);
+				BT_ERR("%s data block is too short",
+							 data->hdev->name);
 				return -EILSEQ;
 			}
 			break;

 		case HCI_SCODATA_PKT:
 			if (len >= HCI_SCO_HDR_SIZE) {
-				struct hci_sco_hdr *hdr = (struct hci_sco_hdr *) buf;
+				struct hci_sco_hdr *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_ERR("%s audio block is too short",
+							 data->hdev->name);
 				return -EILSEQ;
 			}
 			break;
@@ -324,7 +336,8 @@ 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_ERR("%s unexpected continuation block",
+							 data->hdev->name);
 			return -EIO;
 		}
 	}
@@ -473,7 +486,8 @@ static int bfusb_send_frame(struct sk_buff *skb)
 	unsigned char buf[3];
 	int sent = 0, size, count;

-	BT_DBG("hdev %p skb %p type %d len %d", hdev, skb, bt_cb(skb)->pkt_type, skb->len);
+	BT_DBG("hdev %p skb %p type %d len %d",
+				 hdev, skb, bt_cb(skb)->pkt_type, skb->len);

 	if (!hdev) {
 		BT_ERR("Frame for unknown HCI device (hdev=NULL)");
@@ -514,12 +528,14 @@ static int bfusb_send_frame(struct sk_buff *skb)
 	while (count) {
 		size = min_t(uint, count, BFUSB_MAX_BLOCK_SIZE);

-		buf[0] = 0xc1 | ((sent == 0) ? 0x04 : 0) | ((count == size) ? 0x08 : 0);
+		buf[0] = 0xc1 | ((sent == 0) ? 0x04 : 0) |
+						((count == size) ? 0x08 : 0);
 		buf[1] = 0x00;
 		buf[2] = (size == BFUSB_MAX_BLOCK_SIZE) ? 0 : size;

 		memcpy(skb_put(nskb, 3), buf, 3);
-		skb_copy_from_linear_data_offset(skb, sent, skb_put(nskb, size), size);
+		skb_copy_from_linear_data_offset(skb, sent,
+						 skb_put(nskb, size), size);

 		sent  += size;
 		count -= size;
@@ -553,7 +569,8 @@ static void bfusb_destruct(struct hci_dev *hdev)
 	kfree(data);
 }

-static int bfusb_ioctl(struct hci_dev *hdev, unsigned int cmd, unsigned long arg)
+static int bfusb_ioctl(struct hci_dev *hdev, unsigned int cmd,
+							 unsigned long arg)
 {
 	return -ENOIOCTLCMD;
 }
@@ -638,7 +655,8 @@ error:
 	return err;
 }

-static int bfusb_probe(struct usb_interface *intf, const struct usb_device_id *id)
+static int bfusb_probe(struct usb_interface *intf,
+						 const struct usb_device_id *id)
 {
 	const struct firmware *firmware;
 	struct usb_device *udev = interface_to_usbdev(intf);
-- 
1.7.0.4

             reply	other threads:[~2012-01-15 19:47 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-15 19:47 mahendra singh meena [this message]
2012-01-15 20:33 ` [PATCH] Bluetooth: bfusb: Fixed some coding style issues Joe Perches

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4F132D37.7030405@gmail.com \
    --to=mahendra.devel@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marcel@holtmann.org \
    --cc=padovan@profusion.mobi \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.