Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp6159940iog; Thu, 23 Jun 2022 12:36:09 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sq2Vak/zEbx29/hcAmTm1ugvSqk/sVOrXQUnmK1ZWOeK+UaSGZjKlB1chmfw7wHpfp+rfB X-Received: by 2002:a17:903:2584:b0:169:a2b9:b428 with SMTP id jb4-20020a170903258400b00169a2b9b428mr35288079plb.170.1656012969512; Thu, 23 Jun 2022 12:36:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656012969; cv=none; d=google.com; s=arc-20160816; b=05HV1SG36fbaokDiDXalTnNUiTJUKszddhsEdApCjnrn5xn1QmQw/OHAEUf4yJ0H8k vGfGgPha/ZxUwPWhKcUFnTSHWG5wVWeVApEszpjW1QDDDmz5uLHznfHA9xQl0msC7EaY RXMnUw3Na1iJcAgvQmRbWil6YNgg1EI1dP9PoZQrJA1zm57FzmclVw0q7pdjbzHZo/3s eie61QbujGLrA4CDxpZiVTM+XGjqZ3Y1Rw3KzQ4MfV2X81igoVIAl8mKafvd5uzTjKhQ 2bVZb06QOuQ/DZupTKWIJ+B0DyUocQ0PawxduQp9sscFEI/hLfU1mDyPn+8+24UtisDy dlSw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=pVm8MjXTsJMX8WBaTQ/Z/W23uteGk2WgxtylOJuMvn4=; b=K/9ZNpaEswsHvRcc6tyh6bJWnPg0pnzZ06UxFh4WaO9n8g49LZsOgHuoxYKBZ6dhM/ M3n72iVPzu1mlNjkGqSzMtp1EnRS0Pb3QZo+83obg71gRkDkfb+XlN8ZPlL1iSXxnmBb D2k3bEMGZvkhlGruWU3TsMbc8HTNGHHlk0+33Gnd2x+Yd2oVTZUBJsnts4bdLj9bm13j C0aK3llxUtOIh0cuuueokUyC/HNwK4hU+UaAVfFSa5wZrHUAXDqGR1b771qcHlPeJxbt +OQXw5nyEINCP87bX4sYEn0wmKiZbDmqykqcc1jZdu+JLkfTVfj/MYNaEO3N7AaxTxGy R2/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=ROMSf98O; 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 i136-20020a639d8e000000b003fabebb91b0si27650047pgd.753.2022.06.23.12.35.56; Thu, 23 Jun 2022 12:36:09 -0700 (PDT) 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=ROMSf98O; 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 S231658AbiFWTCx (ORCPT + 99 others); Thu, 23 Jun 2022 15:02:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45526 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232625AbiFWTC3 (ORCPT ); Thu, 23 Jun 2022 15:02:29 -0400 Received: from mail-lj1-x22d.google.com (mail-lj1-x22d.google.com [IPv6:2a00:1450:4864:20::22d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AE4C2F54; Thu, 23 Jun 2022 11:07:55 -0700 (PDT) Received: by mail-lj1-x22d.google.com with SMTP id by38so46868ljb.10; Thu, 23 Jun 2022 11:07:55 -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=pVm8MjXTsJMX8WBaTQ/Z/W23uteGk2WgxtylOJuMvn4=; b=ROMSf98OAyUaa6eEUsFo3GNphishFltifgt5QEQzrZNe7sjAM+HfSxcOzzy9W6RXT/ G9dAp8BarXJwUQv1+UFIl9pO6g0/KNAziFw8OQyNNA2F7tBBoJs6F4EVswlaZ/mtrOUr QkvM84BF5zxaVCCNT37WNd2okHNEk6IyyAzwEh1EwAophtbnp7iFhuLKO8Z/XOD1lnUl suS5mf6pbLbWkjRhB9QoLtb2LLY0TBOsJTxfjC7JtzRG8wnlujGjvT+fxjiuxQ7n37lq 7hRGbeT6p1p4iK5XNA2XXK6FCYcJpRLpc3dd/qxtlN637sF3jF8kcCu0NSjABQOuH24p 9Wcw== 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=pVm8MjXTsJMX8WBaTQ/Z/W23uteGk2WgxtylOJuMvn4=; b=Xb9S7b6fWd7xdXqlJcaHZ0mN17UuzdgLETMyfyPsOzbSIXeOQp6+/iVwws+I/pefop YcHw1CKz4Wo2P4daG0W7JuC4bCRa9tQ3/Kp/WD9ir4CRFVpYZK5Cx2SZcfOvoDeq58n4 9ZE4n4RLSqhMpKARkRgMBfO7Kk/rueh80F+Te8a5ENYNVm9n0UcSuoyhok6twjCJBrgX VILSfPtueDbgzl1ae6o95PI4CW5/VFIhPT0fznaggIeo0G/iMqPkLUSyR9Uk6wZOLZIy +Vehxpy7U3qB8k/yDn+behcjHHAMIWYru0OazYS9tvHY++fCsxudiXd/l6R3MtImeDTd xSWw== X-Gm-Message-State: AJIora/4EMHvFVNY1W+j/OE5O81wWrc1KWYvL9KDKMZCDUrdO/vZ44Vm q54jlfjIFPPU16SgrrQrIcolAmhoikiLyezzux0= X-Received: by 2002:a2e:b8d2:0:b0:255:93e3:6fb2 with SMTP id s18-20020a2eb8d2000000b0025593e36fb2mr5737201ljp.334.1656007673996; Thu, 23 Jun 2022 11:07:53 -0700 (PDT) MIME-Version: 1.0 References: <20220623115631.22209-1-peterwu.pub@gmail.com> <20220623115631.22209-9-peterwu.pub@gmail.com> In-Reply-To: <20220623115631.22209-9-peterwu.pub@gmail.com> From: Andy Shevchenko Date: Thu, 23 Jun 2022 20:07:17 +0200 Message-ID: Subject: Re: [PATCH v3 08/14] usb: typec: tcpci_mt6370: Add Mediatek MT6370 tcpci driver To: ChiaEn Wu Cc: 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@richtek.com, alice_chen@richtek.com, 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" 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,T_SCC_BODY_TEXT_LINE 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 Thu, Jun 23, 2022 at 2:00 PM ChiaEn Wu wrote: > > From: ChiYuan Huang > > Add chip level mt6370 tcpci driver. ... > +config TYPEC_TCPCI_MT6370 > + tristate "Mediatek MT6370 Type-C driver" > + depends on MFD_MT6370 > + help > + Mediatek MT6370 is a multi-functional IC that includes > + USB Type-C. It works with Type-C Port Controller Manager > + to provide USB PD and USB Type-C functionalities. What will be the module name? ... > +#include > +#include > +#include > +#include > +#include No user of this header is found in this file. > +#include > +#include > +#include > +#include > +#include > +#include > +#include "tcpci.h" ... > + if (did == MT6370_TCPC_DID_A) { > + ret = regmap_write(data->regmap, TCPC_FAULT_CTRL, 0x80); > + if (ret) > + return ret; return regmap_write(...); > + } > + > + return 0; ... > + if (ret && !source) > + ret = regulator_disable(priv->vbus); > + else if (!ret && source) > + ret = regulator_enable(priv->vbus); > + else > + ret = 0; > + > + return ret; Can it be if (ret && ...) return regulator_disable(...); if (!ret && ...) return regulator_enable(...); return 0; ? ... > + if (!priv->tcpci_data.regmap) { > + dev_err(&pdev->dev, "Failed to init regmap\n"); > + return -ENODEV; > + } return dev_err_probe(...); ? ... > + if (ret) { > + dev_err(&pdev->dev, "Failed to check vendor info (%d)\n", ret); > + return ret; > + } Ditto. ... > + priv->irq = platform_get_irq(pdev, 0); > + if (priv->irq < 0) { > + dev_err(&pdev->dev, "Failed to get TCPC irq (%d)\n", priv->irq); The message like this is printed in case of error inside platform_get_irq(), no need to duplicate. > + return priv->irq; > + } ... > + priv->tcpci = tcpci_register_port(&pdev->dev, &priv->tcpci_data); > + if (IS_ERR(priv->tcpci)) { > + dev_err(&pdev->dev, "Failed to register tcpci port\n"); > + return PTR_ERR(priv->tcpci); return dev_err_probe(); ? > + } ... > + if (ret) { > + dev_err(&pdev->dev, "Failed to allocate irq (%d)\n", ret); > + tcpci_unregister_port(priv->tcpci); > + return ret; Ditto. > + } -- With Best Regards, Andy Shevchenko