mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-07 06:52:07 +00:00
Bluetooth: Remove assignments in if-statements
Remove assignment in if-statements to be consistent with the coding style. Signed-off-by: Valentin Ilie <valentin.ilie@gmail.com> Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
This commit is contained in:
parent
5981a8821b
commit
a08b15e66e
9 changed files with 59 additions and 35 deletions
|
@ -180,10 +180,9 @@ static int ath3k_load_firmware(struct usb_device *udev,
|
||||||
}
|
}
|
||||||
|
|
||||||
memcpy(send_buf, firmware->data, 20);
|
memcpy(send_buf, firmware->data, 20);
|
||||||
if ((err = usb_control_msg(udev, pipe,
|
err = usb_control_msg(udev, pipe, USB_REQ_DFU_DNLOAD, USB_TYPE_VENDOR,
|
||||||
USB_REQ_DFU_DNLOAD,
|
0, 0, send_buf, 20, USB_CTRL_SET_TIMEOUT);
|
||||||
USB_TYPE_VENDOR, 0, 0,
|
if (err < 0) {
|
||||||
send_buf, 20, USB_CTRL_SET_TIMEOUT)) < 0) {
|
|
||||||
BT_ERR("Can't change to loading configuration err");
|
BT_ERR("Can't change to loading configuration err");
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
|
@ -131,8 +131,11 @@ static int bfusb_send_bulk(struct bfusb_data *data, struct sk_buff *skb)
|
||||||
|
|
||||||
BT_DBG("bfusb %p skb %p len %d", data, skb, skb->len);
|
BT_DBG("bfusb %p skb %p len %d", data, skb, skb->len);
|
||||||
|
|
||||||
if (!urb && !(urb = usb_alloc_urb(0, GFP_ATOMIC)))
|
if (!urb) {
|
||||||
return -ENOMEM;
|
urb = usb_alloc_urb(0, GFP_ATOMIC);
|
||||||
|
if (!urb)
|
||||||
|
return -ENOMEM;
|
||||||
|
}
|
||||||
|
|
||||||
pipe = usb_sndbulkpipe(data->udev, data->bulk_out_ep);
|
pipe = usb_sndbulkpipe(data->udev, data->bulk_out_ep);
|
||||||
|
|
||||||
|
@ -218,8 +221,11 @@ static int bfusb_rx_submit(struct bfusb_data *data, struct urb *urb)
|
||||||
|
|
||||||
BT_DBG("bfusb %p urb %p", data, urb);
|
BT_DBG("bfusb %p urb %p", data, urb);
|
||||||
|
|
||||||
if (!urb && !(urb = usb_alloc_urb(0, GFP_ATOMIC)))
|
if (!urb) {
|
||||||
return -ENOMEM;
|
urb = usb_alloc_urb(0, GFP_ATOMIC);
|
||||||
|
if (!urb)
|
||||||
|
return -ENOMEM;
|
||||||
|
}
|
||||||
|
|
||||||
skb = bt_skb_alloc(size, GFP_ATOMIC);
|
skb = bt_skb_alloc(size, GFP_ATOMIC);
|
||||||
if (!skb) {
|
if (!skb) {
|
||||||
|
|
|
@ -257,7 +257,8 @@ static void bluecard_write_wakeup(bluecard_info_t *info)
|
||||||
ready_bit = XMIT_BUF_ONE_READY;
|
ready_bit = XMIT_BUF_ONE_READY;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(skb = skb_dequeue(&(info->txq))))
|
skb = skb_dequeue(&(info->txq));
|
||||||
|
if (!skb)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (bt_cb(skb)->pkt_type & 0x80) {
|
if (bt_cb(skb)->pkt_type & 0x80) {
|
||||||
|
@ -391,7 +392,8 @@ static void bluecard_receive(bluecard_info_t *info, unsigned int offset)
|
||||||
if (info->rx_skb == NULL) {
|
if (info->rx_skb == NULL) {
|
||||||
info->rx_state = RECV_WAIT_PACKET_TYPE;
|
info->rx_state = RECV_WAIT_PACKET_TYPE;
|
||||||
info->rx_count = 0;
|
info->rx_count = 0;
|
||||||
if (!(info->rx_skb = bt_skb_alloc(HCI_MAX_FRAME_SIZE, GFP_ATOMIC))) {
|
info->rx_skb = bt_skb_alloc(HCI_MAX_FRAME_SIZE, GFP_ATOMIC);
|
||||||
|
if (!info->rx_skb) {
|
||||||
BT_ERR("Can't allocate mem for new packet");
|
BT_ERR("Can't allocate mem for new packet");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -566,7 +568,8 @@ static int bluecard_hci_set_baud_rate(struct hci_dev *hdev, int baud)
|
||||||
/* Ericsson baud rate command */
|
/* Ericsson baud rate command */
|
||||||
unsigned char cmd[] = { HCI_COMMAND_PKT, 0x09, 0xfc, 0x01, 0x03 };
|
unsigned char cmd[] = { HCI_COMMAND_PKT, 0x09, 0xfc, 0x01, 0x03 };
|
||||||
|
|
||||||
if (!(skb = bt_skb_alloc(HCI_MAX_FRAME_SIZE, GFP_ATOMIC))) {
|
skb = bt_skb_alloc(HCI_MAX_FRAME_SIZE, GFP_ATOMIC);
|
||||||
|
if (!skb) {
|
||||||
BT_ERR("Can't allocate mem for new packet");
|
BT_ERR("Can't allocate mem for new packet");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -193,8 +193,8 @@ static void bt3c_write_wakeup(bt3c_info_t *info)
|
||||||
if (!pcmcia_dev_present(info->p_dev))
|
if (!pcmcia_dev_present(info->p_dev))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
skb = skb_dequeue(&(info->txq));
|
||||||
if (!(skb = skb_dequeue(&(info->txq)))) {
|
if (!skb) {
|
||||||
clear_bit(XMIT_SENDING, &(info->tx_state));
|
clear_bit(XMIT_SENDING, &(info->tx_state));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -238,7 +238,8 @@ static void bt3c_receive(bt3c_info_t *info)
|
||||||
if (info->rx_skb == NULL) {
|
if (info->rx_skb == NULL) {
|
||||||
info->rx_state = RECV_WAIT_PACKET_TYPE;
|
info->rx_state = RECV_WAIT_PACKET_TYPE;
|
||||||
info->rx_count = 0;
|
info->rx_count = 0;
|
||||||
if (!(info->rx_skb = bt_skb_alloc(HCI_MAX_FRAME_SIZE, GFP_ATOMIC))) {
|
info->rx_skb = bt_skb_alloc(HCI_MAX_FRAME_SIZE, GFP_ATOMIC);
|
||||||
|
if (!info->rx_skb) {
|
||||||
BT_ERR("Can't allocate mem for new packet");
|
BT_ERR("Can't allocate mem for new packet");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -149,7 +149,8 @@ static void btuart_write_wakeup(btuart_info_t *info)
|
||||||
if (!pcmcia_dev_present(info->p_dev))
|
if (!pcmcia_dev_present(info->p_dev))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!(skb = skb_dequeue(&(info->txq))))
|
skb = skb_dequeue(&(info->txq));
|
||||||
|
if (!skb)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* Send frame */
|
/* Send frame */
|
||||||
|
@ -190,7 +191,8 @@ static void btuart_receive(btuart_info_t *info)
|
||||||
if (info->rx_skb == NULL) {
|
if (info->rx_skb == NULL) {
|
||||||
info->rx_state = RECV_WAIT_PACKET_TYPE;
|
info->rx_state = RECV_WAIT_PACKET_TYPE;
|
||||||
info->rx_count = 0;
|
info->rx_count = 0;
|
||||||
if (!(info->rx_skb = bt_skb_alloc(HCI_MAX_FRAME_SIZE, GFP_ATOMIC))) {
|
info->rx_skb = bt_skb_alloc(HCI_MAX_FRAME_SIZE, GFP_ATOMIC);
|
||||||
|
if (!info->rx_skb) {
|
||||||
BT_ERR("Can't allocate mem for new packet");
|
BT_ERR("Can't allocate mem for new packet");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -153,7 +153,8 @@ static void dtl1_write_wakeup(dtl1_info_t *info)
|
||||||
if (!pcmcia_dev_present(info->p_dev))
|
if (!pcmcia_dev_present(info->p_dev))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!(skb = skb_dequeue(&(info->txq))))
|
skb = skb_dequeue(&(info->txq));
|
||||||
|
if (!skb)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* Send frame */
|
/* Send frame */
|
||||||
|
@ -215,13 +216,15 @@ static void dtl1_receive(dtl1_info_t *info)
|
||||||
info->hdev->stat.byte_rx++;
|
info->hdev->stat.byte_rx++;
|
||||||
|
|
||||||
/* Allocate packet */
|
/* Allocate packet */
|
||||||
if (info->rx_skb == NULL)
|
if (info->rx_skb == NULL) {
|
||||||
if (!(info->rx_skb = bt_skb_alloc(HCI_MAX_FRAME_SIZE, GFP_ATOMIC))) {
|
info->rx_skb = bt_skb_alloc(HCI_MAX_FRAME_SIZE, GFP_ATOMIC);
|
||||||
|
if (!info->rx_skb) {
|
||||||
BT_ERR("Can't allocate mem for new packet");
|
BT_ERR("Can't allocate mem for new packet");
|
||||||
info->rx_state = RECV_WAIT_NSH;
|
info->rx_state = RECV_WAIT_NSH;
|
||||||
info->rx_count = NSHL;
|
info->rx_count = NSHL;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
*skb_put(info->rx_skb, 1) = inb(iobase + UART_RX);
|
*skb_put(info->rx_skb, 1) = inb(iobase + UART_RX);
|
||||||
nsh = (nsh_t *)info->rx_skb->data;
|
nsh = (nsh_t *)info->rx_skb->data;
|
||||||
|
|
|
@ -291,7 +291,8 @@ static struct sk_buff *bcsp_dequeue(struct hci_uart *hu)
|
||||||
/* First of all, check for unreliable messages in the queue,
|
/* First of all, check for unreliable messages in the queue,
|
||||||
since they have priority */
|
since they have priority */
|
||||||
|
|
||||||
if ((skb = skb_dequeue(&bcsp->unrel)) != NULL) {
|
skb = skb_dequeue(&bcsp->unrel);
|
||||||
|
if (skb != NULL) {
|
||||||
struct sk_buff *nskb = bcsp_prepare_pkt(bcsp, skb->data, skb->len, bt_cb(skb)->pkt_type);
|
struct sk_buff *nskb = bcsp_prepare_pkt(bcsp, skb->data, skb->len, bt_cb(skb)->pkt_type);
|
||||||
if (nskb) {
|
if (nskb) {
|
||||||
kfree_skb(skb);
|
kfree_skb(skb);
|
||||||
|
@ -308,16 +309,20 @@ static struct sk_buff *bcsp_dequeue(struct hci_uart *hu)
|
||||||
|
|
||||||
spin_lock_irqsave_nested(&bcsp->unack.lock, flags, SINGLE_DEPTH_NESTING);
|
spin_lock_irqsave_nested(&bcsp->unack.lock, flags, SINGLE_DEPTH_NESTING);
|
||||||
|
|
||||||
if (bcsp->unack.qlen < BCSP_TXWINSIZE && (skb = skb_dequeue(&bcsp->rel)) != NULL) {
|
if (bcsp->unack.qlen < BCSP_TXWINSIZE) {
|
||||||
struct sk_buff *nskb = bcsp_prepare_pkt(bcsp, skb->data, skb->len, bt_cb(skb)->pkt_type);
|
skb = skb_dequeue(&bcsp->rel);
|
||||||
if (nskb) {
|
if (skb != NULL) {
|
||||||
__skb_queue_tail(&bcsp->unack, skb);
|
struct sk_buff *nskb = bcsp_prepare_pkt(bcsp, skb->data, skb->len,
|
||||||
mod_timer(&bcsp->tbcsp, jiffies + HZ / 4);
|
bt_cb(skb)->pkt_type);
|
||||||
spin_unlock_irqrestore(&bcsp->unack.lock, flags);
|
if (nskb) {
|
||||||
return nskb;
|
__skb_queue_tail(&bcsp->unack, skb);
|
||||||
} else {
|
mod_timer(&bcsp->tbcsp, jiffies + HZ / 4);
|
||||||
skb_queue_head(&bcsp->rel, skb);
|
spin_unlock_irqrestore(&bcsp->unack.lock, flags);
|
||||||
BT_ERR("Could not dequeue pkt because alloc_skb failed");
|
return nskb;
|
||||||
|
} else {
|
||||||
|
skb_queue_head(&bcsp->rel, skb);
|
||||||
|
BT_ERR("Could not dequeue pkt because alloc_skb failed");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -673,7 +673,8 @@ static struct sk_buff *h5_dequeue(struct hci_uart *hu)
|
||||||
return h5_prepare_pkt(hu, HCI_3WIRE_LINK_PKT, wakeup_req, 2);
|
return h5_prepare_pkt(hu, HCI_3WIRE_LINK_PKT, wakeup_req, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((skb = skb_dequeue(&h5->unrel)) != NULL) {
|
skb = skb_dequeue(&h5->unrel);
|
||||||
|
if (skb != NULL) {
|
||||||
nskb = h5_prepare_pkt(hu, bt_cb(skb)->pkt_type,
|
nskb = h5_prepare_pkt(hu, bt_cb(skb)->pkt_type,
|
||||||
skb->data, skb->len);
|
skb->data, skb->len);
|
||||||
if (nskb) {
|
if (nskb) {
|
||||||
|
@ -690,7 +691,8 @@ static struct sk_buff *h5_dequeue(struct hci_uart *hu)
|
||||||
if (h5->unack.qlen >= h5->tx_win)
|
if (h5->unack.qlen >= h5->tx_win)
|
||||||
goto unlock;
|
goto unlock;
|
||||||
|
|
||||||
if ((skb = skb_dequeue(&h5->rel)) != NULL) {
|
skb = skb_dequeue(&h5->rel);
|
||||||
|
if (skb != NULL) {
|
||||||
nskb = h5_prepare_pkt(hu, bt_cb(skb)->pkt_type,
|
nskb = h5_prepare_pkt(hu, bt_cb(skb)->pkt_type,
|
||||||
skb->data, skb->len);
|
skb->data, skb->len);
|
||||||
if (nskb) {
|
if (nskb) {
|
||||||
|
|
|
@ -271,7 +271,8 @@ static int hci_uart_tty_open(struct tty_struct *tty)
|
||||||
if (tty->ops->write == NULL)
|
if (tty->ops->write == NULL)
|
||||||
return -EOPNOTSUPP;
|
return -EOPNOTSUPP;
|
||||||
|
|
||||||
if (!(hu = kzalloc(sizeof(struct hci_uart), GFP_KERNEL))) {
|
hu = kzalloc(sizeof(struct hci_uart), GFP_KERNEL);
|
||||||
|
if (!hu) {
|
||||||
BT_ERR("Can't allocate control structure");
|
BT_ERR("Can't allocate control structure");
|
||||||
return -ENFILE;
|
return -ENFILE;
|
||||||
}
|
}
|
||||||
|
@ -569,7 +570,8 @@ static int __init hci_uart_init(void)
|
||||||
hci_uart_ldisc.write_wakeup = hci_uart_tty_wakeup;
|
hci_uart_ldisc.write_wakeup = hci_uart_tty_wakeup;
|
||||||
hci_uart_ldisc.owner = THIS_MODULE;
|
hci_uart_ldisc.owner = THIS_MODULE;
|
||||||
|
|
||||||
if ((err = tty_register_ldisc(N_HCI, &hci_uart_ldisc))) {
|
err = tty_register_ldisc(N_HCI, &hci_uart_ldisc);
|
||||||
|
if (err) {
|
||||||
BT_ERR("HCI line discipline registration failed. (%d)", err);
|
BT_ERR("HCI line discipline registration failed. (%d)", err);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
@ -614,7 +616,8 @@ static void __exit hci_uart_exit(void)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Release tty registration of line discipline */
|
/* Release tty registration of line discipline */
|
||||||
if ((err = tty_unregister_ldisc(N_HCI)))
|
err = tty_unregister_ldisc(N_HCI);
|
||||||
|
if (err)
|
||||||
BT_ERR("Can't unregister HCI line discipline (%d)", err);
|
BT_ERR("Can't unregister HCI line discipline (%d)", err);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue