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 X-Spam-Level: X-Spam-Status: No, score=-1.0 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 55198C04EBF for ; Mon, 3 Dec 2018 22:17:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 265F320851 for ; Mon, 3 Dec 2018 22:17:15 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 265F320851 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=bootlin.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726053AbeLCWRO convert rfc822-to-8bit (ORCPT ); Mon, 3 Dec 2018 17:17:14 -0500 Received: from mail.bootlin.com ([62.4.15.54]:34333 "EHLO mail.bootlin.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725848AbeLCWRL (ORCPT ); Mon, 3 Dec 2018 17:17:11 -0500 Received: by mail.bootlin.com (Postfix, from userid 110) id A9141207AD; Mon, 3 Dec 2018 23:17:09 +0100 (CET) Received: from xps13 (unknown [91.224.148.103]) by mail.bootlin.com (Postfix) with ESMTPSA id A78A220379; Mon, 3 Dec 2018 23:16:56 +0100 (CET) Date: Mon, 3 Dec 2018 23:16:55 +0100 From: Miquel Raynal To: Stephen Boyd Cc: kbuild test robot , kbuild-all@01.org, Michael Turquette , Russell King , linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Thomas Petazzoni , Antoine Tenart , Maxime Chevallier , Gregory Clement , Nadav Haklai Subject: Re: [PATCH 2/2] clk: core: link consumer with clock driver Message-ID: <20181203231655.4e7dc330@xps13> In-Reply-To: <154386483105.88331.13970025193347328031@swboyd.mtv.corp.google.com> References: <20181122212212.16039-3-miquel.raynal@bootlin.com> <201811231627.H7ojlKLL%fengguang.wu@intel.com> <20181123101132.6be3829c@xps13> <154356998033.88331.4426431020982838779@swboyd.mtv.corp.google.com> <20181130112052.73d943ec@xps13> <154386483105.88331.13970025193347328031@swboyd.mtv.corp.google.com> Organization: Bootlin X-Mailer: Claws Mail 3.17.1 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Stephen, Stephen Boyd wrote on Mon, 03 Dec 2018 11:20:31 -0800: > Quoting Miquel Raynal (2018-11-30 02:20:52) > > Hi Stephen, > > > > Stephen Boyd wrote on Fri, 30 Nov 2018 01:26:20 > > -0800: > > > > > Quoting Miquel Raynal (2018-11-23 01:11:32) > > > > Would you agree with me adding dummy functions in the #else section > > > > like: > > > > > > > > static inline void __clk_device_link(struct device *consumer, struct clk *clk) > > > > { > > > > return; > > > > } > > > > > > > > static inline void __clk_device_unlink(struct clk *clk) > > > > { > > > > return; > > > > } > > > > > > > > Do you want me to also declare these functions in the #if section > > > > (with the external keyword) to balance the above declarations? > > > > > > Why can't we do the linking in __clk_get() and __clk_put()? > > > > > > > Because we need the caller's 'struct device' to make the link and > > this is not available in __clk_get(). I tried to ad it as parameter but > > I don't think it is possible to retrieve a 'struct device' from the > > device name. The functions where this is problematic are: > > * clk.c:__of_clk_get_from_provider() > > * clkdev.c:clk_get_sys() > > > > By the way in my new version I called the helpers: > > * clk_{link,unlink}_hierarchy() > > * clk_{link,unlink}_consumer() > > > > I will send a new version with these helpers, but if you have anything > > in mind to help me achieve the above request, I will welcome the idea. > > > > We can do the linking in __clk_get() and __clk_put() if we poke into the > struct clk -> struct clk_core and bury the struct device into each > clk_core structure. > I meant the consumer device's structure. Yes, from a struct clk, the first change in patch 1/2 let's us do clk->core->dev to get the clock device. But for linking I need both the clock device and the consumer device; and the latter will be missing in __clk_get(). Thanks, Miquèl