Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp4529819rwl; Tue, 28 Mar 2023 08:05:43 -0700 (PDT) X-Google-Smtp-Source: AKy350ZdhE76UHoCTRTL6ZvuzpFdoUpAJncSujc4IS+UYm3S1Z2Mm2S4IwA7lT8ScYiC7L+Rq7+M X-Received: by 2002:a17:906:ac1:b0:92d:9767:8e0a with SMTP id z1-20020a1709060ac100b0092d97678e0amr14653717ejf.13.1680015942883; Tue, 28 Mar 2023 08:05:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680015942; cv=none; d=google.com; s=arc-20160816; b=t2kQaBxoBfxGN2MLtTdu7P8HSeocGNkh0yd0KzBQcjBNpBtgENyTN9r5fuLrcfULsm 1/JuK+DN70V+vDHQ4q1lR4ATO5lxfakERWKXZ7iZKIXrzTZaeO6du9mcBrW8LUk/okGb mGKXVD/xta5JbCtE7D8n7LM1m6+GUqI0kdUOsnd5UftSQtd/YuHlUSS8FQBQoL43GVHO OUe6cn5xCOimgLohyb5RQOfjbC3O2ZEg8yE20nRiYC9Qlo0ePfHvsmknjmxJ3RIJeX/Y sblZJ6r7LhDONa7Nlx3LYs0bgdkMN3+og3LV3dW7imEjoErMQJwooLx+KYsuFH8PFwZh 5+OA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=fpixAugXoZaAwUVYpLsM7+hqMka5O+Qfwz+XpgeRjTs=; b=tIt8tMr1J4M5DFjHaUjLFaeg9i6bf/emBOBSigc5C4gMJVBD6EBTj8Kj0YI3e7pCrW 6O+rR0cT5INdMH6xjwPocB2z1yVtliYIVr2VwEOOiX9n2fDpyDBmxjVZn5tmUQi8ZSrH sviuoBk1IfTzreL3ez835T3ZBPEhdZ+sl09XGtBtN5QnU14xknCpgYAEprGWUEw6cmbl rO10krBHkCTJWn9DIbHe8WgttuioSMGlqRnOPnWiBCWo84bqOiUypcCyZipL6OKW81bE YNJvLnwy5PHsAAdB7f/EWq9obdGk9347bnPAzSiA8sIOt2u5Yjo4K7DWzioF2mww02ou FcXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@9elements.com header.s=google header.b=SwYO599z; 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=9elements.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s9-20020a170906960900b0093039b03cb4si9419269ejx.603.2023.03.28.08.05.15; Tue, 28 Mar 2023 08:05:42 -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=@9elements.com header.s=google header.b=SwYO599z; 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=9elements.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233826AbjC1PFD (ORCPT + 99 others); Tue, 28 Mar 2023 11:05:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44686 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233837AbjC1PFA (ORCPT ); Tue, 28 Mar 2023 11:05:00 -0400 Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 72FE4EC49 for ; Tue, 28 Mar 2023 08:03:45 -0700 (PDT) Received: by mail-wm1-x32d.google.com with SMTP id o24-20020a05600c511800b003ef59905f26so7671185wms.2 for ; Tue, 28 Mar 2023 08:03:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=9elements.com; s=google; t=1680015818; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=fpixAugXoZaAwUVYpLsM7+hqMka5O+Qfwz+XpgeRjTs=; b=SwYO599zCOMIb+ah0SxNIpjnaqvUaPRoqNOQOnLbI/08m5dkKLq0vxapCVvHBMfYp3 y2wPQeJbC9lJ/Xz7WFhvhsJZJvPHgGA7b7fPNOroAu3qVuXFxPYaKiM66TjUbm+DKV2O RUDkUkOqJDW+Da43id/Jcrf6ijm5Rz4bvNbQFkguPhq3lXCqduLRCLNC72JfRpgrqm9e hj/jMh2PT+ZrDMGa5NXqAg8lb5/vg4pdDNnR/oZIc5ZlB51dx/1GCVrASzZ85bIoYce4 vqb4y0bjWCN8mi/X6/4EDlXkASNlKIgXFZB+jTo+K45BhB07FJ0OR/v4+Ku3jLH/J8uk F6Wg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680015818; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=fpixAugXoZaAwUVYpLsM7+hqMka5O+Qfwz+XpgeRjTs=; b=jtEPbd5GdthmvdAECApEjFiuTddMFTfuubbJO21i6xzga4LzxBbxPBgPaJyJu9beWr NUJarAdPgvoIsDVqy0PUJWHUNX7yNP7LD+mfeEZI3x64UucIdeo4jcLFS7Z0to8EBouY JcZydfDWSGHhQATibs48HojP6F1lHWl1+xZA1jE8rq+h02AGoHuRVc15wqy0vlHdcTAY 2mf9mCX5UGtX2TkKmTq57/FHW0uSKVJp7OSotji2V23sKbUTgR7doOvZpRzDOyuIiM51 SZuoOrnakFRlsEo2febGC5I8ROoVTYCrnrk6pxXUNoQTLM1FVIioJ4RIIYF+D7aRkIHx /0Sw== X-Gm-Message-State: AO0yUKXHQ8tfcmiRmBEYHBORIlf7jfiuqMYtutboPMYiNjUN7vxLQPmJ 9f2Inn9JuKeVXuqELixXVBvlkw== X-Received: by 2002:a7b:c7c5:0:b0:3ed:809b:79ac with SMTP id z5-20020a7bc7c5000000b003ed809b79acmr12587433wmk.19.1680015817802; Tue, 28 Mar 2023 08:03:37 -0700 (PDT) Received: from stroh80.sec.9e.network (ip-078-094-000-051.um19.pools.vodafone-ip.de. [78.94.0.51]) by smtp.gmail.com with ESMTPSA id a2-20020a05600c224200b003ee63fe5203sm17429293wmm.36.2023.03.28.08.03.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Mar 2023 08:03:37 -0700 (PDT) From: Naresh Solanki X-Google-Original-From: Naresh Solanki To: Guenter Roeck , linux-hwmon@vger.kernel.org, Jean Delvare Cc: Patrick Rudolph , Naresh Solanki , linux-kernel@vger.kernel.org Subject: [PATCH v2 1/3] hwmon: (pmbus/core): Add rdev in pmbus_data struct Date: Tue, 28 Mar 2023 17:03:33 +0200 Message-Id: <20230328150335.90238-1-Naresh.Solanki@9elements.com> X-Mailer: git-send-email 2.39.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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 Add regulator device in pmbus_data & initialize the same during PMBus regulator register. Signed-off-by: Naresh Solanki --- drivers/hwmon/pmbus/pmbus_core.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/drivers/hwmon/pmbus/pmbus_core.c b/drivers/hwmon/pmbus/pmbus_core.c index 0ddef2c9ba9b..d93405f1a495 100644 --- a/drivers/hwmon/pmbus/pmbus_core.c +++ b/drivers/hwmon/pmbus/pmbus_core.c @@ -81,6 +81,7 @@ struct pmbus_label { struct pmbus_data { struct device *dev; struct device *hwmon_dev; + struct regulator_dev **rdevs; u32 flags; /* from platform data */ @@ -3109,9 +3110,13 @@ static int pmbus_regulator_register(struct pmbus_data *data) struct device *dev = data->dev; const struct pmbus_driver_info *info = data->info; const struct pmbus_platform_data *pdata = dev_get_platdata(dev); - struct regulator_dev *rdev; int i; + data->rdevs = devm_kzalloc(dev, sizeof(struct regulator_dev *) * info->num_regulators, + GFP_KERNEL); + if (!data->rdevs) + return -ENOMEM; + for (i = 0; i < info->num_regulators; i++) { struct regulator_config config = { }; @@ -3121,10 +3126,10 @@ static int pmbus_regulator_register(struct pmbus_data *data) if (pdata && pdata->reg_init_data) config.init_data = &pdata->reg_init_data[i]; - rdev = devm_regulator_register(dev, &info->reg_desc[i], - &config); - if (IS_ERR(rdev)) - return dev_err_probe(dev, PTR_ERR(rdev), + data->rdevs[i] = devm_regulator_register(dev, &info->reg_desc[i], + &config); + if (IS_ERR(data->rdevs[i])) + return dev_err_probe(dev, PTR_ERR(data->rdevs[i]), "Failed to register %s regulator\n", info->reg_desc[i].name); } base-commit: 8a863eb1b1162653d133856702e13560f3596b85 -- 2.39.1