* RE: [PATCH v2] extcon: usbc-tusb320: Set interrupt polarity based on device-tree
2023-11-22 8:07 ` [PATCH v2] " Lukas Funke
@ 2023-12-04 12:09 ` Chanwoo Choi
2023-12-04 12:32 ` Chanwoo Choi
2023-12-04 12:49 ` Chanwoo Choi
2 siblings, 0 replies; 8+ messages in thread
From: Chanwoo Choi @ 2023-12-04 12:09 UTC (permalink / raw)
To: 'Lukas Funke', lkp, 'MyungJoo Ham'
Cc: Lukas.Funke, linux-kernel, oe-kbuild-all, 'Lukas Funke'
> -----Original Message-----
> From: Lukas Funke <lukas.funke-oss@weidmueller.com>
> Sent: Wednesday, November 22, 2023 5:08 PM
> 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
>
> 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
Applied it. Thanks.
Best Regards,
Chanwoo Choi
^ permalink raw reply [flat|nested] 8+ messages in thread
* RE: [PATCH v2] extcon: usbc-tusb320: Set interrupt polarity based on device-tree
2023-11-22 8:07 ` [PATCH v2] " Lukas Funke
2023-12-04 12:09 ` Chanwoo Choi
@ 2023-12-04 12:32 ` Chanwoo Choi
2023-12-04 12:49 ` Chanwoo Choi
2 siblings, 0 replies; 8+ messages in thread
From: Chanwoo Choi @ 2023-12-04 12:32 UTC (permalink / raw)
To: 'Lukas Funke', lkp, 'MyungJoo Ham'
Cc: Lukas.Funke, linux-kernel, oe-kbuild-all, 'Lukas Funke'
> -----Original Message-----
> From: Chanwoo Choi <cw00.choi@samsung.com>
> Sent: Monday, December 4, 2023 9:09 PM
> To: 'Lukas Funke' <lukas.funke-oss@weidmueller.com>; 'lkp@intel.com'
> <lkp@intel.com>; 'MyungJoo Ham' <myungjoo.ham@samsung.com>
> Cc: 'Lukas.Funke@weidmueller.com' <Lukas.Funke@weidmueller.com>; 'linux-
> kernel@vger.kernel.org' <linux-kernel@vger.kernel.org>; 'oe-kbuild-
> all@lists.linux.dev' <oe-kbuild-all@lists.linux.dev>; 'Lukas Funke'
> <lukas.funke@weidmueller.com>
> Subject: RE: [PATCH v2] extcon: usbc-tusb320: Set interrupt polarity based
> on device-tree
>
>
>
> > -----Original Message-----
> > From: Lukas Funke <lukas.funke-oss@weidmueller.com>
> > Sent: Wednesday, November 22, 2023 5:08 PM
> > 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
> >
> > 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
>
>
> Applied it. Thanks.
>
>
> Best Regards,
> Chanwoo Choi
In order to remove the build warning, I changed the variable type
of 'irq_pol' as following:
index 140ab28dbd36..cec1889549a6 100644
--- a/drivers/extcon/extcon-usbc-tusb320.c
+++ b/drivers/extcon/extcon-usbc-tusb320.c
@@ -516,7 +516,7 @@ static int tusb320_probe(struct i2c_client *client)
const void *match_data;
unsigned int revision;
int ret;
- int irq_pol;
+ u32 irq_pol;
struct irq_data *irq_d;
priv = devm_kzalloc(&client->dev, sizeof(*priv), GFP_KERNEL);
Best Regards,
Chanwoo Choi
^ permalink raw reply related [flat|nested] 8+ messages in thread
* RE: [PATCH v2] extcon: usbc-tusb320: Set interrupt polarity based on device-tree
2023-11-22 8:07 ` [PATCH v2] " Lukas Funke
2023-12-04 12:09 ` Chanwoo Choi
2023-12-04 12:32 ` Chanwoo Choi
@ 2023-12-04 12:49 ` Chanwoo Choi
2023-12-04 13:22 ` Lukas Funke
2 siblings, 1 reply; 8+ messages in thread
From: Chanwoo Choi @ 2023-12-04 12:49 UTC (permalink / raw)
To: 'Lukas Funke', lkp, 'MyungJoo Ham'
Cc: Lukas.Funke, linux-kernel, oe-kbuild-all, 'Lukas Funke'
> -----Original Message-----
> From: Chanwoo Choi <cw00.choi@samsung.com>
> Sent: Monday, December 4, 2023 9:33 PM
> To: 'Lukas Funke' <lukas.funke-oss@weidmueller.com>; 'lkp@intel.com'
> <lkp@intel.com>; 'MyungJoo Ham' <myungjoo.ham@samsung.com>
> Cc: 'Lukas.Funke@weidmueller.com' <Lukas.Funke@weidmueller.com>; 'linux-
> kernel@vger.kernel.org' <linux-kernel@vger.kernel.org>; 'oe-kbuild-
> all@lists.linux.dev' <oe-kbuild-all@lists.linux.dev>; 'Lukas Funke'
> <lukas.funke@weidmueller.com>
> Subject: RE: [PATCH v2] extcon: usbc-tusb320: Set interrupt polarity based
> on device-tree
>
>
>
> > -----Original Message-----
> > From: Chanwoo Choi <cw00.choi@samsung.com>
> > Sent: Monday, December 4, 2023 9:09 PM
> > To: 'Lukas Funke' <lukas.funke-oss@weidmueller.com>; 'lkp@intel.com'
> > <lkp@intel.com>; 'MyungJoo Ham' <myungjoo.ham@samsung.com>
> > Cc: 'Lukas.Funke@weidmueller.com' <Lukas.Funke@weidmueller.com>;
> > 'linux- kernel@vger.kernel.org' <linux-kernel@vger.kernel.org>;
> > 'oe-kbuild- all@lists.linux.dev' <oe-kbuild-all@lists.linux.dev>; 'Lukas
> Funke'
> > <lukas.funke@weidmueller.com>
> > Subject: RE: [PATCH v2] extcon: usbc-tusb320: Set interrupt polarity
> > based on device-tree
> >
> >
> >
> > > -----Original Message-----
> > > From: Lukas Funke <lukas.funke-oss@weidmueller.com>
> > > Sent: Wednesday, November 22, 2023 5:08 PM
> > > 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
> > >
> > > 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
> >
> >
> > Applied it. Thanks.
> >
> >
> > Best Regards,
> > Chanwoo Choi
>
>
> In order to remove the build warning, I changed the variable type
> of 'irq_pol' as following:
>
>
> index 140ab28dbd36..cec1889549a6 100644
> --- a/drivers/extcon/extcon-usbc-tusb320.c
> +++ b/drivers/extcon/extcon-usbc-tusb320.c
> @@ -516,7 +516,7 @@ static int tusb320_probe(struct i2c_client *client)
> const void *match_data;
> unsigned int revision;
> int ret;
> - int irq_pol;
> + u32 irq_pol;
> struct irq_data *irq_d;
>
> priv = devm_kzalloc(&client->dev, sizeof(*priv), GFP_KERNEL);
>
> Best Regards,
> Chanwoo Choi
How about changing this patch as following?
When irq_getg_irq_data returns NULL, just use the IRQF_TRIGGER_FALLING flag
to support previous version. Because I didn't' check the all use-case
of this driver on DT. I think that better to keep the IRQF_TRIGGER_FALLING
flag
when irq_d is NULL.
diff --git a/drivers/extcon/extcon-usbc-tusb320.c
b/drivers/extcon/extcon-usbc-tusb320.c
index 4d08c2123e59..bd5ed8dd8fdd 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;
+ u32 irq_trigger_type;
+ struct irq_data *irq_d;
priv = devm_kzalloc(&client->dev, sizeof(*priv), GFP_KERNEL);
if (!priv)
@@ -568,9 +571,15 @@ 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)
+ irq_trigger_type = irqd_get_trigger_type(irq_d);
+ else
+ irq_trigger_type = IRQF_TRIGGER_FALLING;
+
ret = devm_request_threaded_irq(priv->dev, client->irq, NULL,
tusb320_irq_handler,
- IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
+ IRQF_ONESHOT | irq_trigger_type,
client->name, priv);
if (ret)
tusb320_typec_remove(priv);
--
2.25.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH v2] extcon: usbc-tusb320: Set interrupt polarity based on device-tree
2023-12-04 12:49 ` Chanwoo Choi
@ 2023-12-04 13:22 ` Lukas Funke
0 siblings, 0 replies; 8+ messages in thread
From: Lukas Funke @ 2023-12-04 13:22 UTC (permalink / raw)
To: Chanwoo Choi, lkp, 'MyungJoo Ham'
Cc: Lukas.Funke, linux-kernel, oe-kbuild-all
Hi Chanwoo,
On 04.12.2023 13:49, Chanwoo Choi wrote:
>
>
>> -----Original Message-----
>> From: Chanwoo Choi <cw00.choi@samsung.com>
>> Sent: Monday, December 4, 2023 9:33 PM
>> To: 'Lukas Funke' <lukas.funke-oss@weidmueller.com>; 'lkp@intel.com'
>> <lkp@intel.com>; 'MyungJoo Ham' <myungjoo.ham@samsung.com>
>> Cc: 'Lukas.Funke@weidmueller.com' <Lukas.Funke@weidmueller.com>; 'linux-
>> kernel@vger.kernel.org' <linux-kernel@vger.kernel.org>; 'oe-kbuild-
>> all@lists.linux.dev' <oe-kbuild-all@lists.linux.dev>; 'Lukas Funke'
>> <lukas.funke@weidmueller.com>
>> Subject: RE: [PATCH v2] extcon: usbc-tusb320: Set interrupt polarity based
>> on device-tree
>>
>>
>>
>>> -----Original Message-----
>>> From: Chanwoo Choi <cw00.choi@samsung.com>
>>> Sent: Monday, December 4, 2023 9:09 PM
>>> To: 'Lukas Funke' <lukas.funke-oss@weidmueller.com>; 'lkp@intel.com'
>>> <lkp@intel.com>; 'MyungJoo Ham' <myungjoo.ham@samsung.com>
>>> Cc: 'Lukas.Funke@weidmueller.com' <Lukas.Funke@weidmueller.com>;
>>> 'linux- kernel@vger.kernel.org' <linux-kernel@vger.kernel.org>;
>>> 'oe-kbuild- all@lists.linux.dev' <oe-kbuild-all@lists.linux.dev>; 'Lukas
>> Funke'
>>> <lukas.funke@weidmueller.com>
>>> Subject: RE: [PATCH v2] extcon: usbc-tusb320: Set interrupt polarity
>>> based on device-tree
>>>
>>>
>>>
>>>> -----Original Message-----
>>>> From: Lukas Funke <lukas.funke-oss@weidmueller.com>
>>>> Sent: Wednesday, November 22, 2023 5:08 PM
>>>> 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
>>>>
>>>> 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
>>>
>>>
>>> Applied it. Thanks.
>>>
>>>
>>> Best Regards,
>>> Chanwoo Choi
>>
>>
>> In order to remove the build warning, I changed the variable type
>> of 'irq_pol' as following:
>>
>>
>> index 140ab28dbd36..cec1889549a6 100644
>> --- a/drivers/extcon/extcon-usbc-tusb320.c
>> +++ b/drivers/extcon/extcon-usbc-tusb320.c
>> @@ -516,7 +516,7 @@ static int tusb320_probe(struct i2c_client *client)
>> const void *match_data;
>> unsigned int revision;
>> int ret;
>> - int irq_pol;
>> + u32 irq_pol;
>> struct irq_data *irq_d;
>>
>> priv = devm_kzalloc(&client->dev, sizeof(*priv), GFP_KERNEL);
>>
>> Best Regards,
>> Chanwoo Choi
>
>
> How about changing this patch as following?
> When irq_getg_irq_data returns NULL, just use the IRQF_TRIGGER_FALLING flag
> to support previous version. Because I didn't' check the all use-case
> of this driver on DT. I think that better to keep the IRQF_TRIGGER_FALLING
> flag
> when irq_d is NULL.
Good call. Just one minor change to make the 'else' obsolete (see below).
Best regards
Lukas Funke
>
>
> diff --git a/drivers/extcon/extcon-usbc-tusb320.c
> b/drivers/extcon/extcon-usbc-tusb320.c
> index 4d08c2123e59..bd5ed8dd8fdd 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;
+ u32 irq_trigger_type = IRQF_TRIGGER_FALLING;
> + struct irq_data *irq_d;
>
> priv = devm_kzalloc(&client->dev, sizeof(*priv), GFP_KERNEL);
> if (!priv)
> @@ -568,9 +571,15 @@ 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)
> + irq_trigger_type = 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_trigger_type,
> client->name, priv);
> if (ret)
> tusb320_typec_remove(priv);
^ permalink raw reply [flat|nested] 8+ messages in thread