From patchwork Wed Nov 20 14:42:29 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 21655 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-vb0-f72.google.com (mail-vb0-f72.google.com [209.85.212.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 79211202E6 for ; Wed, 20 Nov 2013 14:42:37 +0000 (UTC) Received: by mail-vb0-f72.google.com with SMTP id w5sf3556309vbf.11 for ; Wed, 20 Nov 2013 06:42:36 -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=5Omo9HiIuoGnz9zvHyLT3SN7kV8L7ZHasGRkOBsfb/s=; b=kIaaXqgkzYVNYDx7qdY/fM1ZjWFFCN8E0Res756RkOoxmkDiWFFW1pl7dbwWOy1f2K kQk1mR6+MbOUj70cNihK0Q0NNBsnBWtyLdu7xoLZpfcphB+nCeBv3ozytO8KBTizQFTo QXeZhTdh0Kd9Rte07eQabmn5v7OLqj9N9WshD5ajXkvES46HaeMzupdbg567HPUoNyQh ESZ3a2j0dg0W5/VifPNZJjeux+2o32o2LXB1MSCo4/xF8a06KIYUeWOQCB5fHibY/Ea2 0mgc1yXDP+UzQe2fYuPG9SVbvXQ1AmIKCYyn2YZgEVOYOv4+nLk0pRYiiofJVEtUHX8x plkA== X-Gm-Message-State: ALoCoQlA5i8EU6YnME4D+9csheUKNSGNDPRL0tOhV0zopyEdvdfm7Gz9xt/VxYmxj3Xg/s1Yw8nV X-Received: by 10.236.92.107 with SMTP id i71mr435784yhf.1.1384958556807; Wed, 20 Nov 2013 06:42:36 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.29.129 with SMTP id k1ls80322qeh.75.gmail; Wed, 20 Nov 2013 06:42:36 -0800 (PST) X-Received: by 10.220.17.131 with SMTP id s3mr705432vca.20.1384958556692; Wed, 20 Nov 2013 06:42:36 -0800 (PST) Received: from mail-ve0-f179.google.com (mail-ve0-f179.google.com [209.85.128.179]) by mx.google.com with ESMTPS id vq3si9549816veb.103.2013.11.20.06.42.36 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 20 Nov 2013 06:42:36 -0800 (PST) Received-SPF: neutral (google.com: 209.85.128.179 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.179; Received: by mail-ve0-f179.google.com with SMTP id jw12so2691975veb.38 for ; Wed, 20 Nov 2013 06:42:36 -0800 (PST) X-Received: by 10.58.181.230 with SMTP id dz6mr133322vec.35.1384958556584; Wed, 20 Nov 2013 06:42:36 -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 u4csp358038vcz; Wed, 20 Nov 2013 06:42:36 -0800 (PST) X-Received: by 10.180.206.239 with SMTP id lr15mr15731006wic.35.1384958555771; Wed, 20 Nov 2013 06:42:35 -0800 (PST) Received: from mail-wi0-f174.google.com (mail-wi0-f174.google.com [209.85.212.174]) by mx.google.com with ESMTPS id os4si9526186wjc.134.2013.11.20.06.42.35 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 20 Nov 2013 06:42:35 -0800 (PST) Received-SPF: neutral (google.com: 209.85.212.174 is neither permitted nor denied by best guess record for domain of linus.walleij@linaro.org) client-ip=209.85.212.174; Received: by mail-wi0-f174.google.com with SMTP id fb10so3161062wid.1 for ; Wed, 20 Nov 2013 06:42:35 -0800 (PST) X-Received: by 10.194.122.99 with SMTP id lr3mr956855wjb.21.1384958555247; Wed, 20 Nov 2013 06:42:35 -0800 (PST) Received: from localhost.localdomain ([85.235.11.236]) by mx.google.com with ESMTPSA id s2sm16690063wiy.7.2013.11.20.06.42.33 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 20 Nov 2013 06:42:34 -0800 (PST) From: Linus Walleij To: linux-gpio@vger.kernel.org, Mathias Nyman , Mika Westerberg Cc: Alexandre Courbot , Linus Walleij Subject: [PATCH] gpio: lynxpoint: lock IRQs when starting them Date: Wed, 20 Nov 2013 15:42:29 +0100 Message-Id: <1384958549-23722-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.179 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: Mathias Nyman Cc: Mika Westerberg Signed-off-by: Linus Walleij --- drivers/gpio/gpio-lynxpoint.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/drivers/gpio/gpio-lynxpoint.c b/drivers/gpio/gpio-lynxpoint.c index f1ca9d5880b6..8c7634250aff 100644 --- a/drivers/gpio/gpio-lynxpoint.c +++ b/drivers/gpio/gpio-lynxpoint.c @@ -301,6 +301,24 @@ static void lp_irq_disable(struct irq_data *d) spin_unlock_irqrestore(&lg->lock, flags); } +static unsigned int lp_irq_startup(struct irq_data *d) +{ + struct lp_gpio *lg = irq_data_get_irq_chip_data(d); + + if (gpio_lock_as_irq(&lg->chip, irqd_to_hwirq(d))) + dev_err(lg->chip.dev, + "unable to lock HW IRQ %lu for IRQ\n", + irqd_to_hwirq(d)); + return 0; +} + +static void lp_irq_shutdown(struct irq_data *d) +{ + struct lp_gpio *lg = irq_data_get_irq_chip_data(d); + + gpio_unlock_as_irq(&lg->chip, irqd_to_hwirq(d)); +} + static struct irq_chip lp_irqchip = { .name = "LP-GPIO", .irq_mask = lp_irq_mask, @@ -308,6 +326,8 @@ static struct irq_chip lp_irqchip = { .irq_enable = lp_irq_enable, .irq_disable = lp_irq_disable, .irq_set_type = lp_irq_type, + .irq_startup = lp_irq_startup, + .irq_shutdown = lp_irq_shutdown, .flags = IRQCHIP_SKIP_SET_WAKE, };