lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Mon,  3 Mar 2014 11:05:56 +0100
From:	Jean-Jacques Hiblot <jjhiblot@...phandler.com>
To:	nicolas.ferre@...el.com
Cc:	plagnioj@...osoft.com, b.brezillon@...rkiz.com,
	linux-kernel@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
	gregory.clement@...e-electrons.com, devicetree@...r.kernel.org,
	thomas.petazzoni@...e-electrons.com,
	alexandre.belloni@...e-electrons.com,
	Jean-Jacques Hiblot <jjhiblot@...phandler.com>
Subject: [PATCH v5 3/9] at91: pinctrl: don't request GPIOs used for interrupts but lock them as IRQ

During the xlate stage of the DT interrupt parsing, the at91 pinctrl driver
requests the GPIOs that are described as interrupt sources. This prevents a
driver to request the gpio later to get its electrical value.
This patch replaces the gpio_request with a gpio_lock_as_irq to prevent the
gpio to be set as an ouput while allowing a subsequent gpio_request to succeed

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@...phandler.com>
---
 drivers/pinctrl/pinctrl-at91.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/pinctrl/pinctrl-at91.c b/drivers/pinctrl/pinctrl-at91.c
index d990e33..db55b96 100644
--- a/drivers/pinctrl/pinctrl-at91.c
+++ b/drivers/pinctrl/pinctrl-at91.c
@@ -1478,18 +1478,17 @@ static int at91_gpio_irq_domain_xlate(struct irq_domain *d,
 {
 	struct at91_gpio_chip *at91_gpio = d->host_data;
 	int ret;
-	int pin = at91_gpio->chip.base + intspec[0];
 
 	if (WARN_ON(intsize < 2))
 		return -EINVAL;
 	*out_hwirq = intspec[0];
 	*out_type = intspec[1] & IRQ_TYPE_SENSE_MASK;
 
-	ret = gpio_request(pin, ctrlr->full_name);
+	ret = gpio_lock_as_irq(&at91_gpio->chip, intspec[0]);
 	if (ret)
 		return ret;
 
-	ret = gpio_direction_input(pin);
+	ret = at91_gpio_direction_input(&at91_gpio->chip, intspec[0]);
 	if (ret)
 		return ret;
 
-- 
1.9.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ