Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp20458rwr; Wed, 19 Apr 2023 17:16:29 -0700 (PDT) X-Google-Smtp-Source: AKy350a4p14sCfFnoyXAiLSljCe8fRps+0q6MJMMMsQoczW4jF+XFxwT4EFU0LyLxkjAGN5Xvand X-Received: by 2002:a05:6a20:a5a8:b0:ee:fe67:5cb9 with SMTP id bc40-20020a056a20a5a800b000eefe675cb9mr490199pzb.17.1681949789127; Wed, 19 Apr 2023 17:16:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681949789; cv=none; d=google.com; s=arc-20160816; b=afTJgmT8ENCRPZ4LQRHn/7Leuk18jv4v5gDDIiuyxH1tiN3awCAxDvOwI1JEM6yDGv rFMHI4ImYmAwjnjpvpDQqY9a7oBqS4bch8b7N7XyeWlnTn3nqxcZH5KyoahD7KnlAtQt vdnfP+cSuYmAtOMz+3RgDbx+yc5zwZQH7hQVlAcWxG+3jn7jWXpEy6O1nbhyjSZeq7VZ 1JyiZbvB4XARLrVLcTtnMM0LfVRy32jwrQuMtDVA76PwO8HW4W+qI8/wRrn4r1IjIHQf UYwCjK2ZgZ4yL9AlIB35aof2sUdqKJpVrN2IYJHUgp6hzAW7UeG8PXpGjvs4hECAiq8j UK3A== 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:from:date:dkim-signature; bh=F3AbR5w5jgDe9WKrNU74298opdwJ1RKaOJYN4wnr8UE=; b=JojFUN2OTAzCwFFiE286U6MZ8XfSXn1HUIIRHuRRhLgtgzsdwYhn5V7clyTh+YM7A4 jEadNP7adSZPXd57SzbApVtODFk8F17DbaLkRalkwU6KJl1JQjK0zvVfo0qN2X+gyghH mbBhxpcueAcasJvuSfgckT1L3GLniLq3E8MGzbrBH5T66yzEAjUD1HTNHtN6oo55SWLF jRNEFWCpHIRrGW/UfLXK3muXj3BP+EsHC0qORZ4y2Ul12jquSS2Xo3IHSCIHcS3XraQm +vDocGCoH4mXPZ9huoCa8n+Jx2SYjNpDQyClCHr3+9DZnfSwdVDAIPbm5plo9uTU8qQF usTg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bewilderbeest.net header.s=thorn header.b=IGj04yVd; 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=NONE dis=NONE) header.from=bewilderbeest.net Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t145-20020a635f97000000b00517ac1a9a63si8428pgb.129.2023.04.19.17.16.14; Wed, 19 Apr 2023 17:16:29 -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=@bewilderbeest.net header.s=thorn header.b=IGj04yVd; 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=NONE dis=NONE) header.from=bewilderbeest.net Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231889AbjDTACR (ORCPT + 99 others); Wed, 19 Apr 2023 20:02:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55206 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231246AbjDTACP (ORCPT ); Wed, 19 Apr 2023 20:02:15 -0400 Received: from thorn.bewilderbeest.net (thorn.bewilderbeest.net [IPv6:2605:2700:0:5::4713:9cab]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C363E4EDC for ; Wed, 19 Apr 2023 17:02:14 -0700 (PDT) Received: from hatter.bewilderbeest.net (174-21-172-149.tukw.qwest.net [174.21.172.149]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: zev) by thorn.bewilderbeest.net (Postfix) with ESMTPSA id 861E491D; Wed, 19 Apr 2023 17:02:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bewilderbeest.net; s=thorn; t=1681948934; bh=F3AbR5w5jgDe9WKrNU74298opdwJ1RKaOJYN4wnr8UE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=IGj04yVdGEWYNGnr8cpD5xvWusJflWifDmBEA/k+UTVwQPEVfbf7UwSUT1PoNDLu5 Om11loNX64WFaR9mVkKeCHU563VJFyB0K0S5nZOZjjzzA2DJnH+k4lq66P4jeGm4O4 /Ru2eNGa00c5b4YyDyw3Rto3XbtliPGs4nMXY+Eo= Date: Wed, 19 Apr 2023 17:02:13 -0700 From: Zev Weiss To: Naresh Solanki Cc: Liam Girdwood , Mark Brown , linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/2] regulator: userspace-consumer: Multiple regulators Message-ID: References: <20230418145051.4192963-1-Naresh.Solanki@9elements.com> <20230418145051.4192963-2-Naresh.Solanki@9elements.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <20230418145051.4192963-2-Naresh.Solanki@9elements.com> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,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 Tue, Apr 18, 2023 at 07:50:51AM PDT, Naresh Solanki wrote: >Use property regulator-supplies to determine all regulator >supplies. >This is useful in case of a connector having 2 or more supplies. >Example: PCIe connector on mainboard can be powered by 12V & 3.3V >suplies. > >Signed-off-by: Naresh Solanki >--- > drivers/regulator/userspace-consumer.c | 19 +++++++++++++++---- > 1 file changed, 15 insertions(+), 4 deletions(-) > >diff --git a/drivers/regulator/userspace-consumer.c b/drivers/regulator/userspace-consumer.c >index 97f075ed68c9..0bb49547b926 100644 >--- a/drivers/regulator/userspace-consumer.c >+++ b/drivers/regulator/userspace-consumer.c >@@ -120,7 +120,10 @@ static int regulator_userspace_consumer_probe(struct platform_device *pdev) > struct regulator_userspace_consumer_data tmpdata; > struct regulator_userspace_consumer_data *pdata; > struct userspace_consumer_data *drvdata; >- int ret; >+ struct device_node *np = pdev->dev.of_node; >+ struct property *prop; >+ const char *supply; >+ int ret, count = 0; > > pdata = dev_get_platdata(&pdev->dev); > if (!pdata) { >@@ -131,11 +134,19 @@ static int regulator_userspace_consumer_probe(struct platform_device *pdev) > memset(pdata, 0, sizeof(*pdata)); > > pdata->no_autoswitch = true; >- pdata->num_supplies = 1; >- pdata->supplies = devm_kzalloc(&pdev->dev, sizeof(*pdata->supplies), GFP_KERNEL); >+ pdata->num_supplies = of_property_count_strings(np, "regulator-supplies"); >+ if (pdata->num_supplies < 0) { >+ dev_err(&pdev->dev, "could not parse property regulator-supplies"); >+ return -EINVAL; >+ } >+ pdata->supplies = devm_kzalloc(&pdev->dev, >+ sizeof(*pdata->supplies) * pdata->num_supplies, >+ GFP_KERNEL); AFAICT this doesn't appear to implement the "vout" default specified in the dt-binding patch? Also, since the core of the userspace-consumer driver itself already supports multiple regulators, it might be nice for the subject line to mention DT supplies or something a bit more specifically. > if (!pdata->supplies) > return -ENOMEM; >- pdata->supplies[0].supply = "vout"; >+ >+ of_property_for_each_string(np, "regulator-supplies", prop, supply) >+ pdata->supplies[count++].supply = supply; > } > > if (pdata->num_supplies < 1) { >-- >2.39.1 > >