Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp2960617pxb; Sun, 8 Nov 2020 21:01:03 -0800 (PST) X-Google-Smtp-Source: ABdhPJxUf+Gx7L0V/9sAx4pGA12i22GrEYQjrYUsWms+NNGH1RvbcHCvxXlJ64iemFMBT055qXHk X-Received: by 2002:a17:906:f1d8:: with SMTP id gx24mr13259297ejb.73.1604898062957; Sun, 08 Nov 2020 21:01:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604898062; cv=none; d=google.com; s=arc-20160816; b=x4kmPAtqgx49v6VQnzxVJsaHNtFzUe6GE+ZfgelHYUdBQ6Y4nFURUU2jDvI88kknSU gkYT4BvqjRx5p7ECLSVMDbYZwxmmYIdklK9KOFCoOota6spSYpzQCB/2HUp8x77tjvcL PwL0XR3uouKWyp582QrCUdIOW+EMAo5L/tk2F/T9X3oaOnZ/dQFujE6ki+lHC20NJKCw wIwYABI3UNO21ayJ4si9n9NZj6SeD71efwwoKjWl9Vf6ngHWFu3Al11X4FK79UoqwS1l 894AbWz3D2SHDj2QULXnZJtb5ad6wW8ZHcoxm0xJCakwiRYWDggGfkl1TB4ak17iILpB E6jw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=FyxKjiZ7wGO9C/98D++nuGu+ry1VQp8BcqI9FcWr6AY=; b=Njl2APRl/K+GGaBjG7RRoteXzWsPUsUoPWTDeO+7p8dKetBtIHcjao/3sx+sM6RjrH phT7j9tcyKSZoSYOT5u9Cuj4EAlzROw851rrUvMgM432pfeFxWPEVVeOX1iRZLqojb1Z mk1usgfgPRlTLwpL6VKhSxTDAPNkOobvKPBzNwY1VFo5RvRd++XrRYKUCE7VXNzZNWuX hWieYFbDcrYOvHJxhgYmLYfbgyI67x9EZd9bjIy2V0JmRFXi1Q8bSp5A9MM8Wd+uS5Mq +oL7T9PX0SIEjWWRPfabqBnKDtAmPpbRFL5SQkbwvCqB0wrbqLCFIcmRo8kr9bX8C9C1 5G8A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=RFMbsOm5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e21si6584050ejx.94.2020.11.08.21.00.40; Sun, 08 Nov 2020 21:01:02 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=RFMbsOm5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S1729354AbgKIE5o (ORCPT + 99 others); Sun, 8 Nov 2020 23:57:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58532 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729308AbgKIE5n (ORCPT ); Sun, 8 Nov 2020 23:57:43 -0500 Received: from mail-pf1-x444.google.com (mail-pf1-x444.google.com [IPv6:2607:f8b0:4864:20::444]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A0290C0613D3 for ; Sun, 8 Nov 2020 20:57:43 -0800 (PST) Received: by mail-pf1-x444.google.com with SMTP id c66so1248500pfa.4 for ; Sun, 08 Nov 2020 20:57:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=FyxKjiZ7wGO9C/98D++nuGu+ry1VQp8BcqI9FcWr6AY=; b=RFMbsOm5+b/YkDxzKr40E/wqin22/AhBOE2lwZLG0UQH0AHXwHyRlL1bLgnZWKS2xC rPknSvmYqEy+TQV2VWHpgzPz2KTZp3NT1+PIPhpkknp6MDqLPt3ZdfjJgW1D04ue2h3A Zkwy+Yi+kYtICK33XlnaUjLsllIVPgXtyAh6878rxTFij9SxZ5enpfPSQQQuCp3wbRIn fHrGKUyR71w6HcMhMaLKEuvhzNUy+wdZt0GZhkW3Q1D22EyKTD/NbRFJTcp2S6RCT2ol 3kzrPKgCimOeaaem2YlEukRl1NhVDQYvDxaY5h2K954VBqJjLuEVQUwL34CqGBw4inIN MeYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=FyxKjiZ7wGO9C/98D++nuGu+ry1VQp8BcqI9FcWr6AY=; b=BiPc/LVRiYQoMiWpDxlE4zxi0KmxyVKfBe7YaG0lZUHdc7FJ4DgqPJUUTcZvRdQ8Aj njKQDBKCiQUuVBs2HXcJLtr0FDxyHlUR2sPUVmoB+SvvoPch4/qh0vkM/ZTYh+QyXpKi mIQBiZv+o02ReVux+KM+8MBLPr6BwsY5Nrd81GEpI6Rn9tAZXBXsbN0Dtuy2EUeLRocB cBKROPzLgct03GtNOA3QDfRv90rtslISzQoXdCrqhYPOafovXEPdE5lthN36ke2MPAi/ I+uCfzNo66D5p1i/oezYXWBniy3AAbgWp9/CMTj7SsBcn2hrtn7rtd7vXUxm3BdbwP9A WUNw== X-Gm-Message-State: AOAM530Z1RZbfR6ZIMp2evm3IDz6N+623cudBuYrkolzPmB0WnrAoyXA 5NW/2TNNbRy/QFKA10iPmYe4cw== X-Received: by 2002:a17:90a:b88f:: with SMTP id o15mr11062332pjr.94.1604897863092; Sun, 08 Nov 2020 20:57:43 -0800 (PST) Received: from localhost ([122.172.12.172]) by smtp.gmail.com with ESMTPSA id u197sm4610861pfc.127.2020.11.08.20.57.42 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 08 Nov 2020 20:57:42 -0800 (PST) Date: Mon, 9 Nov 2020 10:27:40 +0530 From: Viresh Kumar To: Dmitry Osipenko Cc: "Rafael J. Wysocki" , Kevin Hilman , Ulf Hansson , Len Brown , Pavel Machek , Greg Kroah-Hartman , Viresh Kumar , Nishanth Menon , Stephen Boyd , linux-pm@vger.kernel.org, Vincent Guittot , linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/2] opp: Don't create an OPP table from dev_pm_opp_get_opp_table() Message-ID: <20201109045740.y5kpd6tjscoqxhi5@vireshk-i7> References: <684ff01900180c0a40ec307dacc673b24eab593b.1604643714.git.viresh.kumar@linaro.org> <1012a98950355bd5a52424668050a17c3430cbe0.1604643714.git.viresh.kumar@linaro.org> <20201109043457.xf55kufhjjz2fvct@vireshk-i7> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: NeoMutt/20180716-391-311a52 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 09-11-20, 07:41, Dmitry Osipenko wrote: > 09.11.2020 07:34, Viresh Kumar пишет: > > On 06-11-20, 16:18, Dmitry Osipenko wrote: > >> 06.11.2020 09:24, Viresh Kumar пишет: > >>> It has been found that some users (like cpufreq-dt and others on LKML) > >>> have abused the helper dev_pm_opp_get_opp_table() to create the OPP > >>> table instead of just finding it, which is the wrong thing to do. This > >>> routine was meant for OPP core's internal working and exposed the whole > >>> functionality by mistake. > >>> > >>> Change the scope of dev_pm_opp_get_opp_table() to only finding the > >>> table. The internal helpers _opp_get_opp_table*() are thus renamed to > >>> _add_opp_table*(), dev_pm_opp_get_opp_table_indexed() is removed (as we > >>> don't need the index field for finding the OPP table) and so the only > >>> user, genpd, is updated. > >>> > >>> Note that the prototype of _add_opp_table() was already left in opp.h by > >>> mistake when it was removed earlier and so we weren't required to add it > >>> now. > >> > >> Hello Viresh, > >> > >> It looks like this is not an entirely correct change because previously > >> it was possible to get an empty opp_table in order to use it for the > >> dev_pm_opp_set_rate(), which would fall back to clk_set_rate if table is > >> empty. > >> > >> Now it's not possible to get an empty table and > >> dev_pm_opp_of_add_table() would error out if OPPs are missing in a > >> device-tree. Hence it's not possible to implement a fall back without > >> abusing opp_set_regulators() or opp_set_supported_hw() for getting the > >> empty table. Or am I missing something? > > > > For that case you were always required to call > > dev_pm_opp_set_clkname(), otherwise how would the OPP core know which > > clock to set ? And the same shall work now as well. > > Why _allocate_opp_table() grabs the first default clk of a device and > assigns it to the created table? Right, it was there so everybody isn't required to call dev_pm_opp_set_clkname() if they don't need to pass a connection id while getting the clock. But for the case of supporting empty OPP tables for cases where we just want dev_pm_opp_set_rate() to act as clk_set_rate() (in order for the drivers to avoid supporting two different ways of doing so), we do need that call to be made. We need to add the OPP table explicitly and what happened with dev_pm_opp_get_opp_table() was accidental and not what I wanted. drivers/mmc/host/sdhci-msm.c has an example of how this is done. -- viresh