Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp210438rwd; Wed, 7 Jun 2023 22:39:38 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4OPKaPicOHTbLkN+4ebr/PaSHpohIpQi4mGdfP4w3ZdmjLNPqygQ77T3Fpwdt3qhrPGSiz X-Received: by 2002:a54:4014:0:b0:397:f97c:4c94 with SMTP id x20-20020a544014000000b00397f97c4c94mr5415402oie.47.1686202777958; Wed, 07 Jun 2023 22:39:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686202777; cv=none; d=google.com; s=arc-20160816; b=iw8AG1az+Svl3zEge/GC3JEUxHrYiaDRDlFhdT5IiWxmO4w2aCSavmjAx30rdZ/Md6 ztda3pBMGVq4fKt2NrHNTbkXI1UQLqqR77TTDpVLoS3NxF/EIszsBobiLKWz2oKlGqZm X9NEuLbFe0qKI0/G7/TYfl42GO8US2rgTSDvzwu/WXOBayvRbAn/Zpwdm2dKnJYJLyYj 9uJep9SAGENIrEPPcFSuKrE+rPq5GFBDh4XiKFihI405lRaJ5+eCn7cav5CM2i1fb/fa 7M0xrQWOxQUSUTqL3eu62h8QqmJPB1mHTLf7z7BjVEAVyECku4yJSDBuEysDAUi0cluj dvgQ== 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=DE7OrFeNWC7NT42z/fRgG9LWd8ypqqUWEnKJtZerNBA=; b=BnHArlUa8Lf4cIxV2xaNMm8xaKB4GsmMbuH8ETLG39/40Z4wpu4T1hab1c4ZfSvJSS qBl1/q1ALfZF253YgE9dS/oDPSMKE1+R5tLkt1XlBWw22Hxe6hQDk10M10kSQ2zhJzjG 2MrAnVpfdwis+PznrmF72nYq+12F4Gxknmf+cpCjPzylNr2811qnoT8SdOkp6ToRYgBH 4/6v1L9sv0DNbX+maWlUqp8qlzCIMqgDlQfQ7vMkMc4DciQOipKDHybZuO3uACv52CV7 AbKOcVZFg3Ywqs0ZtEOmGbRHAq4elo28jOW1GSucex8ofwVpTPNB/LN2r6oSDxAox4Nw Gkkw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="uZ/e30b1"; 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=linaro.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e29-20020a056a0000dd00b006434e20d023si233913pfj.399.2023.06.07.22.39.24; Wed, 07 Jun 2023 22:39:37 -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=@linaro.org header.s=google header.b="uZ/e30b1"; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231320AbjFHF37 (ORCPT + 99 others); Thu, 8 Jun 2023 01:29:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38012 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234131AbjFHF35 (ORCPT ); Thu, 8 Jun 2023 01:29:57 -0400 Received: from mail-il1-x131.google.com (mail-il1-x131.google.com [IPv6:2607:f8b0:4864:20::131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F3EC326B5 for ; Wed, 7 Jun 2023 22:29:56 -0700 (PDT) Received: by mail-il1-x131.google.com with SMTP id e9e14a558f8ab-33e75ca0a8bso422775ab.0 for ; Wed, 07 Jun 2023 22:29:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1686202196; x=1688794196; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=DE7OrFeNWC7NT42z/fRgG9LWd8ypqqUWEnKJtZerNBA=; b=uZ/e30b1I3gC7oNBD9ef+9VYhMIXL4LiNnJraXSUHTeFWpER9LTP5EAjtj0ylaZdxd uZTBI/sndU0Xr921yVKqdP0aIl33kJqFKnuIaRZ97zn6/UQch8HEPOUt1PmZJYc7Q+pJ gfl+PGnIw9j6zc0vUxgzpFSsUFQ1BcsdkseRTExFmWsIgu22DSsu94ZFs2u5oxboMftz YTUoqmE5jLXmAhKm6zMbVaE4IYi52QitHthsLJAQcpn0M3/oPvTquX+ZdsoW5rfqPPp4 RNpMEvJ2A+iB6b63Ge4kMF+v1BvQTqDn4dqR5TPg9hAe3H5ak2uA9SUKSRbs6128gsWN vZww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686202196; x=1688794196; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=DE7OrFeNWC7NT42z/fRgG9LWd8ypqqUWEnKJtZerNBA=; b=MJR2d4+RX50QXSLe/98Bz0YYu8Ge4nYyYqZ4MVbYvJTqtk6vKW35uZhenVaZjC6dWg ier+eg+ipfB8bIJYzbxgAojcTYUvB0z3hPrlaMCfbrKsIHHZBPJMBMDAQWwYtZWWpikZ XvwjVBAMcnJ6xVZFN8QKESOauNx+Hls2fucC8YqnO/mv57WEvs2LzBEpWH1/ut4eV6Px L8pCJnqL36DSG5+0bCEAe8bFCcX0hbxlBqbIeHdAEu/SYWFWvggvl0OZyTK5v3p+HULT 34aDVDRvWqPiqcvs/CbDoWvzJUqBoSc1d3oLcq8Lhouzzynz9HcvE9D/JAM3lzYAJf0I 9enA== X-Gm-Message-State: AC+VfDzn1iS95E+R+8mnp7EpPKOLdg4O5olgc51hgbR4kEHI5+k/uFff Cr0G2C+bORflGmFs539NFU1Wgw== X-Received: by 2002:a92:d089:0:b0:325:b002:89b4 with SMTP id h9-20020a92d089000000b00325b00289b4mr7837299ilh.25.1686202196369; Wed, 07 Jun 2023 22:29:56 -0700 (PDT) Received: from localhost ([122.172.87.195]) by smtp.gmail.com with ESMTPSA id e21-20020a62aa15000000b0065014c15a57sm271206pff.35.2023.06.07.22.29.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Jun 2023 22:29:55 -0700 (PDT) Date: Thu, 8 Jun 2023 10:59:53 +0530 From: Viresh Kumar To: Ulf Hansson Cc: Sudeep Holla , Cristian Marussi , Viresh Kumar , Nishanth Menon , Stephen Boyd , Nikunj Kela , Prasad Sodagudi , Alexandre Torgue , linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 11/16] OPP: Add dev_pm_opp_add_dynamic() to allow more flexibility Message-ID: <20230608052953.l44dwb6n62kx4umk@vireshk-i7> References: <20230607124628.157465-1-ulf.hansson@linaro.org> <20230607124628.157465-12-ulf.hansson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230607124628.157465-12-ulf.hansson@linaro.org> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,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 07-06-23, 14:46, Ulf Hansson wrote: > diff --git a/drivers/opp/core.c b/drivers/opp/core.c > index 954c94865cf5..0e6ee2980f88 100644 > --- a/drivers/opp/core.c > +++ b/drivers/opp/core.c > @@ -1921,8 +1921,7 @@ int _opp_add(struct device *dev, struct dev_pm_opp *new_opp, > * _opp_add_v1() - Allocate a OPP based on v1 bindings. > * @opp_table: OPP table > * @dev: device for which we do this operation > - * @freq: Frequency in Hz for this OPP > - * @u_volt: Voltage in uVolts for this OPP > + * @opp: The OPP to add > * @dynamic: Dynamically added OPPs. > * > * This function adds an opp definition to the opp table and returns status. > @@ -1940,10 +1939,10 @@ int _opp_add(struct device *dev, struct dev_pm_opp *new_opp, > * -ENOMEM Memory allocation failure > */ > int _opp_add_v1(struct opp_table *opp_table, struct device *dev, > - unsigned long freq, long u_volt, bool dynamic) > + struct dev_pm_opp_data *opp, bool dynamic) The name `opp` is mostly used for instances of `struct dev_pm_opp`. Can we use a different name here please for the data ? > +/** > + * dev_pm_opp_add() - Add an OPP table from a table definitions > + * @dev: device for which we do this operation > + * @freq: Frequency in Hz for this OPP > + * @u_volt: Voltage in uVolts for this OPP > + * > + * This function adds an opp definition to the opp table and returns status. > + * The opp is made available by default and it can be controlled using > + * dev_pm_opp_enable/disable functions. > + * > + * Return: > + * 0 On success OR > + * Duplicate OPPs (both freq and volt are same) and opp->available > + * -EEXIST Freq are same and volt are different OR > + * Duplicate OPPs (both freq and volt are same) and !opp->available > + * -ENOMEM Memory allocation failure > + */ > +int dev_pm_opp_add(struct device *dev, unsigned long freq, unsigned long u_volt) Maybe move this to include/linux/pm_opp.h and mark it static inline and get rid of documentation too. > +{ > + struct dev_pm_opp_data opp; > + > + memset(&opp, 0, sizeof(opp)); What about struct dev_pm_opp_data data = {0}; I think it is guaranteed that all the fields will be 0 now, not the padding of course, but we don't care about that here. > + opp.freq = freq; > + opp.u_volt = u_volt; Or maybe just struct dev_pm_opp_data data = { .freq = freq, .u_volt = u_volt, }; Rest must be 0. -- viresh