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.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJWOpm4AAoJEIqAPN1PVmxKPkcP/2JfannhAqAeX6kJeR0tmLDU
 /urTpD5EETEpBxvKV+gVViLPbnGUDKxpgiU4o5Edp+vz3uEUN/uzftKHpCac+Gby
 AtnCQmoHpP79uiH/mAwMaYC6Ewo7i1rm3URQCdzGorTLx1Z4qlbQuoiXwDms3WzX
 kUOPd71S6H5yE4BJZAoMOYtrfp/06VR9TAPvKksyg8S/rcI/BYsl/Kqdfv0US7Em
 D2Nz4rUhRjWZpfva5FnHgfuJ7JrtOPa910upuHCVYDzJo/zXRzOAajn9ZpaMNL1d
 iyNbwtksJSnYrUZXh9prBhWu41deRPD2dB3M6pcwN0Afw9bAK9NwPbzNHOS9rtkA
 97x3hFSV216ukdRNuLljd9cqVgh6KOXBjWjjacYhUFuyGM/3KzSYKqa+sGCZaYv3
 NhLMdE9XeT9e7sCIUJLs3OTxIVJGM5igizemQOEbUV2AHth5B2dgLSkb88telTUD
 Hb477DgE5lXK1QGtrHW6gQKnhZ8wusZ/YA36IQoRF+rGDroy5fWmH5WIbRTpCThq
 BZuQfyznRfAEAfIHvc4FSkt8b1D8GQmsqux6mTDRXoDCdOV7rHP1InBAmpUUe8oO
 05ieetfpXv4sW7VGSU6j+yJ7bw9zfgOVfJD556xEUYKgBfo743Yrbgk+wL+m3F0t
 +Tk2mISmjEpTzFOSB6dM
 =NK80
 -----END PGP SIGNATURE-----

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>
This commit is contained in:
David S. Miller 2015-11-08 20:47:26 -05:00
commit fb9a10d9d8
4 changed files with 22 additions and 33 deletions

View File

@ -44,7 +44,7 @@ config NFC_MRVL_I2C
config NFC_MRVL_SPI
tristate "Marvell NFC-over-SPI driver"
depends on NFC_MRVL && SPI
depends on NFC_MRVL && NFC_NCI_SPI
help
Marvell NFC-over-SPI driver.

View File

@ -113,9 +113,12 @@ static void fw_dnld_over(struct nfcmrvl_private *priv, u32 error)
}
atomic_set(&priv->ndev->cmd_cnt, 0);
del_timer_sync(&priv->ndev->cmd_timer);
del_timer_sync(&priv->fw_dnld.timer);
if (timer_pending(&priv->ndev->cmd_timer))
del_timer_sync(&priv->ndev->cmd_timer);
if (timer_pending(&priv->fw_dnld.timer))
del_timer_sync(&priv->fw_dnld.timer);
nfc_info(priv->dev, "FW loading over (%d)]\n", error);
@ -472,9 +475,12 @@ void nfcmrvl_fw_dnld_deinit(struct nfcmrvl_private *priv)
void nfcmrvl_fw_dnld_recv_frame(struct nfcmrvl_private *priv,
struct sk_buff *skb)
{
/* Discard command timer */
if (timer_pending(&priv->ndev->cmd_timer))
del_timer_sync(&priv->ndev->cmd_timer);
/* Allow next command */
atomic_set(&priv->ndev->cmd_cnt, 1);
del_timer_sync(&priv->ndev->cmd_timer);
/* Queue and trigger rx work */
skb_queue_tail(&priv->fw_dnld.rx_q, skb);

View File

@ -194,6 +194,9 @@ void nfcmrvl_nci_unregister_dev(struct nfcmrvl_private *priv)
nfcmrvl_fw_dnld_deinit(priv);
if (priv->config.reset_n_io)
devm_gpio_free(priv->dev, priv->config.reset_n_io);
nci_unregister_device(ndev);
nci_free_device(ndev);
kfree(priv);
@ -251,8 +254,6 @@ void nfcmrvl_chip_halt(struct nfcmrvl_private *priv)
gpio_set_value(priv->config.reset_n_io, 0);
}
#ifdef CONFIG_OF
int nfcmrvl_parse_dt(struct device_node *node,
struct nfcmrvl_platform_data *pdata)
{
@ -275,16 +276,6 @@ int nfcmrvl_parse_dt(struct device_node *node,
return 0;
}
#else
int nfcmrvl_parse_dt(struct device_node *node,
struct nfcmrvl_platform_data *pdata)
{
return -ENODEV;
}
#endif
EXPORT_SYMBOL_GPL(nfcmrvl_parse_dt);
MODULE_AUTHOR("Marvell International Ltd.");

View File

@ -67,8 +67,6 @@ static struct nfcmrvl_if_ops uart_ops = {
.nci_update_config = nfcmrvl_uart_nci_update_config
};
#ifdef CONFIG_OF
static int nfcmrvl_uart_parse_dt(struct device_node *node,
struct nfcmrvl_platform_data *pdata)
{
@ -102,16 +100,6 @@ static int nfcmrvl_uart_parse_dt(struct device_node *node,
return 0;
}
#else
static int nfcmrvl_uart_parse_dt(struct device_node *node,
struct nfcmrvl_platform_data *pdata)
{
return -ENODEV;
}
#endif
/*
** NCI UART OPS
*/
@ -152,10 +140,6 @@ static int nfcmrvl_nci_uart_open(struct nci_uart *nu)
nu->drv_data = priv;
nu->ndev = priv->ndev;
/* Set BREAK */
if (priv->config.break_control && nu->tty->ops->break_ctl)
nu->tty->ops->break_ctl(nu->tty, -1);
return 0;
}
@ -174,6 +158,9 @@ static void nfcmrvl_nci_uart_tx_start(struct nci_uart *nu)
{
struct nfcmrvl_private *priv = (struct nfcmrvl_private *)nu->drv_data;
if (priv->ndev->nfc_dev->fw_download_in_progress)
return;
/* Remove BREAK to wake up the NFCC */
if (priv->config.break_control && nu->tty->ops->break_ctl) {
nu->tty->ops->break_ctl(nu->tty, 0);
@ -185,13 +172,18 @@ static void nfcmrvl_nci_uart_tx_done(struct nci_uart *nu)
{
struct nfcmrvl_private *priv = (struct nfcmrvl_private *)nu->drv_data;
if (priv->ndev->nfc_dev->fw_download_in_progress)
return;
/*
** To ensure that if the NFCC goes in DEEP SLEEP sate we can wake him
** up. we set BREAK. Once we will be ready to send again we will remove
** it.
*/
if (priv->config.break_control && nu->tty->ops->break_ctl)
if (priv->config.break_control && nu->tty->ops->break_ctl) {
nu->tty->ops->break_ctl(nu->tty, -1);
usleep_range(1000, 3000);
}
}
static struct nci_uart nfcmrvl_nci_uart = {