Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp1985691rwb; Mon, 7 Nov 2022 07:56:50 -0800 (PST) X-Google-Smtp-Source: AMsMyM6LjVIQuFLRFvHZoUtaYKWd+fMExRo4ZYntSMvqJcyxy29oOP1S5PpvwN70Vtk3x8wNy69b X-Received: by 2002:a05:6402:3896:b0:45c:93c3:3569 with SMTP id fd22-20020a056402389600b0045c93c33569mr20472344edb.37.1667836610321; Mon, 07 Nov 2022 07:56:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667836610; cv=none; d=google.com; s=arc-20160816; b=jaEZOgGuj+0BI4HmtXd6HgmG86aQWBfjRl+CyTHZuuHvSa5GetNJHIIQj8WtnFB+kM EAKwChLhzEEvNTUcm+PSkWSMe3FbCt7Pnhf28dAur7HarFBYglhtWYLv0O13DPyW9Ht5 biLgRjjaIjVedQOdYqE/PdNtJ+gn26r73XSghL0IgJAtXhfn95i1hqRDtNlcoON1woo6 V7V9/SGfO2yWj8IT2Xgb9kNmm358ac8POzFE21xB3kVI64Zg9ODgX1GGTvjH5HJuYn1u jMqpruaPEtgZdZqwsyTblvRy5nYoFZPUMAnU4FVy/jLv6RhTK4iVzujpfJsMB08X8JxU 8MWQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :cc:to:subject:from:date:dkim-signature; bh=WeHFAdZZTdn4mbGrD+QJCE0iLEhqlSNhWrz5LG27594=; b=seeH/1iVxuSHoIxM20YLey2xoN42C07b0iXzhuEvugPRbKoy5Sv+g0WKq9HtqqbXr/ zfnQ7MRgDte477ED84vGiq9W7hdrOTtA33ZuxKGYPEyncTUbT0cxgC17whGvA0cMU4u1 oys9tQ/LFcdbohyImQDZ/i+vEa4W0EhmqDz2vnRFZW/l6T2MhhWvtWGxyauedbHK2NTV uxaJZcAdUztb4N3WH6LV0w9DVdyi8ufzSiUk/KaCQ5NZXQhw/OChbzqMqR3dNVrgpkMt S+yI+5RlHhxZWlCsPDZDRxbzjYwbprdCUzuuzSGpTDq/RMxguozZhLc/Y8COkISvC3OH 5o/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=O3n9G+wr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e22-20020a17090658d600b007836ec6999dsi4517333ejs.904.2022.11.07.07.56.27; Mon, 07 Nov 2022 07:56:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=O3n9G+wr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231521AbiKGPDD (ORCPT + 92 others); Mon, 7 Nov 2022 10:03:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45040 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232752AbiKGPCq (ORCPT ); Mon, 7 Nov 2022 10:02:46 -0500 Received: from mail-wr1-x42e.google.com (mail-wr1-x42e.google.com [IPv6:2a00:1450:4864:20::42e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EE8806300; Mon, 7 Nov 2022 07:02:44 -0800 (PST) Received: by mail-wr1-x42e.google.com with SMTP id bs21so16655365wrb.4; Mon, 07 Nov 2022 07:02:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:message-id:cc:to:subject:from :date:from:to:cc:subject:date:message-id:reply-to; bh=WeHFAdZZTdn4mbGrD+QJCE0iLEhqlSNhWrz5LG27594=; b=O3n9G+wrRQheCpEvGuTOI6m1x1jCcOwfwcQhMJiGCXYDohvZRuuQHirtkTrdsdhCN5 0EjchF5Q9ydSY+fysinpbM0Rl7G3yUZ2NK6rSEf+jSgGU0Mi9iTO/DKktsLTIjW2iDaI Hq8zQdKCC7c9iHRSKUW/hxWuA8bED1IaevzhXm+g3QbJ1lSeI+Q8SfntfEY15v2MKTn7 fs7dMm1LdVLPlskYHf328LU78/UWErFFt5TIdQ/THeMDVb4w7O6rch4IBdayLEISo5J0 Va4UtbxF6z8GKcx/ll3DB+iTeTk1fQMkm5jeKKS6LEG1D82+Cs3K2mL3r0T52PnkTwrv Gv9w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:references:in-reply-to:message-id:cc:to:subject:from :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=WeHFAdZZTdn4mbGrD+QJCE0iLEhqlSNhWrz5LG27594=; b=6XkpVjP6STjAmkZyTlAbbbeIp8M6TyWJEzOcYldEHDm6BqRP/mknkDRwUYIPejqgGi ljA++4tdm4eMGMHNZMk6Qx/CzKoxLXN9fLfyEIHm0LRTIbcinMJ1dO1gFWnby+Pw92GO lLmXk+Csxcj8O0H6PZSNTsUbLLMv4oMOt7qCBizJoEY+iOIpucEEQoM9axOa2ZkS63Y6 1RoS0Y7O9KX0kcGoL/v9lCD9lK8a1GIlMtFA3chVGRNp9WI3RBoJUNsVC9M0vCHUhRFr MJYouwFpAAuupjuymaEupWVYdPzpTpgw5h6oKoFb6wRJDQJOH8yXUg+B9C74Wb0byoMn K+dg== X-Gm-Message-State: ACrzQf1SxsYKDEEYmQb1ZJ/0N1ODJojfbRPEj5BvbP0svyeuy9kxs398 NrQOlI7sZzi2BNRomydI3HI= X-Received: by 2002:adf:fd4a:0:b0:236:87bc:a900 with SMTP id h10-20020adffd4a000000b0023687bca900mr30943428wrs.706.1667833363524; Mon, 07 Nov 2022 07:02:43 -0800 (PST) Received: from [10.32.3.204] ([95.183.227.98]) by smtp.gmail.com with ESMTPSA id u8-20020adfeb48000000b002366b17ca8bsm8882802wrn.108.2022.11.07.07.02.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Nov 2022 07:02:43 -0800 (PST) Date: Mon, 07 Nov 2022 18:02:34 +0300 From: Yassine Oudjana Subject: Re: [PATCH] extcon: usbc-tusb320: Call the Type-C IRQ handler only if a port is registered To: Marek Vasut Cc: MyungJoo Ham , Chanwoo Choi , Alvin =?iso-8859-2?q?=A9ipraga?= , Heikki Krogerus , Greg Kroah-Hartman , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Yassine Oudjana Message-Id: In-Reply-To: <49a553b3-bd79-7845-41c4-2b8a3a3d4932@denx.de> References: <20221107144810.588755-1-y.oudjana@protonmail.com> <49a553b3-bd79-7845-41c4-2b8a3a3d4932@denx.de> X-Mailer: geary/43.0 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Nov 7 2022 at 15:51:55 +01:00:00, Marek Vasut wrote: > On 11/7/22 15:48, Yassine Oudjana wrote: >> From: Yassine Oudjana >> >> 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 >> --- >> 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 ? 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); >>  regmap_write(priv->regmap, TUSB320_REG9, reg); > > Reviewed-by: Marek Vasut > > Thanks! Thanks for the quick review! Yassine