Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp10659250rwr; Fri, 12 May 2023 11:01:18 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5Jp0VOUBH+WLPluQ8d40PXbNIc0SZcBAy8Wws3RI2bMmEJ5nL4r/ObbIvEEScakNKemKIG X-Received: by 2002:a17:903:294c:b0:1a9:6604:2b1b with SMTP id li12-20020a170903294c00b001a966042b1bmr23696012plb.20.1683914478545; Fri, 12 May 2023 11:01:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683914478; cv=none; d=google.com; s=arc-20160816; b=j8uaV6s/bOaS5pQyTP992mlofMfCJXoSmpxVn44a2rB1sFdM1L7jD7okm9uL7VAhbI 8szFhgTAzvJD9jcONyckRmIUQ8CmHnehJ9mFWcNoJUDS0rK4J3PTV1VR8k/Y2TslwVpH fpN3qMllNPsysurnmXX9k6dzdSc3/U+bG43M7IXRxbdIU4dCPn28a2ATYaWm+6CRZ3ry uDJGKp7jyNAfhVTT9iKdDSTbZXI5cM6eI+2dnp1bwcu6fNubAzR6Nqka3u52ijwhkeeA EakRShyxsIphUIfpJ3NHr4OqmYQZQ3WJ988+fcCGeSWCG8VNFxTnhKoNj/cdgHwF4enr rdgg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:date:from; bh=esAkEMGy29XHG0Ad4ONdv5oj5vIiAwg1Zws055CBWFU=; b=FkJCIzL4f7aliv4lxRKauIquSvvD9cFb/PmKEfNgilc9Dme570Om1Kzr15aAnhFi+7 FqmXzF/UabHRP4DRhSQieF1DaA3HMCH7BbVOtRIF4fGiS2e/btXeOApMG0SJ57/w/gBS utZmE+fTybv8kgg7tAXgsPRi7dHC5+FeKiizr5IM9UJrjA3j8ed29CugZcJdIdbmYNDz xKUR4vyHRDGgJtf3GR1IJt3+BTSfZD25eB3pWCU0Xqjln2CC0VcIisgRUUsGVeh4XXTn zFFLholy0DENRrBOdEcqh/1dv7TWPTpdCy7V/knZkkHYa0yVWEZ74mNG0lqCqCCOAOlG 4qBw== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (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 t7-20020a1709028c8700b0019a71e14c19si628413plo.320.2023.05.12.11.01.05; Fri, 12 May 2023 11:01:18 -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; 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=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237999AbjELRey (ORCPT + 99 others); Fri, 12 May 2023 13:34:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40882 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237470AbjELRev (ORCPT ); Fri, 12 May 2023 13:34:51 -0400 Received: from fgw21-7.mail.saunalahti.fi (fgw21-7.mail.saunalahti.fi [62.142.5.82]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1F8801B8 for ; Fri, 12 May 2023 10:34:49 -0700 (PDT) Received: from localhost (88-113-26-95.elisa-laajakaista.fi [88.113.26.95]) by fgw21.mail.saunalahti.fi (Halon) with ESMTP id 4a6e862d-f0eb-11ed-abf4-005056bdd08f; Fri, 12 May 2023 20:34:47 +0300 (EEST) From: andy.shevchenko@gmail.com Date: Fri, 12 May 2023 20:34:47 +0300 To: Esteban Blanc Cc: linus.walleij@linaro.org, lgirdwood@gmail.com, broonie@kernel.org, a.zummo@towertech.it, alexandre.belloni@bootlin.com, linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org, linux-rtc@vger.kernel.org, jpanis@baylibre.com, jneanne@baylibre.com, aseketeli@baylibre.com, sterzik@ti.com, u-kumar1@ti.com Subject: Re: [PATCH v4 3/3] regulator: tps6594-regulator: Add driver for TI TPS6594 regulators Message-ID: References: <20230512141755.1712358-1-eblanc@baylibre.com> <20230512141755.1712358-4-eblanc@baylibre.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230512141755.1712358-4-eblanc@baylibre.com> X-Spam-Status: No, score=0.7 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, FORGED_GMAIL_RCVD,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED,SPF_HELO_NONE, SPF_SOFTFAIL,T_SCC_BODY_TEXT_LINE autolearn=no 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 Fri, May 12, 2023 at 04:17:55PM +0200, Esteban Blanc kirjoitti: > From: Jerome Neanne > > This patch adds support for TPS6594 regulators (bucks and LDOs). > The output voltages are configurable and are meant to supply power > to the main processor and other components. > Bucks can be used in single or multiphase mode, depending on PMIC > part number. ... > + enum { > + MULTI_BUCK12, > + MULTI_BUCK123, > + MULTI_BUCK1234, > + MULTI_BUCK12_34, > + MULTI_FIRST = MULTI_BUCK12, > + MULTI_LAST = MULTI_BUCK12_34, > + MULTI_NUM = MULTI_LAST - MULTI_FIRST + 1 Missing TABs? > + }; ... > + for (multi = MULTI_FIRST ; multi < MULTI_NUM ; multi++) { Just a remark: spaces before ; are not standard. > + np = of_find_node_by_name(tps->dev->of_node, multiphases[multi]); > + npname = of_node_full_name(np); > + np_pmic_parent = of_get_parent(of_get_parent(np)); > + if (strcmp((of_node_full_name(np_pmic_parent)), tps->dev->of_node->full_name)) > + continue; Isn't there an API to compare OF node name with a given parameter? > + delta = strcmp(npname, multiphases[multi]); > + if (!delta) { > + switch (multi) { > + case MULTI_BUCK12: > + buck_multi[0] = 1; > + buck_configured[0] = 1; > + buck_configured[1] = 1; > + break; > + /* multiphase buck34 is supported only with buck12 */ > + case MULTI_BUCK12_34: > + buck_multi[0] = 1; > + buck_configured[0] = 1; > + buck_configured[1] = 1; > + buck_multi[1] = 1; Might be easier to read if this is grouped with [0] assignment above. > + buck_configured[2] = 1; > + buck_configured[3] = 1; > + break; > + case MULTI_BUCK123: > + buck_multi[2] = 1; > + buck_configured[0] = 1; > + buck_configured[1] = 1; > + buck_configured[2] = 1; > + break; > + case MULTI_BUCK1234: > + buck_multi[3] = 1; > + buck_configured[0] = 1; > + buck_configured[1] = 1; > + buck_configured[2] = 1; > + buck_configured[3] = 1; > + break; > + } > + } > + } ... > + irq_data = devm_kmalloc(tps->dev, > + ARRAY_SIZE(tps6594_bucks_irq_types) * > + REGS_INT_NB * > + sizeof(struct tps6594_regulator_irq_data) + > + ARRAY_SIZE(tps6594_ldos_irq_types) * > + REGS_INT_NB * > + sizeof(struct tps6594_regulator_irq_data), We have respective macros in overflow.h that can be used here. > + GFP_KERNEL); > + if (!irq_data) > + return -ENOMEM; ... > + rdev = devm_regulator_register(&pdev->dev, &multi_regs[i], &config); > + if (IS_ERR(rdev)) { > + dev_err(tps->dev, "failed to register %s regulator\n", > + pdev->name); > + return PTR_ERR(rdev); return dev_err_probe(...); ? > + } ... > + rdev = devm_regulator_register(&pdev->dev, &buck_regs[i], &config); > + if (IS_ERR(rdev)) { > + dev_err(tps->dev, "failed to register %s regulator\n", > + pdev->name); > + return PTR_ERR(rdev); Same question. > + } ... > + rdev = devm_regulator_register(&pdev->dev, &ldo_regs[i], &config); > + if (IS_ERR(rdev)) { > + dev_err(tps->dev, > + "failed to register %s regulator\n", > + pdev->name); > + return PTR_ERR(rdev); Same question. > + } > + irq_ext_reg_data = devm_kmalloc(tps->dev, > + ext_reg_irq_nb * > + sizeof(struct tps6594_ext_regulator_irq_data), > + GFP_KERNEL); devm_kmalloc_array() > + if (!irq_ext_reg_data) > + return -ENOMEM; ... > + error = devm_request_threaded_irq(tps->dev, irq, NULL, > + tps6594_regulator_irq_handler, > + IRQF_ONESHOT, > + irq_type->irq_name, > + &irq_ext_reg_data[i]); > + if (error) { > + dev_err(tps->dev, "failed to request %s IRQ %d: %d\n", > + irq_type->irq_name, irq, error); > + return error; return dev_err_probe(...); ? > + } > + } > + return 0; > +} -- With Best Regards, Andy Shevchenko