diff options
author | Johan Hovold <johan@kernel.org> | 2017-03-30 12:15:42 +0200 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2017-06-18 23:58:00 +0200 |
commit | e33a3f84f88f13eab6a45c5230c9b9ee9ac78e60 (patch) | |
tree | e0ab90a18340569ac3d1a1f37a802738fd6887ea | |
parent | 0d1ca88bbfdfdad4f6fc0421da5e4ea9a13a0d42 (diff) | |
download | linux-e33a3f84f88f13eab6a45c5230c9b9ee9ac78e60.tar.bz2 |
NFC: nfcmrvl: allow gpio 0 for reset signalling
Allow gpio 0 to be used for reset signalling, and instead use negative
errnos to disable the reset functionality.
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
-rw-r--r-- | drivers/nfc/nfcmrvl/main.c | 9 | ||||
-rw-r--r-- | include/linux/platform_data/nfcmrvl.h | 2 |
2 files changed, 5 insertions, 6 deletions
diff --git a/drivers/nfc/nfcmrvl/main.c b/drivers/nfc/nfcmrvl/main.c index a5faa604a3b4..e65d027b91fa 100644 --- a/drivers/nfc/nfcmrvl/main.c +++ b/drivers/nfc/nfcmrvl/main.c @@ -123,12 +123,12 @@ struct nfcmrvl_private *nfcmrvl_nci_register_dev(enum nfcmrvl_phy phy, memcpy(&priv->config, pdata, sizeof(*pdata)); - if (priv->config.reset_n_io) { + if (gpio_is_valid(priv->config.reset_n_io)) { rc = gpio_request_one(priv->config.reset_n_io, GPIOF_OUT_INIT_LOW, "nfcmrvl_reset_n"); if (rc < 0) { - priv->config.reset_n_io = 0; + priv->config.reset_n_io = -EINVAL; nfc_err(dev, "failed to request reset_n io\n"); } } @@ -183,7 +183,7 @@ error_fw_dnld_deinit: error_free_dev: nci_free_device(priv->ndev); error_free_gpio: - if (priv->config.reset_n_io) + if (gpio_is_valid(priv->config.reset_n_io)) gpio_free(priv->config.reset_n_io); kfree(priv); return ERR_PTR(rc); @@ -199,7 +199,7 @@ void nfcmrvl_nci_unregister_dev(struct nfcmrvl_private *priv) nfcmrvl_fw_dnld_deinit(priv); - if (priv->config.reset_n_io) + if (gpio_is_valid(priv->config.reset_n_io)) gpio_free(priv->config.reset_n_io); nci_unregister_device(ndev); @@ -267,7 +267,6 @@ int nfcmrvl_parse_dt(struct device_node *node, reset_n_io = of_get_named_gpio(node, "reset-n-io", 0); if (reset_n_io < 0) { pr_info("no reset-n-io config\n"); - reset_n_io = 0; } else if (!gpio_is_valid(reset_n_io)) { pr_err("invalid reset-n-io GPIO\n"); return reset_n_io; diff --git a/include/linux/platform_data/nfcmrvl.h b/include/linux/platform_data/nfcmrvl.h index a6f9d633f5be..9e75ac8d19be 100644 --- a/include/linux/platform_data/nfcmrvl.h +++ b/include/linux/platform_data/nfcmrvl.h @@ -23,7 +23,7 @@ struct nfcmrvl_platform_data { */ /* GPIO that is wired to RESET_N signal */ - unsigned int reset_n_io; + int reset_n_io; /* Tell if transport is muxed in HCI one */ unsigned int hci_muxed; |