From patchwork Fri May 22 14:35:48 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Grygorii.Strashko@linaro.org" X-Patchwork-Id: 48895 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f198.google.com (mail-wi0-f198.google.com [209.85.212.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 0D81A21411 for ; Fri, 22 May 2015 14:37:24 +0000 (UTC) Received: by wixv7 with SMTP id v7sf14078847wix.0 for ; Fri, 22 May 2015 07:37:23 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=zZZvuc+UaOIQJE+pTDqbM3RuZoI4dRR81ccn3Mvbbyg=; b=U1yufEkfo/+Rty3TNrB3KH+sZmovuugDwgW51KrOldVhQo1KTfa4k4cOE5dzMEoUox e7UnwWdFHMGEpWXP+9IbZ4Ep8dgf0VcGR6IBwAXj8dAv+1fqEdtuXDLuZ/p4Bljo+mFL OxbYgdE2Qps3MBxjSHHT7QlmoOXFVjhJCTAt6oZkc4PXjbVb+a6HB5aUeOVa8rmqjz6H w5f//dl06G1hw8MUis1bVikh+DmkIHVAwJ8W7zTwsSCQVUahziSiD0j0w6flP4dCrB+a KA8KIgKM3jGj700ZJN7rypuImzujGG9d1yWYhUVCi/4BbLpbRo0ElAvIOyaN8xpUVdox DsXg== X-Gm-Message-State: ALoCoQn/k7Qe30W5OWlu5hhFqaHlZ1fB4POd4gqqthswcuFm+kq08F5oTsTnE+bRlapoY0OW+od2 X-Received: by 10.180.19.72 with SMTP id c8mr4307315wie.2.1432305443274; Fri, 22 May 2015 07:37:23 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.120.9 with SMTP id ky9ls424928lab.98.gmail; Fri, 22 May 2015 07:37:23 -0700 (PDT) X-Received: by 10.112.157.100 with SMTP id wl4mr6735983lbb.20.1432305443113; Fri, 22 May 2015 07:37:23 -0700 (PDT) Received: from mail-lb0-f173.google.com (mail-lb0-f173.google.com. [209.85.217.173]) by mx.google.com with ESMTPS id l5si1526516lbt.73.2015.05.22.07.37.23 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 22 May 2015 07:37:23 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.173 as permitted sender) client-ip=209.85.217.173; Received: by lbbzk7 with SMTP id zk7so14400090lbb.0 for ; Fri, 22 May 2015 07:37:23 -0700 (PDT) X-Received: by 10.112.140.231 with SMTP id rj7mr6635571lbb.76.1432305442971; Fri, 22 May 2015 07:37:22 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.108.230 with SMTP id hn6csp1454397lbb; Fri, 22 May 2015 07:37:21 -0700 (PDT) X-Received: by 10.70.54.164 with SMTP id k4mr16291571pdp.61.1432305417840; Fri, 22 May 2015 07:36:57 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ci13si3665255pac.227.2015.05.22.07.36.56; Fri, 22 May 2015 07:36:57 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-omap-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757087AbbEVOgb (ORCPT + 5 others); Fri, 22 May 2015 10:36:31 -0400 Received: from mail-la0-f44.google.com ([209.85.215.44]:35432 "EHLO mail-la0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757055AbbEVOgG (ORCPT ); Fri, 22 May 2015 10:36:06 -0400 Received: by labbd9 with SMTP id bd9so14012917lab.2 for ; Fri, 22 May 2015 07:36:04 -0700 (PDT) X-Received: by 10.112.180.201 with SMTP id dq9mr6899615lbc.78.1432305364668; Fri, 22 May 2015 07:36:04 -0700 (PDT) Received: from localhost ([195.238.92.128]) by mx.google.com with ESMTPSA id h3sm529901laf.24.2015.05.22.07.36.03 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 22 May 2015 07:36:04 -0700 (PDT) From: Grygorii Strashko To: Linus Walleij , Alexandre Courbot , tony@atomide.com Cc: Javier Martinez Canillas , ssantosh@kernel.org, Kevin Hilman , linux-omap@vger.kernel.org, linux-gpio@vger.kernel.org, Grygorii Strashko Subject: [PATCH 1/7] gpio: omap: fix omap_gpio_free to not clean up irq configuration Date: Fri, 22 May 2015 17:35:48 +0300 Message-Id: <1432305354-5968-2-git-send-email-grygorii.strashko@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1432305354-5968-1-git-send-email-grygorii.strashko@linaro.org> References: <1432305354-5968-1-git-send-email-grygorii.strashko@linaro.org> Sender: linux-omap-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: grygorii.strashko@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.173 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , This patch fixes following issue: - GPIOn is used as IRQ by some dev, for example PCF8575.INT -> gpio6.11 - PCFx driver knows nothing about type of IRQ line (GPIO or not) so it doesn't request gpio and just do request_irq() - If gpio6.11 will be exported through the sysfs and then un-xeported then IRQs from PCFx will not be received any more, because IRQ configuration for gpio6.11 will be cleaned up unconditionally in omap_gpio_free. Fix this by removing all GPIO IRQ specific code from omap_gpio_free() and also do GPIO clean up (change direction to 'in' and disable debounce) only if corresponding GPIO is not used as IRQ too. GPIO IRQ will be properly cleaned up by GPIO irqchip code. Signed-off-by: Grygorii Strashko --- drivers/gpio/gpio-omap.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c index b232397..bb60cbc 100644 --- a/drivers/gpio/gpio-omap.c +++ b/drivers/gpio/gpio-omap.c @@ -690,8 +690,11 @@ static void omap_gpio_free(struct gpio_chip *chip, unsigned offset) spin_lock_irqsave(&bank->lock, flags); bank->mod_usage &= ~(BIT(offset)); + if (!LINE_USED(bank->irq_usage, offset)) { + omap_set_gpio_direction(bank, offset, 1); + omap_clear_gpio_debounce(bank, offset); + } omap_disable_gpio_module(bank, offset); - omap_reset_gpio(bank, offset); spin_unlock_irqrestore(&bank->lock, flags); /*