From patchwork Wed Oct 16 10:53:41 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heikki Krogerus X-Patchwork-Id: 3051801 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.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id DC402BF924 for ; Wed, 16 Oct 2013 10:54:59 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D652820481 for ; Wed, 16 Oct 2013 10:54:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id F368E20480 for ; Wed, 16 Oct 2013 10:54:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934070Ab3JPKyw (ORCPT ); Wed, 16 Oct 2013 06:54:52 -0400 Received: from mga02.intel.com ([134.134.136.20]:35004 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1760494Ab3JPKx5 (ORCPT ); Wed, 16 Oct 2013 06:53:57 -0400 Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga101.jf.intel.com with ESMTP; 16 Oct 2013 03:53:56 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.93,506,1378882800"; d="scan'208";a="419938339" Received: from blue.fi.intel.com ([10.237.72.156]) by orsmga002.jf.intel.com with ESMTP; 16 Oct 2013 03:53:53 -0700 From: Heikki Krogerus To: "John W. Linville" Cc: Johannes Berg , Rhyland Klein , "Rafael J. Wysocki" , linux-acpi@vger.kernel.org, linux-wireless@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH 3/5] net: rfkill: gpio: spinlock-safe GPIO access Date: Wed, 16 Oct 2013 13:53:41 +0300 Message-Id: <1381920823-15403-4-git-send-email-heikki.krogerus@linux.intel.com> X-Mailer: git-send-email 1.8.4.rc3 In-Reply-To: <1381920823-15403-1-git-send-email-heikki.krogerus@linux.intel.com> References: <1381920823-15403-1-git-send-email-heikki.krogerus@linux.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=-7.4 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, 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 This sets the direction of the gpio once when it's requested, and uses the spinlock-safe gpio_set_state() to change the state. Signed-off-by: Heikki Krogerus --- net/rfkill/rfkill-gpio.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/net/rfkill/rfkill-gpio.c b/net/rfkill/rfkill-gpio.c index 1d104e7..aa4ac10 100644 --- a/net/rfkill/rfkill-gpio.c +++ b/net/rfkill/rfkill-gpio.c @@ -42,18 +42,18 @@ static int rfkill_gpio_set_power(void *data, bool blocked) if (blocked) { if (gpio_is_valid(rfkill->pdata->shutdown_gpio)) - gpio_direction_output(rfkill->pdata->shutdown_gpio, 0); + gpio_set_value(rfkill->pdata->shutdown_gpio, 0); if (gpio_is_valid(rfkill->pdata->reset_gpio)) - gpio_direction_output(rfkill->pdata->reset_gpio, 0); + gpio_set_value(rfkill->pdata->reset_gpio, 0); if (!IS_ERR(rfkill->clk) && rfkill->clk_enabled) clk_disable(rfkill->clk); } else { if (!IS_ERR(rfkill->clk) && !rfkill->clk_enabled) clk_enable(rfkill->clk); if (gpio_is_valid(rfkill->pdata->reset_gpio)) - gpio_direction_output(rfkill->pdata->reset_gpio, 1); + gpio_set_value(rfkill->pdata->reset_gpio, 1); if (gpio_is_valid(rfkill->pdata->shutdown_gpio)) - gpio_direction_output(rfkill->pdata->shutdown_gpio, 1); + gpio_set_value(rfkill->pdata->shutdown_gpio, 1); } rfkill->clk_enabled = blocked; @@ -114,8 +114,8 @@ static int rfkill_gpio_probe(struct platform_device *pdev) rfkill->clk = devm_clk_get(&pdev->dev, pdata->power_clk_name); if (gpio_is_valid(pdata->reset_gpio)) { - ret = devm_gpio_request(&pdev->dev, pdata->reset_gpio, - rfkill->reset_name); + ret = devm_gpio_request_one(&pdev->dev, pdata->reset_gpio, + 0, rfkill->reset_name); if (ret) { pr_warn("%s: failed to get reset gpio.\n", __func__); return ret; @@ -123,8 +123,8 @@ static int rfkill_gpio_probe(struct platform_device *pdev) } if (gpio_is_valid(pdata->shutdown_gpio)) { - ret = devm_gpio_request(&pdev->dev, pdata->shutdown_gpio, - rfkill->shutdown_name); + ret = devm_gpio_request_one(&pdev->dev, pdata->shutdown_gpio, + 0, rfkill->shutdown_name); if (ret) { pr_warn("%s: failed to get shutdown gpio.\n", __func__); return ret;