From patchwork Tue Nov 26 10:11:43 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 21771 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-vb0-f71.google.com (mail-vb0-f71.google.com [209.85.212.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 35F43202DA for ; Tue, 26 Nov 2013 10:11:53 +0000 (UTC) Received: by mail-vb0-f71.google.com with SMTP id w8sf12125701vbj.10 for ; Tue, 26 Nov 2013 02:11:53 -0800 (PST) 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:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=o7Ml9X7sG5b2RknRBL6FcWuWJraxGUiAE6iThBA3WW8=; b=MzP9MtujmJLLpxrmfCdUduEyYHATuDaJ4+Fat0KTt0H9A4FvpYFPoUrmJWPwLc7OHx P2G5E11CKki4qTwE8knu0ft6bbOq4JdbwYtHgbFVbcRbe7pQ6MnalxIrlIn6XlOlHFEb mWavbcINwBPE0qs2KMcPhf5eIy4sLksHQS/nEXItBqsMKEw69/TYotx2/tFZ32bV7YE/ Iy08T67K+SLR2i9upoy2i4U4nHk8/6hWdOkN/2DO9Uz7/12fI1Ahx7+eVN1dWxPMFCJG yhc8LFPE3e5K8Bdfj1PlOJL9Uk0t7r5M99jz++QVgILnKPgWBIV8xaXJl+TtKxyerR/V 2MJQ== X-Gm-Message-State: ALoCoQmpn/QcSKRujw6TvPRFchzb8ngtn8MAN/dz9zmXyvXO3GsocsGnzfw1RXKu6908CTljtFxG X-Received: by 10.58.215.130 with SMTP id oi2mr6655504vec.27.1385460713290; Tue, 26 Nov 2013 02:11:53 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.62.199 with SMTP id a7ls2478576qes.87.gmail; Tue, 26 Nov 2013 02:11:53 -0800 (PST) X-Received: by 10.220.58.1 with SMTP id e1mr29962594vch.0.1385460713191; Tue, 26 Nov 2013 02:11:53 -0800 (PST) Received: from mail-ve0-f182.google.com (mail-ve0-f182.google.com [209.85.128.182]) by mx.google.com with ESMTPS id wp10si19266501vdb.6.2013.11.26.02.11.53 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 26 Nov 2013 02:11:53 -0800 (PST) Received-SPF: neutral (google.com: 209.85.128.182 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.182; Received: by mail-ve0-f182.google.com with SMTP id jy13so3963494veb.27 for ; Tue, 26 Nov 2013 02:11:53 -0800 (PST) X-Received: by 10.58.54.69 with SMTP id h5mr4855483vep.25.1385460713065; Tue, 26 Nov 2013 02:11:53 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.174.196 with SMTP id u4csp200572vcz; Tue, 26 Nov 2013 02:11:52 -0800 (PST) X-Received: by 10.152.120.66 with SMTP id la2mr203438lab.62.1385460711759; Tue, 26 Nov 2013 02:11:51 -0800 (PST) Received: from mail-la0-f44.google.com (mail-la0-f44.google.com [209.85.215.44]) by mx.google.com with ESMTPS id du3si8350085lbc.61.2013.11.26.02.11.51 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 26 Nov 2013 02:11:51 -0800 (PST) Received-SPF: neutral (google.com: 209.85.215.44 is neither permitted nor denied by best guess record for domain of linus.walleij@linaro.org) client-ip=209.85.215.44; Received: by mail-la0-f44.google.com with SMTP id ep20so4099732lab.31 for ; Tue, 26 Nov 2013 02:11:51 -0800 (PST) X-Received: by 10.152.18.201 with SMTP id y9mr400685lad.57.1385460711126; Tue, 26 Nov 2013 02:11:51 -0800 (PST) Received: from localhost.localdomain ([85.235.11.236]) by mx.google.com with ESMTPSA id c10sm38187079lbd.9.2013.11.26.02.11.49 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 26 Nov 2013 02:11:50 -0800 (PST) From: Linus Walleij To: linux-gpio@vger.kernel.org, Markus Mayer Cc: Alexandre Courbot , Linus Walleij , Christian Daudt , Grygorii Strashko , Javier Martinez Canillas Subject: [PATCH v2] gpio: bcm-kona: lock IRQs when starting them Date: Tue, 26 Nov 2013 11:11:43 +0100 Message-Id: <1385460703-31889-1-git-send-email-linus.walleij@linaro.org> X-Mailer: git-send-email 1.8.3.1 X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: linus.walleij@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.128.182 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , This uses the new API for tagging GPIO lines as in use by IRQs. This enforces a few semantic checks on how the underlying GPIO line is used. Cc: Markus Mayer Cc: Christian Daudt Cc: Grygorii Strashko Cc: Javier Martinez Canillas Signed-off-by: Linus Walleij --- ChangeLog v1->v2: - Make sure we call .unmask() and .mask() functions from the .startup() and .shutdown() callbacks so the implicit semantics are satisfied. --- drivers/gpio/gpio-bcm-kona.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/drivers/gpio/gpio-bcm-kona.c b/drivers/gpio/gpio-bcm-kona.c index 72c927dc3be1..3437414eaef2 100644 --- a/drivers/gpio/gpio-bcm-kona.c +++ b/drivers/gpio/gpio-bcm-kona.c @@ -449,12 +449,34 @@ static void bcm_kona_gpio_irq_handler(unsigned int irq, struct irq_desc *desc) chained_irq_exit(chip, desc); } +static unsigned int bcm_kona_gpio_irq_startup(struct irq_data *d) +{ + struct bcm_kona_gpio *kona_gpio = irq_data_get_irq_chip_data(d); + + if (gpio_lock_as_irq(&kona_gpio->gpio_chip, d->hwirq)) + dev_err(kona_gpio->gpio_chip.dev, + "unable to lock HW IRQ %lu for IRQ\n", + d->hwirq); + bcm_kona_gpio_irq_unmask(d); + return 0; +} + +static void bcm_kona_gpio_irq_shutdown(struct irq_data *d) +{ + struct bcm_kona_gpio *kona_gpio = irq_data_get_irq_chip_data(d); + + bcm_kona_gpio_irq_mask(d); + gpio_unlock_as_irq(&kona_gpio->gpio_chip, d->hwirq); +} + static struct irq_chip bcm_gpio_irq_chip = { .name = "bcm-kona-gpio", .irq_ack = bcm_kona_gpio_irq_ack, .irq_mask = bcm_kona_gpio_irq_mask, .irq_unmask = bcm_kona_gpio_irq_unmask, .irq_set_type = bcm_kona_gpio_irq_set_type, + .irq_startup = bcm_kona_gpio_irq_startup, + .irq_shutdown = bcm_kona_gpio_irq_shutdown, }; static struct __initconst of_device_id bcm_kona_gpio_of_match[] = {