From patchwork Tue Nov 26 13:23:47 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 21777 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ob0-f200.google.com (mail-ob0-f200.google.com [209.85.214.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 2656F202E0 for ; Tue, 26 Nov 2013 13:23:56 +0000 (UTC) Received: by mail-ob0-f200.google.com with SMTP id wm4sf18350134obc.11 for ; Tue, 26 Nov 2013 05:23:56 -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=V8ZozJGWrt80u+/b4r3dhO0YrQxgYKWGxXc6y77/Qws=; b=Re40IBnixPhUoWHVDpQFoFC9ZOVc2avhuY2fNnvJGmrBMnDZcNoDm4QCBBeDZoUojs jpfe948ngaElD7hZ0JvlsPsHqqkuzCUlbbgtBzhelHqSv4jnkeFO7Iy6fDzDvAs8aMR4 ritOR4zfLemdc4KxmFoA9IiDRUh7CAuzcGGmkPJxhX01sSFFYtsNXrV8UvwRNdQdM/Qj nb31xC04ngN628vwblVz78LS5qGhUYVGAGYeLCcm5nXt20MGF3bk3YEgApoCiTyQNUu6 VGKIN/JeThkNFvPIKIVnjLGoJxS2XkVrrlboL7+caCOKcqvnMJbuIn/jCoErZty5zRQd rUkw== X-Gm-Message-State: ALoCoQklpJQV0UdcTrvw+wn/ZzbmSFxk1z9KNWYqdv6xEVmSidqJK9d6L86ouRBNywbKfFzq8V+s X-Received: by 10.182.87.2 with SMTP id t2mr11227236obz.2.1385472235912; Tue, 26 Nov 2013 05:23:55 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.74.35 with SMTP id q3ls2562620qev.50.gmail; Tue, 26 Nov 2013 05:23:55 -0800 (PST) X-Received: by 10.220.184.70 with SMTP id cj6mr5626718vcb.23.1385472235789; Tue, 26 Nov 2013 05:23:55 -0800 (PST) Received: from mail-vb0-f53.google.com (mail-vb0-f53.google.com [209.85.212.53]) by mx.google.com with ESMTPS id z9si19529443veh.32.2013.11.26.05.23.55 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 26 Nov 2013 05:23:55 -0800 (PST) Received-SPF: neutral (google.com: 209.85.212.53 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.53; Received: by mail-vb0-f53.google.com with SMTP id g10so3959406vbg.12 for ; Tue, 26 Nov 2013 05:23:55 -0800 (PST) X-Received: by 10.58.108.196 with SMTP id hm4mr4184024veb.28.1385472235699; Tue, 26 Nov 2013 05:23:55 -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 u4csp212243vcz; Tue, 26 Nov 2013 05:23:55 -0800 (PST) X-Received: by 10.112.210.197 with SMTP id mw5mr4441257lbc.42.1385472234430; Tue, 26 Nov 2013 05:23:54 -0800 (PST) Received: from mail-la0-f50.google.com (mail-la0-f50.google.com [209.85.215.50]) by mx.google.com with ESMTPS id yg9si17455785lbb.68.2013.11.26.05.23.53 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 26 Nov 2013 05:23:54 -0800 (PST) Received-SPF: neutral (google.com: 209.85.215.50 is neither permitted nor denied by best guess record for domain of linus.walleij@linaro.org) client-ip=209.85.215.50; Received: by mail-la0-f50.google.com with SMTP id el20so4354902lab.9 for ; Tue, 26 Nov 2013 05:23:53 -0800 (PST) X-Received: by 10.152.116.7 with SMTP id js7mr26374402lab.11.1385472233656; Tue, 26 Nov 2013 05:23:53 -0800 (PST) Received: from localhost.localdomain ([85.235.11.236]) by mx.google.com with ESMTPSA id z3sm34701721lag.10.2013.11.26.05.23.51 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 26 Nov 2013 05:23:52 -0800 (PST) From: Linus Walleij To: linux-gpio@vger.kernel.org Cc: Alexandre Courbot , Linus Walleij , Haojian Zhuang , Baruch Siach , Deepak Sikri Subject: [PATCH 1/3] gpio: pl061: lock IRQs when starting them Date: Tue, 26 Nov 2013 14:23:47 +0100 Message-Id: <1385472227-25956-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.53 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: Haojian Zhuang Cc: Baruch Siach Cc: Deepak Sikri Signed-off-by: Linus Walleij --- drivers/gpio/gpio-pl061.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/drivers/gpio/gpio-pl061.c b/drivers/gpio/gpio-pl061.c index f22f7f3e2e53..1c37c97acc76 100644 --- a/drivers/gpio/gpio-pl061.c +++ b/drivers/gpio/gpio-pl061.c @@ -231,11 +231,33 @@ static void pl061_irq_unmask(struct irq_data *d) spin_unlock(&chip->lock); } +static unsigned int pl061_irq_startup(struct irq_data *d) +{ + struct pl061_gpio *chip = irq_data_get_irq_chip_data(d); + + if (gpio_lock_as_irq(&chip->gc, irqd_to_hwirq(d))) + dev_err(chip->gc.dev, + "unable to lock HW IRQ %lu for IRQ\n", + irqd_to_hwirq(d)); + pl061_irq_unmask(d); + return 0; +} + +static void pl061_irq_shutdown(struct irq_data *d) +{ + struct pl061_gpio *chip = irq_data_get_irq_chip_data(d); + + pl061_irq_mask(d); + gpio_unlock_as_irq(&chip->gc, irqd_to_hwirq(d)); +} + static struct irq_chip pl061_irqchip = { .name = "pl061 gpio", .irq_mask = pl061_irq_mask, .irq_unmask = pl061_irq_unmask, .irq_set_type = pl061_irq_type, + .irq_startup = pl061_irq_startup, + .irq_shutdown = pl061_irq_shutdown, }; static int pl061_irq_map(struct irq_domain *d, unsigned int irq,