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 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D83E4C433F5 for ; Tue, 19 Oct 2021 12:03:55 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A1509610E7 for ; Tue, 19 Oct 2021 12:03:55 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org A1509610E7 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=togaZX1bg1Y1mOgBc3QMDEok7Z4Fe5hWydPxVGli5Lg=; b=bcnHH07dyGeovZ eiC0vzICfLvS8M2XMGwUL7VdUOdKpI7zI+p8sRXuXgg3/xPEF75HS39MKcv98/ftS1TVBfgoCJVNW AI59X+Ad28o6Ql5EKZpgQBW6qNg0MVq1DVzzds3p5R1jRmliqK3OJSGtNOcjbZ6UeMGvmM68yhLGs lviRI1g3F+Ixdav7JbccpxSzbQHjGdqGlhYno2txTlZ1eCv0e8LX9EKd67epRmvptDWSwcxKPtH1p jLpVM5yIAA3+NXskgvncKoogQv0mv1C9RRJ9gkIO01rtx6OfVYl79EcYZxY9wCkYxx8aJDeJXYZii l4D3i62OE2yguH9Mf0yA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mcnpG-001243-Nh; Tue, 19 Oct 2021 12:02:38 +0000 Received: from perceval.ideasonboard.com ([213.167.242.64]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mcnpB-001225-QF for linux-arm-kernel@lists.infradead.org; Tue, 19 Oct 2021 12:02:36 +0000 Received: from pendragon.ideasonboard.com (62-78-145-57.bb.dnainternet.fi [62.78.145.57]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 608CA12A; Tue, 19 Oct 2021 14:02:31 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1634644951; bh=w4LOhk1i7FCnRuEWtYCeKuTGYh411zXBvRaabX/9DSs=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=cQB7vUJLFs0Jf/WJ9KyDdGDLwyXYgIECjNihdCoOinpVVPxVS/a/9rOZTqzTvDPq0 0E5ed8MQL3RvGo8Nv0wJCTm/hymvjZDyB15w9Aow5TKrx1E9uiX6e2lFSPhylucneT nZj2w5Hh9sbvlyxw/mergAsqHfwp0XVdb+AtXcPw= Date: Tue, 19 Oct 2021 15:02:13 +0300 From: Laurent Pinchart To: Maxime Ripard Cc: Rob Herring , Frank Rowand , Chen-Yu Tsai , Jernej =?utf-8?Q?=C5=A0krabec?= , Daniel Vetter , David Airlie , dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH v5 1/7] of: Make of_graph_get_port_by_id take a const device_node Message-ID: References: <20210929084234.1271915-1-maxime@cerno.tech> <20210929084234.1271915-2-maxime@cerno.tech> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20210929084234.1271915-2-maxime@cerno.tech> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211019_050234_037970_8600AE42 X-CRM114-Status: GOOD ( 19.68 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi Maxime, Thank you for the patch. On Wed, Sep 29, 2021 at 10:42:28AM +0200, Maxime Ripard wrote: > of_graph_get_port_by_id doesn't modify the device_node pointer it takes > as argument, so we can make it const. >From a C point of view that's right, but conceptually speaking, is it right to return a non-const child port node of a const device_node ? > Signed-off-by: Maxime Ripard > --- > drivers/of/property.c | 2 +- > include/linux/of_graph.h | 4 ++-- > 2 files changed, 3 insertions(+), 3 deletions(-) > > diff --git a/drivers/of/property.c b/drivers/of/property.c > index 3fd74bb34819..739d5d1c8c3a 100644 > --- a/drivers/of/property.c > +++ b/drivers/of/property.c > @@ -603,7 +603,7 @@ EXPORT_SYMBOL(of_graph_parse_endpoint); > * Return: A 'port' node pointer with refcount incremented. The caller > * has to use of_node_put() on it when done. > */ > -struct device_node *of_graph_get_port_by_id(struct device_node *parent, u32 id) > +struct device_node *of_graph_get_port_by_id(const struct device_node *parent, u32 id) > { > struct device_node *node, *port; > > diff --git a/include/linux/of_graph.h b/include/linux/of_graph.h > index 4d7756087b6b..87f3f4d0d0df 100644 > --- a/include/linux/of_graph.h > +++ b/include/linux/of_graph.h > @@ -42,7 +42,7 @@ bool of_graph_is_present(const struct device_node *node); > int of_graph_parse_endpoint(const struct device_node *node, > struct of_endpoint *endpoint); > int of_graph_get_endpoint_count(const struct device_node *np); > -struct device_node *of_graph_get_port_by_id(struct device_node *node, u32 id); > +struct device_node *of_graph_get_port_by_id(const struct device_node *node, u32 id); > struct device_node *of_graph_get_next_endpoint(const struct device_node *parent, > struct device_node *previous); > struct device_node *of_graph_get_endpoint_by_regs( > @@ -74,7 +74,7 @@ static inline int of_graph_get_endpoint_count(const struct device_node *np) > } > > static inline struct device_node *of_graph_get_port_by_id( > - struct device_node *node, u32 id) > + const struct device_node *node, u32 id) > { > return NULL; > } -- Regards, Laurent Pinchart _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel