From patchwork Tue Nov 19 13:17:31 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 21626 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-oa0-f71.google.com (mail-oa0-f71.google.com [209.85.219.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 97C6223FB4 for ; Tue, 19 Nov 2013 13:17:52 +0000 (UTC) Received: by mail-oa0-f71.google.com with SMTP id j17sf10144024oag.6 for ; Tue, 19 Nov 2013 05:17:52 -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=Gfi/ottS9d899DWl/pi5oaCOVVMw65Jd1AzYgaBhsws=; b=O0pUPPZfrX7NZEQjLcv75kYYc4DHkMju+we83OxXyBnIsi5pTw/G6XN9zE9FsHRgyZ qO8si9Lkim0S4vvGTEtTyshcuIJG6PhcVyZ/H36fheZuIuKxNTzklNIrTrUC9us+arp8 qrhzBOSj9uIlB9g/+IYzKFlMtFb2oUUIJ4+ZANv4iYaz2C7gFUgzBPtFikiyKmpCQlfZ XZIxNQ5vxC6o6YUWXmnbTu1pAFWS41IgZlw6sBtGFdBzZYK5+MKXjT1TcrGaqgqWeZXZ Ms/BesmARlSGMaihuDaG7PV0ukht361qnTtVtrZS30iYxiur57qj2mbZj2kj+L616N5j Jjvw== X-Gm-Message-State: ALoCoQkQAACCPwWd9IyNTJluyfUothuxCHJXdTh1sEzzti4S505ccCNNCatdUvJRF3tgx7gtiR2x X-Received: by 10.182.118.194 with SMTP id ko2mr10043080obb.32.1384867071711; Tue, 19 Nov 2013 05:17:51 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.12.231 with SMTP id b7ls3054666qec.55.gmail; Tue, 19 Nov 2013 05:17:51 -0800 (PST) X-Received: by 10.58.46.18 with SMTP id r18mr21322475vem.4.1384867071180; Tue, 19 Nov 2013 05:17:51 -0800 (PST) Received: from mail-vc0-f182.google.com (mail-vc0-f182.google.com [209.85.220.182]) by mx.google.com with ESMTPS id pv1si8103070veb.18.2013.11.19.05.17.51 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 19 Nov 2013 05:17:51 -0800 (PST) Received-SPF: neutral (google.com: 209.85.220.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.220.182; Received: by mail-vc0-f182.google.com with SMTP id ie18so4791774vcb.13 for ; Tue, 19 Nov 2013 05:17:51 -0800 (PST) X-Received: by 10.58.208.130 with SMTP id me2mr21078674vec.13.1384867071047; Tue, 19 Nov 2013 05:17:51 -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 u4csp277095vcz; Tue, 19 Nov 2013 05:17:50 -0800 (PST) X-Received: by 10.180.75.115 with SMTP id b19mr891951wiw.19.1384867070192; Tue, 19 Nov 2013 05:17:50 -0800 (PST) Received: from mail-wg0-f51.google.com (mail-wg0-f51.google.com [74.125.82.51]) by mx.google.com with ESMTPS id df5si753489wib.68.2013.11.19.05.17.49 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 19 Nov 2013 05:17:50 -0800 (PST) Received-SPF: neutral (google.com: 74.125.82.51 is neither permitted nor denied by best guess record for domain of linus.walleij@linaro.org) client-ip=74.125.82.51; Received: by mail-wg0-f51.google.com with SMTP id m15so7709620wgh.30 for ; Tue, 19 Nov 2013 05:17:49 -0800 (PST) X-Received: by 10.180.211.161 with SMTP id nd1mr5485159wic.0.1384867069624; Tue, 19 Nov 2013 05:17:49 -0800 (PST) Received: from localhost.localdomain ([85.235.11.236]) by mx.google.com with ESMTPSA id s2sm5480435wiy.7.2013.11.19.05.17.41 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 19 Nov 2013 05:17:48 -0800 (PST) From: Linus Walleij To: linux-gpio@vger.kernel.org, Markus Mayer Cc: Alexandre Courbot , Linus Walleij , Christian Daudt Subject: [PATCH] gpio: bcm-kona: lock IRQs when starting them Date: Tue, 19 Nov 2013 14:17:31 +0100 Message-Id: <1384867051-31066-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.220.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 Signed-off-by: Linus Walleij --- drivers/gpio/gpio-bcm-kona.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/drivers/gpio/gpio-bcm-kona.c b/drivers/gpio/gpio-bcm-kona.c index 72c927dc3be1..dee6d03a7959 100644 --- a/drivers/gpio/gpio-bcm-kona.c +++ b/drivers/gpio/gpio-bcm-kona.c @@ -449,12 +449,32 @@ 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); + 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); + + 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[] = {