From patchwork Wed Jan 15 09:10:42 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 23226 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-yh0-f71.google.com (mail-yh0-f71.google.com [209.85.213.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id B3442206A0 for ; Wed, 15 Jan 2014 09:10:49 +0000 (UTC) Received: by mail-yh0-f71.google.com with SMTP id f10sf2505961yha.2 for ; Wed, 15 Jan 2014 01:10:48 -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=w1KvES0d3XDUvK+E5rWREYbFB9eYwVkxVLt9pSpCljA=; b=LUD4d1hU2Lf6Rz5nhQ/MBXDWsJPyEs+t4toJIKu3D65iWApTBbGQPpX6OoG4izzJpz GaXQFqGiAB1LmsK/YmtlWFNqrzpVDPccuH5NafM3X8qN9Y31Imy43F+LEyNlkb8W0Z/r TQlWEyTaRMYE5yGD+XjWxlj79IHqpxWhk5smD0UNyHoEU/uSyLstj4ajRiD7fT+Kx7pA mmgSO+0oSclRUgYFN2FZDHOWW6x7TcLvaT8XqVuB4MDVFjgEJa5VmoJH39ykOHDdjV+L PUk+Pgpi9rkm0Tq/BsAM29Fza+K70RkQadfjMmnYZltarN6Neg4zZN+xGSYZOWwwCaNJ Fe6Q== X-Gm-Message-State: ALoCoQlFTm23Fsre5RzPO7jMLJRJGg/xj+Kg9w/Sxoku78J5vlyW9qZhYHzo8aS/3GggizCfcnP+ X-Received: by 10.236.83.206 with SMTP id q54mr295602yhe.47.1389777048735; Wed, 15 Jan 2014 01:10:48 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.62.199 with SMTP id a7ls530711qes.87.gmail; Wed, 15 Jan 2014 01:10:48 -0800 (PST) X-Received: by 10.52.168.4 with SMTP id zs4mr58092vdb.59.1389777048661; Wed, 15 Jan 2014 01:10:48 -0800 (PST) Received: from mail-vc0-f170.google.com (mail-vc0-f170.google.com [209.85.220.170]) by mx.google.com with ESMTPS id uq6si1382145vcb.75.2014.01.15.01.10.48 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 15 Jan 2014 01:10:48 -0800 (PST) Received-SPF: neutral (google.com: 209.85.220.170 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.170; Received: by mail-vc0-f170.google.com with SMTP id hu8so304397vcb.1 for ; Wed, 15 Jan 2014 01:10:48 -0800 (PST) X-Received: by 10.58.80.103 with SMTP id q7mr585739vex.33.1389777048598; Wed, 15 Jan 2014 01:10:48 -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.59.13.131 with SMTP id ey3csp259376ved; Wed, 15 Jan 2014 01:10:48 -0800 (PST) X-Received: by 10.180.149.238 with SMTP id ud14mr1117104wib.16.1389777047687; Wed, 15 Jan 2014 01:10:47 -0800 (PST) Received: from mail-wi0-f179.google.com (mail-wi0-f179.google.com [209.85.212.179]) by mx.google.com with ESMTPS id cc14si2932472wib.54.2014.01.15.01.10.47 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 15 Jan 2014 01:10:47 -0800 (PST) Received-SPF: neutral (google.com: 209.85.212.179 is neither permitted nor denied by best guess record for domain of linus.walleij@linaro.org) client-ip=209.85.212.179; Received: by mail-wi0-f179.google.com with SMTP id hr1so1863121wib.12 for ; Wed, 15 Jan 2014 01:10:47 -0800 (PST) X-Received: by 10.180.93.196 with SMTP id cw4mr1093235wib.39.1389777047072; Wed, 15 Jan 2014 01:10:47 -0800 (PST) Received: from localhost.localdomain ([85.235.11.236]) by mx.google.com with ESMTPSA id z2sm5608996wiy.11.2014.01.15.01.10.45 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 15 Jan 2014 01:10:46 -0800 (PST) From: Linus Walleij To: linux-kernel@vger.kernel.org, Barry Song Cc: linux-gpio@vger.kernel.org, Linus Walleij Subject: [PATCH] pinctrl: sirf: lock IRQs when starting them Date: Wed, 15 Jan 2014 10:10:42 +0100 Message-Id: <1389777042-2363-1-git-send-email-linus.walleij@linaro.org> X-Mailer: git-send-email 1.8.4.2 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.170 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. Also assign the gpio_chip.dev pointer to be used for error messages. Cc: Barry Song Signed-off-by: Linus Walleij --- Hi Barry, it's be great if you could test this so I can just add it to the v3.14 series. --- drivers/pinctrl/sirf/pinctrl-sirf.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/drivers/pinctrl/sirf/pinctrl-sirf.c b/drivers/pinctrl/sirf/pinctrl-sirf.c index b637f5ab022c..a0d6152701cd 100644 --- a/drivers/pinctrl/sirf/pinctrl-sirf.c +++ b/drivers/pinctrl/sirf/pinctrl-sirf.c @@ -594,12 +594,34 @@ static int sirfsoc_gpio_irq_type(struct irq_data *d, unsigned type) return 0; } +static unsigned int sirfsoc_gpio_irq_startup(struct irq_data *d) +{ + struct sirfsoc_gpio_bank *bank = irq_data_get_irq_chip_data(d); + + if (gpio_lock_as_irq(&bank->chip.gc, d->hwirq)) + dev_err(bank->chip.gc.dev, + "unable to lock HW IRQ %lu for IRQ\n", + d->hwirq); + sirfsoc_gpio_irq_unmask(d); + return 0; +} + +static void sirfsoc_gpio_irq_shutdown(struct irq_data *d) +{ + struct sirfsoc_gpio_bank *bank = irq_data_get_irq_chip_data(d); + + sirfsoc_gpio_irq_mask(d); + gpio_unlock_as_irq(&bank->chip.gc, d->hwirq); +} + static struct irq_chip sirfsoc_irq_chip = { .name = "sirf-gpio-irq", .irq_ack = sirfsoc_gpio_irq_ack, .irq_mask = sirfsoc_gpio_irq_mask, .irq_unmask = sirfsoc_gpio_irq_unmask, .irq_set_type = sirfsoc_gpio_irq_type, + .irq_startup = sirfsoc_gpio_irq_startup, + .irq_shutdown = sirfsoc_gpio_irq_shutdown, }; static void sirfsoc_gpio_handle_irq(unsigned int irq, struct irq_desc *desc) @@ -877,6 +899,7 @@ static int sirfsoc_gpio_probe(struct device_node *np) bank->chip.gc.of_node = np; bank->chip.gc.of_xlate = sirfsoc_gpio_of_xlate; bank->chip.gc.of_gpio_n_cells = 2; + bank->chip.gc.dev = &pdev->dev; bank->chip.regs = regs; bank->id = i; bank->is_marco = is_marco;