From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DF6FDCCA479 for ; Mon, 18 Jul 2022 11:39:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234505AbiGRLjT (ORCPT ); Mon, 18 Jul 2022 07:39:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58656 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234469AbiGRLjQ (ORCPT ); Mon, 18 Jul 2022 07:39:16 -0400 Received: from mail-ed1-x536.google.com (mail-ed1-x536.google.com [IPv6:2a00:1450:4864:20::536]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5C2292704; Mon, 18 Jul 2022 04:39:13 -0700 (PDT) Received: by mail-ed1-x536.google.com with SMTP id m8so1395959edd.9; Mon, 18 Jul 2022 04:39:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=WM+zWzeYAitwMFZLUVsc8lp6MA3Zpo/kJcizrD/8ssk=; b=OvcuKUIjR4uhqpfL8lpsxLQ88mCYxcDOZ5lSaz8YMU5SyNSpWm2LhWIoS9CC+qDuiX DI/fnwo811XGeH4U+R290EOyJleoAHOZMLhaBd4hEdDGJHO0ZVerBEE3gVl6te9BpcT4 KyyXCEIlVZI9vzIm3Fjqb3WD+Kz4vqa72ux+kIiV8AtKAdtI87dFPLp0/j+Mpfxof+su lev/A8157qmlXkCgs9+5cRS0ruqiTC3/PHuZcO3JHcb+eMLKX823Z/MyUYWDhywL+lc6 ZEQD7h68BhRbIcXy5EQnFOo4JXLrkrtrSYjrBnXa5BTwwYZFNpiLwNcI86j6oai3JcHf Kb7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=WM+zWzeYAitwMFZLUVsc8lp6MA3Zpo/kJcizrD/8ssk=; b=ZPzABo93bnWSf4CHpIJ+mtevlCaIMyi7sdL5NY4HacH09HwL/vR97GBSlDS+1DG8rV erOe41DsfrcUEupmTUtssvzTrh1gKVWrWy0VFcWJvVKMRSfCcEkkBuQAMn44WF313Y9R arEIWomj3UU/9Ovtv6mkXJoewEKSYBA4AbafY23LQuwrKOyuemF3J6NIBha+d7+Ld/54 F6dasTaUobv1LSoXbrt4+9VnLcnQjtNZl3h86Yc3dynIom83ihN96OQTJvXPB/hyXR7c QpcNqr2IeD72plYgLjRyitIL06HvknE1D7W8WYrlYG6JuMcD7NNYZPyEBZODQ7ekPGDh GdGw== X-Gm-Message-State: AJIora/VW1UdhFwT2CeR9JblilLwjoIjTf3Bf7NsF//p2OnvnZF/o1EY 2XgXIlJJtj44+Fcj+HE7hdoVxBc8a4VUQoJ6dcE= X-Google-Smtp-Source: AGRyM1uLSUr+2lvxiCg3cwvu9VMJCLD+uDi8ZOzhv3dgH0XROSPP5YW44n0Pb3saV+i0UvUB6nImoWisC6NYG7PACSY= X-Received: by 2002:a05:6402:34c5:b0:43a:8f90:e643 with SMTP id w5-20020a05640234c500b0043a8f90e643mr35599070edc.88.1658144351737; Mon, 18 Jul 2022 04:39:11 -0700 (PDT) MIME-Version: 1.0 References: <20220715112607.591-1-peterwu.pub@gmail.com> <20220715112607.591-9-peterwu.pub@gmail.com> <20220718080831.GA31509@cyhuang-hp-elitebook-840-g3.rt> In-Reply-To: <20220718080831.GA31509@cyhuang-hp-elitebook-840-g3.rt> From: Andy Shevchenko Date: Mon, 18 Jul 2022 13:38:35 +0200 Message-ID: Subject: Re: [PATCH v5 08/13] usb: typec: tcpci_mt6370: Add MediaTek MT6370 tcpci driver To: ChiYuan Huang Cc: ChiaEn Wu , Lee Jones , Daniel Thompson , Jingoo Han , Pavel Machek , Rob Herring , Krzysztof Kozlowski , Matthias Brugger , Sebastian Reichel , Chunfeng Yun , Greg Kroah-Hartman , Jonathan Cameron , Lars-Peter Clausen , Liam Girdwood , Mark Brown , Guenter Roeck , "Krogerus, Heikki" , Helge Deller , ChiaEn Wu , Alice Chen , cy_huang , dri-devel , Linux LED Subsystem , devicetree , linux-arm Mailing List , "moderated list:ARM/Mediatek SoC support" , Linux Kernel Mailing List , Linux PM , USB , linux-iio , "open list:FRAMEBUFFER LAYER" , szuni chen Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-leds@vger.kernel.org On Mon, Jul 18, 2022 at 10:08 AM ChiYuan Huang wrote: > On Fri, Jul 15, 2022 at 03:10:42PM +0200, Andy Shevchenko wrote: > > On Fri, Jul 15, 2022 at 1:28 PM ChiaEn Wu wrote: ... > > > This commit add support for the Type-C & Power Delivery controller in > > > > This commit add -> Add > > > Upper case? Or rewrite it as 'This commit is to add .....'? Please, read this documentation [1] for better understanding. It should clarify this and perhaps other possible questions. [1]: https://www.kernel.org/doc/html/latest/process/submitting-patches.html#describe-your-changes > > > MediaTek MT6370 IC. ... > > > + ret = devm_request_threaded_irq(dev, priv->irq, NULL, > > > + mt6370_irq_handler, IRQF_ONESHOT, > > > + dev_name(dev), priv); > > > + if (ret) { > > > > > + tcpci_unregister_port(priv->tcpci); > > > > This is wrong. > > You mixed devm_ with non-devm. Either drop devm_ *after* the first > > non-devm_ call, or convert everything to be managed. > > > How about to add 'devm_add_action_or_reset' for tcpci_unregister_port? > This will convert all as 'devm_' version. I think it would work, that wrapper was designed to cover cases like this. > > > + return dev_err_probe(dev, ret, "Failed to allocate irq\n"); > > > + } ... > > > +static int mt6370_tcpc_remove(struct platform_device *pdev) > > > +{ > > > + struct mt6370_priv *priv = platform_get_drvdata(pdev); > > > > > + disable_irq(priv->irq); > > > > Why? > > An ugly workaround due to ordering issues in ->probe()? > > > Yes, due to the ordering in probe. > 'bus remove' will be called before device resource releases. > > Like as you said, another way is to convert all as non-devm > version after 'tcpci_unregister_port'. > > If to keep the original order, 'disable_irq' before > 'tcpci_unregister_port' can make the flow more safe. > > Or you can think one case if irq triggers after > 'tcpci_unregister_port'. Null pointer occurs. > > Anyway, in next revision, I'll convert all to be 'devm_' version. > For this remove callback, only 'dev_pm_clear_wake_irq' and > 'device_init_wakeup' will be kept. > > Is this better? Sounds like a plan! > > > + tcpci_unregister_port(priv->tcpci); > > > + dev_pm_clear_wake_irq(&pdev->dev); > > > + device_init_wakeup(&pdev->dev, false); > > > + > > > + return 0; > > > +} -- With Best Regards, Andy Shevchenko From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E676EC43334 for ; Mon, 18 Jul 2022 11:39:15 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 395B7995A6; Mon, 18 Jul 2022 11:39:15 +0000 (UTC) Received: from mail-ed1-x534.google.com (mail-ed1-x534.google.com [IPv6:2a00:1450:4864:20::534]) by gabe.freedesktop.org (Postfix) with ESMTPS id 4C8AD99589 for ; Mon, 18 Jul 2022 11:39:13 +0000 (UTC) Received: by mail-ed1-x534.google.com with SMTP id m13so4675940edc.5 for ; Mon, 18 Jul 2022 04:39:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=WM+zWzeYAitwMFZLUVsc8lp6MA3Zpo/kJcizrD/8ssk=; b=OvcuKUIjR4uhqpfL8lpsxLQ88mCYxcDOZ5lSaz8YMU5SyNSpWm2LhWIoS9CC+qDuiX DI/fnwo811XGeH4U+R290EOyJleoAHOZMLhaBd4hEdDGJHO0ZVerBEE3gVl6te9BpcT4 KyyXCEIlVZI9vzIm3Fjqb3WD+Kz4vqa72ux+kIiV8AtKAdtI87dFPLp0/j+Mpfxof+su lev/A8157qmlXkCgs9+5cRS0ruqiTC3/PHuZcO3JHcb+eMLKX823Z/MyUYWDhywL+lc6 ZEQD7h68BhRbIcXy5EQnFOo4JXLrkrtrSYjrBnXa5BTwwYZFNpiLwNcI86j6oai3JcHf Kb7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=WM+zWzeYAitwMFZLUVsc8lp6MA3Zpo/kJcizrD/8ssk=; b=w/1ToVNZSRo51e8o4A33bvxGT2EdHeEU/GF1klywxQJajytEP4micQAFOM0P84FLiP TakVdSEw2FDJuAplZCBZyrsWoGs8f6cnw9ah3W80JJO/h7+Ifvc+uzTMyPM9HVsnBPSa ErpXyBBf50HSKvd9scceOhl7FVAmcR11Gr632GsHdXFYXlu+NAGjxdlK6hvUXOZsnpwO z9p9uWnB5ZdmoQGTsHEQhXfkD6ozy8iAz2VeKO6l2vyZk0bPBZQ1Rq8OSqoThxVctz54 Kumrq+KVytNi0+JN1ENlOQLzzHe3lkFlg1idOh7/FowvPKmH/fMWzyZZ32DKNUOtgcDh eJZQ== X-Gm-Message-State: AJIora9GxfNEOCwkknd8Fq96+wTRUBDyf0fmJY+HjY6bQXgApuBpbJVk BYXHEMnnnr8OpWj3PJWNLfpDseDl14nAGNjSZCk= X-Google-Smtp-Source: AGRyM1uLSUr+2lvxiCg3cwvu9VMJCLD+uDi8ZOzhv3dgH0XROSPP5YW44n0Pb3saV+i0UvUB6nImoWisC6NYG7PACSY= X-Received: by 2002:a05:6402:34c5:b0:43a:8f90:e643 with SMTP id w5-20020a05640234c500b0043a8f90e643mr35599070edc.88.1658144351737; Mon, 18 Jul 2022 04:39:11 -0700 (PDT) MIME-Version: 1.0 References: <20220715112607.591-1-peterwu.pub@gmail.com> <20220715112607.591-9-peterwu.pub@gmail.com> <20220718080831.GA31509@cyhuang-hp-elitebook-840-g3.rt> In-Reply-To: <20220718080831.GA31509@cyhuang-hp-elitebook-840-g3.rt> From: Andy Shevchenko Date: Mon, 18 Jul 2022 13:38:35 +0200 Message-ID: Subject: Re: [PATCH v5 08/13] usb: typec: tcpci_mt6370: Add MediaTek MT6370 tcpci driver To: ChiYuan Huang Content-Type: text/plain; charset="UTF-8" X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "open list:FRAMEBUFFER LAYER" , "Krogerus, Heikki" , Pavel Machek , Alice Chen , linux-iio , dri-devel , Liam Girdwood , cy_huang , Krzysztof Kozlowski , Lee Jones , Linux LED Subsystem , Daniel Thompson , Helge Deller , Rob Herring , Chunfeng Yun , Guenter Roeck , devicetree , Linux PM , szuni chen , Mark Brown , "moderated list:ARM/Mediatek SoC support" , Matthias Brugger , ChiaEn Wu , linux-arm Mailing List , Jingoo Han , USB , Sebastian Reichel , Linux Kernel Mailing List , ChiaEn Wu , Greg Kroah-Hartman , Jonathan Cameron Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" On Mon, Jul 18, 2022 at 10:08 AM ChiYuan Huang wrote: > On Fri, Jul 15, 2022 at 03:10:42PM +0200, Andy Shevchenko wrote: > > On Fri, Jul 15, 2022 at 1:28 PM ChiaEn Wu wrote: ... > > > This commit add support for the Type-C & Power Delivery controller in > > > > This commit add -> Add > > > Upper case? Or rewrite it as 'This commit is to add .....'? Please, read this documentation [1] for better understanding. It should clarify this and perhaps other possible questions. [1]: https://www.kernel.org/doc/html/latest/process/submitting-patches.html#describe-your-changes > > > MediaTek MT6370 IC. ... > > > + ret = devm_request_threaded_irq(dev, priv->irq, NULL, > > > + mt6370_irq_handler, IRQF_ONESHOT, > > > + dev_name(dev), priv); > > > + if (ret) { > > > > > + tcpci_unregister_port(priv->tcpci); > > > > This is wrong. > > You mixed devm_ with non-devm. Either drop devm_ *after* the first > > non-devm_ call, or convert everything to be managed. > > > How about to add 'devm_add_action_or_reset' for tcpci_unregister_port? > This will convert all as 'devm_' version. I think it would work, that wrapper was designed to cover cases like this. > > > + return dev_err_probe(dev, ret, "Failed to allocate irq\n"); > > > + } ... > > > +static int mt6370_tcpc_remove(struct platform_device *pdev) > > > +{ > > > + struct mt6370_priv *priv = platform_get_drvdata(pdev); > > > > > + disable_irq(priv->irq); > > > > Why? > > An ugly workaround due to ordering issues in ->probe()? > > > Yes, due to the ordering in probe. > 'bus remove' will be called before device resource releases. > > Like as you said, another way is to convert all as non-devm > version after 'tcpci_unregister_port'. > > If to keep the original order, 'disable_irq' before > 'tcpci_unregister_port' can make the flow more safe. > > Or you can think one case if irq triggers after > 'tcpci_unregister_port'. Null pointer occurs. > > Anyway, in next revision, I'll convert all to be 'devm_' version. > For this remove callback, only 'dev_pm_clear_wake_irq' and > 'device_init_wakeup' will be kept. > > Is this better? Sounds like a plan! > > > + tcpci_unregister_port(priv->tcpci); > > > + dev_pm_clear_wake_irq(&pdev->dev); > > > + device_init_wakeup(&pdev->dev, false); > > > + > > > + return 0; > > > +} -- With Best Regards, Andy Shevchenko From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4D8F3C433EF for ; Mon, 18 Jul 2022 11:40:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:Subject:Message-ID:Date:From: In-Reply-To:References:MIME-Version:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=H8jvvgc4YPAXG4UZXm8mhbHI6ADclQ4MvNkwwtpmNUU=; b=mlMlrhoUT2kpFW a4RngvPGs8bCxaC6mpV6qXYqO69FVpG2p8bx3rsiFDqryKDXgn8AFkVVHL41MjvHh3cCRx0e9KeSp kZ1yvsCiiuzvwGkvk+Cu+nCmV426Et5ozwW8qp0NLj5VVzFyU/9v5LkY46gkfs02NW3tw1eLFI2kn 4uKbMGQbMg7dUaktc24HCHTgMlbdCFc5/q7zYW3ak09N8tvSqHn9L+dSrDzHNRoA3TDR5pKfDzwKm yAaOunlus0zHR3XzCM9/in9DeXkHiyFsB0WdWEr0ECS/wYCkQvWE1waE02qvmXD4n6pq00md78HzP Zps0ktPqetNaQLeNQ8Jg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oDP5p-00CuS4-4M; Mon, 18 Jul 2022 11:39:17 +0000 Received: from mail-ed1-x531.google.com ([2a00:1450:4864:20::531]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oDP5m-00CuP8-By; Mon, 18 Jul 2022 11:39:15 +0000 Received: by mail-ed1-x531.google.com with SMTP id w12so14804193edd.13; Mon, 18 Jul 2022 04:39:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=WM+zWzeYAitwMFZLUVsc8lp6MA3Zpo/kJcizrD/8ssk=; b=OvcuKUIjR4uhqpfL8lpsxLQ88mCYxcDOZ5lSaz8YMU5SyNSpWm2LhWIoS9CC+qDuiX DI/fnwo811XGeH4U+R290EOyJleoAHOZMLhaBd4hEdDGJHO0ZVerBEE3gVl6te9BpcT4 KyyXCEIlVZI9vzIm3Fjqb3WD+Kz4vqa72ux+kIiV8AtKAdtI87dFPLp0/j+Mpfxof+su lev/A8157qmlXkCgs9+5cRS0ruqiTC3/PHuZcO3JHcb+eMLKX823Z/MyUYWDhywL+lc6 ZEQD7h68BhRbIcXy5EQnFOo4JXLrkrtrSYjrBnXa5BTwwYZFNpiLwNcI86j6oai3JcHf Kb7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=WM+zWzeYAitwMFZLUVsc8lp6MA3Zpo/kJcizrD/8ssk=; b=ohhmWxdHQH3GiRBxNwPlaUmMk4xouVa5aQot2vTXCvEoEq2Sg8GY3lyml8q9SwqFC/ rPUByulX3l7lMCaubPTahwukim/oJgeEnAGuLNkWBMQcYtXRMdlWcsOsO6owWXoNdBNJ /e0fksD0S53w0+gtVuFy1AXdZZJQb+xhbD2W8Dw9LivOkRXL8mvj+CvFUZ8/OVWU5PhY quAghxuNx0ZxjC5G1Ofw9ffNyOibPD3F1A/1KIeqCQPWbJ2Xn9QIkk4fw1+EfkwFVRtq qn5xA/3HdYdgDStEfoAnSB5kdKoDJ1P5agYw9tlGD3EddXhcLWYDajyHTf50kPsE4t3f bMtA== X-Gm-Message-State: AJIora9n92h/W29LE8c8fktT66e8SfuOKXdyBE5+6SEynuiy5NySjYx0 lcWOYUn9np+KVE2ZNVQ0rgwmO8SBqI8vGirAPGc= X-Google-Smtp-Source: AGRyM1uLSUr+2lvxiCg3cwvu9VMJCLD+uDi8ZOzhv3dgH0XROSPP5YW44n0Pb3saV+i0UvUB6nImoWisC6NYG7PACSY= X-Received: by 2002:a05:6402:34c5:b0:43a:8f90:e643 with SMTP id w5-20020a05640234c500b0043a8f90e643mr35599070edc.88.1658144351737; Mon, 18 Jul 2022 04:39:11 -0700 (PDT) MIME-Version: 1.0 References: <20220715112607.591-1-peterwu.pub@gmail.com> <20220715112607.591-9-peterwu.pub@gmail.com> <20220718080831.GA31509@cyhuang-hp-elitebook-840-g3.rt> In-Reply-To: <20220718080831.GA31509@cyhuang-hp-elitebook-840-g3.rt> From: Andy Shevchenko Date: Mon, 18 Jul 2022 13:38:35 +0200 Message-ID: Subject: Re: [PATCH v5 08/13] usb: typec: tcpci_mt6370: Add MediaTek MT6370 tcpci driver To: ChiYuan Huang Cc: ChiaEn Wu , Lee Jones , Daniel Thompson , Jingoo Han , Pavel Machek , Rob Herring , Krzysztof Kozlowski , Matthias Brugger , Sebastian Reichel , Chunfeng Yun , Greg Kroah-Hartman , Jonathan Cameron , Lars-Peter Clausen , Liam Girdwood , Mark Brown , Guenter Roeck , "Krogerus, Heikki" , Helge Deller , ChiaEn Wu , Alice Chen , cy_huang , dri-devel , Linux LED Subsystem , devicetree , linux-arm Mailing List , "moderated list:ARM/Mediatek SoC support" , Linux Kernel Mailing List , Linux PM , USB , linux-iio , "open list:FRAMEBUFFER LAYER" , szuni chen X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220718_043914_456523_A26D881B X-CRM114-Status: GOOD ( 27.98 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Mon, Jul 18, 2022 at 10:08 AM ChiYuan Huang wrote: > On Fri, Jul 15, 2022 at 03:10:42PM +0200, Andy Shevchenko wrote: > > On Fri, Jul 15, 2022 at 1:28 PM ChiaEn Wu wrote: ... > > > This commit add support for the Type-C & Power Delivery controller in > > > > This commit add -> Add > > > Upper case? Or rewrite it as 'This commit is to add .....'? Please, read this documentation [1] for better understanding. It should clarify this and perhaps other possible questions. [1]: https://www.kernel.org/doc/html/latest/process/submitting-patches.html#describe-your-changes > > > MediaTek MT6370 IC. ... > > > + ret = devm_request_threaded_irq(dev, priv->irq, NULL, > > > + mt6370_irq_handler, IRQF_ONESHOT, > > > + dev_name(dev), priv); > > > + if (ret) { > > > > > + tcpci_unregister_port(priv->tcpci); > > > > This is wrong. > > You mixed devm_ with non-devm. Either drop devm_ *after* the first > > non-devm_ call, or convert everything to be managed. > > > How about to add 'devm_add_action_or_reset' for tcpci_unregister_port? > This will convert all as 'devm_' version. I think it would work, that wrapper was designed to cover cases like this. > > > + return dev_err_probe(dev, ret, "Failed to allocate irq\n"); > > > + } ... > > > +static int mt6370_tcpc_remove(struct platform_device *pdev) > > > +{ > > > + struct mt6370_priv *priv = platform_get_drvdata(pdev); > > > > > + disable_irq(priv->irq); > > > > Why? > > An ugly workaround due to ordering issues in ->probe()? > > > Yes, due to the ordering in probe. > 'bus remove' will be called before device resource releases. > > Like as you said, another way is to convert all as non-devm > version after 'tcpci_unregister_port'. > > If to keep the original order, 'disable_irq' before > 'tcpci_unregister_port' can make the flow more safe. > > Or you can think one case if irq triggers after > 'tcpci_unregister_port'. Null pointer occurs. > > Anyway, in next revision, I'll convert all to be 'devm_' version. > For this remove callback, only 'dev_pm_clear_wake_irq' and > 'device_init_wakeup' will be kept. > > Is this better? Sounds like a plan! > > > + tcpci_unregister_port(priv->tcpci); > > > + dev_pm_clear_wake_irq(&pdev->dev); > > > + device_init_wakeup(&pdev->dev, false); > > > + > > > + return 0; > > > +} -- With Best Regards, Andy Shevchenko _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel