Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp429591rwd; Thu, 8 Jun 2023 02:48:39 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6oasfXZ+YSs225pJj/UJ1HfmqXhCXENquHNuczmOgCpnNGIoBug+pkD0EfOvnIStoLbZgJ X-Received: by 2002:a05:6a21:3394:b0:ef:7aa2:3cfd with SMTP id yy20-20020a056a21339400b000ef7aa23cfdmr3681499pzb.50.1686217719662; Thu, 08 Jun 2023 02:48:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686217719; cv=none; d=google.com; s=arc-20160816; b=qGnKikbyHaMD8V8eztvZotH/6JtAkmleOTA2nRmg8idQasQHrnmibeP8HwpKtPDNQD 42aIZpCqYfbRkR9vxrKc7YLrZlPMHnRGJaDOqsldZrur4GS9HiZjw2cIxRQrfUgHjKP4 /tNDE9NGUfr5OqxQZCsoksF++j1oh088RhzQS/ORvdB1L2pNF0UOD6NVovWLAMViEFJp 7yxC0OQvDZa0ZAltFOS0+tt+WQvK9G06JhmC1DESXYsheFWDZTfcXQC4KvKMZNzdc6YS 9mE7ogIONZus8IpPodDTESH/niT1HlVuLnHtBBCxQaF+YMmTf75umh+DzQbGhG6F7ako wcug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=k0aUfso+mqed718DXVZBOh7dWuv36gH3PMUsz0/Om4Y=; b=gfgsapNd4cAQtKP5pg3uRxfCU0oEhoenuU2iQ7n/AkWa1bJ/5qwkIGuIoBgJaXzdxt XvrqlrVjiuDCci4QTCcTPCYBEx+/tj3iMYaBf/OaByY9P/WtmoVwgJGWKY96uoC0DpgO RwluLrcx5sa/9dMXuEYekqT+AKtk13HeJjS6Ay7G7Fok0MPOZ0xyJe/XKI5cdWBDriCD l2ogOZ1dCsa0BKRN9pp8vLWMt+u8zRQrCFU5zgmxgoRNoWdHcF3yW2sbd6mw/0nyXHvM iwqoiEuZktmoAO+z3j3tyNo34yGOkfvgj9zrV+BiHQkldFQ5UBVRDhBUBfGM5kOb2P0L 2j5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=RR9fneaG; 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 i26-20020a056a00005a00b0064f6a531c88si548600pfk.323.2023.06.08.02.48.27; Thu, 08 Jun 2023 02:48:39 -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=RR9fneaG; 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 S232262AbjFHJhq (ORCPT + 99 others); Thu, 8 Jun 2023 05:37:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42810 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233473AbjFHJho (ORCPT ); Thu, 8 Jun 2023 05:37:44 -0400 Received: from mail-yb1-xb2b.google.com (mail-yb1-xb2b.google.com [IPv6:2607:f8b0:4864:20::b2b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5CA271BFF for ; Thu, 8 Jun 2023 02:37:43 -0700 (PDT) Received: by mail-yb1-xb2b.google.com with SMTP id 3f1490d57ef6-bacf5b89da7so488935276.2 for ; Thu, 08 Jun 2023 02:37:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1686217062; x=1688809062; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=k0aUfso+mqed718DXVZBOh7dWuv36gH3PMUsz0/Om4Y=; b=RR9fneaGbSjT8vSD0NNMv3dAoiwDN/Po6A7iO6KQqhAtQV7KeeXJIdW01wkDjczV27 S/Q85c+80/41rffy1DjN7lKodqzjmCo+scaeyuBhQSs7G0D6JYcIhss3GXHW8imXsP60 bg3KfGqWUsPQn8WY+lmaHOxAYItdjVdfOJWlY++3ZPY0woVVvgKhG00KB9jjtr1dpdTy bGJ5T5sDUJYnSMHNaNhCI4TR09T4Q3xpXhK8/uDmJ4+hB0p/aZEP4dwRe/PQJRoo6Jaq PXw5SSF77ZLkdzz5X+Ow9AUKnE21QtyvkHN4Jq55zrDNLiNIuztFDugBBeQpmWHG77O+ 1LMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686217062; x=1688809062; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=k0aUfso+mqed718DXVZBOh7dWuv36gH3PMUsz0/Om4Y=; b=kIjhw+0McGDx9gcqKE93ykvRp/bjqyzEBcPWTKcrzFPjW4qYaMNmQF/1faX+Y1EwuA MJJw98+LjaPZaONSzwz2pf3XNI2qQ2kvc+H/9pP8LJi9PHiBKzxxtqBySa9quYPlm7m5 5JrBSp481M4Jhnq03UO9a+0qJxNNBRfBZ2q7pD0zaxkl2uY1mTsbdaWmFXd/U6tu8fds rWkeVlmErKTZKJpmaxFQn7fIiCPQ0BYGEyAk7I+MtAZJzpvvzkbvzRX8f4/UNUFRVEoN KNnIimG3/DIkYokn39MeiGzLPABbEELM8wov78dbIkOgciXv5jwoo5VpsK8bxXv9oSjL 0h8A== X-Gm-Message-State: AC+VfDw2sr8YP7Xl9PuKt0Xhcd2g2KVkxCw+u4Ht0kyJj7ifs5EYH2y6 Bc9vdf87lDx/J4YoBUDc0gGCoj0XZ0sK5aXXkGm5Tw== X-Received: by 2002:a81:5b8a:0:b0:561:e724:eb3 with SMTP id p132-20020a815b8a000000b00561e7240eb3mr9721264ywb.17.1686217062552; Thu, 08 Jun 2023 02:37:42 -0700 (PDT) MIME-Version: 1.0 References: <20230607124628.157465-1-ulf.hansson@linaro.org> <20230607124628.157465-14-ulf.hansson@linaro.org> <20230608053446.ngoxh7zo7drnr32z@vireshk-i7> In-Reply-To: <20230608053446.ngoxh7zo7drnr32z@vireshk-i7> From: Ulf Hansson Date: Thu, 8 Jun 2023 11:37:06 +0200 Message-ID: Subject: Re: [PATCH 13/16] OPP: Extend dev_pm_opp_data with OPP provider support To: Viresh Kumar 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 Content-Type: text/plain; charset="UTF-8" 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=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 On Thu, 8 Jun 2023 at 07:34, Viresh Kumar wrote: > > On 07-06-23, 14:46, Ulf Hansson wrote: > > diff --git a/drivers/opp/core.c b/drivers/opp/core.c > > index 79b4b44ced3e..81a3418e2eaf 100644 > > --- a/drivers/opp/core.c > > +++ b/drivers/opp/core.c > > @@ -1112,6 +1112,15 @@ static int _set_opp(struct device *dev, struct opp_table *opp_table, > > return ret; > > } > > > > + if (opp->provider == DEV_PM_OPP_TYPE_GENPD) { > > + ret = dev_pm_genpd_set_performance_state(dev, opp->level); > > + if (ret) { > > + dev_err(dev, "Failed to set performance level: %d\n", > > + ret); > > + return ret; > > + } > > + } > > + > > I don't like this :) > > We already have these calls in place from within _set_required_opps(), and we > should try to get this done in a way that those calls themselves get the > performance state configured. I was looking at that, but wanted to keep things as simple as possible in the $subject series. The required opps are also different, as it's getting parsed from DT both for the genpd provider and the consumer. The point is, there are more code involved but just _set_required_opps(). For example, _set_performance_state() (which is the one that calls dev_pm_genpd_set_performance_state()) is designed to be used for required opps. Does it really make sense to rework _set_performance_state() so it can be used for this case too, just to avoid another call to dev_pm_genpd_set_performance_state() somewhere in the code? One improvement we can make though, is to add a helper function, "_set_opp_level()", which we call from _set_opp(). This can then replace the call to _set_required_opps() and the code above that I am adding for DEV_PM_OPP_TYPE_GENPD. At least that should keep the code _set_opp() a bit more readable. What do you think? Kind regards Uffe