* [PATCH] extcon: usbc-tusb320: Call the Type-C IRQ handler only if a port is registered
@ 2022-11-07 14:48 Yassine Oudjana
2022-11-07 14:51 ` Marek Vasut
0 siblings, 1 reply; 4+ messages in thread
From: Yassine Oudjana @ 2022-11-07 14:48 UTC (permalink / raw)
To: MyungJoo Ham, Chanwoo Choi, Alvin Šipraga, Heikki Krogerus,
Marek Vasut, Greg Kroah-Hartman
Cc: linux-usb, linux-kernel, Yassine Oudjana, Yassine Oudjana
From: Yassine Oudjana <y.oudjana@protonmail.com>
Commit bf7571c00dca ("extcon: usbc-tusb320: Add USB TYPE-C support")
added an optional Type-C interface to the driver but missed to check
if it is in use when calling the IRQ handler. This causes an oops on
devices currently using the old extcon interface. Check if a Type-C
port is registered before calling the Type-C IRQ handler.
Fixes: bf7571c00dca ("extcon: usbc-tusb320: Add USB TYPE-C support")
Signed-off-by: Yassine Oudjana <y.oudjana@protonmail.com>
---
drivers/extcon/extcon-usbc-tusb320.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/drivers/extcon/extcon-usbc-tusb320.c b/drivers/extcon/extcon-usbc-tusb320.c
index 41041ff0fadb..037bc11b2a48 100644
--- a/drivers/extcon/extcon-usbc-tusb320.c
+++ b/drivers/extcon/extcon-usbc-tusb320.c
@@ -327,7 +327,14 @@ static irqreturn_t tusb320_irq_handler(int irq, void *dev_id)
return IRQ_NONE;
tusb320_extcon_irq_handler(priv, reg);
- tusb320_typec_irq_handler(priv, reg);
+
+ /*
+ * Type-C support is optional for backward compatibility.
+ * Only call the Type-C handler if a port had been registered
+ * previously.
+ */
+ if (priv->port)
+ tusb320_typec_irq_handler(priv, reg);
regmap_write(priv->regmap, TUSB320_REG9, reg);
--
2.38.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] extcon: usbc-tusb320: Call the Type-C IRQ handler only if a port is registered
2022-11-07 14:48 [PATCH] extcon: usbc-tusb320: Call the Type-C IRQ handler only if a port is registered Yassine Oudjana
@ 2022-11-07 14:51 ` Marek Vasut
2022-11-07 15:02 ` Yassine Oudjana
0 siblings, 1 reply; 4+ messages in thread
From: Marek Vasut @ 2022-11-07 14:51 UTC (permalink / raw)
To: Yassine Oudjana, MyungJoo Ham, Chanwoo Choi, Alvin Šipraga,
Heikki Krogerus, Greg Kroah-Hartman
Cc: linux-usb, linux-kernel, Yassine Oudjana
On 11/7/22 15:48, Yassine Oudjana wrote:
> From: Yassine Oudjana <y.oudjana@protonmail.com>
>
> Commit bf7571c00dca ("extcon: usbc-tusb320: Add USB TYPE-C support")
> added an optional Type-C interface to the driver but missed to check
> if it is in use when calling the IRQ handler. This causes an oops on
> devices currently using the old extcon interface. Check if a Type-C
> port is registered before calling the Type-C IRQ handler.
>
> Fixes: bf7571c00dca ("extcon: usbc-tusb320: Add USB TYPE-C support")
> Signed-off-by: Yassine Oudjana <y.oudjana@protonmail.com>
> ---
> drivers/extcon/extcon-usbc-tusb320.c | 9 ++++++++-
> 1 file changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/extcon/extcon-usbc-tusb320.c b/drivers/extcon/extcon-usbc-tusb320.c
> index 41041ff0fadb..037bc11b2a48 100644
> --- a/drivers/extcon/extcon-usbc-tusb320.c
> +++ b/drivers/extcon/extcon-usbc-tusb320.c
> @@ -327,7 +327,14 @@ static irqreturn_t tusb320_irq_handler(int irq, void *dev_id)
> return IRQ_NONE;
>
> tusb320_extcon_irq_handler(priv, reg);
> - tusb320_typec_irq_handler(priv, reg);
> +
> + /*
> + * Type-C support is optional for backward compatibility.
It's the other way around, extcon is the legacy, type-c is the new, right ?
> + * Only call the Type-C handler if a port had been registered
> + * previously.
> + */
> + if (priv->port)
> + tusb320_typec_irq_handler(priv, reg);
>
> regmap_write(priv->regmap, TUSB320_REG9, reg);
Reviewed-by: Marek Vasut <marex@denx.de>
Thanks!
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] extcon: usbc-tusb320: Call the Type-C IRQ handler only if a port is registered
2022-11-07 14:51 ` Marek Vasut
@ 2022-11-07 15:02 ` Yassine Oudjana
2022-11-07 15:25 ` Marek Vasut
0 siblings, 1 reply; 4+ messages in thread
From: Yassine Oudjana @ 2022-11-07 15:02 UTC (permalink / raw)
To: Marek Vasut
Cc: MyungJoo Ham, Chanwoo Choi, Alvin Šipraga, Heikki Krogerus,
Greg Kroah-Hartman, linux-usb, linux-kernel, Yassine Oudjana
On Mon, Nov 7 2022 at 15:51:55 +01:00:00, Marek Vasut <marex@denx.de>
wrote:
> On 11/7/22 15:48, Yassine Oudjana wrote:
>> From: Yassine Oudjana <y.oudjana@protonmail.com>
>>
>> Commit bf7571c00dca ("extcon: usbc-tusb320: Add USB TYPE-C support")
>> added an optional Type-C interface to the driver but missed to check
>> if it is in use when calling the IRQ handler. This causes an oops on
>> devices currently using the old extcon interface. Check if a Type-C
>> port is registered before calling the Type-C IRQ handler.
>>
>> Fixes: bf7571c00dca ("extcon: usbc-tusb320: Add USB TYPE-C support")
>> Signed-off-by: Yassine Oudjana <y.oudjana@protonmail.com>
>> ---
>> drivers/extcon/extcon-usbc-tusb320.c | 9 ++++++++-
>> 1 file changed, 8 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/extcon/extcon-usbc-tusb320.c
>> b/drivers/extcon/extcon-usbc-tusb320.c
>> index 41041ff0fadb..037bc11b2a48 100644
>> --- a/drivers/extcon/extcon-usbc-tusb320.c
>> +++ b/drivers/extcon/extcon-usbc-tusb320.c
>> @@ -327,7 +327,14 @@ static irqreturn_t tusb320_irq_handler(int irq,
>> void *dev_id)
>> return IRQ_NONE;
>> \x7f tusb320_extcon_irq_handler(priv, reg);
>> - tusb320_typec_irq_handler(priv, reg);
>> +
>> + /*
>> + * Type-C support is optional for backward compatibility.
>
> It's the other way around, extcon is the legacy, type-c is the new,
> right ?
Type-C is the new one, yes. This comment is somewhat similar to the one
in tusb320_typec_probe():
/* The Type-C connector is optional, for backward compatibility. */
Perhaps a better way to say this in both comments would be "to
maintain" instead of "for".
>
>> + * Only call the Type-C handler if a port had been registered
>> + * previously.
>> + */
>> + if (priv->port)
>> + tusb320_typec_irq_handler(priv, reg);
>> \x7f regmap_write(priv->regmap, TUSB320_REG9, reg);
>
> Reviewed-by: Marek Vasut <marex@denx.de>
>
> Thanks!
Thanks for the quick review!
Yassine
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] extcon: usbc-tusb320: Call the Type-C IRQ handler only if a port is registered
2022-11-07 15:02 ` Yassine Oudjana
@ 2022-11-07 15:25 ` Marek Vasut
0 siblings, 0 replies; 4+ messages in thread
From: Marek Vasut @ 2022-11-07 15:25 UTC (permalink / raw)
To: Yassine Oudjana
Cc: MyungJoo Ham, Chanwoo Choi, Alvin Šipraga, Heikki Krogerus,
Greg Kroah-Hartman, linux-usb, linux-kernel, Yassine Oudjana
On 11/7/22 16:02, Yassine Oudjana wrote:
>
> On Mon, Nov 7 2022 at 15:51:55 +01:00:00, Marek Vasut <marex@denx.de>
> wrote:
>> On 11/7/22 15:48, Yassine Oudjana wrote:
>>> From: Yassine Oudjana <y.oudjana@protonmail.com>
>>>
>>> Commit bf7571c00dca ("extcon: usbc-tusb320: Add USB TYPE-C support")
>>> added an optional Type-C interface to the driver but missed to check
>>> if it is in use when calling the IRQ handler. This causes an oops on
>>> devices currently using the old extcon interface. Check if a Type-C
>>> port is registered before calling the Type-C IRQ handler.
>>>
>>> Fixes: bf7571c00dca ("extcon: usbc-tusb320: Add USB TYPE-C support")
>>> Signed-off-by: Yassine Oudjana <y.oudjana@protonmail.com>
>>> ---
>>> drivers/extcon/extcon-usbc-tusb320.c | 9 ++++++++-
>>> 1 file changed, 8 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/extcon/extcon-usbc-tusb320.c
>>> b/drivers/extcon/extcon-usbc-tusb320.c
>>> index 41041ff0fadb..037bc11b2a48 100644
>>> --- a/drivers/extcon/extcon-usbc-tusb320.c
>>> +++ b/drivers/extcon/extcon-usbc-tusb320.c
>>> @@ -327,7 +327,14 @@ static irqreturn_t tusb320_irq_handler(int irq,
>>> void *dev_id)
>>> return IRQ_NONE;
>>> \x7f tusb320_extcon_irq_handler(priv, reg);
>>> - tusb320_typec_irq_handler(priv, reg);
>>> +
>>> + /*
>>> + * Type-C support is optional for backward compatibility.
>>
>> It's the other way around, extcon is the legacy, type-c is the new,
>> right ?
>
> Type-C is the new one, yes. This comment is somewhat similar to the one
> in tusb320_typec_probe():
>
> /* The Type-C connector is optional, for backward compatibility. */
Ahhh, The Type-C connector support is indeed optional to avoid breaking
any of the older systems which only use/provide extcon.
> Perhaps a better way to say this in both comments would be "to maintain"
> instead of "for".
I think best just drop the "for backward compatibility" altogether, like so:
/*
* Type-C support is optional. Only call the Type-C handler if a
* port had been registered previously.
*/
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-11-07 15:25 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-07 14:48 [PATCH] extcon: usbc-tusb320: Call the Type-C IRQ handler only if a port is registered Yassine Oudjana
2022-11-07 14:51 ` Marek Vasut
2022-11-07 15:02 ` Yassine Oudjana
2022-11-07 15:25 ` Marek Vasut
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).