From patchwork Mon Jan 26 11:13:36 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Dolca X-Patchwork-Id: 5708631 Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 6F5A5C058D for ; Mon, 26 Jan 2015 11:16:26 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 949F520122 for ; Mon, 26 Jan 2015 11:16:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A99FF2011B for ; Mon, 26 Jan 2015 11:16:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754816AbbAZLOI (ORCPT ); Mon, 26 Jan 2015 06:14:08 -0500 Received: from mga14.intel.com ([192.55.52.115]:64239 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751221AbbAZLOG (ORCPT ); Mon, 26 Jan 2015 06:14:06 -0500 Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga103.fm.intel.com with ESMTP; 26 Jan 2015 03:08:03 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.09,468,1418112000"; d="scan'208";a="642582659" Received: from rdolca-desk.ger.corp.intel.com (HELO rdolca-desk.rb.intel.com) ([10.237.104.134]) by orsmga001.jf.intel.com with ESMTP; 26 Jan 2015 03:14:02 -0800 From: Robert Dolca To: linux-nfc@lists.01.org, Lauro Ramos Venancio , Aloisio Almeida Jr , Samuel Ortiz Cc: linux-kernel@vger.kernel.org, linux-wireless@vger.kernel.org, netdev@vger.kernel.org, "David S. Miller" , Berg Johannes , Clement Perrochaud , Robert Dolca Subject: [PATCH v2 1/2] NFC: PN544: GPIO access that may sleep Date: Mon, 26 Jan 2015 13:13:36 +0200 Message-Id: <1422270817-10950-2-git-send-email-robert.dolca@intel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1422270817-10950-1-git-send-email-robert.dolca@intel.com> References: <1422270817-10950-1-git-send-email-robert.dolca@intel.com> Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP gpio_set_value was replaced with gpio_set_value_cansleep in order to allow GPIO access that may sleep. This is particularelly useful when GPIO is accessed using busses like I2C, SPI, USB Signed-off-by: Robert Dolca --- drivers/nfc/pn544/i2c.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/drivers/nfc/pn544/i2c.c b/drivers/nfc/pn544/i2c.c index fc02e8d..d9018cd 100644 --- a/drivers/nfc/pn544/i2c.c +++ b/drivers/nfc/pn544/i2c.c @@ -195,18 +195,19 @@ static void pn544_hci_i2c_platform_init(struct pn544_i2c_phy *phy) nfc_info(&phy->i2c_dev->dev, "Detecting nfc_en polarity\n"); /* Disable fw download */ - gpio_set_value(phy->gpio_fw, 0); + gpio_set_value_cansleep(phy->gpio_fw, 0); for (polarity = 0; polarity < 2; polarity++) { phy->en_polarity = polarity; retry = 3; while (retry--) { /* power off */ - gpio_set_value(phy->gpio_en, !phy->en_polarity); + gpio_set_value_cansleep(phy->gpio_en, + !phy->en_polarity); usleep_range(10000, 15000); /* power on */ - gpio_set_value(phy->gpio_en, phy->en_polarity); + gpio_set_value_cansleep(phy->gpio_en, phy->en_polarity); usleep_range(10000, 15000); /* send reset */ @@ -225,13 +226,14 @@ static void pn544_hci_i2c_platform_init(struct pn544_i2c_phy *phy) "Could not detect nfc_en polarity, fallback to active high\n"); out: - gpio_set_value(phy->gpio_en, !phy->en_polarity); + gpio_set_value_cansleep(phy->gpio_en, !phy->en_polarity); } static void pn544_hci_i2c_enable_mode(struct pn544_i2c_phy *phy, int run_mode) { - gpio_set_value(phy->gpio_fw, run_mode == PN544_FW_MODE ? 1 : 0); - gpio_set_value(phy->gpio_en, phy->en_polarity); + gpio_set_value_cansleep(phy->gpio_fw, + run_mode == PN544_FW_MODE ? 1 : 0); + gpio_set_value_cansleep(phy->gpio_en, phy->en_polarity); usleep_range(10000, 15000); phy->run_mode = run_mode; @@ -254,14 +256,14 @@ static void pn544_hci_i2c_disable(void *phy_id) { struct pn544_i2c_phy *phy = phy_id; - gpio_set_value(phy->gpio_fw, 0); - gpio_set_value(phy->gpio_en, !phy->en_polarity); + gpio_set_value_cansleep(phy->gpio_fw, 0); + gpio_set_value_cansleep(phy->gpio_en, !phy->en_polarity); usleep_range(10000, 15000); - gpio_set_value(phy->gpio_en, phy->en_polarity); + gpio_set_value_cansleep(phy->gpio_en, phy->en_polarity); usleep_range(10000, 15000); - gpio_set_value(phy->gpio_en, !phy->en_polarity); + gpio_set_value_cansleep(phy->gpio_en, !phy->en_polarity); usleep_range(10000, 15000); phy->powered = 0;