diff options
author | David S. Miller <davem@davemloft.net> | 2015-11-08 20:47:26 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-11-08 20:47:26 -0500 |
commit | fb9a10d9d8552acf6f9dee2ecb2d047777821d8b (patch) | |
tree | 9ee8508e7b6cf462c797c03c463f3e158a015bfc | |
parent | d0b891415f5e6e3d478cf069e573c70f9d9c0217 (diff) | |
parent | 82aff3ea3b87892ce1476dad83de211741b3ac00 (diff) |
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>
-rw-r--r-- | drivers/nfc/nfcmrvl/Kconfig | 2 | ||||
-rw-r--r-- | drivers/nfc/nfcmrvl/fw_dnld.c | 12 | ||||
-rw-r--r-- | drivers/nfc/nfcmrvl/main.c | 15 | ||||
-rw-r--r-- | drivers/nfc/nfcmrvl/uart.c | 26 |
4 files changed, 22 insertions, 33 deletions
diff --git a/drivers/nfc/nfcmrvl/Kconfig b/drivers/nfc/nfcmrvl/Kconfig index 444ca94697d9..670af76922e0 100644 --- a/drivers/nfc/nfcmrvl/Kconfig +++ b/drivers/nfc/nfcmrvl/Kconfig | |||
@@ -44,7 +44,7 @@ config NFC_MRVL_I2C | |||
44 | 44 | ||
45 | config NFC_MRVL_SPI | 45 | config NFC_MRVL_SPI |
46 | tristate "Marvell NFC-over-SPI driver" | 46 | tristate "Marvell NFC-over-SPI driver" |
47 | depends on NFC_MRVL && SPI | 47 | depends on NFC_MRVL && NFC_NCI_SPI |
48 | help | 48 | help |
49 | Marvell NFC-over-SPI driver. | 49 | Marvell NFC-over-SPI driver. |
50 | 50 | ||
diff --git a/drivers/nfc/nfcmrvl/fw_dnld.c b/drivers/nfc/nfcmrvl/fw_dnld.c index bfa771392b1f..f8dcdf4b24f6 100644 --- a/drivers/nfc/nfcmrvl/fw_dnld.c +++ b/drivers/nfc/nfcmrvl/fw_dnld.c | |||
@@ -113,9 +113,12 @@ static void fw_dnld_over(struct nfcmrvl_private *priv, u32 error) | |||
113 | } | 113 | } |
114 | 114 | ||
115 | atomic_set(&priv->ndev->cmd_cnt, 0); | 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 | nfc_info(priv->dev, "FW loading over (%d)]\n", error); | 123 | nfc_info(priv->dev, "FW loading over (%d)]\n", error); |
121 | 124 | ||
@@ -472,9 +475,12 @@ void nfcmrvl_fw_dnld_deinit(struct nfcmrvl_private *priv) | |||
472 | void nfcmrvl_fw_dnld_recv_frame(struct nfcmrvl_private *priv, | 475 | void nfcmrvl_fw_dnld_recv_frame(struct nfcmrvl_private *priv, |
473 | struct sk_buff *skb) | 476 | struct sk_buff *skb) |
474 | { | 477 | { |
478 | /* Discard command timer */ | ||
479 | if (timer_pending(&priv->ndev->cmd_timer)) | ||
480 | del_timer_sync(&priv->ndev->cmd_timer); | ||
481 | |||
475 | /* Allow next command */ | 482 | /* Allow next command */ |
476 | atomic_set(&priv->ndev->cmd_cnt, 1); | 483 | atomic_set(&priv->ndev->cmd_cnt, 1); |
477 | del_timer_sync(&priv->ndev->cmd_timer); | ||
478 | 484 | ||
479 | /* Queue and trigger rx work */ | 485 | /* Queue and trigger rx work */ |
480 | skb_queue_tail(&priv->fw_dnld.rx_q, skb); | 486 | skb_queue_tail(&priv->fw_dnld.rx_q, skb); |
diff --git a/drivers/nfc/nfcmrvl/main.c b/drivers/nfc/nfcmrvl/main.c index 8079ae0de21e..51c8240a1672 100644 --- a/drivers/nfc/nfcmrvl/main.c +++ b/drivers/nfc/nfcmrvl/main.c | |||
@@ -194,6 +194,9 @@ void nfcmrvl_nci_unregister_dev(struct nfcmrvl_private *priv) | |||
194 | 194 | ||
195 | nfcmrvl_fw_dnld_deinit(priv); | 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 | nci_unregister_device(ndev); | 200 | nci_unregister_device(ndev); |
198 | nci_free_device(ndev); | 201 | nci_free_device(ndev); |
199 | kfree(priv); | 202 | kfree(priv); |
@@ -251,8 +254,6 @@ void nfcmrvl_chip_halt(struct nfcmrvl_private *priv) | |||
251 | gpio_set_value(priv->config.reset_n_io, 0); | 254 | gpio_set_value(priv->config.reset_n_io, 0); |
252 | } | 255 | } |
253 | 256 | ||
254 | #ifdef CONFIG_OF | ||
255 | |||
256 | int nfcmrvl_parse_dt(struct device_node *node, | 257 | int nfcmrvl_parse_dt(struct device_node *node, |
257 | struct nfcmrvl_platform_data *pdata) | 258 | struct nfcmrvl_platform_data *pdata) |
258 | { | 259 | { |
@@ -275,16 +276,6 @@ int nfcmrvl_parse_dt(struct device_node *node, | |||
275 | 276 | ||
276 | return 0; | 277 | return 0; |
277 | } | 278 | } |
278 | |||
279 | #else | ||
280 | |||
281 | int nfcmrvl_parse_dt(struct device_node *node, | ||
282 | struct nfcmrvl_platform_data *pdata) | ||
283 | { | ||
284 | return -ENODEV; | ||
285 | } | ||
286 | |||
287 | #endif | ||
288 | EXPORT_SYMBOL_GPL(nfcmrvl_parse_dt); | 279 | EXPORT_SYMBOL_GPL(nfcmrvl_parse_dt); |
289 | 280 | ||
290 | MODULE_AUTHOR("Marvell International Ltd."); | 281 | MODULE_AUTHOR("Marvell International Ltd."); |
diff --git a/drivers/nfc/nfcmrvl/uart.c b/drivers/nfc/nfcmrvl/uart.c index f3d041c4f249..83a99e38e7bd 100644 --- a/drivers/nfc/nfcmrvl/uart.c +++ b/drivers/nfc/nfcmrvl/uart.c | |||
@@ -67,8 +67,6 @@ static struct nfcmrvl_if_ops uart_ops = { | |||
67 | .nci_update_config = nfcmrvl_uart_nci_update_config | 67 | .nci_update_config = nfcmrvl_uart_nci_update_config |
68 | }; | 68 | }; |
69 | 69 | ||
70 | #ifdef CONFIG_OF | ||
71 | |||
72 | static int nfcmrvl_uart_parse_dt(struct device_node *node, | 70 | static int nfcmrvl_uart_parse_dt(struct device_node *node, |
73 | struct nfcmrvl_platform_data *pdata) | 71 | struct nfcmrvl_platform_data *pdata) |
74 | { | 72 | { |
@@ -102,16 +100,6 @@ static int nfcmrvl_uart_parse_dt(struct device_node *node, | |||
102 | return 0; | 100 | return 0; |
103 | } | 101 | } |
104 | 102 | ||
105 | #else | ||
106 | |||
107 | static int nfcmrvl_uart_parse_dt(struct device_node *node, | ||
108 | struct nfcmrvl_platform_data *pdata) | ||
109 | { | ||
110 | return -ENODEV; | ||
111 | } | ||
112 | |||
113 | #endif | ||
114 | |||
115 | /* | 103 | /* |
116 | ** NCI UART OPS | 104 | ** NCI UART OPS |
117 | */ | 105 | */ |
@@ -152,10 +140,6 @@ static int nfcmrvl_nci_uart_open(struct nci_uart *nu) | |||
152 | nu->drv_data = priv; | 140 | nu->drv_data = priv; |
153 | nu->ndev = priv->ndev; | 141 | nu->ndev = priv->ndev; |
154 | 142 | ||
155 | /* Set BREAK */ | ||
156 | if (priv->config.break_control && nu->tty->ops->break_ctl) | ||
157 | nu->tty->ops->break_ctl(nu->tty, -1); | ||
158 | |||
159 | return 0; | 143 | return 0; |
160 | } | 144 | } |
161 | 145 | ||
@@ -174,6 +158,9 @@ static void nfcmrvl_nci_uart_tx_start(struct nci_uart *nu) | |||
174 | { | 158 | { |
175 | struct nfcmrvl_private *priv = (struct nfcmrvl_private *)nu->drv_data; | 159 | struct nfcmrvl_private *priv = (struct nfcmrvl_private *)nu->drv_data; |
176 | 160 | ||
161 | if (priv->ndev->nfc_dev->fw_download_in_progress) | ||
162 | return; | ||
163 | |||
177 | /* Remove BREAK to wake up the NFCC */ | 164 | /* Remove BREAK to wake up the NFCC */ |
178 | if (priv->config.break_control && nu->tty->ops->break_ctl) { | 165 | if (priv->config.break_control && nu->tty->ops->break_ctl) { |
179 | nu->tty->ops->break_ctl(nu->tty, 0); | 166 | nu->tty->ops->break_ctl(nu->tty, 0); |
@@ -185,13 +172,18 @@ static void nfcmrvl_nci_uart_tx_done(struct nci_uart *nu) | |||
185 | { | 172 | { |
186 | struct nfcmrvl_private *priv = (struct nfcmrvl_private *)nu->drv_data; | 173 | struct nfcmrvl_private *priv = (struct nfcmrvl_private *)nu->drv_data; |
187 | 174 | ||
175 | if (priv->ndev->nfc_dev->fw_download_in_progress) | ||
176 | return; | ||
177 | |||
188 | /* | 178 | /* |
189 | ** To ensure that if the NFCC goes in DEEP SLEEP sate we can wake him | 179 | ** To ensure that if the NFCC goes in DEEP SLEEP sate we can wake him |
190 | ** up. we set BREAK. Once we will be ready to send again we will remove | 180 | ** up. we set BREAK. Once we will be ready to send again we will remove |
191 | ** it. | 181 | ** it. |
192 | */ | 182 | */ |
193 | if (priv->config.break_control && nu->tty->ops->break_ctl) | 183 | if (priv->config.break_control && nu->tty->ops->break_ctl) { |
194 | nu->tty->ops->break_ctl(nu->tty, -1); | 184 | nu->tty->ops->break_ctl(nu->tty, -1); |
185 | usleep_range(1000, 3000); | ||
186 | } | ||
195 | } | 187 | } |
196 | 188 | ||
197 | static struct nci_uart nfcmrvl_nci_uart = { | 189 | static struct nci_uart nfcmrvl_nci_uart = { |