From patchwork Thu Mar 30 10:15:42 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 9653619 X-Patchwork-Delegate: sameo@linux.intel.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id C4FBE60349 for ; Thu, 30 Mar 2017 10:22:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B05272846C for ; Thu, 30 Mar 2017 10:22:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A4DC127F90; Thu, 30 Mar 2017 10:22:12 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5D9B727F90 for ; Thu, 30 Mar 2017 10:22:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933101AbdC3KVi (ORCPT ); Thu, 30 Mar 2017 06:21:38 -0400 Received: from mail-lf0-f68.google.com ([209.85.215.68]:36512 "EHLO mail-lf0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933245AbdC3KQG (ORCPT ); Thu, 30 Mar 2017 06:16:06 -0400 Received: by mail-lf0-f68.google.com with SMTP id n78so4121316lfi.3; Thu, 30 Mar 2017 03:16:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=SBTo/h71KOZMXfjmZU6WZunmS2ilDicaNB/OxVyTA9g=; b=MR5JIKBwke99XK+EI9fjcMtj/tuB+/lkYIX/ZVqUDJfR+SBptrB64M/jGVrW3qqiQQ 8ySn99bvNiorD+OyybVwHx2tqD3+40NpsWCrp/3JkJ91eOY/6GBfWe+LcDq260BgsYV8 eDk0ws9uPAMTKm3E4qoY0duFEYaVRB42C40taS/eHC+TyH0YP4JAQZBh9OSgeY5WEeUR wuF/4W/tDfo3tlyJUQVDrsePNDQVisCdiiISJWfKCifXuxsaqTIQsaWQOwd+FHGJiDVL ekYIYsmd5xZnL7J7y9a0Ei0HJrgezl7T1olUqybrnXI0X1sHPl8jQZUqfEMLMM+SZtoW nMuQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=SBTo/h71KOZMXfjmZU6WZunmS2ilDicaNB/OxVyTA9g=; b=cr5HgihyQGvBuSBF6Jdhrmoj7vi0JURYA0RSlKKR9NAzU62HUSiGnoiNjp5FoM53oL CPsdVk49n6HKDFKRVapxs4OzidRv+es/ePHcnz1CwocvhuNMieLHDBfExt291BDz0kEV niIHLtHSBf4YyiAU8xIFxUVRKRrupQjajMp9Co+sMsTcLB6AiWtXUlcU4vvXXIs1r524 eVNnILFYRXfBjZuI9/vtO8TgJWhhGOlvhI0UhOI3y+p7c7DAjDOHjNTAQa6tHAEl4urE nrOZ2gHdMroxXS+ltFIxoeyjrEyPT9d1AH92dz9F2W8J0GAAi+HcVbWr2ND6BNOSvwsK 773Q== X-Gm-Message-State: AFeK/H2YshBKuUDkbmFQKoD36aVz1DDeOg8fYcU9KOCnCALMMdwkXWl7Sfo6Vx7WUuDklQ== X-Received: by 10.25.25.147 with SMTP id 141mr1563794lfz.87.1490868964055; Thu, 30 Mar 2017 03:16:04 -0700 (PDT) Received: from xi.terra ([84.216.234.102]) by smtp.gmail.com with ESMTPSA id o100sm300134lfi.18.2017.03.30.03.16.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 30 Mar 2017 03:16:01 -0700 (PDT) Received: from johan by xi.terra with local (Exim 4.89) (envelope-from ) id 1ctX7R-00041a-Nk; Thu, 30 Mar 2017 12:15:53 +0200 From: Johan Hovold To: Lauro Ramos Venancio , Aloisio Almeida Jr , Samuel Ortiz Cc: linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold Subject: [PATCH v2 8/8] NFC: nfcmrvl: allow gpio 0 for reset signalling Date: Thu, 30 Mar 2017 12:15:42 +0200 Message-Id: <20170330101542.15384-9-johan@kernel.org> X-Mailer: git-send-email 2.12.2 In-Reply-To: <20170330101542.15384-1-johan@kernel.org> References: <20170330101542.15384-1-johan@kernel.org> Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Allow gpio 0 to be used for reset signalling, and instead use negative errnos to disable the reset functionality. Signed-off-by: Johan Hovold --- drivers/nfc/nfcmrvl/main.c | 9 ++++----- 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 a446590a71ca..838627fa82ee 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 @@ struct nfcmrvl_private *nfcmrvl_nci_register_dev(enum nfcmrvl_phy phy, 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;