Received: by 10.223.176.5 with SMTP id f5csp1987218wra; Thu, 8 Feb 2018 06:45:52 -0800 (PST) X-Google-Smtp-Source: AH8x227+lE5/UnLgcVE+vow6QApuaPuuMtyyeHAwTWW5Zp/z7Rak6J/dk7w4otUAhCYJtPO3bH2p X-Received: by 2002:a17:902:3225:: with SMTP id y34-v6mr829931plb.399.1518101152328; Thu, 08 Feb 2018 06:45:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518101152; cv=none; d=google.com; s=arc-20160816; b=M7tMThzL5zb73dfjIJa35YpYYCaoE8XjZu6aR58B46D4skwieiLTmg++lCawOJ5rUG 3UjZ2AqIRULdY6z/HStbD/hBGTVxdEI29mXBIrmBgaq21WvXW4Q47lFUZ95UB5g1mNu+ f4xxSB5lVvWcpSCDimY/mWNDpQf7aTG7P2s07uKF689YAH2vUH/X2ZJjqENQWNO2i3MD TmiFIjaJoT/22x7UhDkaQQuo3cAJ0qUQZyYc9XoUzh0ZAO/sMWa0YbLeR/y3YTR+lmpt Qq9mFj9NyjusBHF4SsQ2uat3QOycVqDDW7mczA+J9IqxwBDk+xnPwo/7ZzjvwArBYAeI Wk9Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature :arc-authentication-results; bh=azEUsRxIfL1GVp3/2Tf2kNLomiUwuo7r5Jn944Ne9OE=; b=AMqCqMUSfZC+j1IB8Is2LHmGGRiytxtVreNLJXHZ/cKW5NzwQuBHJcM7VmnAILLBRf CC4AuWVQfzqNw/SdNWOUrb6KbtTVzqU2e5ZUvz4ZLXGfLrTgXVFHU2wsi3pt2nhXJknL 4h4TfTSgzvuesyqVGV9Ob/MOHhp4Hx1mtDYkCQuKi6dFFlEHrJdC/i2xAbgcQzsctLwg IrZvH567yrBUOLThfRZvO7oBGsInRL0uktanRlZXvN7CGnDFdrplwJmqKngCFl8zJSia j0sOArbtrXLyCa/I32lbBc9LbwlruKbHTzjpKOrE/kvc+nF29stdAPsRBpGV8BqtPP3x seWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=suXX3hJN; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m10si145pgn.120.2018.02.08.06.45.37; Thu, 08 Feb 2018 06:45:52 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=suXX3hJN; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752172AbeBHOo0 (ORCPT + 99 others); Thu, 8 Feb 2018 09:44:26 -0500 Received: from fllnx210.ext.ti.com ([198.47.19.17]:54316 "EHLO fllnx210.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750882AbeBHOoY (ORCPT ); Thu, 8 Feb 2018 09:44:24 -0500 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by fllnx210.ext.ti.com (8.15.1/8.15.1) with ESMTP id w18EhBt2018205; Thu, 8 Feb 2018 08:43:11 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1518100991; bh=hf4FojQ6LneKtOyinMKscccvafIOXLpTMF0svQKpTDk=; h=Subject:To:CC:References:From:Date:In-Reply-To; b=suXX3hJNoM4Yc/pL3DIpyxK1U2XWzN8h4psVoMeNpDgRSi/we1obWaJlH4VizzilR 7f2OGEr/GAeXcT24PDK6iu6SPbJsc9PcrnHNSSpIXEjeOwabfLTKKfzcXl3Xmamw47 3fqrP5m7Rl9zczh4EGk08XocGk/XoEpkyFKKM1cs= Received: from DLEE109.ent.ti.com (dlee109.ent.ti.com [157.170.170.41]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id w18EhBwT017360; Thu, 8 Feb 2018 08:43:11 -0600 Received: from DLEE106.ent.ti.com (157.170.170.36) by DLEE109.ent.ti.com (157.170.170.41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1261.35; Thu, 8 Feb 2018 08:43:10 -0600 Received: from dlep33.itg.ti.com (157.170.170.75) by DLEE106.ent.ti.com (157.170.170.36) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1261.35 via Frontend Transport; Thu, 8 Feb 2018 08:43:10 -0600 Received: from [172.24.190.171] (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep33.itg.ti.com (8.14.3/8.13.8) with ESMTP id w18Eh7AM007151; Thu, 8 Feb 2018 08:43:08 -0600 Subject: Re: [PATCH 2/7] soc: davinci: new genpd driver To: Bartosz Golaszewski CC: Rob Herring , Mark Rutland , Kevin Hilman , Russell King , David Lechner , devicetree , Linux Kernel Mailing List , Linux ARM , Bartosz Golaszewski References: <20180207134553.13510-1-brgl@bgdev.pl> <20180207134553.13510-3-brgl@bgdev.pl> <65f2690c-c605-3c66-9d8a-9a882aaf446d@ti.com> <34d3980b-2c94-1540-94f0-dc0c86743475@ti.com> From: Sekhar Nori Message-ID: Date: Thu, 8 Feb 2018 20:13:06 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thursday 08 February 2018 06:57 PM, Bartosz Golaszewski wrote: > 2018-02-08 13:56 GMT+01:00 Sekhar Nori : >> On Thursday 08 February 2018 03:24 PM, Bartosz Golaszewski wrote: >>> 2018-02-08 10:30 GMT+01:00 Sekhar Nori : >>>> On Wednesday 07 February 2018 07:15 PM, Bartosz Golaszewski wrote: >>>>> + /* >>>>> + * DaVinci always uses a single clock for power-management. We assume >>>>> + * it's the first one in the clocks property. >>>>> + */ >>>>> + clk = of_clk_get(dev->of_node, 0); >>>>> + if (IS_ERR(clk)) >>>>> + return PTR_ERR(clk); >>>> >>>> We already get this today with drivers/base/power/clock_ops.c once >>>> .con_ids list is dropped from pm_clk_notifier_block (which I think it >>>> should). >>>> >>>> If there is no reason to introduce thus functionality at this stage, >>>> perhaps we should wait till such a time when its clearly needed? >>>> >>>> Thanks, >>>> Sekhar >>> >>> If I understand correctly: once we drop the con_ids list, we end up >>> calling clk_get(dev, NULL) from pm_clk_acquire(), which matches >>> against the clock with NULL con_id, which may not necessarily be the >>> first clock in the list. >> >> Hmm, not sure of this. In __of_clk_get_by_name() called by clk_get(): >> >> int index = 0; >> >> /* >> * For named clocks, first look up the name in the >> * "clock-names" property. If it cannot be found, then >> * index will be an error code, and of_clk_get() will fail. >> */ >> if (name) >> index = of_property_match_string(np, "clock-names", name); >> >> So, if no con_id is provided (name == NULL), then index is set to 0 >> which will always get the first clock in clocks = list. >> > > But we're talking here about device tree mode. In legacy mode the > device_node pointer will be NULL, __of_clk_get_by_name() will return > -ENOENT and we'll end up calling clk_get_sys() -> clk_find(). We'll > then iterate over the clock entries and check the following: > > (...) > 152 if (p->con_id) { > 153 if (!con_id || strcmp(p->con_id, con_id)) > 154 continue; > 155 match += 1; > 156 } > (...) > > So we'll skip the first clock if it has a con_id and we passed an > empty con_id to clk_get(). You are right. I missed taking the effect on legacy boot into consideration. Please send v2 then, and consider this objection withdrawn. Thanks, Sekhar