Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'nfc-fixes-4.4-1' of git://git.kernel.org/pub/scm/linux/kernel/git/sameo/nfc-fixes

Samuel Ortiz says:

====================
NFC 4.4 fixes

This is the 1st NFC fixes pull request for 4.4.

It includes bug fixes and one fix for a build failure, all of them
introduced with the first NFC pull request for 4.4.

We have:

- Fix nfcmrvl SPI driver potential build error due to a broken Kconfig
dependency.
- A few fixes for the firmware download implementation for the nfcmrvl
UART driver.
- A GPIO allocation leak for the nfcmrvl driver.
- One code simplification for the nfcmrvl DT handling.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>

+22 -33
+1 -1
drivers/nfc/nfcmrvl/Kconfig
··· 44 44 45 45 config NFC_MRVL_SPI 46 46 tristate "Marvell NFC-over-SPI driver" 47 - depends on NFC_MRVL && SPI 47 + depends on NFC_MRVL && NFC_NCI_SPI 48 48 help 49 49 Marvell NFC-over-SPI driver. 50 50
+9 -3
drivers/nfc/nfcmrvl/fw_dnld.c
··· 113 113 } 114 114 115 115 atomic_set(&priv->ndev->cmd_cnt, 0); 116 - del_timer_sync(&priv->ndev->cmd_timer); 117 116 118 - del_timer_sync(&priv->fw_dnld.timer); 117 + if (timer_pending(&priv->ndev->cmd_timer)) 118 + del_timer_sync(&priv->ndev->cmd_timer); 119 + 120 + if (timer_pending(&priv->fw_dnld.timer)) 121 + del_timer_sync(&priv->fw_dnld.timer); 119 122 120 123 nfc_info(priv->dev, "FW loading over (%d)]\n", error); 121 124 ··· 475 472 void nfcmrvl_fw_dnld_recv_frame(struct nfcmrvl_private *priv, 476 473 struct sk_buff *skb) 477 474 { 475 + /* Discard command timer */ 476 + if (timer_pending(&priv->ndev->cmd_timer)) 477 + del_timer_sync(&priv->ndev->cmd_timer); 478 + 478 479 /* Allow next command */ 479 480 atomic_set(&priv->ndev->cmd_cnt, 1); 480 - del_timer_sync(&priv->ndev->cmd_timer); 481 481 482 482 /* Queue and trigger rx work */ 483 483 skb_queue_tail(&priv->fw_dnld.rx_q, skb);
+3 -12
drivers/nfc/nfcmrvl/main.c
··· 194 194 195 195 nfcmrvl_fw_dnld_deinit(priv); 196 196 197 + if (priv->config.reset_n_io) 198 + devm_gpio_free(priv->dev, priv->config.reset_n_io); 199 + 197 200 nci_unregister_device(ndev); 198 201 nci_free_device(ndev); 199 202 kfree(priv); ··· 254 251 gpio_set_value(priv->config.reset_n_io, 0); 255 252 } 256 253 257 - #ifdef CONFIG_OF 258 - 259 254 int nfcmrvl_parse_dt(struct device_node *node, 260 255 struct nfcmrvl_platform_data *pdata) 261 256 { ··· 276 275 277 276 return 0; 278 277 } 279 - 280 - #else 281 - 282 - int nfcmrvl_parse_dt(struct device_node *node, 283 - struct nfcmrvl_platform_data *pdata) 284 - { 285 - return -ENODEV; 286 - } 287 - 288 - #endif 289 278 EXPORT_SYMBOL_GPL(nfcmrvl_parse_dt); 290 279 291 280 MODULE_AUTHOR("Marvell International Ltd.");
+9 -17
drivers/nfc/nfcmrvl/uart.c
··· 67 67 .nci_update_config = nfcmrvl_uart_nci_update_config 68 68 }; 69 69 70 - #ifdef CONFIG_OF 71 - 72 70 static int nfcmrvl_uart_parse_dt(struct device_node *node, 73 71 struct nfcmrvl_platform_data *pdata) 74 72 { ··· 99 101 100 102 return 0; 101 103 } 102 - 103 - #else 104 - 105 - static int nfcmrvl_uart_parse_dt(struct device_node *node, 106 - struct nfcmrvl_platform_data *pdata) 107 - { 108 - return -ENODEV; 109 - } 110 - 111 - #endif 112 104 113 105 /* 114 106 ** NCI UART OPS ··· 140 152 nu->drv_data = priv; 141 153 nu->ndev = priv->ndev; 142 154 143 - /* Set BREAK */ 144 - if (priv->config.break_control && nu->tty->ops->break_ctl) 145 - nu->tty->ops->break_ctl(nu->tty, -1); 146 - 147 155 return 0; 148 156 } 149 157 ··· 158 174 { 159 175 struct nfcmrvl_private *priv = (struct nfcmrvl_private *)nu->drv_data; 160 176 177 + if (priv->ndev->nfc_dev->fw_download_in_progress) 178 + return; 179 + 161 180 /* Remove BREAK to wake up the NFCC */ 162 181 if (priv->config.break_control && nu->tty->ops->break_ctl) { 163 182 nu->tty->ops->break_ctl(nu->tty, 0); ··· 172 185 { 173 186 struct nfcmrvl_private *priv = (struct nfcmrvl_private *)nu->drv_data; 174 187 188 + if (priv->ndev->nfc_dev->fw_download_in_progress) 189 + return; 190 + 175 191 /* 176 192 ** To ensure that if the NFCC goes in DEEP SLEEP sate we can wake him 177 193 ** up. we set BREAK. Once we will be ready to send again we will remove 178 194 ** it. 179 195 */ 180 - if (priv->config.break_control && nu->tty->ops->break_ctl) 196 + if (priv->config.break_control && nu->tty->ops->break_ctl) { 181 197 nu->tty->ops->break_ctl(nu->tty, -1); 198 + usleep_range(1000, 3000); 199 + } 182 200 } 183 201 184 202 static struct nci_uart nfcmrvl_nci_uart = {