Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp520966imw; Mon, 4 Jul 2022 14:06:59 -0700 (PDT) X-Google-Smtp-Source: AGRyM1s2SwNTL6Q27tzIsxN8xmL8h1u2oL3AokDDSxhzZlQnCOh2iOSoENUK0SCvFfATL/1Y1gyx X-Received: by 2002:aa7:8390:0:b0:528:5e9:9d31 with SMTP id u16-20020aa78390000000b0052805e99d31mr29054699pfm.30.1656968819492; Mon, 04 Jul 2022 14:06:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656968819; cv=none; d=google.com; s=arc-20160816; b=FZ60G2dkm92nGaSm1E37+G37AU1p60YIIiiyp1JMG0lQCNxGTVfzh4ZQ8jlphDrL8R k5jTZ9jn2VziTjkpPK/nkm5a1vowPn6T8mxoIPQ3wjMfhzV0xi6qy0RJt75ik5N3EIwf zPDXNlk6t/+O+N5lqg2Bmp+ZI5WTVB7AmuqZv5a6LKsHwUuaaX43truY8kM/QgqR51HM lBXo7gS2mKkW0Tug1qrzYzJh44Qd0nLU/w1KBB2cQKCc8LXzWlgx5I81aUkcrN7G/ieq 3WCWWeo/q56BRcyUmjEDR11drH/+lijreK+9N3S96POdsx/icl3GQ1gY+E54PvLMobfj +JLg== 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=yX/+5EHmJzouiASTPWEy2vcXLPBh//GiWKeXcuGIwQ8=; b=EUQTCAlTKZs1wwyqf3PjkI/A7zY1adOzVVEzV1c/c2dsOCQ84MWUHrLExWisKREhgd UvgrFqFamp8oa4X+A65WYT0jPeWI4c6RGpd2Kpnir3lcE9wavBBsHT3olLZFgKRJ29nW ir7QOTpUySvC0b1HZy1AIiDu5Ir/t+DLeEMAisdYEbVxykmLzgUjvD1Y4ckGCcivM/l1 LKTH6zecl77LE6neCjiayoRidVCAl/yD3enpSud+YAnFCMabRRwqnJCgyYlOUpQMCD1D uaLljj2JJenv51MLil8epCYnTZPas3FfX+CR54kAngkO5mLPdYWxIfpb/pSIrKe/LNFk JGbg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=B3+vMtHk; 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 jh7-20020a170903328700b0016bdf4bb1f9si5176338plb.202.2022.07.04.14.06.48; Mon, 04 Jul 2022 14:06:59 -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=B3+vMtHk; 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 S231238AbiGDUyE (ORCPT + 99 others); Mon, 4 Jul 2022 16:54:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52418 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229989AbiGDUyD (ORCPT ); Mon, 4 Jul 2022 16:54:03 -0400 Received: from mail-yb1-xb2f.google.com (mail-yb1-xb2f.google.com [IPv6:2607:f8b0:4864:20::b2f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 03361B1FF; Mon, 4 Jul 2022 13:54:00 -0700 (PDT) Received: by mail-yb1-xb2f.google.com with SMTP id c143so10056844ybf.3; Mon, 04 Jul 2022 13:53:59 -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=yX/+5EHmJzouiASTPWEy2vcXLPBh//GiWKeXcuGIwQ8=; b=B3+vMtHkh7oMCAMnDoWG8DEYz2b0JCtP5ZfXbihV47SV3dWC+3OwqEGsEMwBqAFjz7 khAxgZHq8sJMmNaICKe6NssutaTTjWLNGJBKORgb6vraCnVB5t+OtelrciWNFx45ctsy JvI3604+UpHWwrRhFauDs9e1foPdkNSdzNHqlHWwdWLiIR5uNgh7cOgQIAGgo+d4nbqk vWBgis+eV5qV8Zk/AkWLLfaslFlFZF3eEW3XKUxRruxM5WjKyLFbe1tfQJnycOJwtO/v olhGLIkEl+ub8ONlqXskW875SxgXQbu+BJdjC1nw7gUrRk69EDJ2IlghqhNSArZzWIXy kOpg== 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=yX/+5EHmJzouiASTPWEy2vcXLPBh//GiWKeXcuGIwQ8=; b=39Q5fdvEQpHOp7bFl7WvGKpBpO6tHw64uT1dwJNWFOEMM1r7UUfs9l0CrttZOOcsPp OHjZpsv1QIhQuQKzX6UbAq+hDom5LpaSO2D1nHSeCVWHGmJ+kIVtYtD7OVUpE7IOWoPA DxqWkyjoWH6U5Cb7HMzxAif2KgCvmOaDKUmqSO+w5YQEfAwoF6JvMxGLkWKJPly9n2Pp xa1dNlwNfFwv23qPxuXf/ly+HiynD8nQ2nD5uh5SwgzQY2rFHlshGn69/4kU53Pg/NKj nQAjZdVSbmXrL1OJ8McBVeATqHPSCmPmFHWwttkcNIyVMErBTZTqUrCfs0Z0DleXUmwN lTEQ== X-Gm-Message-State: AJIora8YhalBc7qWdIbRnUeItWxXwdlGx8N899kK1uoxROkKYnifN7JZ rni6Jeit5DdvbiNZ6M+/zdZs+Q1w6Io6XvRGPss= X-Received: by 2002:a05:6902:c4:b0:64b:4677:331b with SMTP id i4-20020a05690200c400b0064b4677331bmr33612017ybs.93.1656968039226; Mon, 04 Jul 2022 13:53:59 -0700 (PDT) MIME-Version: 1.0 References: <20220704053901.728-1-peterwu.pub@gmail.com> <20220704053901.728-11-peterwu.pub@gmail.com> In-Reply-To: <20220704053901.728-11-peterwu.pub@gmail.com> From: Andy Shevchenko Date: Mon, 4 Jul 2022 22:53:22 +0200 Message-ID: Subject: Re: [PATCH v4 10/13] power: supply: mt6370: Add Mediatek MT6370 charger 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 , 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" 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 Mon, Jul 4, 2022 at 7:42 AM ChiaEn Wu wrote: > Add Mediatek MT6370 charger driver. ... > + This driver can also be built as a module. If so the module If so, > + will be called "mt6370-charger.ko". No ".ko" part. ... > +#define MT6370_MIVR_IBUS_TH_100_MA 100000 mA ... > + if (mt6370_chg_fields[fd].range) { > + return linear_range_get_value(mt6370_chg_fields[fd].range, > + reg_val, val); > + } else { Redundant 'else'. > + *val = reg_val; > + return 0; > + } ... > + if (fd != F_VMIVR) Why not positive conditional? > + linear_range_get_selector_within(r, val, &val); > + else { > + ret = linear_range_get_selector_high(r, val, &val, &f); > + if (!ret) > + val = r->max_sel; > + } Checkpatch didn't complain about the absence of {} ? ... > + irq_num = platform_get_irq_byname(pdev, irq_name); > + if (irq_num >= 0) { if (irq_num < 0) return; > + if (en) > + enable_irq(irq_num); > + else > + disable_irq_nosync(irq_num); > + } ... > + /* Check in otg mode or not */ OTG ... > +static int mt6370_chg_set_online(struct mt6370_priv *priv, > + const union power_supply_propval *val) > +{ > + unsigned int pwr_rdy = !!val->intval; Seems you are using int as boolean, do you need it specifically for something? Otherwise use boolean here. > + > + mutex_lock(&priv->attach_lock); > + if (pwr_rdy == !!priv->attach) { > + dev_err(priv->dev, "pwr_rdy is same(%d)\n", pwr_rdy); > + mutex_unlock(&priv->attach_lock); > + return 0; > + } > + > + priv->attach = pwr_rdy; > + mutex_unlock(&priv->attach_lock); > + > + if (!queue_work(priv->wq, &priv->bc12_work)) > + dev_err(priv->dev, "bc12 work has already queued\n"); > + > + return 0; > +} -- With Best Regards, Andy Shevchenko