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-next>] [day] [month] [year] [list]
Message-Id: <20231121124844.872238-1-lukas.funke-oss@weidmueller.com>
Date:   Tue, 21 Nov 2023 13:48:44 +0100
From:   Lukas Funke <lukas.funke-oss@...dmueller.com>
To:     MyungJoo Ham <myungjoo.ham@...sung.com>,
        Chanwoo Choi <cw00.choi@...sung.com>
Cc:     Lukas Funke <Lukas.Funke@...dmueller.com>,
        Lukas Funke <lukas.funke@...dmueller.com>,
        linux-kernel@...r.kernel.org
Subject: [PATCH] extcon: usbc-tusb320: Set interrupt polarity based on device-tree

From: Lukas Funke <Lukas.Funke@...dmueller.com>

Remove 'IRQF_TRIGGER_FALLING' request which is not allowed on
every interrupt controller (i.e. arm64 GIC). Replace flag by a 
request that depends on the actual device-tree setting.

Signed-off-by: Lukas Funke <lukas.funke@...dmueller.com>
---
 drivers/extcon/extcon-usbc-tusb320.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/drivers/extcon/extcon-usbc-tusb320.c b/drivers/extcon/extcon-usbc-tusb320.c
index 4d08c2123e59..f7d699a90f72 100644
--- a/drivers/extcon/extcon-usbc-tusb320.c
+++ b/drivers/extcon/extcon-usbc-tusb320.c
@@ -515,6 +515,8 @@ static int tusb320_probe(struct i2c_client *client)
 	const void *match_data;
 	unsigned int revision;
 	int ret;
+	int irq_pol;
+	struct irq_data *irq_d;
 
 	priv = devm_kzalloc(&client->dev, sizeof(*priv), GFP_KERNEL);
 	if (!priv)
@@ -568,9 +570,17 @@ static int tusb320_probe(struct i2c_client *client)
 		 */
 		tusb320_state_update_handler(priv, true);
 
+	irq_d = irq_get_irq_data(client->irq);
+	if (!irq_d) {
+		dev_err(&client->dev, "Invalid IRQ: %d\n", client->irq);
+		return -ENODEV;
+	}
+
+	irq_pol = irqd_get_trigger_type(irq_d);
+
 	ret = devm_request_threaded_irq(priv->dev, client->irq, NULL,
 					tusb320_irq_handler,
-					IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
+					IRQF_ONESHOT | irq_pol,
 					client->name, priv);
 	if (ret)
 		tusb320_typec_remove(priv);
-- 
2.30.2

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ