Bluetooth: clean up
PATCH 1/1 Bluetooth: clean up
Clean up bluetooth files
- replace foo* bar with foo *bar
- add space arround '='
- remove trailing witespaces
- remove assignment in if
- fix coding style issues
--- drivers/bluetooth/Kconfig | 12 +++++------ drivers/bluetooth/dtl1_cs.c | 6 +++--- drivers/bluetooth/hci_bcsp.c | 48 +++++++++++++++++++++-------------------- drivers/bluetooth/hci_h5.c | 6 ++++-- drivers/bluetooth/hci_ldisc.c | 15 +++++++------ drivers/bluetooth/hci_vhci.c | 4 ++-- 6 files changed, 49 insertions(+), 42 deletions(-)
drivers/bluetooth/Kconfig +6 -6
@@ -30,8 +30,8 @@ config BT_HCIUART help Bluetooth HCI UART driver. This driver is required if you want to use Bluetooth devices with - serial port interface. You will also need this driver if you have - UART based Bluetooth PCMCIA and CF devices like Xircom Credit Card + serial port interface. You will also need this driver if you have + UART based Bluetooth PCMCIA and CF devices like Xircom Credit Card adapter and BrainBoxes Bluetooth PC Card. Say Y here to compile support for Bluetooth UART devices into the
@@ -41,9 +41,9 @@ config BT_HCIUART_H4 bool "UART (H4) protocol support" depends on BT_HCIUART help - UART (H4) is serial protocol for communication between Bluetooth - device and host. This protocol is required for most Bluetooth devices - with UART interface, including PCMCIA and CF cards. + UART (H4) is serial protocol for communication between Bluetooth + device and host. This protocol is required for most Bluetooth devices + with UART interface, including PCMCIA and CF cards. Say Y here to compile support for HCI UART (H4) protocol.
@@ -52,7 +52,7 @@ config BT_HCIUART_BCSP depends on BT_HCIUART select BITREVERSE help - BCSP (BlueCore Serial Protocol) is serial protocol for communication + BCSP (BlueCore Serial Protocol) is serial protocol for communication between Bluetooth device and host. This protocol is required for non USB Bluetooth devices based on CSR BlueCore chip, including PCMCIA and CF cards.
drivers/bluetooth/dtl1_cs.c +3 -3
@@ -153,7 +153,8 @@ static void dtl1_write_wakeup(dtl1_info_t *info)if (!pcmcia_dev_present (info->p_dev))return ; -if (!(skb =skb_dequeue (&(info->txq)))) + skb =skb_dequeue (&(info->txq)); +if (!skb)break ;/* Send frame */
@@ -181,9 +182,8 @@ static void dtl1_control(dtl1_info_t *info, struct sk_buff *skb)int i;printk (KERN_INFO "Bluetooth: Nokia control data =" ); -for (i =0 ; i < skb->len; i++) { +for (i =0 ; i < skb->len; i++)printk (" %02x" , skb->data[i]); - }printk ("\n" );/* transition to active state */
drivers/bluetooth/hci_bcsp.c +25 -23
137 lines not on this page · raw message
drivers/bluetooth/hci_h5.c +4 -2
@@ -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 ); } -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, skb->data, skb->len);if (nskb) {
@@ -690,7 +691,8 @@ static struct sk_buff *h5_dequeue(struct hci_uart *hu)if (h5->unack.qlen >= h5->tx_win) 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, skb->data, skb->len);if (nskb) {
drivers/bluetooth/hci_ldisc.c +9 -6
@@ -236,7 +236,7 @@ static int hci_uart_close(struct hci_dev *hdev)/* Send frames from HCI layer */ static int hci_uart_send_frame (struct sk_buff *skb) { -struct hci_dev * hdev = (struct hci_dev *) skb->dev; +struct hci_dev *hdev = (struct hci_dev *) skb->dev;struct hci_uart *hu;if (!hdev) {
@@ -279,7 +279,8 @@ static int hci_uart_tty_open(struct tty_struct *tty)if (tty->ops->write ==NULL )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" );return -ENFILE ; }
@@ -483,7 +484,7 @@ static int hci_uart_set_proto(struct hci_uart *hu, int id)* * Return Value: Command dependent */ -static int hci_uart_tty_ioctl (struct tty_struct *tty,struct file * file, +static int hci_uart_tty_ioctl (struct tty_struct *tty,struct file *file,unsigned int cmd,unsigned long arg) {struct hci_uart *hu = (void *)tty->disc_data;
@@ -564,7 +565,7 @@ static int __init hci_uart_init(void)/* Register the tty discipline */ -memset (&hci_uart_ldisc,0 ,sizeof (hci_uart_ldisc)); +memset (&hci_uart_ldisc,0 ,sizeof (hci_uart_ldisc)); hci_uart_ldisc.magic =TTY_LDISC_MAGIC ; hci_uart_ldisc.name ="n_hci" ; hci_uart_ldisc.open = hci_uart_tty_open;
@@ -577,7 +578,8 @@ static int __init hci_uart_init(void) hci_uart_ldisc.write_wakeup = hci_uart_tty_wakeup; 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);return err; }
@@ -622,7 +624,8 @@ static void __exit hci_uart_exit(void)#endif /* 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); }
drivers/bluetooth/hci_vhci.c +2 -2
@@ -82,7 +82,7 @@ static int vhci_flush(struct hci_dev *hdev)static int vhci_send_frame (struct sk_buff *skb) { -struct hci_dev * hdev = (struct hci_dev *) skb->dev; +struct hci_dev *hdev = (struct hci_dev *) skb->dev;struct vhci_data *data;if (!hdev) {
@@ -281,7 +281,7 @@ static const struct file_operations vhci_fops = { .llseek = no_llseek, }; -static struct miscdevice vhci_miscdev= { +static struct miscdevice vhci_miscdev = { .name ="vhci" , .fops = &vhci_fops, .minor =MISC_DYNAMIC_MINOR ,
Signature · 1 line
1.7.9.5
Quoted 6 lines · Valentin Ilie
Clean up bluetooth files
- replace foo* bar with foo *bar
- add space arround '='
- remove trailing witespaces
- remove assignment in if
- fix coding style issues
I suggest you split the commits into 2:
a) commit with whitespace changes
b) commit with other coding style changes that cause C statements to be rewritten.
This makes it easier for people to separate whitespace changes from technical changes to the C code.
Also it would help people back-porting these commits to older kernels.
Quoted 109 lines
Signed-off-by Valentin Ilie <[email protected]>--- drivers/bluetooth/Kconfig | 12 +++++------ drivers/bluetooth/dtl1_cs.c | 6 +++--- drivers/bluetooth/hci_bcsp.c | 48 +++++++++++++++++++++-------------------- drivers/bluetooth/hci_h5.c | 6 ++++-- drivers/bluetooth/hci_ldisc.c | 15 +++++++------ drivers/bluetooth/hci_vhci.c | 4 ++-- 6 files changed, 49 insertions(+), 42 deletions(-)drivers/bluetooth/Kconfig +6
-6@@ -30,8 +30,8 @@ config BT_HCIUART help Bluetooth HCI UART driver. This driver is required if you want to use Bluetooth devices with - serial port interface. You will also need this driver if you have - UART based Bluetooth PCMCIA and CF devices like Xircom Credit Card + serial port interface. You will also need this driver if you have + UART based Bluetooth PCMCIA and CF devices like Xircom Credit Card adapter and BrainBoxes Bluetooth PC Card. Say Y here to compile support for Bluetooth UART devices into the@@ -41,9 +41,9 @@ config BT_HCIUART_H4 bool "UART (H4) protocol support" depends on BT_HCIUART help - UART (H4) is serial protocol for communication between Bluetooth - device and host. This protocol is required for most Bluetooth devices - with UART interface, including PCMCIA and CF cards. + UART (H4) is serial protocol for communication between Bluetooth + device and host. This protocol is required for most Bluetooth devices + with UART interface, including PCMCIA and CF cards. Say Y here to compile support for HCI UART (H4) protocol.@@ -52,7 +52,7 @@ config BT_HCIUART_BCSP depends on BT_HCIUART select BITREVERSE help - BCSP (BlueCore Serial Protocol) is serial protocol for communication + BCSP (BlueCore Serial Protocol) is serial protocol for communication between Bluetooth device and host. This protocol is required for non USB Bluetooth devices based on CSR BlueCore chip, including PCMCIA and CF cards.drivers/bluetooth/dtl1_cs.c +3
-3@@ -153,7 +153,8 @@ static void dtl1_write_wakeup(dtl1_info_t *info)if (!pcmcia_dev_present (info->p_dev))return ; -if (!(skb =skb_dequeue (&(info->txq)))) + skb =skb_dequeue (&(info->txq)); +if (!skb)break ;/* Send frame */ @@ -181,9 +182,8 @@ static void dtl1_control(dtl1_info_t *info, struct sk_buff *skb)int i;printk (KERN_INFO "Bluetooth: Nokia control data =" ); -for (i =0 ; i < skb->len; i++) { +for (i =0 ; i < skb->len; i++)printk (" %02x" , skb->data[i]); - }printk ("\n" );/* transition to active state */ drivers/bluetooth/hci_bcsp.c +7
-6@@ -105,11 +105,11 @@ static const u16 crc_table[] = {#define BCSP_CRC_INIT (x) x = 0xffff/* -Update crc with next data byte +Update crc with next data byte -Implementation note -The data byte is treated as two nibbles. The crc is generated -in reverse, i.e., bits are fed into the register from the top. +Implementation note +The data byte is treated as two nibbles. The crc is generated +in reverse, i.e., bits are fed into the register from the top. */ static void bcsp_crc_update (u16 *crc,u8 d) {@@ -287,11 +287,12 @@ static struct sk_buff *bcsp_dequeue(struct hci_uart *hu)struct bcsp_struct *bcsp = hu->priv;unsigned long flags;struct sk_buff *skb; - +/* First of all, check for unreliable messages in the queue, 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);if (nskb) {kfree_skb (skb);
drivers/bluetooth/hci_bcsp.c static struct sk_buff *bcsp_dequeue(struct hci_uart *hu) · line 313
Quoted 6 lines
drivers/bluetooth/hci_bcsp.c +2
-1@@ -308,7 +309,8 @@ static struct sk_buff *bcsp_dequeue(struct hci_uart *hu)spin_lock_irqsave_nested (&bcsp->unack.lock, flags,SINGLE_DEPTH_NESTING ); -if (bcsp->unack.qlen <BCSP_TXWINSIZE && (skb =skb_dequeue (&bcsp->rel)) !=NULL ) { + skb =skb_dequeue (&bcsp->rel); +if (bcsp->unack.qlen <BCSP_TXWINSIZE && skb !=NULL ) {
THIS CHANGE IS INCORRECT.
The call to skb_dequeue() depends on bcsp->unack.qlen < BCSP_TXWINSIZE being true. In other words the 2nd condition of && is not executed when the 1st condition is false. Therefore 2 nested if statements are needed.
Quoted 210 lines
drivers/bluetooth/hci_bcsp.c +16
-16struct sk_buff *nskb =bcsp_prepare_pkt (bcsp, skb->data, skb->len,bt_cb (skb)->pkt_type);if (nskb) {__skb_queue_tail (&bcsp->unack, skb);@@ -433,7 +435,7 @@ static inline void bcsp_unslip_one_byte(struct bcsp_struct *bcsp, unsigned charbreak ;default :memcpy (skb_put (bcsp->rx_skb,1 ), &byte,1 ); -if ((bcsp->rx_skb-> data[0 ] &0x40 ) !=0 && +if ((bcsp->rx_skb->data[0 ] &0x40 ) !=0 && bcsp->rx_state !=BCSP_W4_CRC )bcsp_crc_update (&bcsp->message_crc, byte); bcsp->rx_count--;@@ -444,24 +446,24 @@ static inline void bcsp_unslip_one_byte(struct bcsp_struct *bcsp, unsigned charswitch (byte) {case 0xdc :memcpy (skb_put (bcsp->rx_skb,1 ), &c0,1 ); -if ((bcsp->rx_skb-> data[0 ] &0x40 ) !=0 && +if ((bcsp->rx_skb->data[0 ] &0x40 ) !=0 && bcsp->rx_state !=BCSP_W4_CRC ) -bcsp_crc_update (&bcsp-> message_crc,0xc0 ); +bcsp_crc_update (&bcsp->message_crc,0xc0 ); bcsp->rx_esc_state =BCSP_ESCSTATE_NOESC ; bcsp->rx_count--;break ;case 0xdd :memcpy (skb_put (bcsp->rx_skb,1 ), &db,1 ); -if ((bcsp->rx_skb-> data[0 ] &0x40 ) !=0 && - bcsp->rx_state !=BCSP_W4_CRC ) -bcsp_crc_update (&bcsp-> message_crc,0xdb ); +if ((bcsp->rx_skb->data[0 ] &0x40 ) !=0 && + bcsp->rx_state !=BCSP_W4_CRC ) +bcsp_crc_update (&bcsp->message_crc,0xdb ); bcsp->rx_esc_state =BCSP_ESCSTATE_NOESC ; bcsp->rx_count--;break ;default : -BT_ERR ("Invalid byte %02x after esc byte" , byte); +BT_ERR ("Invalid byte %02x after esc byte" , byte);kfree_skb (bcsp->rx_skb); bcsp->rx_skb =NULL ; bcsp->rx_state =BCSP_W4_PKT_DELIMITER ;@@ -524,9 +526,9 @@ static void bcsp_complete_rx_pkt(struct hci_uart *hu)hci_recv_frame (bcsp->rx_skb); }else { -BT_ERR ("Packet for unknown channel (%u %s)" , +BT_ERR ("Packet for unknown channel (%u %s)" , bcsp->rx_skb->data[1 ] &0x0f , - bcsp->rx_skb->data[0 ] &0x80 ? + bcsp->rx_skb->data[0 ] &0x80 ?"reliable" :"unreliable" );kfree_skb (bcsp->rx_skb); }@@ -554,7 +556,7 @@ static int bcsp_recv(struct hci_uart *hu, void *data, int count)struct bcsp_struct *bcsp = hu->priv;unsigned char *ptr; -BT_DBG ("hu %p count %d rx_state %d rx_count %ld" , +BT_DBG ("hu %p count %d rx_state %d rx_count %ld" , hu, count, bcsp->rx_state, bcsp->rx_count); ptr = data;@@ -574,7 +576,7 @@ static int bcsp_recv(struct hci_uart *hu, void *data, int count)switch (bcsp->rx_state) {case BCSP_W4_BCSP_HDR : -if ((0xff & (u8 ) ~ (bcsp->rx_skb->data[0 ] + bcsp->rx_skb->data[1 ] + +if ((0xff & (u8 ) ~(bcsp->rx_skb->data[0 ] + bcsp->rx_skb->data[1 ] + bcsp->rx_skb->data[2 ])) != bcsp->rx_skb->data[3 ]) {BT_ERR ("Error in BCSP hdr checksum" );kfree_skb (bcsp->rx_skb);@@ -583,8 +585,8 @@ static int bcsp_recv(struct hci_uart *hu, void *data, int count)continue ; }if (bcsp->rx_skb->data[0 ] &0x80 /* reliable pkt */ - && (bcsp->rx_skb->data[0 ] &0x07 ) != bcsp->rxseq_txack) { -BT_ERR ("Out-of-order packet arrived, got %u expected %u" , + && (bcsp->rx_skb->data[0 ] &0x07 ) != bcsp->rxseq_txack) { +BT_ERR ("Out-of-order packet arrived, got %u expected %u" , bcsp->rx_skb->data[0 ] &0x07 , bcsp->rxseq_txack);kfree_skb (bcsp->rx_skb);@@ -593,7 +595,7 @@ static int bcsp_recv(struct hci_uart *hu, void *data, int count)continue ; } bcsp->rx_state =BCSP_W4_DATA ; - bcsp->rx_count = (bcsp->rx_skb->data[1 ] >>4 ) + + bcsp->rx_count = (bcsp->rx_skb->data[1 ] >>4 ) + (bcsp->rx_skb->data[2 ] <<4 );/* May be 0 */ continue ;@@ -607,7 +609,7 @@ static int bcsp_recv(struct hci_uart *hu, void *data, int count)case BCSP_W4_CRC :if (bitrev16 (bcsp->message_crc) !=bscp_get_crc (bcsp)) { -BT_ERR ("Checksum failed: computed %04x received %04x" , +BT_ERR ("Checksum failed: computed %04x received %04x" ,bitrev16 (bcsp->message_crc),bscp_get_crc (bcsp));@@ -645,7 +647,7 @@ static int bcsp_recv(struct hci_uart *hu, void *data, int count)BCSP_CRC_INIT (bcsp->message_crc);/* Do not increment ptr or decrement count -* Allocate packet. Max len of a BCSP pkt= +* Allocate packet. Max len of a BCSP pkt= * 0xFFF (payload) +4 (header) +2 (crc) */ bcsp->rx_skb =bt_skb_alloc (0x1005 ,GFP_ATOMIC );drivers/bluetooth/hci_h5.c +4
-2@@ -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 ); } -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, skb->data, skb->len);if (nskb) {@@ -690,7 +691,8 @@ static struct sk_buff *h5_dequeue(struct hci_uart *hu)if (h5->unack.qlen >= h5->tx_win) 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, skb->data, skb->len);if (nskb) {drivers/bluetooth/hci_ldisc.c +9
-6@@ -236,7 +236,7 @@ static int hci_uart_close(struct hci_dev *hdev)/* Send frames from HCI layer */ static int hci_uart_send_frame (struct sk_buff *skb) { -struct hci_dev * hdev = (struct hci_dev *) skb->dev; +struct hci_dev *hdev = (struct hci_dev *) skb->dev;struct hci_uart *hu;if (!hdev) {@@ -279,7 +279,8 @@ static int hci_uart_tty_open(struct tty_struct *tty)if (tty->ops->write ==NULL )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" );return -ENFILE ; }@@ -483,7 +484,7 @@ static int hci_uart_set_proto(struct hci_uart *hu, int id)* * Return Value: Command dependent */ -static int hci_uart_tty_ioctl (struct tty_struct *tty,struct file * file, +static int hci_uart_tty_ioctl (struct tty_struct *tty,struct file *file,unsigned int cmd,unsigned long arg) {struct hci_uart *hu = (void *)tty->disc_data;@@ -564,7 +565,7 @@ static int __init hci_uart_init(void)/* Register the tty discipline */ -memset (&hci_uart_ldisc,0 ,sizeof (hci_uart_ldisc)); +memset (&hci_uart_ldisc,0 ,sizeof (hci_uart_ldisc)); hci_uart_ldisc.magic =TTY_LDISC_MAGIC ; hci_uart_ldisc.name ="n_hci" ; hci_uart_ldisc.open = hci_uart_tty_open;@@ -577,7 +578,8 @@ static int __init hci_uart_init(void) hci_uart_ldisc.write_wakeup = hci_uart_tty_wakeup; 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);return err; }@@ -622,7 +624,8 @@ static void __exit hci_uart_exit(void)#endif /* 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); }drivers/bluetooth/hci_vhci.c +1
-1@@ -82,7 +82,7 @@ static int vhci_flush(struct hci_dev *hdev)static int vhci_send_frame (struct sk_buff *skb) { -struct hci_dev * hdev = (struct hci_dev *) skb->dev; +struct hci_dev *hdev = (struct hci_dev *) skb->dev;struct vhci_data *data;if (!hdev) {
drivers/bluetooth/hci_vhci.c static const struct file_operations vhci_fops = { · line 287
Quoted 8 lines
drivers/bluetooth/hci_vhci.c +1
-1@@ -281,7 +281,7 @@ static const struct file_operations vhci_fops = { .llseek = no_llseek, }; -static struct miscdevice vhci_miscdev= { +static struct miscdevice vhci_miscdev = { .name ="vhci" , .fops = &vhci_fops, .minor =MISC_DYNAMIC_MINOR ,
Dean Jenkins
Mentor Graphics
PATCH v2 1/1 Bluetooth: Remove assignment in if
In reply to Valentin IlieRemove assignment in if
--- drivers/bluetooth/ath3k.c | 7 +++---- drivers/bluetooth/bfusb.c | 14 ++++++++++---- drivers/bluetooth/bluecard_cs.c | 9 ++++++--- drivers/bluetooth/bt3c_cs.c | 7 ++++--- drivers/bluetooth/btuart_cs.c | 6 ++++-- drivers/bluetooth/dtl1_cs.c | 9 ++++++--- drivers/bluetooth/hci_bcsp.c | 26 +++++++++++++++----------- drivers/bluetooth/hci_h5.c | 6 ++++-- drivers/bluetooth/hci_ldisc.c | 9 ++++++--- 9 files changed, 58 insertions(+), 35 deletions(-)
drivers/bluetooth/ath3k.c +3 -4
@@ -166,10 +166,9 @@ static int ath3k_load_firmware(struct usb_device *udev, }memcpy (send_buf, firmware->data,20 ); -if ((err =usb_control_msg (udev, pipe, -USB_REQ_DFU_DNLOAD , -USB_TYPE_VENDOR ,0 ,0 , - send_buf,20 ,USB_CTRL_SET_TIMEOUT )) <0 ) { + err =usb_control_msg (udev, pipe,USB_REQ_DFU_DNLOAD ,USB_TYPE_VENDOR , +0 ,0 , send_buf,20 ,USB_CTRL_SET_TIMEOUT ); +if (err <0 ) {BT_ERR ("Can't change to loading configuration err" ); goto error; }
drivers/bluetooth/bfusb.c +10 -4
@@ -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); -if (!urb && !(urb =usb_alloc_urb (0 ,GFP_ATOMIC ))) -return -ENOMEM ; +if (!urb) { + urb =usb_alloc_urb (0 ,GFP_ATOMIC ); +if (!urb) +return -ENOMEM ; + } 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); -if (!urb && !(urb =usb_alloc_urb (0 ,GFP_ATOMIC ))) -return -ENOMEM ; +if (!urb) { + urb =usb_alloc_urb (0 ,GFP_ATOMIC ); +if (!urb) +return -ENOMEM ; + } skb =bt_skb_alloc (size,GFP_ATOMIC );if (!skb) {
drivers/bluetooth/bluecard_cs.c +6 -3
@@ -257,7 +257,8 @@ static void bluecard_write_wakeup(bluecard_info_t *info) ready_bit =XMIT_BUF_ONE_READY ; } -if (!(skb =skb_dequeue (&(info->txq)))) + skb =skb_dequeue (&(info->txq)); +if (!skb)break ;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 ) { info->rx_state =RECV_WAIT_PACKET_TYPE ; 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" );return ; }
@@ -567,7 +569,8 @@ static int bluecard_hci_set_baud_rate(struct hci_dev *hdev, int baud)/* Ericsson baud rate command */ 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" );return -1 ; }
drivers/bluetooth/bt3c_cs.c +4 -3
@@ -193,8 +193,8 @@ static void bt3c_write_wakeup(bt3c_info_t *info)if (!pcmcia_dev_present (info->p_dev))break ; - -if (!(skb =skb_dequeue (&(info->txq)))) { + skb =skb_dequeue (&(info->txq)); +if (!skb) {clear_bit (XMIT_SENDING , &(info->tx_state));break ; }
@@ -238,7 +238,8 @@ static void bt3c_receive(bt3c_info_t *info)if (info->rx_skb ==NULL ) { info->rx_state =RECV_WAIT_PACKET_TYPE ; 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" );return ; }
drivers/bluetooth/btuart_cs.c +4 -2
@@ -149,7 +149,8 @@ static void btuart_write_wakeup(btuart_info_t *info)if (!pcmcia_dev_present (info->p_dev))return ; -if (!(skb =skb_dequeue (&(info->txq)))) + skb =skb_dequeue (&(info->txq)); +if (!skb)break ;/* Send frame */
@@ -190,7 +191,8 @@ static void btuart_receive(btuart_info_t *info)if (info->rx_skb ==NULL ) { info->rx_state =RECV_WAIT_PACKET_TYPE ; 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" );return ; }
drivers/bluetooth/dtl1_cs.c +6 -3
@@ -153,7 +153,8 @@ static void dtl1_write_wakeup(dtl1_info_t *info)if (!pcmcia_dev_present (info->p_dev))return ; -if (!(skb =skb_dequeue (&(info->txq)))) + skb =skb_dequeue (&(info->txq)); +if (!skb)break ;/* Send frame */
@@ -215,13 +216,15 @@ static void dtl1_receive(dtl1_info_t *info) info->hdev->stat.byte_rx++;/* Allocate packet */ -if (info->rx_skb ==NULL ) -if (!(info->rx_skb =bt_skb_alloc (HCI_MAX_FRAME_SIZE ,GFP_ATOMIC ))) { +if (info->rx_skb ==NULL ) { + 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" ); info->rx_state =RECV_WAIT_NSH ; info->rx_count =NSHL ;return ; } + } *skb_put (info->rx_skb,1 ) =inb (iobase +UART_RX ); nsh = (nsh_t *)info->rx_skb->data;
drivers/bluetooth/hci_bcsp.c +15 -11
@@ -291,7 +291,8 @@ static struct sk_buff *bcsp_dequeue(struct hci_uart *hu)/* First of all, check for unreliable messages in the queue, 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);if (nskb) {kfree_skb (skb);
@@ -308,16 +309,19 @@ static struct sk_buff *bcsp_dequeue(struct hci_uart *hu)spin_lock_irqsave_nested (&bcsp->unack.lock, flags,SINGLE_DEPTH_NESTING ); -if (bcsp->unack.qlen <BCSP_TXWINSIZE && (skb =skb_dequeue (&bcsp->rel)) !=NULL ) { -struct sk_buff *nskb =bcsp_prepare_pkt (bcsp, skb->data, skb->len,bt_cb (skb)->pkt_type); -if (nskb) { -__skb_queue_tail (&bcsp->unack, skb); -mod_timer (&bcsp->tbcsp, jiffies +HZ /4 ); -spin_unlock_irqrestore (&bcsp->unack.lock, flags); -return nskb; - }else { -skb_queue_head (&bcsp->rel, skb); -BT_ERR ("Could not dequeue pkt because alloc_skb failed" ); +if (bcsp->unack.qlen <BCSP_TXWINSIZE ) { + skb =skb_dequeue (&bcsp->rel); +if (skb !=NULL ) { +struct sk_buff *nskb =bcsp_prepare_pkt (bcsp, skb->data, skb->len,bt_cb (skb)->pkt_type); +if (nskb) { +__skb_queue_tail (&bcsp->unack, skb); +mod_timer (&bcsp->tbcsp, jiffies +HZ /4 ); +spin_unlock_irqrestore (&bcsp->unack.lock, flags); +return nskb; + }else { +skb_queue_head (&bcsp->rel, skb); +BT_ERR ("Could not dequeue pkt because alloc_skb failed" ); + } } }
drivers/bluetooth/hci_h5.c +4 -2
@@ -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 ); } -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, skb->data, skb->len);if (nskb) {
@@ -690,7 +691,8 @@ static struct sk_buff *h5_dequeue(struct hci_uart *hu)if (h5->unack.qlen >= h5->tx_win) 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, skb->data, skb->len);if (nskb) {
drivers/bluetooth/hci_ldisc.c +6 -3
@@ -279,7 +279,8 @@ static int hci_uart_tty_open(struct tty_struct *tty)if (tty->ops->write ==NULL )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" );return -ENFILE ; }
@@ -577,7 +578,8 @@ static int __init hci_uart_init(void) hci_uart_ldisc.write_wakeup = hci_uart_tty_wakeup; 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);return err; }
@@ -622,7 +624,8 @@ static void __exit hci_uart_exit(void)#endif /* 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); }
Signature · 1 line
1.8.1.2
Re: [PATCH v2] Bluetooth: Remove assignment in if
Quoted 1 line · Valentin Ilie
Remove assignment in if
Hello,
Can anyone look into this patch? I've corrected it as requested.
Regards,
Signature · 1 line
Valentin Ilie
Re: [PATCH v2] Bluetooth: Remove assignment in if
Hi Valentin,
2013-08-19 Valentin Ilie <[email protected]>:
Quoted 6 lines · Valentin Ilie
Quoted 1 line
Remove assignment in if
Hello,
Can anyone look into this patch? I've corrected it as requested.
I can't see your patch anywhere. Could you please resend it?
Gustavo
Re: [PATCH v2] Bluetooth: Remove assignment in if
In reply to Valentin IlieHi Valentin,
Quoted 14 lines · Valentin Ilie
Remove assignment in if
Signed-off-by Valentin Ilie <[email protected]>--- drivers/bluetooth/ath3k.c | 7 +++---- drivers/bluetooth/bfusb.c | 14 ++++++++++---- drivers/bluetooth/bluecard_cs.c | 9 ++++++--- drivers/bluetooth/bt3c_cs.c | 7 ++++--- drivers/bluetooth/btuart_cs.c | 6 ++++-- drivers/bluetooth/dtl1_cs.c | 9 ++++++--- drivers/bluetooth/hci_bcsp.c | 26 +++++++++++++++----------- drivers/bluetooth/hci_h5.c | 6 ++++-- drivers/bluetooth/hci_ldisc.c | 9 ++++++--- 9 files changed, 58 insertions(+), 35 deletions(-)
Applied (with a minor coding style fix) to the bluetooth-next tree. Thanks.
Johan