All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lukas Funke <lukas.funke-oss@weidmueller.com>
To: lkp@intel.com, MyungJoo Ham <myungjoo.ham@samsung.com>,
	Chanwoo Choi <cw00.choi@samsung.com>
Cc: Lukas.Funke@weidmueller.com, linux-kernel@vger.kernel.org,
	lukas.funke-oss@weidmueller.com, oe-kbuild-all@lists.linux.dev,
	Lukas Funke <lukas.funke@weidmueller.com>
Subject: [PATCH v2] extcon: usbc-tusb320: Set interrupt polarity based on device-tree
Date: Wed, 22 Nov 2023 09:07:48 +0100	[thread overview]
Message-ID: <20231122080749.947682-1-lukas.funke-oss@weidmueller.com> (raw)
In-Reply-To: <202311221355.yxYpTIw3-lkp@intel.com>

From: Lukas Funke <Lukas.Funke@weidmueller.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.

Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202311221355.yxYpTIw3-lkp@intel.com/
Signed-off-by: Lukas Funke <lukas.funke@weidmueller.com>
---
 drivers/extcon/extcon-usbc-tusb320.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/drivers/extcon/extcon-usbc-tusb320.c b/drivers/extcon/extcon-usbc-tusb320.c
index 4d08c2123e59..140ab28dbd36 100644
--- a/drivers/extcon/extcon-usbc-tusb320.c
+++ b/drivers/extcon/extcon-usbc-tusb320.c
@@ -17,6 +17,7 @@
 #include <linux/usb/typec.h>
 #include <linux/usb/typec_altmode.h>
 #include <linux/usb/role.h>
+#include <linux/irq.h>
 
 #define TUSB320_REG8				0x8
 #define TUSB320_REG8_CURRENT_MODE_ADVERTISE	GENMASK(7, 6)
@@ -515,6 +516,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 +571,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


  reply	other threads:[~2023-11-22  8:08 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-21 12:48 [PATCH] extcon: usbc-tusb320: Set interrupt polarity based on device-tree Lukas Funke
2023-11-22  0:54 ` kernel test robot
2023-11-22  7:19 ` kernel test robot
2023-11-22  8:07   ` Lukas Funke [this message]
2023-12-04 12:09     ` [PATCH v2] " Chanwoo Choi
2023-12-04 12:32     ` Chanwoo Choi
2023-12-04 12:49     ` Chanwoo Choi
2023-12-04 13:22       ` Lukas Funke
2023-11-23  1:54 ` [PATCH] " kernel test robot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231122080749.947682-1-lukas.funke-oss@weidmueller.com \
    --to=lukas.funke-oss@weidmueller.com \
    --cc=Lukas.Funke@weidmueller.com \
    --cc=cw00.choi@samsung.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=myungjoo.ham@samsung.com \
    --cc=oe-kbuild-all@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.