Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp4846298rdb; Tue, 12 Dec 2023 10:50:58 -0800 (PST) X-Google-Smtp-Source: AGHT+IE/5d5UTSJZjjFPfmWUIcr8iIbXZFUUpHZxRfnBOBrdIf8oVzcO/TRPV0CLYmBcs2JTSrlw X-Received: by 2002:a17:90a:dc02:b0:286:6cc1:866a with SMTP id i2-20020a17090adc0200b002866cc1866amr3649297pjv.79.1702407058202; Tue, 12 Dec 2023 10:50:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702407058; cv=none; d=google.com; s=arc-20160816; b=zHyIvtWYuQ6q/mZogUOKb47tPohodv6ZyVjCtBU4SGG86xsBKveYkDNqWiArFnLLMx cVqsXCsJczIAOsSI5AUpVzYvYQXkyP5ILsH5r6atPbIQuKHEP/au41zxuGYMtyCHOz71 sGmd560RkyXHxipXkqWoCEjz33B4f+NZW8ssrWOTOHX+bLJhOtNVZfK5H7rrKmj++1OC sclefXU4AVeU3NQIfd0McqS6wCdUFyeuvXlv0pgY7/hGHAk+QzFvOSvcu/Qm5zl0o9vb 6CR9JF3jVq8QX1oTFQq09ncqdhO68mYc7MmpTVqMqUhHgNp3L2B+azFe+bdCApeh0pD7 VJrg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=RQtLKsC1GJO7VlTKy9IdfYiM/NXCdQtA/xxt7gZTMWo=; fh=b6jz0bdxnlnt0RSJHliaH022TdeHcNL6OWCvUlnI6JM=; b=0cXUSPyb5pjPbE/D+hvcHyeKGxM6K2LBE1V4aVqs3kOafoYuL+WkbSN88a1NsqvwB1 Bk+bUHRjIc2ZQ9FBgqKRS8RVEzPDL+88v/HZwgx+uYJ+m+YB40Xp4r5i5oJBYEljFfJ2 8aSK0x830UDSrJbaezBd8VvNvcFblO8beYhMRFN3zxQj6hoM4hPk7lbLuVkIuKQO9XdQ motuPo0tYRD4VG1laaugHAOwDUIbEJswPAdH8GIf9LiS880UaiahiN0D+HxVxG2NYg6Z CNpJ+th5ZQ0kG+BzqcT65XzhBdabun03hf/CvfdmflxMOQBW5tGYHvUyhGr0ohxFNRMG J5OQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id iz3-20020a170902ef8300b001d076ffeecdsi8212205plb.198.2023.12.12.10.50.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Dec 2023 10:50:58 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id D93D080A8BB4; Tue, 12 Dec 2023 10:50:16 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1376734AbjLLSuD (ORCPT + 99 others); Tue, 12 Dec 2023 13:50:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45740 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1376732AbjLLSt7 (ORCPT ); Tue, 12 Dec 2023 13:49:59 -0500 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 002DBBD; Tue, 12 Dec 2023 10:50:03 -0800 (PST) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 17E371FB; Tue, 12 Dec 2023 10:50:50 -0800 (PST) Received: from [192.168.178.6] (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 6C0133F762; Tue, 12 Dec 2023 10:50:01 -0800 (PST) Message-ID: Date: Tue, 12 Dec 2023 19:50:01 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v5 07/23] PM: EM: Refactor how the EM table is allocated and populated Content-Language: en-US To: Lukasz Luba , linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, rafael@kernel.org Cc: rui.zhang@intel.com, amit.kucheria@verdurent.com, amit.kachhap@gmail.com, daniel.lezcano@linaro.org, viresh.kumar@linaro.org, len.brown@intel.com, pavel@ucw.cz, mhiramat@kernel.org, qyousef@layalina.io, wvw@google.com References: <20231129110853.94344-1-lukasz.luba@arm.com> <20231129110853.94344-8-lukasz.luba@arm.com> From: Dietmar Eggemann In-Reply-To: <20231129110853.94344-8-lukasz.luba@arm.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Tue, 12 Dec 2023 10:50:17 -0800 (PST) On 29/11/2023 12:08, Lukasz Luba wrote: > Split the process of allocation and data initialization for the EM table. > The upcoming changes for modifiable EM will use it. > > This change is not expected to alter the general functionality. NIT: IMHO, I guess you wanted to say: "No functional changes introduced"? I.e. all not only general functionality ... [...] > static int em_create_pd(struct device *dev, int nr_states, > @@ -234,11 +234,15 @@ static int em_create_pd(struct device *dev, int nr_states, > return -ENOMEM; > } > > - ret = em_create_perf_table(dev, pd, nr_states, cb, flags); > - if (ret) { > - kfree(pd); > - return ret; > - } > + pd->nr_perf_states = nr_states; Why does `pd->nr_perf_states = nr_states;` have to move from em_create_perf_table() to em_create_pd()? > + > + ret = em_allocate_perf_table(pd, nr_states); > + if (ret) > + goto free_pd; > + > + ret = em_create_perf_table(dev, pd, pd->table, nr_states, cb, flags); If you set it in em_create_pd() then you can use 'pd->nr_perf_states' in em_create_perf_table() and doesn't have to pass `nr_states`. [...]