From patchwork Wed Nov 20 14:27:35 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 21653 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pb0-f69.google.com (mail-pb0-f69.google.com [209.85.160.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id C634023FDC for ; Wed, 20 Nov 2013 14:27:47 +0000 (UTC) Received: by mail-pb0-f69.google.com with SMTP id md12sf5930102pbc.0 for ; Wed, 20 Nov 2013 06:27: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=dYd7nesXUBcRX8vvaSES/kLy7YJFVjmd9OQcCBqqSh8=; b=U2UzdqzouFdwNfr3i8/4J1E3vCh5pA3KJMR93gOeA7urx5dpZijvK94+Q6Q/wS/wdE /4BEphF08vEUnYfPl0lRfCtXqPdzOYhvnY4+cHHO/YdNVk6ayC0JkkbyQUvvQ4daV8Yc vTR3JBoBZeTOtmnbWYKPHF3Z//FXhLnXSCK8UJZVDbNOP609ap0GTvcnnotIR+8/jMs4 PIq1fOZA93/J5f+P8Ria4crS8mSvRzWNFJbQswhS/D/rLPXOH+3fal+PiaVbHLle0iPH D4sfym7JlDLyLUzG+6r3vyGaKbdQI/Oo6HjnQLqzBWAsiwpKSz6uCYQ7ge8/Wqylr32C 8lWQ== X-Gm-Message-State: ALoCoQmf5wv5XSbEyuupG4pSXiZz981SckmUrhxbhYlGgtVz/OHCcR6bplDym00v93xZ46VqCaYd X-Received: by 10.66.146.65 with SMTP id ta1mr276417pab.19.1384957663711; Wed, 20 Nov 2013 06:27:43 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.35.18 with SMTP id d18ls79481qej.14.gmail; Wed, 20 Nov 2013 06:27:43 -0800 (PST) X-Received: by 10.220.199.5 with SMTP id eq5mr646880vcb.16.1384957663569; Wed, 20 Nov 2013 06:27:43 -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 ef6si9529506ved.123.2013.11.20.06.27.43 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 20 Nov 2013 06:27:43 -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 jy13so351760veb.13 for ; Wed, 20 Nov 2013 06:27:43 -0800 (PST) X-Received: by 10.58.255.233 with SMTP id at9mr647165ved.20.1384957663489; Wed, 20 Nov 2013 06:27: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 u4csp357065vcz; Wed, 20 Nov 2013 06:27:43 -0800 (PST) X-Received: by 10.180.75.115 with SMTP id b19mr5551983wiw.19.1384957662706; Wed, 20 Nov 2013 06:27:42 -0800 (PST) Received: from mail-we0-f177.google.com (mail-we0-f177.google.com [74.125.82.177]) by mx.google.com with ESMTPS id dn5si9509506wjb.119.2013.11.20.06.27.42 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 20 Nov 2013 06:27:42 -0800 (PST) Received-SPF: neutral (google.com: 74.125.82.177 is neither permitted nor denied by best guess record for domain of linus.walleij@linaro.org) client-ip=74.125.82.177; Received: by mail-we0-f177.google.com with SMTP id p61so4426295wes.8 for ; Wed, 20 Nov 2013 06:27:42 -0800 (PST) X-Received: by 10.180.95.73 with SMTP id di9mr1580626wib.28.1384957661956; Wed, 20 Nov 2013 06:27:41 -0800 (PST) Received: from localhost.localdomain ([85.235.11.236]) by mx.google.com with ESMTPSA id bs15sm16703925wib.10.2013.11.20.06.27.40 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 20 Nov 2013 06:27:41 -0800 (PST) From: Linus Walleij To: linux-gpio@vger.kernel.org, David Cohen Cc: Alexandre Courbot , Linus Walleij Subject: [PATCH] gpio: intel-mid: lock IRQs when starting them Date: Wed, 20 Nov 2013 15:27:35 +0100 Message-Id: <1384957655-23215-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: David Cohen Signed-off-by: Linus Walleij --- drivers/gpio/gpio-intel-mid.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/drivers/gpio/gpio-intel-mid.c b/drivers/gpio/gpio-intel-mid.c index be803af658ac..49de7d13915f 100644 --- a/drivers/gpio/gpio-intel-mid.c +++ b/drivers/gpio/gpio-intel-mid.c @@ -235,11 +235,31 @@ 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)); + return 0; +} + +static void intel_mid_irq_shutdown(struct irq_data *d) +{ + struct intel_mid_gpio *priv = irq_data_get_irq_chip_data(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 +438,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;