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 E81B0C76196 for ; Thu, 23 Mar 2023 15:33:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232072AbjCWPdd (ORCPT ); Thu, 23 Mar 2023 11:33:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59614 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231830AbjCWPda (ORCPT ); Thu, 23 Mar 2023 11:33:30 -0400 Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 404837DB4; Thu, 23 Mar 2023 08:33:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1679585606; x=1711121606; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=FSr9ghF0Z+gbb/JxQNcySsnS0FLxNhtSAag/X+SSZ2Y=; b=f4FQzR6rOw1kSKkJHa3b0mc+7V7KRaEOGMqAUyWhpcUfHu/61Erp1Aag 0sBitEB6zY0028ch482RHyEcd3EssazTpegfYPZTcdnjH82EXYu5Shd1O /pg3BIA3uC1b1l4rncL3zgi9am3VrP2FQE3Zm0a8h9XOuIjGiAOqtcNtO +XW6FAvEZudHjslsKRvPc9exz+9nHUYFnFiYPfvzdNR9cBQc1W+9i4KIQ EVkI94r3+BieLxC2RB+bc7qT4kZZYnTbz8BRiLzMytaqlRrBItOdkw6MS eHyTLDMI1dDhH0/7PU2cULArcBq4+L2zB5t3ljUxOspEVQDfQbEi0v13L g==; X-IronPort-AV: E=McAfee;i="6600,9927,10658"; a="319177596" X-IronPort-AV: E=Sophos;i="5.98,285,1673942400"; d="scan'208";a="319177596" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Mar 2023 08:33:24 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10658"; a="712713758" X-IronPort-AV: E=Sophos;i="5.98,285,1673942400"; d="scan'208";a="712713758" Received: from smile.fi.intel.com ([10.237.72.54]) by orsmga008.jf.intel.com with ESMTP; 23 Mar 2023 08:33:20 -0700 Received: from andy by smile.fi.intel.com with local (Exim 4.96) (envelope-from ) id 1pfMwI-007Yd3-0H; Thu, 23 Mar 2023 17:33:18 +0200 Date: Thu, 23 Mar 2023 17:33:17 +0200 From: Andy Shevchenko To: "Russell King (Oracle)" Cc: Andrew Lunn , Heiner Kallweit , Daniel Scally , "David S. Miller" , Eric Dumazet , Florian Fainelli , Greg Kroah-Hartman , Heikki Krogerus , Jakub Kicinski , linux-acpi@vger.kernel.org, netdev@vger.kernel.org, Paolo Abeni , "Rafael J. Wysocki" , Sakari Ailus , Vladimir Oltean Subject: Re: [PATCH RFC net-next 3/7] net: dsa: use fwnode_get_phy_mode() to get phy interface mode Message-ID: References: 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: netdev@vger.kernel.org On Thu, Mar 23, 2023 at 03:23:12PM +0000, Russell King (Oracle) wrote: > On Thu, Mar 23, 2023 at 05:00:08PM +0200, Andy Shevchenko wrote: > > On Thu, Mar 23, 2023 at 02:49:01PM +0000, Russell King (Oracle) wrote: > > > On Thu, Mar 23, 2023 at 04:38:29PM +0200, Andy Shevchenko wrote: > > > > On Thu, Mar 23, 2023 at 02:31:04PM +0000, Russell King (Oracle) wrote: > > > > > On Thu, Mar 23, 2023 at 04:03:05PM +0200, Andy Shevchenko wrote: > > > > > > On Wed, Mar 22, 2023 at 12:00:06PM +0000, Russell King (Oracle) wrote: ... > > > > > > > + struct fwnode_handle *fwnode; > > > > > > > > > > > > > + fwnode = of_fwnode_handle(dp->dn); > > > > > > > > > > > > const struct fwnode_handle *fwnode = of_fwnode_handle(dp->dn); > > > > > > > > > > > > ? > > > > > > > > > > Why const? > > > > > > > > Do you modify its content on the fly? > > > > > > Do you want to litter code with casts to get rid of the const? > > > > > > > For fwnode as a basic object type we want to reduce the scope of the possible > > > > modifications. If you don't modify and APIs you call do not require non-const > > > > object, use const for fwnode. > > > > > > Let's start here. We pass this fwnode to fwnode_get_phy_mode(): > > > > > > include/linux/property.h:int fwnode_get_phy_mode(struct fwnode_handle *fwnode); > > > > > > Does fwnode_get_phy_mode() alter the contents of the fwnode? Probably > > > not, but it doesn't take a const pointer. Therefore, to declare my > > > fwnode as const, I'd need to cast the const-ness away before calling > > > this. > > > > So, fix the fwnode_get_phy_mode(). Is it a problem? > > No, I refuse. That's for a different patch set. I don't disagree, but it can be done as a precursor to your RFC. > > > Then there's phylink_create(). Same problem. > > > > So, fix that. Is it a problem? > > No for the same reason. > > > > So NAK to this const - until such time that we have a concerted effort > > > to making functions we call which do not modify the "fwnode" argument > > > constify that argument. Otherwise it's just rediculously crazy to > > > declare a variable const only to then litter the code with casts to get > > > rid of it at every call site. > > > > > > Please do a bit of research before making suggestions. Thanks. > > > > So, MAK to your patch. You can fix that, and you know that. > > Sorry, I don't accept your NAK. While you have a valid point about > these things being const, that is not the fault of this patch series, > and is something that should be addressed separately. Yes, and since it's not a big deal it can be done as a precursor work. > The lack of const-ness that has been there for quite some time is no > reason to NAK a patch that has nothing to do with this. Instead of saying politely that you didn't agree of the necessity of the asked changes, you shoowed your confrontational manner with a strong NAK. Let's not escalate it further, it won't play well with a nervous system. > > P.S. Please, move that phy thingy away from property.h, it doesn't belong > > there. > > Again, that's a subject for a separate patch. > > I will re-post this in due course and ignore your NAK (due to your > lack of research, and confrontational nature.) Don't make a drama out of it. Many maintainers are asking for a small cleanups before applying a feature. Nevertheless, since I'm neither a net nor a DSA maintainer, I have only thing to push is to move the PHY APIs out from the property.h. The rest is up to you. -- With Best Regards, Andy Shevchenko