Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp1995520iog; Sun, 19 Jun 2022 04:41:00 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tm8RNvqQdvt1qyyz2+sa5fzLoSe5maE5HMPUObCphhiGDOOslN58JOX/9lursEpiUgRs6f X-Received: by 2002:a17:906:5352:b0:712:3916:e92 with SMTP id j18-20020a170906535200b0071239160e92mr16495705ejo.756.1655638860204; Sun, 19 Jun 2022 04:41:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655638860; cv=none; d=google.com; s=arc-20160816; b=B9nV4xRmzqHNI5XaPRIHIS2TyVR3yE1Vm6mPwrqq0ikC9JkhvorankthsQ3sAdlyap RzpkIIJ6wr6+ojWT+xAyhIVT4cx3FDQsvbleVtdGPRGn5XZJ1U/wCxrNvfVdmZD6gv5v MeOT78DmSmBJXPTKk3c0PlVMsVg9uksb5dzNKLsg5fNaRLv9w0kSmf3qF5JdUyVAPFBK tvuHMEnTtIjSxr/I9Y8UwAGHdHoZnF2wJOZo0zk7kU659zNXFARbx2Nmv4DmDk9U1OdQ KSq5uxsy9j6tzrG79WXyWO7tOkPobVYpaRvdKeKoLFqq8zpWVHD6VBtCzlV00dQKrbza tF/g== 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=MfTpm336cuBYZzkP2acrVbBvCS8+4Y29Ne3uwgFeW9Y=; b=HSUbIh9oQb1Te95TPmcJaVJza61LLluoss+olPiQ3PUnVJX11LNOMg9JGnzOgpfmWE L8SxnydneW7h35W88aG07ECstqfaBYLjJN1DOo7KlcLGHZNHXNw9kCjl0qrhyTWxigtR NzTjW6WEu5yMfr4GVilkU6BbR3RW8/+QlPZk7KIn5OVrKfmv5+HyqS656RyibQsHQoXb 5lUYOThjd+ZDm5VknVZRMCr+A2QWtySYlM63gL+0W2Ifgpfpnk+mrbgNnEpTaj6TwZx+ 97tWLkDhElMt+5JOgGtAc26OBDwdQl/yHkYDpBgXSa8cvBayhPJxFsH2jzVjRP8GQOT0 00rQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=l++D45ij; 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 y11-20020a17090629cb00b007064dc53a88si9203560eje.619.2022.06.19.04.40.33; Sun, 19 Jun 2022 04:41:00 -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=l++D45ij; 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 S236429AbiFSLZo (ORCPT + 99 others); Sun, 19 Jun 2022 07:25:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51898 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229853AbiFSLZm (ORCPT ); Sun, 19 Jun 2022 07:25:42 -0400 Received: from mail-ed1-x532.google.com (mail-ed1-x532.google.com [IPv6:2a00:1450:4864:20::532]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3DFE55F67; Sun, 19 Jun 2022 04:25:41 -0700 (PDT) Received: by mail-ed1-x532.google.com with SMTP id cf14so1759371edb.8; Sun, 19 Jun 2022 04:25:41 -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=MfTpm336cuBYZzkP2acrVbBvCS8+4Y29Ne3uwgFeW9Y=; b=l++D45ijPavfLV7Ac80KJhVk9aQUSLHhd02xSe6sdWF9tkBNYWKP2kEOgtPBuFGhab 9r71F1CAtF89cCvZ+F4SIaRS9Cd355wrtF/OKvK9QHWygOqkSqhq4e5dsAweENKCqIli 2UUypJF0NtbO5dUGLidFFnA+BSF827Q+GqHbc2PcsZAfMIjHx64qrSYPf+Fes2cwrLUp MNU4/tUkxGUhnI5UnI/WY0WUY8BPfZV6RwcsVNuo/2xn3JTYgFpFOaRAdP+aTZZml6Qr sNMPW6224LkgS9grlukrKOjr4fQEdFSJuL4A6MaoKUBm5VKK1Q3tt/tKd+gdsNqPMw/n /m3Q== 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=MfTpm336cuBYZzkP2acrVbBvCS8+4Y29Ne3uwgFeW9Y=; b=igIrPtR9RaalD90yrExo56VnhG3hJZSxYecb91GCHHMxfRQYGDkPmG3DypccmaO+4o eW3uKebTbPDK7cIODQDda6YOT4JpDq4n9/9sD+JQJC/90n2wA17sbwzr8lhTZLIStw79 5+GjXa5XT9ivborGm1QCGyN85gIaCloSF5w3fYK9dKa+rtNc7w9lQcLnVCMvXuUdZb/a eD0VYRtqFQqNfNxNN6AMZ1DcdHg/wEEUyIWzWoqWWM18ukfslpGveqUZrOZ43pm9e7me 0JyUZ5CUi/fLt6xOfflKCJbCBNvjNVS6cU10HK8X3dTjH5IyMbjUT+p4EM8DNHWEuOsd rltg== X-Gm-Message-State: AJIora/7XKiEM3/Bg5/wdYHTHooJ945YJ8vWpsDvatxhAFC0pC+ZzPt9 qAjzIrtlm5M0guG5yA/Ys7ZWtlRw9T1uPXc2rQQ= X-Received: by 2002:a05:6402:249e:b0:42d:bb88:865b with SMTP id q30-20020a056402249e00b0042dbb88865bmr22727590eda.141.1655637939780; Sun, 19 Jun 2022 04:25:39 -0700 (PDT) MIME-Version: 1.0 References: <20220618214009.2178567-1-aidanmacdonald.0x0@gmail.com> <20220618214009.2178567-14-aidanmacdonald.0x0@gmail.com> In-Reply-To: From: Andy Shevchenko Date: Sun, 19 Jun 2022 13:25:03 +0200 Message-ID: Subject: Re: [PATCH v3 13/16] pinctrl: Add AXP192 pin control driver To: Aidan MacDonald Cc: Linus Walleij , Bartosz Golaszewski , Rob Herring , Krzysztof Kozlowski , Chen-Yu Tsai , Jonathan Cameron , Lee Jones , Sebastian Reichel , Mark Brown , Greg Kroah-Hartman , Liam Girdwood , Lars-Peter Clausen , "Rafael J. Wysocki" , quic_gurus@quicinc.com, Sebastian Reichel , Michael Walle , "open list:GPIO SUBSYSTEM" , devicetree , Linux Kernel Mailing List , linux-iio , Linux PM 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 Sun, Jun 19, 2022 at 1:20 PM Andy Shevchenko wrote: > On Sat, Jun 18, 2022 at 11:40 PM Aidan MacDonald > wrote: Hit 'Send' accidentally, here is the rest of the review, including previous comments. ... > > +config PINCTRL_AXP192 > > + tristate "X-Powers AXP192 PMIC pinctrl and GPIO Support" > > + depends on MFD_AXP20X > > > > + depends on OF > > Why? > > > + select PINMUX > > + select GENERIC_PINCONF > > + select GPIOLIB > > ... > > > +#include > > +#include > > Why? Perhaps you missed mod_devicetable.h. > ... > > > +struct axp192_pctl_function { > > + const char *name; > > + /* Mux value written to the control register to select the function (-1 if unsupported) */ > > Comment is misleading. -1 can't be a value of unsigned type. > > > + const u8 *muxvals; > > + const char * const *groups; > > + unsigned int ngroups; > > +}; > > ... > > > +struct axp192_pctl_desc { > > + unsigned int npins; > > + const struct pinctrl_pin_desc *pins; > > + /* Description of the function control register for each pin */ > > + const struct axp192_pctl_reg_info *ctrl_regs; > > + /* Description of the output signal register for each pin */ > > + const struct axp192_pctl_reg_info *out_regs; > > + /* Description of the input signal register for each pin */ > > + const struct axp192_pctl_reg_info *in_regs; > > + /* Description of the pull down resistor config register for each pin */ > > Can you just convert these comments to a kernel-doc? > > > + const struct axp192_pctl_reg_info *pull_down_regs; > > + > > + unsigned int nfunctions; > > + const struct axp192_pctl_function *functions; > > +}; > > ... > > > + > > + > > One blank line is enough. > > ... > > > + switch (param) { > > + case PIN_CONFIG_BIAS_DISABLE: > > + ret = axp192_pinconf_get_pull_down(pctldev, pin); > > + if (ret < 0) > > + return ret; > > > + else if (ret != 0) > > 1. Redundant 'else' > 2. if (ret > 0) > > > + return -EINVAL; > > + break; > > + > > + case PIN_CONFIG_BIAS_PULL_DOWN: > > + ret = axp192_pinconf_get_pull_down(pctldev, pin); > > + if (ret < 0) > > + return ret; > > + else if (ret == 0) > > Ditto. > > Looking at this I would rather expect the function to return something > defined, than 0, non-0. > > > + return -EINVAL; > > + break; > > > + default: > > + return -ENOTSUPP; > > + } > > ... > > > + for (cfg = 0; cfg < num_configs; ++cfg) { > > cfg++ will work the same way and easier to read. ... You may make some lines shorter by introducing here struct device *dev = &pdev->dev; > > + struct axp20x_dev *axp20x = dev_get_drvdata(pdev->dev.parent); dev->parent and so on... ... > > + pctl->pctl_dev = devm_pinctrl_register(&pdev->dev, pctrl_desc, pctl); > > + if (IS_ERR(pctl->pctl_dev)) > > + dev_err_probe(&pdev->dev, PTR_ERR(pctl->pctl_dev), > > + "couldn't register pinctrl driver\n"); With the above it probably fits one line. -- With Best Regards, Andy Shevchenko