Received: by 10.223.176.5 with SMTP id f5csp1902018wra; Thu, 8 Feb 2018 05:28:48 -0800 (PST) X-Google-Smtp-Source: AH8x225ptVcuKhoUjiehxvV9RH0dgbcsLuzMbsTWuqVQjs9P17oec7G1XT8/YX1haRZ+unrtFDdl X-Received: by 10.98.153.197 with SMTP id t66mr739315pfk.142.1518096528350; Thu, 08 Feb 2018 05:28:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518096528; cv=none; d=google.com; s=arc-20160816; b=Sf9WmCNB9ZwNXiZH5PdUMV4EFexQDp60mp/iATQFfmGWQU7eoVVgTcGGwXiy9o1AbB Qf2v/ZQNA8AZWwXH+L6NwI6WWYTS/bLvxZh4h3lAhmHOds9/fwRktjbe2j1yPQ2znlP+ lF2k2Tiyyb6L6Mog5egzVxAQc5KBwBYvDJInudZItZG27d+3Exk54vSXOse6Dnq5Cm+d oGo1T3JZPX7/3+MpjyeWfRv2kqwKsd666Tp1yuK2eEpvfykRE0mnxXCLDSKIozCKO4PP FUP//Ve1TqQM/3kstxx6YpcDvIYxKgZHxgM6nVMgfLhwCmIV/hmyfZu/4HnKEoji+agh vTXw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=AFE2Fecn9BnW6Rax5fHlp5bPnOZwI+9lvGT0Pk9c3gw=; b=msreTZYffwMfulRXI7Cey0wr+Q6m3q75G80Yc08jLkf1s0ZwVmpSC3YgsVFeydJ61h oFZJSfNwpPuzDPOlNBje7/OMS5au6eyk8TE5Zhze+uFJcAsPB6a+JalUsOCU+NFtyOLx pokyQ+Td9OV403iyUNi1SBeQUpYFT5MZxsnTqtaG3iMjuuRraaY+LirN5+cQ90f1nJdo eRZIvhghEv8TWfTSHMCNrIKJeWT0MoV1gdy7G86JrzJomjB10lWFxTcuMyCnFVOgqxAe jB5ABW1JYX7ZMxYN/TjydM+yxZYu3zPseCEsg2h8dFoyoYfonCkQPIH1L+r8dkxXo7XP 9nyg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bgdev-pl.20150623.gappssmtp.com header.s=20150623 header.b=guCkjjRt; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n1-v6si2723652pld.589.2018.02.08.05.28.34; Thu, 08 Feb 2018 05:28:48 -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=@bgdev-pl.20150623.gappssmtp.com header.s=20150623 header.b=guCkjjRt; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751834AbeBHN1o (ORCPT + 99 others); Thu, 8 Feb 2018 08:27:44 -0500 Received: from mail-oi0-f43.google.com ([209.85.218.43]:40474 "EHLO mail-oi0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750961AbeBHN1n (ORCPT ); Thu, 8 Feb 2018 08:27:43 -0500 Received: by mail-oi0-f43.google.com with SMTP id 8so3448023oix.7 for ; Thu, 08 Feb 2018 05:27:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=AFE2Fecn9BnW6Rax5fHlp5bPnOZwI+9lvGT0Pk9c3gw=; b=guCkjjRtUPhO/bsV6G/hZYBkxRRC9f9Zq99WObX2AEVBtnYno5+BGjPZghCSWGgyJU lv7AnU42gaedmnLSq8vpOqil6z8dstxdqVeSPhTSfFRo3mib2X6ISCLxoOdp9BdRmJ4S pyaHGgLzqvAN7+lJGtdpGpvo7vv1jdyfGZEH+NqUen951X5tA8+8UVeLKLPmBxwvj1dl 0lD3hHkTrrcHb4408FoYhg9AQbA6er8GOIuTx2Vn7gTprzF3vsVhww0rR2utUU5tlLmk mUVXodtb/7KXoyXMMwIH6f+blpDimbE9qcqAq3mEa38MFVJtJFj4o6oS8TEt8+IbiL9w AF/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=AFE2Fecn9BnW6Rax5fHlp5bPnOZwI+9lvGT0Pk9c3gw=; b=d05SPauyvYvOBk6UppFD5RffVj3/sAxy5/DxaMtNWOEIDyq8IQUXwgMYvjR6wuELpt //f6PvAb8nFQg9AxSH+v2kYlI1tbmVnVjZRX9sTvRl1tlOiAlthIWeH+V4xM+WYPu8Yp I6aAodK6D7ok1w+H+S7oX82MNp4Xh1SjcBgYMz+Dw1frJlW7OQJv3l+S9OhiLLEvawiJ Cx9F2fI0uyenTP/pOo0pt6ZSrsyBoe2XyRSIwbxgxtzrr8aZ0mHnuy3p5VMRe6nU1h7C IHBlr6RBWiQJ/UP14nqd3K9kaUeyhYLISy+tbezAJLw/OSpsRt5KD7Qdp+ngfymAsxRA 33MQ== X-Gm-Message-State: APf1xPDdYAJrLu6HiOUHM3p4AF/y+WdomH0QM2PtqskL+bDLZHqQ1dcW cXV64q63wkJzFcM3UlV7el18wW96/ojMpftgZhqv5g== X-Received: by 10.202.82.208 with SMTP id g199mr430876oib.355.1518096462451; Thu, 08 Feb 2018 05:27:42 -0800 (PST) MIME-Version: 1.0 Received: by 10.157.42.71 with HTTP; Thu, 8 Feb 2018 05:27:42 -0800 (PST) In-Reply-To: <34d3980b-2c94-1540-94f0-dc0c86743475@ti.com> 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: Bartosz Golaszewski Date: Thu, 8 Feb 2018 14:27:42 +0100 Message-ID: Subject: Re: [PATCH 2/7] soc: davinci: new genpd driver To: Sekhar Nori Cc: Rob Herring , Mark Rutland , Kevin Hilman , Russell King , David Lechner , devicetree , Linux Kernel Mailing List , Linux ARM , Bartosz Golaszewski Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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(). Bartosz