Skip to content

Commit fb9a10d

Browse files
committed
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 <[email protected]>
2 parents d0b8914 + 82aff3e commit fb9a10d

File tree

4 files changed

+22
-33
lines changed

4 files changed

+22
-33
lines changed

drivers/nfc/nfcmrvl/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ config NFC_MRVL_I2C
4444

4545
config NFC_MRVL_SPI
4646
tristate "Marvell NFC-over-SPI driver"
47-
depends on NFC_MRVL && SPI
47+
depends on NFC_MRVL && NFC_NCI_SPI
4848
help
4949
Marvell NFC-over-SPI driver.
5050

drivers/nfc/nfcmrvl/fw_dnld.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,12 @@ static void fw_dnld_over(struct nfcmrvl_private *priv, u32 error)
113113
}
114114

115115
atomic_set(&priv->ndev->cmd_cnt, 0);
116-
del_timer_sync(&priv->ndev->cmd_timer);
117116

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);
119122

120123
nfc_info(priv->dev, "FW loading over (%d)]\n", error);
121124

@@ -472,9 +475,12 @@ void nfcmrvl_fw_dnld_deinit(struct nfcmrvl_private *priv)
472475
void nfcmrvl_fw_dnld_recv_frame(struct nfcmrvl_private *priv,
473476
struct sk_buff *skb)
474477
{
478+
/* Discard command timer */
479+
if (timer_pending(&priv->ndev->cmd_timer))
480+
del_timer_sync(&priv->ndev->cmd_timer);
481+
475482
/* Allow next command */
476483
atomic_set(&priv->ndev->cmd_cnt, 1);
477-
del_timer_sync(&priv->ndev->cmd_timer);
478484

479485
/* Queue and trigger rx work */
480486
skb_queue_tail(&priv->fw_dnld.rx_q, skb);

drivers/nfc/nfcmrvl/main.c

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,9 @@ void nfcmrvl_nci_unregister_dev(struct nfcmrvl_private *priv)
194194

195195
nfcmrvl_fw_dnld_deinit(priv);
196196

197+
if (priv->config.reset_n_io)
198+
devm_gpio_free(priv->dev, priv->config.reset_n_io);
199+
197200
nci_unregister_device(ndev);
198201
nci_free_device(ndev);
199202
kfree(priv);
@@ -251,8 +254,6 @@ void nfcmrvl_chip_halt(struct nfcmrvl_private *priv)
251254
gpio_set_value(priv->config.reset_n_io, 0);
252255
}
253256

254-
#ifdef CONFIG_OF
255-
256257
int nfcmrvl_parse_dt(struct device_node *node,
257258
struct nfcmrvl_platform_data *pdata)
258259
{
@@ -275,16 +276,6 @@ int nfcmrvl_parse_dt(struct device_node *node,
275276

276277
return 0;
277278
}
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
288279
EXPORT_SYMBOL_GPL(nfcmrvl_parse_dt);
289280

290281
MODULE_AUTHOR("Marvell International Ltd.");

drivers/nfc/nfcmrvl/uart.c

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,6 @@ static struct nfcmrvl_if_ops uart_ops = {
6767
.nci_update_config = nfcmrvl_uart_nci_update_config
6868
};
6969

70-
#ifdef CONFIG_OF
71-
7270
static int nfcmrvl_uart_parse_dt(struct device_node *node,
7371
struct nfcmrvl_platform_data *pdata)
7472
{
@@ -102,16 +100,6 @@ static int nfcmrvl_uart_parse_dt(struct device_node *node,
102100
return 0;
103101
}
104102

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-
115103
/*
116104
** NCI UART OPS
117105
*/
@@ -152,10 +140,6 @@ static int nfcmrvl_nci_uart_open(struct nci_uart *nu)
152140
nu->drv_data = priv;
153141
nu->ndev = priv->ndev;
154142

155-
/* Set BREAK */
156-
if (priv->config.break_control && nu->tty->ops->break_ctl)
157-
nu->tty->ops->break_ctl(nu->tty, -1);
158-
159143
return 0;
160144
}
161145

@@ -174,6 +158,9 @@ static void nfcmrvl_nci_uart_tx_start(struct nci_uart *nu)
174158
{
175159
struct nfcmrvl_private *priv = (struct nfcmrvl_private *)nu->drv_data;
176160

161+
if (priv->ndev->nfc_dev->fw_download_in_progress)
162+
return;
163+
177164
/* Remove BREAK to wake up the NFCC */
178165
if (priv->config.break_control && nu->tty->ops->break_ctl) {
179166
nu->tty->ops->break_ctl(nu->tty, 0);
@@ -185,13 +172,18 @@ static void nfcmrvl_nci_uart_tx_done(struct nci_uart *nu)
185172
{
186173
struct nfcmrvl_private *priv = (struct nfcmrvl_private *)nu->drv_data;
187174

175+
if (priv->ndev->nfc_dev->fw_download_in_progress)
176+
return;
177+
188178
/*
189179
** To ensure that if the NFCC goes in DEEP SLEEP sate we can wake him
190180
** up. we set BREAK. Once we will be ready to send again we will remove
191181
** it.
192182
*/
193-
if (priv->config.break_control && nu->tty->ops->break_ctl)
183+
if (priv->config.break_control && nu->tty->ops->break_ctl) {
194184
nu->tty->ops->break_ctl(nu->tty, -1);
185+
usleep_range(1000, 3000);
186+
}
195187
}
196188

197189
static struct nci_uart nfcmrvl_nci_uart = {

0 commit comments

Comments
 (0)