From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 64854EB64DB for ; Thu, 15 Jun 2023 23:36:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239165AbjFOXgA (ORCPT ); Thu, 15 Jun 2023 19:36:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56072 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229767AbjFOXf6 (ORCPT ); Thu, 15 Jun 2023 19:35:58 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EFF2EB3; Thu, 15 Jun 2023 16:35:57 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 7F23F61A74; Thu, 15 Jun 2023 23:35:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BC689C433C0; Thu, 15 Jun 2023 23:35:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1686872156; bh=Fvk5Dc9K0rFsG6EAHYFj3OY5iRKxvUDW3ss1RR11yBQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=mH15AYzP+pzlTa81fcWg4skrONtIm9GVkLZfw26IH0TX44xUAUc0ROJ60Vcw12I1P 3/q1yqlwaNnx254o4igPuRwhViIhXZ7l/QHYkKKwbAv4aZxB1cMr/prUS+VtFf+Gzo nG5igMmC1IIwp0pVTCC5/jf6hxJhbAP8ig+AwMW7y1kipwycUIyOCpR0HTjoWQ1Sup CBz0J8BaccwXzC53F6JiCdnjWkPm4TC7w3j5If8pnZYt1DPW7tSDM5qWBiIgB6nZI4 oMGyRtLjKP45CJBSb3295Li4zaki16jnM4ex55TvoEiImsnqVSulPYAp4EbqmcdRlA TmRJPSK/HE0mg== Date: Thu, 15 Jun 2023 18:35:53 -0500 From: Bjorn Andersson To: Viresh Kumar Cc: Viresh Kumar , Nishanth Menon , Stephen Boyd , linux-pm@vger.kernel.org, Vincent Guittot , "Rafael J. Wysocki" , Ulf Hansson , linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/2] OPP: pstate is only valid for genpd OPP tables Message-ID: References: <5437756c65c79f9520886bc54321d39c022c8638.1686739018.git.viresh.kumar@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5437756c65c79f9520886bc54321d39c022c8638.1686739018.git.viresh.kumar@linaro.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jun 14, 2023 at 04:07:25PM +0530, Viresh Kumar wrote: > It is not very clear right now that the `pstate` field is only valid for > genpd OPP tables and not consumer tables. And there is no checking for > the same at various places. > > Add checks in place to verify that and make it clear to the reader. > > Signed-off-by: Viresh Kumar > --- > drivers/opp/core.c | 18 ++++++++++++++++-- > drivers/opp/debugfs.c | 4 +++- > drivers/opp/of.c | 6 ++++++ > 3 files changed, 25 insertions(+), 3 deletions(-) > > diff --git a/drivers/opp/core.c b/drivers/opp/core.c [..] > @@ -2686,6 +2694,12 @@ int dev_pm_opp_xlate_performance_state(struct opp_table *src_table, > int dest_pstate = -EINVAL; > int i; > > + /* Both OPP tables must belong to genpds */ > + if (unlikely(!src_table->is_genpd || !dst_table->is_genpd)) { I have a platform_device, with a required-opps and with an associated genpd which does not implement set_performance_state(), but its parent genpd does. This results in me arriving here with src_table of NULL, and boom... Looking at the very next statement in this function, it seems arriving here without src_table was valid up until this change. Regards, Bjorn