Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3950939pxf; Mon, 29 Mar 2021 16:33:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxUaqRhBBM0nhQhzgprHxfsrCLP4sJS9pB+gGqldCaG+cJy1qk9ibsldztpA7bkN+5gwb96 X-Received: by 2002:a17:906:d157:: with SMTP id br23mr31701451ejb.192.1617060816075; Mon, 29 Mar 2021 16:33:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617060816; cv=none; d=google.com; s=arc-20160816; b=kKk0s3YSwkodB7lgZyJJbUD/46CUiQ6XkUbGKEP2kNOYZroFftDNbN4VAmGYhlIoUo DnEeWIwVybOCSh4R8WDA6I8jeFUVvX4vM8L2QMTBO45+/YMTRBM4LmOz6uNsVbIxQs5j hK0ksJKY9j2yROMDq8gy5MCeDq0iTj3MAfhJkDYvQv7/lP2iuPcFJRcCzZWtPz3ZfwJK 1ELjFJ9SPGDLGsU4V48Td/OL9+XfNrruPzEXWsxl/WwSP+F9d4t86voF6FJl9HT/roZi 0qCawDKj1HYlYoilwoFyUmoNdgeH2pdqOofvCSbl7/qotHRUDR4rsKfSNoSZUEyFIgIA vx+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=WDde1oog8pONjUYe4veyTF77bnbUW5uOW/VjN8BRrfc=; b=PRuLZK0WMhMXlUUMewHsWDPjQZUt+eljJLpgriwgNM2OFaP9tsFd3n/el33d/WG7Y4 +pjBwKhVWIs6VJ2g2SsGNilOfMlA8UZFsIt/kaB8/Bm7Snl0DZG+vldW5O4KQVxf99Jk LuasyWD1KBYPRP6BXlPSYKCGQo6bvChB2cqYpsk1adYDjwDeVbka4KxYGIoDWjlL3Zx5 wLq10jVdQahz4QjBJPTOEyFvfHdkXgjSieZxmHGv5sdTL3HW21efEi90uyEULlnQ+B6N l/RDA3/rIzelKBK4YH7YOG/0tNFaDqbswjkKzqUN3n3M5RN4K2CiWn5wzH7nSTuqwCt0 TdLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=tR1uudSR; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g8si14829601ejm.240.2021.03.29.16.33.13; Mon, 29 Mar 2021 16:33:36 -0700 (PDT) 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=@google.com header.s=20161025 header.b=tR1uudSR; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229655AbhC2X3K (ORCPT + 99 others); Mon, 29 Mar 2021 19:29:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48952 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229873AbhC2X25 (ORCPT ); Mon, 29 Mar 2021 19:28:57 -0400 Received: from mail-yb1-xb2e.google.com (mail-yb1-xb2e.google.com [IPv6:2607:f8b0:4864:20::b2e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 66F46C061765 for ; Mon, 29 Mar 2021 16:28:57 -0700 (PDT) Received: by mail-yb1-xb2e.google.com with SMTP id m132so15493075ybf.2 for ; Mon, 29 Mar 2021 16:28:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=WDde1oog8pONjUYe4veyTF77bnbUW5uOW/VjN8BRrfc=; b=tR1uudSRQlnzL7FPxhVK1H2lmKlgH5Jstl69KtGaXiKfzpJeNtd3sKUREc83E14Hyg KNtpU52k/3GvnCheolompf0OcGFwxjIztQl12NPKWvtVUo2Ca28hh6VmkNVc+jIKNYve qR/5ZhPcLbSkgxU1WQSwPiF+Kkczewe7xqJWQApgPqPzpetjUWvmTZ7Qr41GdZDiJIJH XibRwn4VLj8hlEfGH9NN6fS+EgkU8yH6ME68JPyNOJ8MKcOIyH806NIpP9D2drko4jdM T3dCqd2FpbrDSQ8blvlO8F8dItLzhwn6XP5WAL3ZurP3FGTL5yuve9pXPXBjS913UV8N utww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=WDde1oog8pONjUYe4veyTF77bnbUW5uOW/VjN8BRrfc=; b=bZNu7qQojJ+48aLORgixQkRRXLZ3rgh9pFipcsq5gJck6rTexeCqpr8x0VC12BK90b pfDQ31NI4JCXNmwLqWh7aH3J8jwITk3Wpb/b2a0tqUQZrwvm3EoB6NfwWIiAtc2CxOkl I9vG8PKB1CYLj7hbaKUxVg1caUImfNNUc7wQYzO/ktai5Xbi52hIBkHMNLX9aarzNsq0 U5h8os5orT/fLVtsAeVZ0+a5S61dISxdxgOgTUHyRso2XRta+bXIMPUVKuyhR1oJ1Vrg HYME16fxwCBVzw1S+8NAbccVPKQADZcm6EXauwACCrhzwwcirC2DaOSSCf2d84zbPOo6 uoXg== X-Gm-Message-State: AOAM531vascDx84ov7G+YK75iaBbTw5MOt49BBb+9PfhrwqZOce/1qKl NClxYFK8815Cg75k+JRpCugHPCs9TO+wBhfpYWLX/w== X-Received: by 2002:a25:b443:: with SMTP id c3mr43370477ybg.32.1617060536158; Mon, 29 Mar 2021 16:28:56 -0700 (PDT) MIME-Version: 1.0 References: <20210205222644.2357303-9-saravanak@google.com> <20210210114435.122242-1-tudor.ambarus@microchip.com> <20210210114435.122242-2-tudor.ambarus@microchip.com> <9b206c4d00dfe8b7f941260f18909914b2b2eecb.camel@suse.de> <161678243444.3012082.5031467952132861429@swboyd.mtv.corp.google.com> <161705310317.3012082.15148238105608149214@swboyd.mtv.corp.google.com> In-Reply-To: <161705310317.3012082.15148238105608149214@swboyd.mtv.corp.google.com> From: Saravana Kannan Date: Mon, 29 Mar 2021 16:28:20 -0700 Message-ID: Subject: Re: [PATCH] clk: Mark fwnodes when their clock provider is added To: Stephen Boyd Cc: Geert Uytterhoeven , Marek Szyprowski , Nicolas Saenz Julienne , Tudor Ambarus , Jonathan Corbet , Frank Rowand , Greg KH , Kevin Hilman , Len Brown , Len Brown , Marc Zyngier , Michael Turquette , Pavel Machek , "Rafael J. Wysocki" , Rob Herring , Thomas Gleixner , Ulf Hansson , Nicolas Ferre , Claudiu Beznea , DOCUMENTATION , Linux Kernel Mailing List , Linux PM list , linux-clk , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS , ACPI Devel Maling List , Android Kernel Team , linux-rpi-kernel" Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Mar 29, 2021 at 2:25 PM Stephen Boyd wrote: > > Quoting Geert Uytterhoeven (2021-03-26 11:29:55) > > On Fri, Mar 26, 2021 at 7:13 PM Stephen Boyd wrote: > > > Quoting Nicolas Saenz Julienne (2021-03-25 11:25:24) > > > > > > > > > > This patch mainly revealed that clk/bcm/clk-raspberrypi.c driver calls > > > > > devm_of_clk_add_hw_provider(), with a device pointer, which has a NULL > > > > > dev->of_node. I'm not sure if adding a check for a NULL np in > > > > > of_clk_add_hw_provider() is a right fix, though. > > > > > > > > I believe the right fix is not to call 'devm_of_clk_add_hw_provider()' if > > > > 'pdev->dev.of_node == NULL'. In such case, which is RPi3's, only the CPU clock > > > > is used, and it's defined and queried later through > > > > devm_clk_hw_register_clkdev(). > > > > > > > > @Marek, I don't mind taking care of it if it's OK with you. > > > > > > > > > > Ah I see this is related to the patch I just reviewed. Can you reference > > > this in the commit text? And instead of putting the change into the clk > > > provider let's check for NULL 'np' in of_clk_add_hw_provider() instead > > > and return 0 if there's nothing to do. That way we don't visit this > > > problem over and over again. > > > > I'm not sure the latter is what we reall want: shouldn't calling > > *of*_clk_add_hw_provider() with a NULL np be a bug in the provider? > > > > I don't have a strong opinion either way. Would it be useful if the > function returned an error when 'np' is NULL? I lean towards returning an error. Not a strong opinion either. -Saravana > I guess the caller could > use that to figure out that it should register a clkdev. But it > shouldn't hurt to register both a clkdev lookup and a DT provider for > the same clk. The framework will try the DT path first and then fallback > to a clkdev lookup otherwise, so we'll be wasting memory for clkdev but > otherwise be fine. > > Really it feels like we should try to unify around a > devm_clk_add_hw_provider() API that figures out what to do based on if > the device has an of_node or not. That would mean implementing something > like clkdev but for a whole provider instead of a single clk. Then this > question of returning an error would be moot here.