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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A130CC433FE for ; Wed, 13 Apr 2022 16:58:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232667AbiDMRBE (ORCPT ); Wed, 13 Apr 2022 13:01:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34112 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237115AbiDMRBD (ORCPT ); Wed, 13 Apr 2022 13:01:03 -0400 Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 24EDE6A044; Wed, 13 Apr 2022 09:58:41 -0700 (PDT) X-IronPort-AV: E=McAfee;i="6400,9594,10316"; a="243306417" X-IronPort-AV: E=Sophos;i="5.90,257,1643702400"; d="scan'208";a="243306417" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Apr 2022 09:58:40 -0700 X-IronPort-AV: E=Sophos;i="5.90,257,1643702400"; d="scan'208";a="573354935" Received: from smile.fi.intel.com ([10.237.72.54]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Apr 2022 09:58:37 -0700 Received: from andy by smile.fi.intel.com with local (Exim 4.95) (envelope-from ) id 1negGh-001vzG-3X; Wed, 13 Apr 2022 19:54:59 +0300 Date: Wed, 13 Apr 2022 19:54:58 +0300 From: Andy Shevchenko To: Sakari Ailus Cc: Rob Herring , ACPI Devel Maling List , Linux Kernel Mailing List , devicetree , Daniel Scally , Heikki Krogerus , Greg Kroah-Hartman , "Rafael J. Wysocki" , Rob Herring , Frank Rowand , Len Brown Subject: Re: [PATCH v6 4/5] device property: Constify fwnode_handle_get() Message-ID: References: <20220408184844.22829-1-andriy.shevchenko@linux.intel.com> <20220408184844.22829-4-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org On Wed, Apr 13, 2022 at 05:35:46PM +0300, Sakari Ailus wrote: > On Sun, Apr 10, 2022 at 05:10:23PM +0300, Andy Shevchenko wrote: > > On Sat, Apr 9, 2022 at 2:35 AM Sakari Ailus > > wrote: > > > On Fri, Apr 08, 2022 at 09:48:43PM +0300, Andy Shevchenko wrote: > > > > As to_of_node() suggests and the way the code in the OF and software node > > > > back ends actually uses the fwnode handle, it may be constified. Do this > > > > for good. > > > > > > How? > > > > > > If the fwnode is const, then the struct it contains must be presumed to be > > > const, too. > > > > Why? The idea is that we are not updating the fwnode, but the container. > > The container may or may not be const. It's orthogonal, no? > > As you wrote: may or may not. The stricter requirement, i.e. const, must be > thus followed. I think it would be fine (after adding a comment on what is > being done) if you *know* the container struct is not const. But that is > not the case here. But even with the original code one may not guarantee that. How the original code works or prevents of using a const container against non-const fwnode pointer? -- With Best Regards, Andy Shevchenko