From patchwork Tue Nov 26 10:20:36 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 21773 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pd0-f199.google.com (mail-pd0-f199.google.com [209.85.192.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 9666A202DA for ; Tue, 26 Nov 2013 10:20:44 +0000 (UTC) Received: by mail-pd0-f199.google.com with SMTP id r10sf13396451pdi.6 for ; Tue, 26 Nov 2013 02:20:43 -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=TP68HkkGlecRJTi4gza2rYBLGBkgNB1U3d2Sq1poREo=; b=grmeWgcJelIbI3NqO4Et024GSi4SvHA3729v7TWhKiAN9FYET0d4lln/kR8JtycPfY DEc5VXodVO85LDOoXv2ZK3hG3eEvx5Vkpltas8a3iuvlTEJhX3kw/AvhMnDjWqQ0XWwT 7/i16rmeYWJAuGlX1MHDZZT7vJpwI5X6VLP1EZ5LbZQPkjvqaO9F2mP9mW0CmmV6h7B+ R1C1dTvvaM58nlGsbIkGdWYt1nxEyqEo+izNuenHpsiDlBq6pSyvgoP9UjWHDvBI0i+F t781J78WmLkfFT0gQJhvUGUNDhco+lqDW6gq/KDoiB50o9bNU+EciJXQuVrSvMVmhEHK 2++A== X-Gm-Message-State: ALoCoQlmvCY9i4w/12T8+t7hJDEWa9km+AeLFEzdo1JRBHPIVYIs9k1x0EzZptIMGG2EWQeA6hp/ X-Received: by 10.66.65.109 with SMTP id w13mr10541192pas.21.1385461243754; Tue, 26 Nov 2013 02:20:43 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.25.196 with SMTP id e4ls2386037qeg.6.gmail; Tue, 26 Nov 2013 02:20:43 -0800 (PST) X-Received: by 10.58.255.71 with SMTP id ao7mr30006465ved.16.1385461243632; Tue, 26 Nov 2013 02:20:43 -0800 (PST) Received: from mail-vb0-f47.google.com (mail-vb0-f47.google.com [209.85.212.47]) by mx.google.com with ESMTPS id z11si19311782vcj.53.2013.11.26.02.20.43 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 26 Nov 2013 02:20:43 -0800 (PST) Received-SPF: neutral (google.com: 209.85.212.47 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.212.47; Received: by mail-vb0-f47.google.com with SMTP id x11so3626889vbb.20 for ; Tue, 26 Nov 2013 02:20:43 -0800 (PST) X-Received: by 10.58.228.231 with SMTP id sl7mr126585vec.49.1385461243524; Tue, 26 Nov 2013 02:20:43 -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 u4csp201073vcz; Tue, 26 Nov 2013 02:20:43 -0800 (PST) X-Received: by 10.152.8.18 with SMTP id n18mr8923385laa.24.1385461242396; Tue, 26 Nov 2013 02:20:42 -0800 (PST) Received: from mail-la0-f52.google.com (mail-la0-f52.google.com [209.85.215.52]) by mx.google.com with ESMTPS id wf1si17230148lbb.48.2013.11.26.02.20.41 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 26 Nov 2013 02:20:42 -0800 (PST) Received-SPF: neutral (google.com: 209.85.215.52 is neither permitted nor denied by best guess record for domain of linus.walleij@linaro.org) client-ip=209.85.215.52; Received: by mail-la0-f52.google.com with SMTP id y1so2164902lam.39 for ; Tue, 26 Nov 2013 02:20:41 -0800 (PST) X-Received: by 10.152.234.37 with SMTP id ub5mr420292lac.51.1385461241660; Tue, 26 Nov 2013 02:20:41 -0800 (PST) Received: from localhost.localdomain ([85.235.11.236]) by mx.google.com with ESMTPSA id o1sm58015388lah.8.2013.11.26.02.20.39 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 26 Nov 2013 02:20:40 -0800 (PST) From: Linus Walleij To: linux-gpio@vger.kernel.org, David Cohen Cc: Alexandre Courbot , Linus Walleij Subject: [PATCH v2] gpio: intel-mid: lock IRQs when starting them Date: Tue, 26 Nov 2013 11:20:36 +0100 Message-Id: <1385461236-5101-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.212.47 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. Acked-by: David Cohen Signed-off-by: Linus Walleij --- ChangeLog v1->v2: - Explicitly call the - empty - mask/unmask functions from the startup/shutdown hooks. These are currently empty, but maybe they will not be that forever, so better be safe than sorry. --- drivers/gpio/gpio-intel-mid.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/drivers/gpio/gpio-intel-mid.c b/drivers/gpio/gpio-intel-mid.c index be803af658ac..039de0e6cf16 100644 --- a/drivers/gpio/gpio-intel-mid.c +++ b/drivers/gpio/gpio-intel-mid.c @@ -235,11 +235,33 @@ static void intel_mid_irq_mask(struct irq_data *d) { } +static unsigned int intel_mid_irq_startup(struct irq_data *d) +{ + struct intel_mid_gpio *priv = irq_data_get_irq_chip_data(d); + + if (gpio_lock_as_irq(&priv->chip, irqd_to_hwirq(d))) + dev_err(priv->chip.dev, + "unable to lock HW IRQ %lu for IRQ\n", + irqd_to_hwirq(d)); + intel_mid_irq_unmask(d); + return 0; +} + +static void intel_mid_irq_shutdown(struct irq_data *d) +{ + struct intel_mid_gpio *priv = irq_data_get_irq_chip_data(d); + + intel_mid_irq_mask(d); + gpio_unlock_as_irq(&priv->chip, irqd_to_hwirq(d)); +} + static struct irq_chip intel_mid_irqchip = { .name = "INTEL_MID-GPIO", .irq_mask = intel_mid_irq_mask, .irq_unmask = intel_mid_irq_unmask, .irq_set_type = intel_mid_irq_type, + .irq_startup = intel_mid_irq_startup, + .irq_shutdown = intel_mid_irq_shutdown, }; static const struct intel_mid_gpio_ddata gpio_lincroft = { @@ -418,6 +440,7 @@ static int intel_gpio_probe(struct pci_dev *pdev, priv->reg_base = pcim_iomap_table(pdev)[0]; priv->chip.label = dev_name(&pdev->dev); + priv->chip.dev = &pdev->dev; priv->chip.request = intel_gpio_request; priv->chip.direction_input = intel_gpio_direction_input; priv->chip.direction_output = intel_gpio_direction_output;