Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp20304006ybl; Sat, 4 Jan 2020 23:08:08 -0800 (PST) X-Google-Smtp-Source: APXvYqxYIBsM5oZ4b2u7KJjzxs/TYDk713vPYUZzt+5Gj/dbIOOub6pKw83fv6yElPACwNNQIq2r X-Received: by 2002:a05:6830:1f19:: with SMTP id u25mr111415866otg.170.1578208088784; Sat, 04 Jan 2020 23:08:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578208088; cv=none; d=google.com; s=arc-20160816; b=GshslzxJd5aYL1Hu+m+d8q9DVmXafOsDNOfGmNxbsMTOZvnIE8mGmmTjDOoMYK+89a Ey277SpKOIhdWt5wwvby0ZHvf6GOksxFbTELLMzB24fP1A1YwH53SLUUYja6QlN33QHv G8wuAcS50FTNk9GyUc5NvTHHZRdCy6/CCzYFbxWFkbOWP5GbCrIlCzlzrTid+aaK5jc+ oGSwUGzn8iDR779Zfkgmjdin8ussVUaMq7DEEXWrB8t2Z1+Cwl+IeBfmh+ymQzIgE9Hx oA1NmhKj8WJ3IDebbSvNk66kvKOQI+QUxKX7Q4etYxVcJTc3Tidlz6CMvUaoxW51iDcp n8SA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:user-agent:from:to :subject:cc:references:in-reply-to:content-transfer-encoding :mime-version:dkim-signature; bh=odTebhFPQhZxthcaS8cIeRmo6X74im6dw9y5rGIIsls=; b=nH9md6umInLQyvfn/+L3xMBTcJPLb0qxfb/+TrKWIdnj7sZyODtcLcjL3YftaBHn9y cMosW1/MiLVCcjiUPdkgYYbYTzz6mNVQjMVeR0x+JR3MzKVHRV9v6hjT9pkbdQ4iv87W QVsNRLvExhA3pC1+opIybr49WhJRCZ+Ziu/U8TbhqSfilHdvgFRKRh00/aDQSEJ9YkS9 MjPa5Q0nxjx3HfD0osyI0CtoCfoybtm9Z9I2rnnxH7e6vPnPoWqXqO5wMoTei4/cvm4D 40EzxfLn2Bg4D75oCaST2pvc6+AEGLQJU9pDi1mCCEWcBWUSkhizmcXmgJYJmmVDXiNu o58g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=p4F83HXs; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q20si33014341otn.297.2020.01.04.23.07.54; Sat, 04 Jan 2020 23:08:08 -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=@kernel.org header.s=default header.b=p4F83HXs; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725948AbgAEHHN (ORCPT + 99 others); Sun, 5 Jan 2020 02:07:13 -0500 Received: from mail.kernel.org ([198.145.29.99]:50878 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725535AbgAEHHN (ORCPT ); Sun, 5 Jan 2020 02:07:13 -0500 Received: from kernel.org (unknown [104.132.0.74]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 6C7012085B; Sun, 5 Jan 2020 07:07:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578208032; bh=0lUYrloB+zV0FkXyKfuZPMuMZUbqhgY43nJHRPwyOGY=; h=In-Reply-To:References:Cc:Subject:To:From:Date:From; b=p4F83HXsr9t4oo2TcmhliRogenShbTBF+gsdoRAIMoKYRRLJGbS6NJBvvQ/TvtYA+ NIQ/l9xjYwlUIZ9xazBdpm2lGIFb2/LIEIA8ZyyvdJx2gbkA006yIZDE/dCmSzhPbE aFR4zRfTxD+SoxPHXFpEtp1VLyxei57IqltmHrsg= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable In-Reply-To: <20200103073926.GM988120@minitux> References: <20191230190455.141339-1-sboyd@kernel.org> <20200103073926.GM988120@minitux> Cc: Michael Turquette , linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, Niklas Cassel Subject: Re: [PATCH] clk: Use parent node pointer during registration if necessary To: Bjorn Andersson From: Stephen Boyd User-Agent: alot/0.8.1 Date: Sat, 04 Jan 2020 23:07:11 -0800 Message-Id: <20200105070712.6C7012085B@mail.kernel.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Quoting Bjorn Andersson (2020-01-02 23:39:26) > On Mon 30 Dec 11:04 PST 2019, Stephen Boyd wrote: >=20 > > Sometimes clk drivers are attached to devices which are children of a > > parent device that is connected to a node in DT. This happens when > > devices are MFD-ish and the parent device driver mostly registers child > > devices to match against drivers placed in their respective subsystem > > directories like drivers/clk, drivers/regulator, etc. When the clk > > driver calls clk_register() with a device pointer, that struct device > > pointer won't have a device_node associated with it because it was > > created purely in software as a way to partition logic to a subsystem. > >=20 > > This causes problems for the way we find parent clks for the clks > > registered by these child devices because we look at the registering > > device's device_node pointer to lookup 'clocks' and 'clock-names' > > properties. Let's use the parent device's device_node pointer if the > > registering device doesn't have a device_node but the parent does. This > > simplifies clk registration code by avoiding the need to assign some > > device_node to the device registering the clk. > >=20 > > Cc: Bjorn Andersson > > Reported-by: Niklas Cassel > > Signed-off-by: Stephen Boyd > > --- > >=20 > > I decided to introduce a new function instead of trying to jam it all > > in the one line where we assign np. This way the function gets the=20 > > true 'np' as an argument all the time. > >=20 >=20 > Looks better. >=20 > > drivers/clk/clk.c | 27 +++++++++++++++++++++++++-- > > 1 file changed, 25 insertions(+), 2 deletions(-) > >=20 > > diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c > > index b68e200829f2..a743fffe8e46 100644 > > --- a/drivers/clk/clk.c > > +++ b/drivers/clk/clk.c > > @@ -3719,6 +3719,28 @@ __clk_register(struct device *dev, struct device= _node *np, struct clk_hw *hw) > > return ERR_PTR(ret); > > } > > =20 > > +/** > > + * dev_or_parent_of_node - Get device node of @dev or @dev's parent >=20 > () This has been left out historically in this file. I'll add it but I guess I should really take a pass at updating the docs in the whole file! >=20 > > + * @dev: Device to get device node of > > + * > > + * Returns: device node pointer of @dev, or the device node pointer of >=20 > Return: (no 's') Thanks. >=20 >=20 > With that, >=20 > Reviewed-by: Bjorn Andersson > Tested-by: Bjorn Andersson >=20