public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Yassine Oudjana <yassine.oudjana@gmail.com>
To: Marek Vasut <marex@denx.de>
Cc: "MyungJoo Ham" <myungjoo.ham@samsung.com>,
	"Chanwoo Choi" <cw00.choi@samsung.com>,
	"Alvin Šipraga" <alsi@bang-olufsen.dk>,
	"Heikki Krogerus" <heikki.krogerus@linux.intel.com>,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
	"Yassine Oudjana" <y.oudjana@protonmail.com>
Subject: Re: [PATCH] extcon: usbc-tusb320: Call the Type-C IRQ handler only if a port is registered
Date: Mon, 07 Nov 2022 18:02:34 +0300	[thread overview]
Message-ID: <AGGZKR.PDKF4SHFJVZC3@gmail.com> (raw)
In-Reply-To: <49a553b3-bd79-7845-41c4-2b8a3a3d4932@denx.de>


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




  reply	other threads:[~2022-11-07 15:03 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2022-11-07 15:25     ` Marek Vasut

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=AGGZKR.PDKF4SHFJVZC3@gmail.com \
    --to=yassine.oudjana@gmail.com \
    --cc=alsi@bang-olufsen.dk \
    --cc=cw00.choi@samsung.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=heikki.krogerus@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=marex@denx.de \
    --cc=myungjoo.ham@samsung.com \
    --cc=y.oudjana@protonmail.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox